Skip to contentSkip to conversation

rust: task: make Pid type alias public

PATCH Applied Alice Ryhl 3 participants 3 messages Jan 30, 2025 – Mar 6, 2025 Rust

lore
Share & tools
lore

Alice Ryhl

author reviewer
#0 lore raw

PATCH 1/1 rust: task: make Pid type alias public

The Pid type alias represents the integer type used for pids in the kernel. It's the Rust equivalent to pid_t, and there are various methods on Task that use Pid as the return type.

Binder needs to use Pid as the type for function arguments and struct fields in many places. Thus, make the type public so that Binder can access it.

---
 rust/kernel/task.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
rust/kernel/task.rs +1 -1
index 07bc22a7645c..49012e711942 100644
@@ -106,7 +106,7 @@ unsafe impl Send for Task {}
 unsafe impl Sync for Task {}
 
 /// The type of process identifiers (PIDs).
-type Pid = bindings::pid_t;
+pub type Pid = bindings::pid_t;
 
 /// The type of user identifiers (UIDs).
 #[derive(Copy, Clone)]

---
base-commit: ceff0757f5dafb5be5205988171809c877b1d3e3
change-id: 20250130-task-pid-pub-484458aec19b

Best regards,

Signature · 1 line
Alice Ryhl <[email protected]>
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Alice Ryhl

The Pid type alias represents the integer type used for pids in the kernel. It's the Rust equivalent to pid_t, and there are various methods on Task that use Pid as the return type.

Binder needs to use Pid as the type for function arguments and struct fields in many places. Thus, make the type public so that Binder can access it.

Quoted 23 lines
---
 rust/kernel/task.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
rust/kernel/task.rs +1 -2
index 07bc22a7645c..49012e711942 100644
@@ -106,7 +106,7 @@ unsafe impl Send for Task {}
 unsafe impl Sync for Task {}
 
 /// The type of process identifiers (PIDs).
-type Pid = bindings::pid_t;
+pub type Pid = bindings::pid_t;
 
 /// The type of user identifiers (UIDs).
 #[derive(Copy, Clone)]
 
---

base-commit: ceff0757f5dafb5be5205988171809c877b1d3e3
change-id: 20250130-task-pid-pub-484458aec19b

Best regards,

Applied
#2 lore raw
In reply to Alice Ryhl
Quoted 10 lines · Alice Ryhl

The Pid type alias represents the integer type used for pids in the kernel. It's the Rust equivalent to pid_t, and there are various methods on Task that use Pid as the return type.

Binder needs to use Pid as the type for function arguments and struct fields in many places. Thus, make the type public so that Binder can access it.

Applied to rust-next -- thanks everyone!

Cheers,
Miguel