aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/sched.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/sched.h')
-rw-r--r--include/linux/sched.h51
1 files changed, 27 insertions, 24 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 772c5f643764..93be319e0cbf 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1173,13 +1173,6 @@ static inline pid_t task_tgid_nr(struct task_struct *tsk)
1173 return tsk->tgid; 1173 return tsk->tgid;
1174} 1174}
1175 1175
1176extern pid_t task_tgid_nr_ns(struct task_struct *tsk, struct pid_namespace *ns);
1177
1178static inline pid_t task_tgid_vnr(struct task_struct *tsk)
1179{
1180 return pid_vnr(task_tgid(tsk));
1181}
1182
1183/** 1176/**
1184 * pid_alive - check that a task structure is not stale 1177 * pid_alive - check that a task structure is not stale
1185 * @p: Task structure to be checked. 1178 * @p: Task structure to be checked.
@@ -1195,23 +1188,6 @@ static inline int pid_alive(const struct task_struct *p)
1195 return p->pids[PIDTYPE_PID].pid != NULL; 1188 return p->pids[PIDTYPE_PID].pid != NULL;
1196} 1189}
1197 1190
1198static inline pid_t task_ppid_nr_ns(const struct task_struct *tsk, struct pid_namespace *ns)
1199{
1200 pid_t pid = 0;
1201
1202 rcu_read_lock();
1203 if (pid_alive(tsk))
1204 pid = task_tgid_nr_ns(rcu_dereference(tsk->real_parent), ns);
1205 rcu_read_unlock();
1206
1207 return pid;
1208}
1209
1210static inline pid_t task_ppid_nr(const struct task_struct *tsk)
1211{
1212 return task_ppid_nr_ns(tsk, &init_pid_ns);
1213}
1214
1215static inline pid_t task_pgrp_nr_ns(struct task_struct *tsk, struct pid_namespace *ns) 1191static inline pid_t task_pgrp_nr_ns(struct task_struct *tsk, struct pid_namespace *ns)
1216{ 1192{
1217 return __task_pid_nr_ns(tsk, PIDTYPE_PGID, ns); 1193 return __task_pid_nr_ns(tsk, PIDTYPE_PGID, ns);
@@ -1233,6 +1209,33 @@ static inline pid_t task_session_vnr(struct task_struct *tsk)
1233 return __task_pid_nr_ns(tsk, PIDTYPE_SID, NULL); 1209 return __task_pid_nr_ns(tsk, PIDTYPE_SID, NULL);
1234} 1210}
1235 1211
1212static inline pid_t task_tgid_nr_ns(struct task_struct *tsk, struct pid_namespace *ns)
1213{
1214 return __task_pid_nr_ns(tsk, __PIDTYPE_TGID, ns);
1215}
1216
1217static inline pid_t task_tgid_vnr(struct task_struct *tsk)
1218{
1219 return __task_pid_nr_ns(tsk, __PIDTYPE_TGID, NULL);
1220}
1221
1222static inline pid_t task_ppid_nr_ns(const struct task_struct *tsk, struct pid_namespace *ns)
1223{
1224 pid_t pid = 0;
1225
1226 rcu_read_lock();
1227 if (pid_alive(tsk))
1228 pid = task_tgid_nr_ns(rcu_dereference(tsk->real_parent), ns);
1229 rcu_read_unlock();
1230
1231 return pid;
1232}
1233
1234static inline pid_t task_ppid_nr(const struct task_struct *tsk)
1235{
1236 return task_ppid_nr_ns(tsk, &init_pid_ns);
1237}
1238
1236/* Obsolete, do not use: */ 1239/* Obsolete, do not use: */
1237static inline pid_t task_pgrp_nr(struct task_struct *tsk) 1240static inline pid_t task_pgrp_nr(struct task_struct *tsk)
1238{ 1241{