ANDROID: rust_binder: use tgid_nr_ns for getting pid

Because we are backporting commit e0020ba6cbcb ("rust: add
PidNamespace"), it is neccesary to update Rust Binder to use the new
tgid_nr_ns() method for getting the task's pid, as that commit deleted
pid_in_current_ns().

Bug: 429146594
Change-Id: I3acd7e3f1fee2957d5663208614667220e09dfd5
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
This commit is contained in:
Alice Ryhl
2025-07-02 12:52:35 +00:00
parent 6a2be11026
commit 2ef75ab83a
4 changed files with 11 additions and 7 deletions

View File

@@ -723,7 +723,7 @@ impl Node {
if len == inner.freeze_list.len() {
pr_warn!(
"Could not remove freeze listener for {}\n",
p.task.pid_in_current_ns()
p.pid_in_current_ns()
);
}
if inner.freeze_list.is_empty() {

View File

@@ -511,9 +511,13 @@ impl Process {
Ok(process)
}
pub(crate) fn pid_in_current_ns(&self) -> kernel::task::Pid {
self.task.tgid_nr_ns(None)
}
#[inline(never)]
pub(crate) fn debug_print_stats(&self, m: &SeqFile, ctx: &Context) -> Result<()> {
seq_print!(m, "proc {}\n", self.task.pid_in_current_ns());
seq_print!(m, "proc {}\n", self.pid_in_current_ns());
seq_print!(m, "context {}\n", &*ctx.name);
let inner = self.inner.lock();
@@ -561,7 +565,7 @@ impl Process {
#[inline(never)]
pub(crate) fn debug_print(&self, m: &SeqFile, ctx: &Context, print_all: bool) -> Result<()> {
seq_print!(m, "proc {}\n", self.task.pid_in_current_ns());
seq_print!(m, "proc {}\n", self.pid_in_current_ns());
seq_print!(m, "context {}\n", &*ctx.name);
let mut all_threads = KVec::new();

View File

@@ -1299,7 +1299,7 @@ impl Thread {
pr_warn!(
"Transaction failed: {:?} my_pid:{}",
err,
self.process.task.pid_in_current_ns()
self.process.pid_in_current_ns()
);
}
@@ -1584,7 +1584,7 @@ impl Thread {
pr_warn!(
"Write failure {:?} in pid:{}",
err,
self.process.task.pid_in_current_ns()
self.process.pid_in_current_ns()
);
req.read_consumed = 0;
writer.write(&req)?;
@@ -1601,7 +1601,7 @@ impl Thread {
pr_warn!(
"Read failure {:?} in pid:{}",
ret,
self.process.task.pid_in_current_ns()
self.process.pid_in_current_ns()
);
}
}

View File

@@ -429,7 +429,7 @@ impl DeliverToRead for Transaction {
tr.sender_pid = 0;
if self.target_node.is_some() && self.flags & TF_ONE_WAY == 0 {
// Not a reply and not one-way.
tr.sender_pid = self.from.process.task.pid_in_current_ns();
tr.sender_pid = self.from.process.pid_in_current_ns();
}
let code = if self.target_node.is_none() {
BR_REPLY