• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // SPDX-License-Identifier: GPL-2.0
2 
3 #include <linux/export.h>
4 #include <linux/sched/task.h>
5 
rust_helper_get_current(void)6 struct task_struct *rust_helper_get_current(void)
7 {
8 	return current;
9 }
10 
rust_helper_get_task_struct(struct task_struct * t)11 void rust_helper_get_task_struct(struct task_struct *t)
12 {
13 	get_task_struct(t);
14 }
15 
rust_helper_put_task_struct(struct task_struct * t)16 void rust_helper_put_task_struct(struct task_struct *t)
17 {
18 	put_task_struct(t);
19 }
20 
rust_helper_task_uid(struct task_struct * task)21 kuid_t rust_helper_task_uid(struct task_struct *task)
22 {
23 	return task_uid(task);
24 }
25 
rust_helper_task_euid(struct task_struct * task)26 kuid_t rust_helper_task_euid(struct task_struct *task)
27 {
28 	return task_euid(task);
29 }
30 
31 #ifndef CONFIG_USER_NS
rust_helper_from_kuid(struct user_namespace * to,kuid_t uid)32 uid_t rust_helper_from_kuid(struct user_namespace *to, kuid_t uid)
33 {
34 	return from_kuid(to, uid);
35 }
36 #endif /* CONFIG_USER_NS */
37 
rust_helper_uid_eq(kuid_t left,kuid_t right)38 bool rust_helper_uid_eq(kuid_t left, kuid_t right)
39 {
40 	return uid_eq(left, right);
41 }
42 
rust_helper_current_euid(void)43 kuid_t rust_helper_current_euid(void)
44 {
45 	return current_euid();
46 }
47 
rust_helper_current_user_ns(void)48 struct user_namespace *rust_helper_current_user_ns(void)
49 {
50 	return current_user_ns();
51 }
52 
rust_helper_task_tgid_nr_ns(struct task_struct * tsk,struct pid_namespace * ns)53 pid_t rust_helper_task_tgid_nr_ns(struct task_struct *tsk,
54 				  struct pid_namespace *ns)
55 {
56 	return task_tgid_nr_ns(tsk, ns);
57 }
58 
rust_helper_task_rlimit(const struct task_struct * task,unsigned int limit)59 unsigned long rust_helper_task_rlimit(const struct task_struct *task,
60 				      unsigned int limit)
61 {
62 	return task_rlimit(task, limit);
63 }
64