diff options
Diffstat (limited to 'include/linux/sched/signal.h')
| -rw-r--r-- | include/linux/sched/signal.h | 51 |
1 files changed, 47 insertions, 4 deletions
diff --git a/include/linux/sched/signal.h b/include/linux/sched/signal.h index 113d1ad1ced7..1be35729c2c5 100644 --- a/include/linux/sched/signal.h +++ b/include/linux/sched/signal.h | |||
| @@ -69,6 +69,11 @@ struct thread_group_cputimer { | |||
| 69 | bool checking_timer; | 69 | bool checking_timer; |
| 70 | }; | 70 | }; |
| 71 | 71 | ||
| 72 | struct multiprocess_signals { | ||
| 73 | sigset_t signal; | ||
| 74 | struct hlist_node node; | ||
| 75 | }; | ||
| 76 | |||
| 72 | /* | 77 | /* |
| 73 | * NOTE! "signal_struct" does not have its own | 78 | * NOTE! "signal_struct" does not have its own |
| 74 | * locking, because a shared signal_struct always | 79 | * locking, because a shared signal_struct always |
| @@ -90,6 +95,9 @@ struct signal_struct { | |||
| 90 | /* shared signal handling: */ | 95 | /* shared signal handling: */ |
| 91 | struct sigpending shared_pending; | 96 | struct sigpending shared_pending; |
| 92 | 97 | ||
| 98 | /* For collecting multiprocess signals during fork */ | ||
| 99 | struct hlist_head multiprocess; | ||
| 100 | |||
| 93 | /* thread group exit support */ | 101 | /* thread group exit support */ |
| 94 | int group_exit_code; | 102 | int group_exit_code; |
| 95 | /* overloaded: | 103 | /* overloaded: |
| @@ -146,7 +154,8 @@ struct signal_struct { | |||
| 146 | 154 | ||
| 147 | #endif | 155 | #endif |
| 148 | 156 | ||
| 149 | struct pid *leader_pid; | 157 | /* PID/PID hash table linkage. */ |
| 158 | struct pid *pids[PIDTYPE_MAX]; | ||
| 150 | 159 | ||
| 151 | #ifdef CONFIG_NO_HZ_FULL | 160 | #ifdef CONFIG_NO_HZ_FULL |
| 152 | atomic_t tick_dep_mask; | 161 | atomic_t tick_dep_mask; |
| @@ -314,7 +323,7 @@ int force_sig_pkuerr(void __user *addr, u32 pkey); | |||
| 314 | int force_sig_ptrace_errno_trap(int errno, void __user *addr); | 323 | int force_sig_ptrace_errno_trap(int errno, void __user *addr); |
| 315 | 324 | ||
| 316 | extern int send_sig_info(int, struct siginfo *, struct task_struct *); | 325 | extern int send_sig_info(int, struct siginfo *, struct task_struct *); |
| 317 | extern int force_sigsegv(int, struct task_struct *); | 326 | extern void force_sigsegv(int sig, struct task_struct *p); |
| 318 | extern int force_sig_info(int, struct siginfo *, struct task_struct *); | 327 | extern int force_sig_info(int, struct siginfo *, struct task_struct *); |
| 319 | extern int __kill_pgrp_info(int sig, struct siginfo *info, struct pid *pgrp); | 328 | extern int __kill_pgrp_info(int sig, struct siginfo *info, struct pid *pgrp); |
| 320 | extern int kill_pid_info(int sig, struct siginfo *info, struct pid *pid); | 329 | extern int kill_pid_info(int sig, struct siginfo *info, struct pid *pid); |
| @@ -329,7 +338,7 @@ extern int send_sig(int, struct task_struct *, int); | |||
| 329 | extern int zap_other_threads(struct task_struct *p); | 338 | extern int zap_other_threads(struct task_struct *p); |
| 330 | extern struct sigqueue *sigqueue_alloc(void); | 339 | extern struct sigqueue *sigqueue_alloc(void); |
| 331 | extern void sigqueue_free(struct sigqueue *); | 340 | extern void sigqueue_free(struct sigqueue *); |
| 332 | extern int send_sigqueue(struct sigqueue *, struct task_struct *, int group); | 341 | extern int send_sigqueue(struct sigqueue *, struct pid *, enum pid_type); |
| 333 | extern int do_sigaction(int, struct k_sigaction *, struct k_sigaction *); | 342 | extern int do_sigaction(int, struct k_sigaction *, struct k_sigaction *); |
| 334 | 343 | ||
| 335 | static inline int restart_syscall(void) | 344 | static inline int restart_syscall(void) |
| @@ -371,6 +380,7 @@ static inline int signal_pending_state(long state, struct task_struct *p) | |||
| 371 | */ | 380 | */ |
| 372 | extern void recalc_sigpending_and_wake(struct task_struct *t); | 381 | extern void recalc_sigpending_and_wake(struct task_struct *t); |
| 373 | extern void recalc_sigpending(void); | 382 | extern void recalc_sigpending(void); |
| 383 | extern void calculate_sigpending(void); | ||
| 374 | 384 | ||
| 375 | extern void signal_wake_up_state(struct task_struct *t, unsigned int state); | 385 | extern void signal_wake_up_state(struct task_struct *t, unsigned int state); |
| 376 | 386 | ||
| @@ -383,6 +393,8 @@ static inline void ptrace_signal_wake_up(struct task_struct *t, bool resume) | |||
| 383 | signal_wake_up_state(t, resume ? __TASK_TRACED : 0); | 393 | signal_wake_up_state(t, resume ? __TASK_TRACED : 0); |
| 384 | } | 394 | } |
| 385 | 395 | ||
| 396 | void task_join_group_stop(struct task_struct *task); | ||
| 397 | |||
| 386 | #ifdef TIF_RESTORE_SIGMASK | 398 | #ifdef TIF_RESTORE_SIGMASK |
| 387 | /* | 399 | /* |
| 388 | * Legacy restore_sigmask accessors. These are inefficient on | 400 | * Legacy restore_sigmask accessors. These are inefficient on |
| @@ -556,6 +568,37 @@ extern bool current_is_single_threaded(void); | |||
| 556 | typedef int (*proc_visitor)(struct task_struct *p, void *data); | 568 | typedef int (*proc_visitor)(struct task_struct *p, void *data); |
| 557 | void walk_process_tree(struct task_struct *top, proc_visitor, void *); | 569 | void walk_process_tree(struct task_struct *top, proc_visitor, void *); |
| 558 | 570 | ||
| 571 | static inline | ||
| 572 | struct pid *task_pid_type(struct task_struct *task, enum pid_type type) | ||
| 573 | { | ||
| 574 | struct pid *pid; | ||
| 575 | if (type == PIDTYPE_PID) | ||
| 576 | pid = task_pid(task); | ||
| 577 | else | ||
| 578 | pid = task->signal->pids[type]; | ||
| 579 | return pid; | ||
| 580 | } | ||
| 581 | |||
| 582 | static inline struct pid *task_tgid(struct task_struct *task) | ||
| 583 | { | ||
| 584 | return task->signal->pids[PIDTYPE_TGID]; | ||
| 585 | } | ||
| 586 | |||
| 587 | /* | ||
| 588 | * Without tasklist or RCU lock it is not safe to dereference | ||
| 589 | * the result of task_pgrp/task_session even if task == current, | ||
| 590 | * we can race with another thread doing sys_setsid/sys_setpgid. | ||
| 591 | */ | ||
| 592 | static inline struct pid *task_pgrp(struct task_struct *task) | ||
| 593 | { | ||
| 594 | return task->signal->pids[PIDTYPE_PGID]; | ||
| 595 | } | ||
| 596 | |||
| 597 | static inline struct pid *task_session(struct task_struct *task) | ||
| 598 | { | ||
| 599 | return task->signal->pids[PIDTYPE_SID]; | ||
| 600 | } | ||
| 601 | |||
| 559 | static inline int get_nr_threads(struct task_struct *tsk) | 602 | static inline int get_nr_threads(struct task_struct *tsk) |
| 560 | { | 603 | { |
| 561 | return tsk->signal->nr_threads; | 604 | return tsk->signal->nr_threads; |
| @@ -574,7 +617,7 @@ static inline bool thread_group_leader(struct task_struct *p) | |||
| 574 | */ | 617 | */ |
| 575 | static inline bool has_group_leader_pid(struct task_struct *p) | 618 | static inline bool has_group_leader_pid(struct task_struct *p) |
| 576 | { | 619 | { |
| 577 | return task_pid(p) == p->signal->leader_pid; | 620 | return task_pid(p) == task_tgid(p); |
| 578 | } | 621 | } |
| 579 | 622 | ||
| 580 | static inline | 623 | static inline |
