projects/linux·blob master · refs

28 lines · 581 B

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