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