On Fri, Dec 08, 2023 at 08:43:19AM -0800, Boqun Feng wrote: > On Fri, Dec 08, 2023 at 04:40:09PM +0000, Benno Lossin wrote: > > On 12/6/23 12:59, Alice Ryhl wrote: > > > + /// Returns the given task's pid in the current pid namespace. > > > + pub fn pid_in_current_ns(&self) -> Pid { > > > + // SAFETY: Calling `task_active_pid_ns` with the current task is always safe. > > > + let namespace = unsafe { bindings::task_active_pid_ns(bindings::get_current()) }; > > > > Why not create a safe wrapper for `bindings::get_current()`? > > This patch series has three occurrences of `get_current`, so I think it > > should be ok to add a wrapper. > > I would also prefer to move the call to `bindings::get_current()` out of > > the `unsafe` block. > > FWIW, we have a current!() macro, we should use it here. Why does it need to be a macro?