| 1 | // SPDX-License-Identifier: GPL-2.0 |
|---|---|
| 2 | |
| 3 | #include <linux/pid_namespace.h> |
| 4 | #include <linux/cleanup.h> |
| 5 | |
| 6 | struct pid_namespace *rust_helper_get_pid_ns(struct pid_namespace *ns) |
| 7 | { |
| 8 | return get_pid_ns(ns); |
| 9 | } |
| 10 | |
| 11 | void rust_helper_put_pid_ns(struct pid_namespace *ns) |
| 12 | { |
| 13 | put_pid_ns(ns); |
| 14 | } |
| 15 | |
| 16 | /* Get a reference on a task's pid namespace. */ |
| 17 | struct pid_namespace *rust_helper_task_get_pid_ns(struct task_struct *task) |
| 18 | { |
| 19 | struct pid_namespace *pid_ns; |
| 20 | |
| 21 | guard(rcu)(); |
| 22 | pid_ns = task_active_pid_ns(tsk: task); |
| 23 | if (pid_ns) |
| 24 | get_pid_ns(ns: pid_ns); |
| 25 | return pid_ns; |
| 26 | } |
| 27 |
