pid_namespace.c 581 B

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