aboutsummaryrefslogtreecommitdiffstats
path: root/rust
diff options
authorAlice Ryhl <aliceryhl@google.com>2026-03-24 20:02:36 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2026-04-01 12:18:21 +0200
commit12c688086f091c24e62504f5a26c009a6a8dd8bc (patch)
treefca0fb3af5b0d6afc0c7ea0f2808c4dfe6645c4c /rust
parent18e9fafb2672cb976edfe51e899484c2ea892170 (diff)
downloadath-12c688086f091c24e62504f5a26c009a6a8dd8bc.tar.gz
rust: task: implement == operator for Task
It's useful to compare if two tasks are the same task or not. Rust Binder wants this to check if a certain task is equal to the group leader of current. Reviewed-by: Gary Guo <gary@garyguo.net> Signed-off-by: Alice Ryhl <aliceryhl@google.com> Link: https://patch.msgid.link/20260324-close-fd-check-current-v3-2-b94274bedac7@google.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'rust')
-rw-r--r--rust/kernel/task.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/rust/kernel/task.rs b/rust/kernel/task.rs
index cc907fb531bce..deb948d99921c 100644
--- a/rust/kernel/task.rs
+++ b/rust/kernel/task.rs
@@ -362,6 +362,15 @@ unsafe impl crate::sync::aref::AlwaysRefCounted for Task {
}
}
+impl PartialEq for Task {
+ #[inline]
+ fn eq(&self, other: &Self) -> bool {
+ ptr::eq(self.as_ptr(), other.as_ptr())
+ }
+}
+
+impl Eq for Task {}
+
impl Kuid {
/// Get the current euid.
#[inline]