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>
master
Alice Ryhl 2026-03-24 20:02:36 +00:00 committed by Greg Kroah-Hartman
parent 18e9fafb26
commit 12c688086f
1 changed files with 9 additions and 0 deletions

View File

@ -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]