at master 537 B view raw
1// SPDX-License-Identifier: GPL-2.0 2 3#include <linux/pid_namespace.h> 4#include <linux/cleanup.h> 5 6struct pid_namespace *rust_helper_get_pid_ns(struct pid_namespace *ns) 7{ 8 return get_pid_ns(ns); 9} 10 11void 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. */ 17struct 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(task); 23 if (pid_ns) 24 get_pid_ns(pid_ns); 25 return pid_ns; 26}