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.h58
1 files changed, 38 insertions, 20 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 2b094bdaafa..096834c7c63 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1298,7 +1298,7 @@ struct task_struct {
1298 int exit_state; 1298 int exit_state;
1299 int exit_code, exit_signal; 1299 int exit_code, exit_signal;
1300 int pdeath_signal; /* The signal sent when the parent dies */ 1300 int pdeath_signal; /* The signal sent when the parent dies */
1301 unsigned int group_stop; /* GROUP_STOP_*, siglock protected */ 1301 unsigned int jobctl; /* JOBCTL_*, siglock protected */
1302 /* ??? */ 1302 /* ??? */
1303 unsigned int personality; 1303 unsigned int personality;
1304 unsigned did_exec:1; 1304 unsigned did_exec:1;
@@ -1518,7 +1518,6 @@ struct task_struct {
1518 short il_next; 1518 short il_next;
1519 short pref_node_fork; 1519 short pref_node_fork;
1520#endif 1520#endif
1521 atomic_t fs_excl; /* holding fs exclusive resources */
1522 struct rcu_head rcu; 1521 struct rcu_head rcu;
1523 1522
1524 /* 1523 /*
@@ -1769,6 +1768,9 @@ static inline void put_task_struct(struct task_struct *t)
1769extern void task_times(struct task_struct *p, cputime_t *ut, cputime_t *st); 1768extern void task_times(struct task_struct *p, cputime_t *ut, cputime_t *st);
1770extern void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *st); 1769extern void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *st);
1771 1770
1771extern int task_free_register(struct notifier_block *n);
1772extern int task_free_unregister(struct notifier_block *n);
1773
1772/* 1774/*
1773 * Per process flags 1775 * Per process flags
1774 */ 1776 */
@@ -1783,6 +1785,7 @@ extern void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *
1783#define PF_DUMPCORE 0x00000200 /* dumped core */ 1785#define PF_DUMPCORE 0x00000200 /* dumped core */
1784#define PF_SIGNALED 0x00000400 /* killed by a signal */ 1786#define PF_SIGNALED 0x00000400 /* killed by a signal */
1785#define PF_MEMALLOC 0x00000800 /* Allocating memory */ 1787#define PF_MEMALLOC 0x00000800 /* Allocating memory */
1788#define PF_NPROC_EXCEEDED 0x00001000 /* set_user noticed that RLIMIT_NPROC was exceeded */
1786#define PF_USED_MATH 0x00002000 /* if unset the fpu must be initialized before use */ 1789#define PF_USED_MATH 0x00002000 /* if unset the fpu must be initialized before use */
1787#define PF_FREEZING 0x00004000 /* freeze in progress. do not account to load */ 1790#define PF_FREEZING 0x00004000 /* freeze in progress. do not account to load */
1788#define PF_NOFREEZE 0x00008000 /* this thread should not be frozen */ 1791#define PF_NOFREEZE 0x00008000 /* this thread should not be frozen */
@@ -1828,15 +1831,34 @@ extern void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *
1828#define used_math() tsk_used_math(current) 1831#define used_math() tsk_used_math(current)
1829 1832
1830/* 1833/*
1831 * task->group_stop flags 1834 * task->jobctl flags
1832 */ 1835 */
1833#define GROUP_STOP_SIGMASK 0xffff /* signr of the last group stop */ 1836#define JOBCTL_STOP_SIGMASK 0xffff /* signr of the last group stop */
1834#define GROUP_STOP_PENDING (1 << 16) /* task should stop for group stop */ 1837
1835#define GROUP_STOP_CONSUME (1 << 17) /* consume group stop count */ 1838#define JOBCTL_STOP_DEQUEUED_BIT 16 /* stop signal dequeued */
1836#define GROUP_STOP_TRAPPING (1 << 18) /* switching from STOPPED to TRACED */ 1839#define JOBCTL_STOP_PENDING_BIT 17 /* task should stop for group stop */
1837#define GROUP_STOP_DEQUEUED (1 << 19) /* stop signal dequeued */ 1840#define JOBCTL_STOP_CONSUME_BIT 18 /* consume group stop count */
1838 1841#define JOBCTL_TRAP_STOP_BIT 19 /* trap for STOP */
1839extern void task_clear_group_stop_pending(struct task_struct *task); 1842#define JOBCTL_TRAP_NOTIFY_BIT 20 /* trap for NOTIFY */
1843#define JOBCTL_TRAPPING_BIT 21 /* switching to TRACED */
1844#define JOBCTL_LISTENING_BIT 22 /* ptracer is listening for events */
1845
1846#define JOBCTL_STOP_DEQUEUED (1 << JOBCTL_STOP_DEQUEUED_BIT)
1847#define JOBCTL_STOP_PENDING (1 << JOBCTL_STOP_PENDING_BIT)
1848#define JOBCTL_STOP_CONSUME (1 << JOBCTL_STOP_CONSUME_BIT)
1849#define JOBCTL_TRAP_STOP (1 << JOBCTL_TRAP_STOP_BIT)
1850#define JOBCTL_TRAP_NOTIFY (1 << JOBCTL_TRAP_NOTIFY_BIT)
1851#define JOBCTL_TRAPPING (1 << JOBCTL_TRAPPING_BIT)
1852#define JOBCTL_LISTENING (1 << JOBCTL_LISTENING_BIT)
1853
1854#define JOBCTL_TRAP_MASK (JOBCTL_TRAP_STOP | JOBCTL_TRAP_NOTIFY)
1855#define JOBCTL_PENDING_MASK (JOBCTL_STOP_PENDING | JOBCTL_TRAP_MASK)
1856
1857extern bool task_set_jobctl_pending(struct task_struct *task,
1858 unsigned int mask);
1859extern void task_clear_jobctl_trapping(struct task_struct *task);
1860extern void task_clear_jobctl_pending(struct task_struct *task,
1861 unsigned int mask);
1840 1862
1841#ifdef CONFIG_PREEMPT_RCU 1863#ifdef CONFIG_PREEMPT_RCU
1842 1864
@@ -1952,7 +1974,6 @@ static inline void disable_sched_clock_irqtime(void) {}
1952 1974
1953extern unsigned long long 1975extern unsigned long long
1954task_sched_runtime(struct task_struct *task); 1976task_sched_runtime(struct task_struct *task);
1955extern unsigned long long thread_group_sched_runtime(struct task_struct *task);
1956 1977
1957/* sched_exec is called by processes performing an exec */ 1978/* sched_exec is called by processes performing an exec */
1958#ifdef CONFIG_SMP 1979#ifdef CONFIG_SMP
@@ -2166,7 +2187,7 @@ extern int kill_pid_info_as_uid(int, struct siginfo *, struct pid *, uid_t, uid_
2166extern int kill_pgrp(struct pid *pid, int sig, int priv); 2187extern int kill_pgrp(struct pid *pid, int sig, int priv);
2167extern int kill_pid(struct pid *pid, int sig, int priv); 2188extern int kill_pid(struct pid *pid, int sig, int priv);
2168extern int kill_proc_info(int, struct siginfo *, pid_t); 2189extern int kill_proc_info(int, struct siginfo *, pid_t);
2169extern int do_notify_parent(struct task_struct *, int); 2190extern __must_check bool do_notify_parent(struct task_struct *, int);
2170extern void __wake_up_parent(struct task_struct *p, struct task_struct *parent); 2191extern void __wake_up_parent(struct task_struct *p, struct task_struct *parent);
2171extern void force_sig(int, struct task_struct *); 2192extern void force_sig(int, struct task_struct *);
2172extern int send_sig(int, struct task_struct *, int); 2193extern int send_sig(int, struct task_struct *, int);
@@ -2290,8 +2311,10 @@ static inline int get_nr_threads(struct task_struct *tsk)
2290 return tsk->signal->nr_threads; 2311 return tsk->signal->nr_threads;
2291} 2312}
2292 2313
2293/* de_thread depends on thread_group_leader not being a pid based check */ 2314static inline bool thread_group_leader(struct task_struct *p)
2294#define thread_group_leader(p) (p == p->group_leader) 2315{
2316 return p->exit_signal >= 0;
2317}
2295 2318
2296/* Do to the insanities of de_thread it is possible for a process 2319/* Do to the insanities of de_thread it is possible for a process
2297 * to have the pid of the thread group leader without actually being 2320 * to have the pid of the thread group leader without actually being
@@ -2324,11 +2347,6 @@ static inline int thread_group_empty(struct task_struct *p)
2324#define delay_group_leader(p) \ 2347#define delay_group_leader(p) \
2325 (thread_group_leader(p) && !thread_group_empty(p)) 2348 (thread_group_leader(p) && !thread_group_empty(p))
2326 2349
2327static inline int task_detached(struct task_struct *p)
2328{
2329 return p->exit_signal == -1;
2330}
2331
2332/* 2350/*
2333 * Protects ->fs, ->files, ->mm, ->group_info, ->comm, keyring 2351 * Protects ->fs, ->files, ->mm, ->group_info, ->comm, keyring
2334 * subscriptions and synchronises with wait4(). Also used in procfs. Also 2352 * subscriptions and synchronises with wait4(). Also used in procfs. Also
@@ -2526,7 +2544,7 @@ extern int _cond_resched(void);
2526 2544
2527extern int __cond_resched_lock(spinlock_t *lock); 2545extern int __cond_resched_lock(spinlock_t *lock);
2528 2546
2529#ifdef CONFIG_PREEMPT 2547#ifdef CONFIG_PREEMPT_COUNT
2530#define PREEMPT_LOCK_OFFSET PREEMPT_OFFSET 2548#define PREEMPT_LOCK_OFFSET PREEMPT_OFFSET
2531#else 2549#else
2532#define PREEMPT_LOCK_OFFSET 0 2550#define PREEMPT_LOCK_OFFSET 0