aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/sched.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-07-22 18:06:50 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-07-22 18:06:50 -0400
commit8209f53d79444747782a28520187abaf689761f2 (patch)
tree726270ea29e037f026d77a99787b9d844531ac42 /include/linux/sched.h
parent22a3b9771117d566def0150ea787fcc95f16e724 (diff)
parenteac1b5e57d7abc836e78fd3fbcf77dbeed01edc9 (diff)
Merge branch 'ptrace' of git://git.kernel.org/pub/scm/linux/kernel/git/oleg/misc
* 'ptrace' of git://git.kernel.org/pub/scm/linux/kernel/git/oleg/misc: (39 commits) ptrace: do_wait(traced_leader_killed_by_mt_exec) can block forever ptrace: fix ptrace_signal() && STOP_DEQUEUED interaction connector: add an event for monitoring process tracers ptrace: dont send SIGSTOP on auto-attach if PT_SEIZED ptrace: mv send-SIGSTOP from do_fork() to ptrace_init_task() ptrace_init_task: initialize child->jobctl explicitly has_stopped_jobs: s/task_is_stopped/SIGNAL_STOP_STOPPED/ ptrace: make former thread ID available via PTRACE_GETEVENTMSG after PTRACE_EVENT_EXEC stop ptrace: wait_consider_task: s/same_thread_group/ptrace_reparented/ ptrace: kill real_parent_is_ptracer() in in favor of ptrace_reparented() ptrace: ptrace_reparented() should check same_thread_group() redefine thread_group_leader() as exit_signal >= 0 do not change dead_task->exit_signal kill task_detached() reparent_leader: check EXIT_DEAD instead of task_detached() make do_notify_parent() __must_check, update the callers __ptrace_detach: avoid task_detached(), check do_notify_parent() kill tracehook_notify_death() make do_notify_parent() return bool ptrace: s/tracehook_tracer_task()/ptrace_parent()/ ...
Diffstat (limited to 'include/linux/sched.h')
-rw-r--r--include/linux/sched.h52
1 files changed, 34 insertions, 18 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 14a6c7b545de..f6ef727ee4fc 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1292,7 +1292,7 @@ struct task_struct {
1292 int exit_state; 1292 int exit_state;
1293 int exit_code, exit_signal; 1293 int exit_code, exit_signal;
1294 int pdeath_signal; /* The signal sent when the parent dies */ 1294 int pdeath_signal; /* The signal sent when the parent dies */
1295 unsigned int group_stop; /* GROUP_STOP_*, siglock protected */ 1295 unsigned int jobctl; /* JOBCTL_*, siglock protected */
1296 /* ??? */ 1296 /* ??? */
1297 unsigned int personality; 1297 unsigned int personality;
1298 unsigned did_exec:1; 1298 unsigned did_exec:1;
@@ -1813,15 +1813,34 @@ extern void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *
1813#define used_math() tsk_used_math(current) 1813#define used_math() tsk_used_math(current)
1814 1814
1815/* 1815/*
1816 * task->group_stop flags 1816 * task->jobctl flags
1817 */ 1817 */
1818#define GROUP_STOP_SIGMASK 0xffff /* signr of the last group stop */ 1818#define JOBCTL_STOP_SIGMASK 0xffff /* signr of the last group stop */
1819#define GROUP_STOP_PENDING (1 << 16) /* task should stop for group stop */ 1819
1820#define GROUP_STOP_CONSUME (1 << 17) /* consume group stop count */ 1820#define JOBCTL_STOP_DEQUEUED_BIT 16 /* stop signal dequeued */
1821#define GROUP_STOP_TRAPPING (1 << 18) /* switching from STOPPED to TRACED */ 1821#define JOBCTL_STOP_PENDING_BIT 17 /* task should stop for group stop */
1822#define GROUP_STOP_DEQUEUED (1 << 19) /* stop signal dequeued */ 1822#define JOBCTL_STOP_CONSUME_BIT 18 /* consume group stop count */
1823 1823#define JOBCTL_TRAP_STOP_BIT 19 /* trap for STOP */
1824extern void task_clear_group_stop_pending(struct task_struct *task); 1824#define JOBCTL_TRAP_NOTIFY_BIT 20 /* trap for NOTIFY */
1825#define JOBCTL_TRAPPING_BIT 21 /* switching to TRACED */
1826#define JOBCTL_LISTENING_BIT 22 /* ptracer is listening for events */
1827
1828#define JOBCTL_STOP_DEQUEUED (1 << JOBCTL_STOP_DEQUEUED_BIT)
1829#define JOBCTL_STOP_PENDING (1 << JOBCTL_STOP_PENDING_BIT)
1830#define JOBCTL_STOP_CONSUME (1 << JOBCTL_STOP_CONSUME_BIT)
1831#define JOBCTL_TRAP_STOP (1 << JOBCTL_TRAP_STOP_BIT)
1832#define JOBCTL_TRAP_NOTIFY (1 << JOBCTL_TRAP_NOTIFY_BIT)
1833#define JOBCTL_TRAPPING (1 << JOBCTL_TRAPPING_BIT)
1834#define JOBCTL_LISTENING (1 << JOBCTL_LISTENING_BIT)
1835
1836#define JOBCTL_TRAP_MASK (JOBCTL_TRAP_STOP | JOBCTL_TRAP_NOTIFY)
1837#define JOBCTL_PENDING_MASK (JOBCTL_STOP_PENDING | JOBCTL_TRAP_MASK)
1838
1839extern bool task_set_jobctl_pending(struct task_struct *task,
1840 unsigned int mask);
1841extern void task_clear_jobctl_trapping(struct task_struct *task);
1842extern void task_clear_jobctl_pending(struct task_struct *task,
1843 unsigned int mask);
1825 1844
1826#ifdef CONFIG_PREEMPT_RCU 1845#ifdef CONFIG_PREEMPT_RCU
1827 1846
@@ -2136,7 +2155,7 @@ static inline int dequeue_signal_lock(struct task_struct *tsk, sigset_t *mask, s
2136 spin_unlock_irqrestore(&tsk->sighand->siglock, flags); 2155 spin_unlock_irqrestore(&tsk->sighand->siglock, flags);
2137 2156
2138 return ret; 2157 return ret;
2139} 2158}
2140 2159
2141extern void block_all_signals(int (*notifier)(void *priv), void *priv, 2160extern void block_all_signals(int (*notifier)(void *priv), void *priv,
2142 sigset_t *mask); 2161 sigset_t *mask);
@@ -2151,7 +2170,7 @@ extern int kill_pid_info_as_uid(int, struct siginfo *, struct pid *, uid_t, uid_
2151extern int kill_pgrp(struct pid *pid, int sig, int priv); 2170extern int kill_pgrp(struct pid *pid, int sig, int priv);
2152extern int kill_pid(struct pid *pid, int sig, int priv); 2171extern int kill_pid(struct pid *pid, int sig, int priv);
2153extern int kill_proc_info(int, struct siginfo *, pid_t); 2172extern int kill_proc_info(int, struct siginfo *, pid_t);
2154extern int do_notify_parent(struct task_struct *, int); 2173extern __must_check bool do_notify_parent(struct task_struct *, int);
2155extern void __wake_up_parent(struct task_struct *p, struct task_struct *parent); 2174extern void __wake_up_parent(struct task_struct *p, struct task_struct *parent);
2156extern void force_sig(int, struct task_struct *); 2175extern void force_sig(int, struct task_struct *);
2157extern int send_sig(int, struct task_struct *, int); 2176extern int send_sig(int, struct task_struct *, int);
@@ -2275,8 +2294,10 @@ static inline int get_nr_threads(struct task_struct *tsk)
2275 return tsk->signal->nr_threads; 2294 return tsk->signal->nr_threads;
2276} 2295}
2277 2296
2278/* de_thread depends on thread_group_leader not being a pid based check */ 2297static inline bool thread_group_leader(struct task_struct *p)
2279#define thread_group_leader(p) (p == p->group_leader) 2298{
2299 return p->exit_signal >= 0;
2300}
2280 2301
2281/* Do to the insanities of de_thread it is possible for a process 2302/* Do to the insanities of de_thread it is possible for a process
2282 * to have the pid of the thread group leader without actually being 2303 * to have the pid of the thread group leader without actually being
@@ -2309,11 +2330,6 @@ static inline int thread_group_empty(struct task_struct *p)
2309#define delay_group_leader(p) \ 2330#define delay_group_leader(p) \
2310 (thread_group_leader(p) && !thread_group_empty(p)) 2331 (thread_group_leader(p) && !thread_group_empty(p))
2311 2332
2312static inline int task_detached(struct task_struct *p)
2313{
2314 return p->exit_signal == -1;
2315}
2316
2317/* 2333/*
2318 * Protects ->fs, ->files, ->mm, ->group_info, ->comm, keyring 2334 * Protects ->fs, ->files, ->mm, ->group_info, ->comm, keyring
2319 * subscriptions and synchronises with wait4(). Also used in procfs. Also 2335 * subscriptions and synchronises with wait4(). Also used in procfs. Also