aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/sched.h')
-rw-r--r--include/linux/sched.h50
1 files changed, 27 insertions, 23 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h
index eff7c1fad26f..e887c8d6f395 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1949,31 +1949,8 @@ static inline pid_t task_tgid_nr(struct task_struct *tsk)
1949 return tsk->tgid; 1949 return tsk->tgid;
1950} 1950}
1951 1951
1952pid_t task_tgid_nr_ns(struct task_struct *tsk, struct pid_namespace *ns);
1953
1954static inline pid_t task_tgid_vnr(struct task_struct *tsk)
1955{
1956 return pid_vnr(task_tgid(tsk));
1957}
1958
1959 1952
1960static inline int pid_alive(const struct task_struct *p); 1953static inline int pid_alive(const struct task_struct *p);
1961static inline pid_t task_ppid_nr_ns(const struct task_struct *tsk, struct pid_namespace *ns)
1962{
1963 pid_t pid = 0;
1964
1965 rcu_read_lock();
1966 if (pid_alive(tsk))
1967 pid = task_tgid_nr_ns(rcu_dereference(tsk->real_parent), ns);
1968 rcu_read_unlock();
1969
1970 return pid;
1971}
1972
1973static inline pid_t task_ppid_nr(const struct task_struct *tsk)
1974{
1975 return task_ppid_nr_ns(tsk, &init_pid_ns);
1976}
1977 1954
1978static inline pid_t task_pgrp_nr_ns(struct task_struct *tsk, 1955static inline pid_t task_pgrp_nr_ns(struct task_struct *tsk,
1979 struct pid_namespace *ns) 1956 struct pid_namespace *ns)
@@ -1998,6 +1975,33 @@ static inline pid_t task_session_vnr(struct task_struct *tsk)
1998 return __task_pid_nr_ns(tsk, PIDTYPE_SID, NULL); 1975 return __task_pid_nr_ns(tsk, PIDTYPE_SID, NULL);
1999} 1976}
2000 1977
1978static inline pid_t task_tgid_nr_ns(struct task_struct *tsk, struct pid_namespace *ns)
1979{
1980 return __task_pid_nr_ns(tsk, __PIDTYPE_TGID, ns);
1981}
1982
1983static inline pid_t task_tgid_vnr(struct task_struct *tsk)
1984{
1985 return __task_pid_nr_ns(tsk, __PIDTYPE_TGID, NULL);
1986}
1987
1988static inline pid_t task_ppid_nr_ns(const struct task_struct *tsk, struct pid_namespace *ns)
1989{
1990 pid_t pid = 0;
1991
1992 rcu_read_lock();
1993 if (pid_alive(tsk))
1994 pid = task_tgid_nr_ns(rcu_dereference(tsk->real_parent), ns);
1995 rcu_read_unlock();
1996
1997 return pid;
1998}
1999
2000static inline pid_t task_ppid_nr(const struct task_struct *tsk)
2001{
2002 return task_ppid_nr_ns(tsk, &init_pid_ns);
2003}
2004
2001/* obsolete, do not use */ 2005/* obsolete, do not use */
2002static inline pid_t task_pgrp_nr(struct task_struct *tsk) 2006static inline pid_t task_pgrp_nr(struct task_struct *tsk)
2003{ 2007{