Lines Matching +full:signal +full:- +full:group
1 /* SPDX-License-Identifier: GPL-2.0 */
6 #include <linux/signal.h>
12 #include <linux/posix-timers.h>
17 * Types defining task->signal and task->sighand and APIs using them:
28 * Per-process accounting stats:
60 * struct thread_group_cputimer - thread group interval timer counts
61 * @cputime_atomic: atomic thread group interval timers.
64 * used for thread group CPU timer calculations.
71 sigset_t signal; member
102 /* current thread group signal load-balancing target: */
105 /* shared signal handling: */
111 /* thread group exit support */
117 /* thread group stop support, overloads group_exit_code too */
125 * manager, to re-parent orphan (double-forking) child processes
153 * Thread group totals for process CPU timers.
171 /* boolean value for session group leader */
180 * Cumulative resource counters for dead threads in the group,
181 * and for reaped dead child processes forked by this group.
183 * in __exit_signal, except for the group leader.
198 * group, not including a zombie group leader, (This only differs
209 * getrlimit/setrlimit use task_lock(current->group_leader) to
216 struct pacct_struct pacct; /* per-process accounting information */
234 struct mm_struct *oom_mm; /* recorded mm when the thread group got
255 #define SIGNAL_GROUP_EXIT 0x00000004 /* group exit in progress */
271 WARN_ON(sig->flags & SIGNAL_GROUP_EXIT); in signal_set_stop_flags()
272 sig->flags = (sig->flags & ~SIGNAL_STOP_MASK) | flags; in signal_set_stop_flags()
288 spin_lock_irq(&task->sighand->siglock); in kernel_dequeue_signal()
289 ret = dequeue_signal(task, &task->blocked, &__info, &__type); in kernel_dequeue_signal()
290 spin_unlock_irq(&task->sighand->siglock); in kernel_dequeue_signal()
297 spin_lock_irq(¤t->sighand->siglock); in kernel_signal_stop()
298 if (current->jobctl & JOBCTL_STOP_DEQUEUED) { in kernel_signal_stop()
299 current->jobctl |= JOBCTL_STOPPED; in kernel_signal_stop()
302 spin_unlock_irq(¤t->sighand->siglock); in kernel_signal_stop()
363 * user -> kernel to guarantee expedient run of TWA_SIGNAL based task_work.
384 return -ERESTARTNOINTR; in restart_syscall()
395 * TIF_NOTIFY_SIGNAL isn't really a signal, but it requires the same in signal_pending()
397 * so that notify signal callbacks can be processed. in signal_pending()
406 return unlikely(sigismember(&p->pending.signal, SIGKILL)); in __fatal_signal_pending()
442 * callers must hold sighand->siglock.
453 if (fatal && !(t->jobctl & JOBCTL_PTRACE_FROZEN)) { in signal_wake_up()
454 t->jobctl &= ~(JOBCTL_STOPPED | JOBCTL_TRACED); in signal_wake_up()
463 t->jobctl &= ~JOBCTL_TRACED; in ptrace_signal_wake_up()
478 * set_restore_sigmask() - make sure saved_sigmask processing gets done
480 * This sets TIF_RESTORE_SIGMASK and ensures that the arch signal code
486 * signal code always gets run when TIF_RESTORE_SIGMASK is set.
517 /* Higher-quality implementation, used if TIF_RESTORE_SIGMASK doesn't exist. */
520 current->restore_sigmask = true; in set_restore_sigmask()
524 task->restore_sigmask = false; in clear_tsk_restore_sigmask()
528 current->restore_sigmask = false; in clear_restore_sigmask()
532 return current->restore_sigmask; in test_restore_sigmask()
536 return task->restore_sigmask; in test_tsk_restore_sigmask()
540 if (!current->restore_sigmask) in test_and_clear_restore_sigmask()
542 current->restore_sigmask = false; in test_and_clear_restore_sigmask()
550 __set_current_blocked(¤t->saved_sigmask); in restore_saved_sigmask()
565 sigset_t *res = ¤t->blocked; in sigmask_to_save()
567 res = ¤t->saved_sigmask; in sigmask_to_save()
583 return sp >= current->sas_ss_sp && in __on_sig_stack()
584 sp - current->sas_ss_sp < current->sas_ss_size; in __on_sig_stack()
586 return sp > current->sas_ss_sp && in __on_sig_stack()
587 sp - current->sas_ss_sp <= current->sas_ss_size; in __on_sig_stack()
592 * True if we are on the alternate signal stack.
597 * If the signal stack is SS_AUTODISARM then, by construction, we in on_sig_stack()
598 * can't be on the signal stack unless user code deliberately set in on_sig_stack()
602 * the stack pointer points very close to the end of the signal stack, in on_sig_stack()
603 * then this check will enable the signal to be handled anyway. in on_sig_stack()
605 if (current->sas_ss_flags & SS_AUTODISARM) in on_sig_stack()
613 if (!current->sas_ss_size) in sas_ss_flags()
621 p->sas_ss_sp = 0; in sas_ss_reset()
622 p->sas_ss_size = 0; in sas_ss_reset()
623 p->sas_ss_flags = SS_DISABLE; in sas_ss_reset()
628 if (unlikely((ksig->ka.sa.sa_flags & SA_ONSTACK)) && ! sas_ss_flags(sp)) in sigsp()
630 return current->sas_ss_sp; in sigsp()
632 return current->sas_ss_sp + current->sas_ss_size; in sigsp()
644 list_entry_rcu((p)->tasks.next, struct task_struct, tasks)
653 * 'break' will not work as expected - use goto instead.
661 #define __for_each_thread(signal, t) \ argument
662 list_for_each_entry_rcu(t, &(signal)->thread_head, thread_node)
665 __for_each_thread((p)->signal, t)
681 pid = task->signal->pids[type]; in task_pid_type()
687 return task->signal->pids[PIDTYPE_TGID]; in task_tgid()
697 return task->signal->pids[PIDTYPE_PGID]; in task_pgrp()
702 return task->signal->pids[PIDTYPE_SID]; in task_session()
707 return task->signal->nr_threads; in get_nr_threads()
712 return p->exit_signal >= 0; in thread_group_leader()
718 return p1->signal == p2->signal; in same_thread_group()
723 return list_entry_rcu(p->thread_group.next, in next_thread()
729 return list_empty(&p->thread_group); in thread_group_empty()
746 (void)__cond_lock(&task->sighand->siglock, ret); in lock_task_sighand()
753 spin_unlock_irqrestore(&task->sighand->siglock, *flags); in unlock_task_sighand()
765 return READ_ONCE(task->signal->rlim[limit].rlim_cur); in task_rlimit()
771 return READ_ONCE(task->signal->rlim[limit].rlim_max); in task_rlimit_max()