+
+static inline
+uid_t lttng_task_vuid(struct task_struct *p, struct user_namespace *ns)
+{
+ uid_t uid;
+
+ /*
+ * __task_cred requires the RCU readlock be held
+ */
+ rcu_read_lock();
+ uid = user_ns_map_uid(ns, __task_cred(p), __task_cred(p)->uid);
+ rcu_read_unlock();
+
+ return uid;
+}
+
+static inline
+gid_t lttng_task_vgid(struct task_struct *p, struct user_namespace *ns)
+{
+ gid_t gid;
+
+ /*
+ * __task_cred requires the RCU readlock be held
+ */
+ rcu_read_lock();
+ gid = user_ns_map_gid(ns, __task_cred(p), __task_cred(p)->gid);
+ rcu_read_unlock();
+
+ return gid;
+}
+