FreeBSD kernel kern code
kern_sig.c File Reference
#include <sys/cdefs.h>
#include "opt_compat.h"
#include "opt_kdtrace.h"
#include "opt_ktrace.h"
#include "opt_core.h"
#include "opt_procdesc.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/signalvar.h>
#include <sys/vnode.h>
#include <sys/acct.h>
#include <sys/capability.h>
#include <sys/condvar.h>
#include <sys/event.h>
#include <sys/fcntl.h>
#include <sys/imgact.h>
#include <sys/kernel.h>
#include <sys/ktr.h>
#include <sys/ktrace.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/mutex.h>
#include <sys/namei.h>
#include <sys/proc.h>
#include <sys/procdesc.h>
#include <sys/posix4.h>
#include <sys/pioctl.h>
#include <sys/racct.h>
#include <sys/resourcevar.h>
#include <sys/sdt.h>
#include <sys/sbuf.h>
#include <sys/sleepqueue.h>
#include <sys/smp.h>
#include <sys/stat.h>
#include <sys/sx.h>
#include <sys/syscallsubr.h>
#include <sys/sysctl.h>
#include <sys/sysent.h>
#include <sys/syslog.h>
#include <sys/sysproto.h>
#include <sys/timers.h>
#include <sys/unistd.h>
#include <sys/wait.h>
#include <vm/vm.h>
#include <vm/vm_extern.h>
#include <vm/uma.h>
#include <sys/jail.h>
#include <machine/cpu.h>
#include <security/audit/audit.h>
Include dependency graph for kern_sig.c:

Go to the source code of this file.

Data Structures

struct  sigaction_args
 
struct  sigprocmask_args
 
struct  sigpending_args
 
struct  sigsuspend_args
 
struct  sigaltstack_args
 
struct  kill_args
 
struct  sigqueue_args
 
struct  nosys_args
 

Macros

#define ONSIG   32 /* NSIG for osig* syscalls. XXX. */
 
#define CANSIGIO(cr1, cr2)
 
#define SA_KILL   0x01 /* terminates process by default */
 
#define SA_CORE   0x02 /* ditto and coredumps */
 
#define SA_STOP   0x04 /* suspend process */
 
#define SA_TTYSTOP   0x08 /* ditto, from tty */
 
#define SA_IGNORE   0x10 /* ignore by default */
 
#define SA_CONT   0x20 /* continue if suspended */
 
#define SA_CANTMASK   0x40 /* non-maskable, catchable */
 
#define SA_PROC   0x80 /* deliverable to any thread */
 
#define MAX_NUM_CORES   10
 

Functions

 __FBSDID ("$BSDSUniX$")
 
 SDT_PROVIDER_DECLARE (proc)
 
 SDT_PROBE_DEFINE3 (proc, kernel,, signal__send,"struct thread *","struct proc *","int")
 
 SDT_PROBE_DEFINE2 (proc, kernel,, signal__clear,"int","ksiginfo_t *")
 
 SDT_PROBE_DEFINE3 (proc, kernel,, signal__discard,"struct thread *","struct proc *","int")
 
static int coredump (struct thread *)
 
static char * expand_name (const char *, uid_t, pid_t, struct thread *, int)
 
static int killpg1 (struct thread *td, int sig, int pgid, int all, ksiginfo_t *ksi)
 
static int issignal (struct thread *td, int stop_allowed)
 
static int sigprop (int sig)
 
static void tdsigwakeup (struct thread *, int, sig_t, int)
 
static void sig_suspend_threads (struct thread *, struct proc *, int)
 
static int filt_sigattach (struct knote *kn)
 
static void filt_sigdetach (struct knote *kn)
 
static int filt_signal (struct knote *kn, long hint)
 
static struct thread * sigtd (struct proc *p, int sig, int prop)
 
static void sigqueue_start (void)
 
 SYSCTL_INT (_kern, KERN_LOGSIGEXIT, logsigexit, CTLFLAG_RW,&kern_logsigexit, 0,"Log processes quitting on abnormal signals to syslog(3)")
 
 SYSCTL_INT (_kern, OID_AUTO, forcesigexit, CTLFLAG_RW,&kern_forcesigexit, 0,"Force trap signal to be handled")
 
static SYSCTL_NODE (_kern, OID_AUTO, sigqueue, CTLFLAG_RW, 0,"POSIX real time signal")
 
 SYSCTL_INT (_kern_sigqueue, OID_AUTO, max_pending_per_proc, CTLFLAG_RW,&max_pending_per_proc, 0,"Max pending signals per proc")
 
 TUNABLE_INT ("kern.sigqueue.preallocate",&preallocate_siginfo)
 
 SYSCTL_INT (_kern_sigqueue, OID_AUTO, preallocate, CTLFLAG_RD,&preallocate_siginfo, 0,"Preallocated signal memory size")
 
 SYSCTL_INT (_kern_sigqueue, OID_AUTO, overflow, CTLFLAG_RD,&signal_overflow, 0,"Number of signals overflew")
 
 SYSCTL_INT (_kern_sigqueue, OID_AUTO, alloc_fail, CTLFLAG_RD,&signal_alloc_fail, 0,"signals failed to be allocated")
 
 SYSINIT (signal, SI_SUB_P1003_1B, SI_ORDER_FIRST+3, sigqueue_start, NULL)
 
 SYSCTL_INT (_kern, OID_AUTO, sugid_coredump, CTLFLAG_RW,&sugid_coredump, 0,"Allow setuid and setgid processes to dump core")
 
 SYSCTL_INT (_kern, OID_AUTO, coredump, CTLFLAG_RW,&do_coredump, 0,"Enable/Disable coredumps")
 
 SYSCTL_INT (_kern, OID_AUTO, nodump_coredump, CTLFLAG_RW,&set_core_nodump_flag, 0,"Enable setting the NODUMP flag on coredump files")
 
static void reschedule_signals (struct proc *p, sigset_t block, int flags)
 
ksiginfo_t * ksiginfo_alloc (int wait)
 
void ksiginfo_free (ksiginfo_t *ksi)
 
static __inline int ksiginfo_tryfree (ksiginfo_t *ksi)
 
void sigqueue_init (sigqueue_t *list, struct proc *p)
 
static int sigqueue_get (sigqueue_t *sq, int signo, ksiginfo_t *si)
 
void sigqueue_take (ksiginfo_t *ksi)
 
static int sigqueue_add (sigqueue_t *sq, int signo, ksiginfo_t *si)
 
void sigqueue_flush (sigqueue_t *sq)
 
static void sigqueue_move_set (sigqueue_t *src, sigqueue_t *dst, const sigset_t *set)
 
static void sigqueue_delete_set (sigqueue_t *sq, const sigset_t *set)
 
void sigqueue_delete (sigqueue_t *sq, int signo)
 
static void sigqueue_delete_set_proc (struct proc *p, const sigset_t *set)
 
void sigqueue_delete_proc (struct proc *p, int signo)
 
static void sigqueue_delete_stopmask_proc (struct proc *p)
 
int cursig (struct thread *td, int stop_allowed)
 
void signotify (struct thread *td)
 
int sigonstack (size_t sp)
 
int sig_ffs (sigset_t *set)
 
int kern_sigaction (struct thread *td, int sig, struct sigaction *act, struct sigaction *oact, int flags)
 
int sys_sigaction (struct thread *td, struct sigaction_args *uap)
 
void siginit (struct proc *p)
 
void execsigs (struct proc *p)
 
int kern_sigprocmask (struct thread *td, int how, sigset_t *set, sigset_t *oset, int flags)
 
int sys_sigprocmask (struct thread *td, struct sigprocmask_args *uap)
 
int sys_sigwait (struct thread *td, struct sigwait_args *uap)
 
int sys_sigtimedwait (struct thread *td, struct sigtimedwait_args *uap)
 
int sys_sigwaitinfo (struct thread *td, struct sigwaitinfo_args *uap)
 
int kern_sigtimedwait (struct thread *td, sigset_t waitset, ksiginfo_t *ksi, struct timespec *timeout)
 
int sys_sigpending (struct thread *td, struct sigpending_args *uap)
 
int sys_sigsuspend (struct thread *td, struct sigsuspend_args *uap)
 
int kern_sigsuspend (struct thread *td, sigset_t mask)
 
int sys_sigaltstack (struct thread *td, struct sigaltstack_args *uap)
 
int kern_sigaltstack (struct thread *td, stack_t *ss, stack_t *oss)
 
int sys_kill (struct thread *td, struct kill_args *uap)
 
int sys_pdkill (struct thread *td, struct pdkill_args *uap)
 
int sys_sigqueue (struct thread *td, struct sigqueue_args *uap)
 
void gsignal (int pgid, int sig, ksiginfo_t *ksi)
 
void pgsignal (struct pgrp *pgrp, int sig, int checkctty, ksiginfo_t *ksi)
 
static void postsig_done (int sig, struct thread *td, struct sigacts *ps)
 
void trapsignal (struct thread *td, ksiginfo_t *ksi)
 
void kern_psignal (struct proc *p, int sig)
 
int pksignal (struct proc *p, int sig, ksiginfo_t *ksi)
 
int sigev_findtd (struct proc *p, struct sigevent *sigev, struct thread **ttd)
 
void tdsignal (struct thread *td, int sig)
 
void tdksignal (struct thread *td, int sig, ksiginfo_t *ksi)
 
int tdsendsignal (struct proc *p, struct thread *td, int sig, ksiginfo_t *ksi)
 
int ptracestop (struct thread *td, int sig)
 
void tdsigcleanup (struct thread *td)
 
int sigdeferstop (void)
 
void sigallowstop ()
 
void thread_stopped (struct proc *p)
 
int postsig (int sig)
 
void killproc (struct proc *p, char *why)
 
void sigexit (struct thread *td, int sig)
 
static void sigparent (struct proc *p, int reason, int status)
 
static void childproc_jobstate (struct proc *p, int reason, int sig)
 
void childproc_stopped (struct proc *p, int reason)
 
void childproc_continued (struct proc *p)
 
void childproc_exited (struct proc *p)
 
static int sysctl_debug_num_cores_check (SYSCTL_HANDLER_ARGS)
 
 SYSCTL_PROC (_debug, OID_AUTO, ncores, CTLTYPE_INT|CTLFLAG_RW, 0, sizeof(int), sysctl_debug_num_cores_check,"I","")
 
 SYSCTL_STRING (_kern, OID_AUTO, corefile, CTLFLAG_RW, corefilename, sizeof(corefilename),"process corefile name format string")
 
int nosys (struct thread *td, struct nosys_args *args)
 
void pgsigio (struct sigio **sigiop, int sig, int checkctty)
 
struct sigacts * sigacts_alloc (void)
 
void sigacts_free (struct sigacts *ps)
 
struct sigacts * sigacts_hold (struct sigacts *ps)
 
void sigacts_copy (struct sigacts *dest, struct sigacts *src)
 
int sigacts_shared (struct sigacts *ps)
 

Variables

static uma_zone_t ksiginfo_zone = NULL
 
struct filterops sig_filtops
 
static int kern_logsigexit = 1
 
static int kern_forcesigexit = 1
 
static int max_pending_per_proc = 128
 
static int preallocate_siginfo = 1024
 
static int signal_overflow = 0
 
static int signal_alloc_fail = 0
 
static int sugid_coredump
 
static int do_coredump = 1
 
static int set_core_nodump_flag = 0
 
static int sigproptbl [NSIG]
 
static int num_cores = 5
 
static char corefilename [MAXPATHLEN] = {"%N.core"}
 

Macro Definition Documentation

#define CANSIGIO (   cr1,
  cr2 
)
Value:
((cr1)->cr_uid == 0 || \
(cr1)->cr_ruid == (cr2)->cr_ruid || \
(cr1)->cr_uid == (cr2)->cr_ruid || \
(cr1)->cr_ruid == (cr2)->cr_uid || \
(cr1)->cr_uid == (cr2)->cr_uid)

Definition at line 161 of file kern_sig.c.

Referenced by pgsigio().

#define MAX_NUM_CORES   10

Definition at line 3014 of file kern_sig.c.

Referenced by sysctl_debug_num_cores_check().

#define ONSIG   32 /* NSIG for osig* syscalls. XXX. */

Definition at line 93 of file kern_sig.c.

#define SA_CANTMASK   0x40 /* non-maskable, catchable */

Definition at line 191 of file kern_sig.c.

#define SA_CONT   0x20 /* continue if suspended */

Definition at line 190 of file kern_sig.c.

Referenced by issignal(), tdsendsignal(), and tdsigwakeup().

#define SA_CORE   0x02 /* ditto and coredumps */

Definition at line 186 of file kern_sig.c.

Referenced by sigexit().

#define SA_IGNORE   0x10 /* ignore by default */

Definition at line 189 of file kern_sig.c.

Referenced by execsigs(), issignal(), kern_sigaction(), postsig_done(), and siginit().

#define SA_KILL   0x01 /* terminates process by default */

Definition at line 185 of file kern_sig.c.

Referenced by tdsigwakeup().

#define SA_PROC   0x80 /* deliverable to any thread */

Definition at line 192 of file kern_sig.c.

#define SA_STOP   0x04 /* suspend process */

Definition at line 187 of file kern_sig.c.

Referenced by issignal(), tdsendsignal(), and tdsigwakeup().

#define SA_TTYSTOP   0x08 /* ditto, from tty */

Definition at line 188 of file kern_sig.c.

Referenced by issignal(), and tdsendsignal().

Function Documentation

__FBSDID ( "$BSDSUniX$"  )
void childproc_continued ( struct proc *  p)

Definition at line 2985 of file kern_sig.c.

References childproc_jobstate().

Referenced by tdsendsignal().

Here is the call graph for this function:

Here is the caller graph for this function:

void childproc_exited ( struct proc *  p)

Definition at line 2991 of file kern_sig.c.

References sigparent().

Referenced by exit1().

Here is the call graph for this function:

Here is the caller graph for this function:

static void childproc_jobstate ( struct proc *  p,
int  reason,
int  sig 
)
static

Definition at line 2952 of file kern_sig.c.

References sigparent(), and wakeup().

Referenced by childproc_continued(), and childproc_stopped().

Here is the call graph for this function:

Here is the caller graph for this function:

void childproc_stopped ( struct proc *  p,
int  reason 
)

Definition at line 2978 of file kern_sig.c.

References childproc_jobstate().

Referenced by thread_stopped().

Here is the call graph for this function:

Here is the caller graph for this function:

static int coredump ( struct thread *  td)
static

Definition at line 3207 of file kern_sig.c.

References do_coredump, expand_name(), free(), lim_cur(), name, NDFREE(), racct_get_available(), set_core_nodump_flag, sugid_coredump, vn_close(), vn_finished_write(), vn_open_cred(), and vn_start_write().

Referenced by sigexit().

Here is the call graph for this function:

Here is the caller graph for this function:

int cursig ( struct thread *  td,
int  stop_allowed 
)

Definition at line 559 of file kern_sig.c.

References issignal().

Referenced by ast(), kern_sigsuspend(), kern_sigtimedwait(), and sleepq_catch_signals().

Here is the call graph for this function:

Here is the caller graph for this function:

void execsigs ( struct proc *  p)

Definition at line 916 of file kern_sig.c.

References SA_IGNORE, sig_ffs(), sigprop(), and sigqueue_delete_proc().

Referenced by do_execve().

Here is the call graph for this function:

Here is the caller graph for this function:

static char * expand_name ( const char *  name,
uid_t  uid,
pid_t  pid,
struct thread *  td,
int  compress 
)
static

Definition at line 3066 of file kern_sig.c.

References corefilename, free(), getcredhostname(), log(), malloc(), NDFREE(), num_cores, sbuf_delete(), sbuf_error(), sbuf_finish(), sbuf_len(), sbuf_new(), sbuf_printf(), sbuf_putc(), vn_close(), and vn_open().

Referenced by coredump().

Here is the call graph for this function:

Here is the caller graph for this function:

static int filt_sigattach ( struct knote kn)
static

Definition at line 3412 of file kern_sig.c.

References knlist_add().

Here is the call graph for this function:

static void filt_sigdetach ( struct knote kn)
static

Definition at line 3425 of file kern_sig.c.

References knlist_remove().

Here is the call graph for this function:

static int filt_signal ( struct knote kn,
long  hint 
)
static

Definition at line 3439 of file kern_sig.c.

void gsignal ( int  pgid,
int  sig,
ksiginfo_t *  ksi 
)

Definition at line 1814 of file kern_sig.c.

References pgfind(), pgsignal(), and proctree_lock.

Here is the call graph for this function:

static int issignal ( struct thread *  td,
int  stop_allowed 
)
static

Definition at line 2583 of file kern_sig.c.

References printf(), ptracestop(), SA_CONT, SA_IGNORE, SA_STOP, SA_TTYSTOP, sig_ffs(), sig_suspend_threads(), signotify(), sigprop(), sigqueue_add(), sigqueue_delete(), sigqueue_get(), stopevent(), and thread_suspend_switch().

Referenced by cursig().

Here is the call graph for this function:

Here is the caller graph for this function:

void kern_psignal ( struct proc *  p,
int  sig 
)

Definition at line 1975 of file kern_sig.c.

References tdsendsignal().

Referenced by aio_process(), ast(), devctl_queue_data_f(), do_fork(), exit1(), kern_ptrace(), killproc(), lim_cb(), orphanpg(), pgsigio(), prison_remove_one(), realitexpire(), shutdown_nice(), sys_pdkill(), tty_signal_sessleader(), and vn_rlimit_fsize().

Here is the call graph for this function:

Here is the caller graph for this function:

int kern_sigaction ( struct thread *  td,
int  sig,
struct sigaction *  act,
struct sigaction *  oact,
int  flags 
)

Definition at line 633 of file kern_sig.c.

References SA_IGNORE, sigprop(), and sigqueue_delete_proc().

Referenced by sys_sigaction().

Here is the call graph for this function:

Here is the caller graph for this function:

int kern_sigaltstack ( struct thread *  td,
stack_t *  ss,
stack_t *  oss 
)

Definition at line 1558 of file kern_sig.c.

References sigonstack().

Referenced by sys_sigaltstack().

Here is the call graph for this function:

Here is the caller graph for this function:

int kern_sigprocmask ( struct thread *  td,
int  how,
sigset_t *  set,
sigset_t *  oset,
int  flags 
)

Definition at line 964 of file kern_sig.c.

References reschedule_signals(), set, and signotify().

Referenced by ast(), kern_pselect(), kern_sigsuspend(), postsig_done(), sys_setcontext(), sys_sigprocmask(), and sys_swapcontext().

Here is the call graph for this function:

Here is the caller graph for this function:

int kern_sigsuspend ( struct thread *  td,
sigset_t  mask 
)

Definition at line 1429 of file kern_sig.c.

References cursig(), kern_sigprocmask(), postsig(), and thread_suspend_check().

Referenced by sys_sigsuspend().

Here is the call graph for this function:

Here is the caller graph for this function:

int kern_sigtimedwait ( struct thread *  td,
sigset_t  waitset,
ksiginfo_t *  ksi,
struct timespec *  timeout 
)

Definition at line 1164 of file kern_sig.c.

References cursig(), getnanouptime(), itimer_accept(), reschedule_signals(), sigexit(), sigqueue_get(), and tvtohz().

Referenced by sys_sigtimedwait(), sys_sigwait(), and sys_sigwaitinfo().

Here is the call graph for this function:

Here is the caller graph for this function:

static int killpg1 ( struct thread *  td,
int  sig,
int  pgid,
int  all,
ksiginfo_t *  ksi 
)
static

Definition at line 1594 of file kern_sig.c.

References allproc_lock, p_cansignal(), pgfind(), pksignal(), and proctree_lock.

Referenced by sys_kill().

Here is the call graph for this function:

Here is the caller graph for this function:

void killproc ( struct proc *  p,
char *  why 
)

Definition at line 2865 of file kern_sig.c.

References kern_psignal(), and log().

Referenced by lim_cb().

Here is the call graph for this function:

Here is the caller graph for this function:

ksiginfo_t* ksiginfo_alloc ( int  wait)

Definition at line 242 of file kern_sig.c.

References ksiginfo_zone.

Referenced by proc_linkup(), and sigqueue_add().

Here is the caller graph for this function:

void ksiginfo_free ( ksiginfo_t *  ksi)

Definition at line 255 of file kern_sig.c.

References ksiginfo_zone.

Referenced by proc_fini().

Here is the caller graph for this function:

static __inline int ksiginfo_tryfree ( ksiginfo_t *  ksi)
static

Definition at line 261 of file kern_sig.c.

References ksiginfo_zone.

Referenced by sigqueue_delete_set(), sigqueue_flush(), sigqueue_get(), and tdsendsignal().

Here is the caller graph for this function:

int nosys ( struct thread *  td,
struct nosys_args args 
)

Definition at line 3355 of file kern_sig.c.

References tdsignal().

Referenced by lkmnosys(), and lkmressys().

Here is the call graph for this function:

Here is the caller graph for this function:

void pgsigio ( struct sigio **  sigiop,
int  sig,
int  checkctty 
)

Definition at line 3372 of file kern_sig.c.

References CANSIGIO, and kern_psignal().

Referenced by kqueue_wakeup(), logtimeout(), pipeselwakeup(), sohasoutofband(), sowakeup(), and tty_wakeup().

Here is the call graph for this function:

Here is the caller graph for this function:

void pgsignal ( struct pgrp *  pgrp,
int  sig,
int  checkctty,
ksiginfo_t *  ksi 
)

Definition at line 1834 of file kern_sig.c.

References pksignal().

Referenced by gsignal(), tty_signal_pgrp(), and tty_wait_background().

Here is the call graph for this function:

Here is the caller graph for this function:

int pksignal ( struct proc *  p,
int  sig,
ksiginfo_t *  ksi 
)

Definition at line 1986 of file kern_sig.c.

References tdsendsignal().

Referenced by killpg1(), pgsignal(), proc_reap(), sigparent(), sys_kill(), and sys_sigqueue().

Here is the call graph for this function:

Here is the caller graph for this function:

int postsig ( int  sig)

Definition at line 2788 of file kern_sig.c.

References itimer_accept(), postsig_done(), sigexit(), sigqueue_get(), and stopevent().

Referenced by ast(), and kern_sigsuspend().

Here is the call graph for this function:

Here is the caller graph for this function:

static void postsig_done ( int  sig,
struct thread *  td,
struct sigacts *  ps 
)
static

Definition at line 1858 of file kern_sig.c.

References kern_sigprocmask(), mask, SA_IGNORE, and sigprop().

Referenced by postsig(), and trapsignal().

Here is the call graph for this function:

Here is the caller graph for this function:

int ptracestop ( struct thread *  td,
int  sig 
)

Definition at line 2434 of file kern_sig.c.

References sig_suspend_threads(), and thread_suspend_switch().

Referenced by fork_return(), issignal(), syscallenter(), and syscallret().

Here is the call graph for this function:

Here is the caller graph for this function:

static void reschedule_signals ( struct proc *  p,
sigset_t  block,
int  flags 
)
static

Definition at line 2482 of file kern_sig.c.

References sig_ffs(), signotify(), sigtd(), and tdsigwakeup().

Referenced by kern_sigprocmask(), kern_sigtimedwait(), and tdsigcleanup().

Here is the call graph for this function:

Here is the caller graph for this function:

SDT_PROBE_DEFINE2 ( proc  ,
kernel  ,
signal__clear  ,
"int"  ,
"ksiginfo_t *"   
)
SDT_PROBE_DEFINE3 ( proc  ,
kernel  ,
signal__send  ,
"struct thread *"  ,
"struct proc *"  ,
"int"   
)
SDT_PROBE_DEFINE3 ( proc  ,
kernel  ,
signal__discard  ,
"struct thread *"  ,
"struct proc *"  ,
"int"   
)
SDT_PROVIDER_DECLARE ( proc  )
int sig_ffs ( sigset_t *  set)

Definition at line 616 of file kern_sig.c.

Referenced by execsigs(), issignal(), and reschedule_signals().

Here is the caller graph for this function:

static void sig_suspend_threads ( struct thread *  td,
struct proc *  p,
int  sending 
)
static

Definition at line 2394 of file kern_sig.c.

References thread_suspend_one().

Referenced by issignal(), ptracestop(), and tdsendsignal().

Here is the call graph for this function:

Here is the caller graph for this function:

struct sigacts* sigacts_alloc ( void  )

Definition at line 3452 of file kern_sig.c.

References malloc(), and mtx_init().

Referenced by do_execve(), do_fork(), and proc0_init().

Here is the call graph for this function:

Here is the caller graph for this function:

void sigacts_copy ( struct sigacts *  dest,
struct sigacts *  src 
)

Definition at line 3485 of file kern_sig.c.

Referenced by do_execve(), and do_fork().

Here is the caller graph for this function:

void sigacts_free ( struct sigacts *  ps)

Definition at line 3463 of file kern_sig.c.

References free(), and mtx_destroy().

Referenced by do_execve(), and proc_reap().

Here is the call graph for this function:

Here is the caller graph for this function:

struct sigacts* sigacts_hold ( struct sigacts *  ps)

Definition at line 3476 of file kern_sig.c.

Referenced by do_fork().

Here is the caller graph for this function:

int sigacts_shared ( struct sigacts *  ps)

Definition at line 3495 of file kern_sig.c.

Referenced by do_execve().

Here is the caller graph for this function:

void sigallowstop ( )

Definition at line 2560 of file kern_sig.c.

int sigdeferstop ( void  )

Definition at line 2541 of file kern_sig.c.

int sigev_findtd ( struct proc *  p,
struct sigevent *  sigev,
struct thread **  ttd 
)

Definition at line 1994 of file kern_sig.c.

References tdfind().

Referenced by aio_sendsig(), itimer_fire(), and mqueue_send_notification().

Here is the call graph for this function:

Here is the caller graph for this function:

void sigexit ( struct thread *  td,
int  sig 
)

Definition at line 2888 of file kern_sig.c.

References coredump(), exit1(), kern_logsigexit, log(), SA_CORE, sigprop(), and thread_single().

Referenced by kern_sigtimedwait(), and postsig().

Here is the call graph for this function:

Here is the caller graph for this function:

void siginit ( struct proc *  p)

Definition at line 896 of file kern_sig.c.

References SA_IGNORE, and sigprop().

Referenced by proc0_init().

Here is the call graph for this function:

Here is the caller graph for this function:

void signotify ( struct thread *  td)

Definition at line 575 of file kern_sig.c.

Referenced by issignal(), kern_sigprocmask(), reschedule_signals(), and tdsendsignal().

Here is the caller graph for this function:

int sigonstack ( size_t  sp)

Definition at line 591 of file kern_sig.c.

Referenced by kern_sigaltstack().

Here is the caller graph for this function:

static void sigparent ( struct proc *  p,
int  reason,
int  status 
)
static

Definition at line 2934 of file kern_sig.c.

References pksignal().

Referenced by childproc_exited(), and childproc_jobstate().

Here is the call graph for this function:

Here is the caller graph for this function:

static __inline int sigprop ( int  sig)
static

Definition at line 607 of file kern_sig.c.

References sigproptbl.

Referenced by execsigs(), issignal(), kern_sigaction(), postsig_done(), sigexit(), siginit(), tdsendsignal(), and tdsigwakeup().

Here is the caller graph for this function:

static int sigqueue_add ( sigqueue_t *  sq,
int  signo,
ksiginfo_t *  si 
)
static

Definition at line 349 of file kern_sig.c.

References ksiginfo_alloc(), ksiginfo_zone, max_pending_per_proc, signal_alloc_fail, and signal_overflow.

Referenced by issignal(), and tdsendsignal().

Here is the call graph for this function:

Here is the caller graph for this function:

void sigqueue_delete ( sigqueue_t *  sq,
int  signo 
)

Definition at line 503 of file kern_sig.c.

References set, and sigqueue_delete_set().

Referenced by issignal(), tdsendsignal(), and tdsigwakeup().

Here is the call graph for this function:

Here is the caller graph for this function:

void sigqueue_delete_proc ( struct proc *  p,
int  signo 
)

Definition at line 531 of file kern_sig.c.

References set, and sigqueue_delete_set_proc().

Referenced by execsigs(), kern_sigaction(), and tdsendsignal().

Here is the call graph for this function:

Here is the caller graph for this function:

static void sigqueue_delete_set ( sigqueue_t *  sq,
const sigset_t *  set 
)
static

Definition at line 482 of file kern_sig.c.

References ksiginfo_tryfree().

Referenced by sigqueue_delete().

Here is the call graph for this function:

Here is the caller graph for this function:

static void sigqueue_delete_set_proc ( struct proc *  p,
const sigset_t *  set 
)
static

Definition at line 514 of file kern_sig.c.

References sigqueue_flush(), sigqueue_init(), and sigqueue_move_set().

Referenced by sigqueue_delete_proc(), and sigqueue_delete_stopmask_proc().

Here is the call graph for this function:

Here is the caller graph for this function:

static void sigqueue_delete_stopmask_proc ( struct proc *  p)
static

Definition at line 541 of file kern_sig.c.

References set, and sigqueue_delete_set_proc().

Referenced by tdsendsignal().

Here is the call graph for this function:

Here is the caller graph for this function:

void sigqueue_flush ( sigqueue_t *  sq)

Definition at line 412 of file kern_sig.c.

References ksiginfo_tryfree().

Referenced by exit1(), sigqueue_delete_set_proc(), and tdsigcleanup().

Here is the call graph for this function:

Here is the caller graph for this function:

static int sigqueue_get ( sigqueue_t *  sq,
int  signo,
ksiginfo_t *  si 
)
static

Definition at line 287 of file kern_sig.c.

References count, and ksiginfo_tryfree().

Referenced by issignal(), kern_sigtimedwait(), and postsig().

Here is the call graph for this function:

Here is the caller graph for this function:

void sigqueue_init ( sigqueue_t *  list,
struct proc *  p 
)

Definition at line 271 of file kern_sig.c.

Referenced by proc_linkup(), sigqueue_delete_set_proc(), and thread_link().

Here is the caller graph for this function:

static void sigqueue_move_set ( sigqueue_t *  src,
sigqueue_t *  dst,
const sigset_t *  set 
)
static

Definition at line 434 of file kern_sig.c.

Referenced by sigqueue_delete_set_proc().

Here is the caller graph for this function:

static void sigqueue_start ( void  )
static

Definition at line 231 of file kern_sig.c.

References ksiginfo_zone, max_pending_per_proc, p31b_setcfg(), and preallocate_siginfo.

Here is the call graph for this function:

void sigqueue_take ( ksiginfo_t *  ksi)
static struct thread * sigtd ( struct proc *  p,
int  sig,
int  prop 
)
static

Definition at line 1933 of file kern_sig.c.

Referenced by reschedule_signals(), and tdsendsignal().

Here is the caller graph for this function:

int sys_kill ( struct thread *  td,
struct kill_args uap 
)

Definition at line 1671 of file kern_sig.c.

References killpg1(), p_cansignal(), pfind(), kill_args::pid, pksignal(), kill_args::signum, and zpfind().

Here is the call graph for this function:

int sys_pdkill ( struct thread *  td,
struct pdkill_args *  uap 
)

Definition at line 1713 of file kern_sig.c.

References kern_psignal(), and p_cansignal().

Here is the call graph for this function:

int sys_sigaction ( struct thread *  td,
struct sigaction_args uap 
)

Definition at line 783 of file kern_sig.c.

References kern_sigaction().

Here is the call graph for this function:

int sys_sigaltstack ( struct thread *  td,
struct sigaltstack_args uap 
)

Definition at line 1536 of file kern_sig.c.

References kern_sigaltstack().

Here is the call graph for this function:

int sys_sigpending ( struct thread *  td,
struct sigpending_args uap 
)

Definition at line 1283 of file kern_sig.c.

References sigpending_args::set.

int sys_sigprocmask ( struct thread *  td,
struct sigprocmask_args uap 
)

Definition at line 1034 of file kern_sig.c.

References sigprocmask_args::how, kern_sigprocmask(), sigprocmask_args::oset, set, and sigprocmask_args::set.

Here is the call graph for this function:

int sys_sigqueue ( struct thread *  td,
struct sigqueue_args uap 
)

Definition at line 1775 of file kern_sig.c.

References p_cansignal(), pfind(), sigqueue_args::pid, pksignal(), sigqueue_args::signum, sigqueue_args::value, and zpfind().

Here is the call graph for this function:

int sys_sigsuspend ( struct thread *  td,
struct sigsuspend_args uap 
)

Definition at line 1415 of file kern_sig.c.

References kern_sigsuspend(), mask, and sigsuspend_args::sigmask.

Here is the call graph for this function:

int sys_sigtimedwait ( struct thread *  td,
struct sigtimedwait_args *  uap 
)

Definition at line 1107 of file kern_sig.c.

References kern_sigtimedwait(), set, timeout(), and ts.

Here is the call graph for this function:

int sys_sigwait ( struct thread *  td,
struct sigwait_args *  uap 
)

Definition at line 1079 of file kern_sig.c.

References kern_sigtimedwait(), and set.

Here is the call graph for this function:

int sys_sigwaitinfo ( struct thread *  td,
struct sigwaitinfo_args *  uap 
)

Definition at line 1141 of file kern_sig.c.

References kern_sigtimedwait(), and set.

Here is the call graph for this function:

static int sysctl_debug_num_cores_check ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 3018 of file kern_sig.c.

References MAX_NUM_CORES, num_cores, and sysctl_handle_int().

Here is the call graph for this function:

SYSCTL_INT ( _kern  ,
KERN_LOGSIGEXIT  ,
logsigexit  ,
CTLFLAG_RW  ,
kern_logsigexit,
,
"Log processes quitting on abnormal signals to syslog(3)"   
)
SYSCTL_INT ( _kern  ,
OID_AUTO  ,
forcesigexit  ,
CTLFLAG_RW  ,
kern_forcesigexit,
,
"Force trap signal to be handled"   
)
SYSCTL_INT ( _kern_sigqueue  ,
OID_AUTO  ,
max_pending_per_proc  ,
CTLFLAG_RW  ,
max_pending_per_proc,
,
"Max pending signals per proc"   
)
SYSCTL_INT ( _kern_sigqueue  ,
OID_AUTO  ,
preallocate  ,
CTLFLAG_RD  ,
preallocate_siginfo,
,
"Preallocated signal memory size"   
)
SYSCTL_INT ( _kern_sigqueue  ,
OID_AUTO  ,
overflow  ,
CTLFLAG_RD  ,
signal_overflow,
,
"Number of signals overflew"   
)
SYSCTL_INT ( _kern_sigqueue  ,
OID_AUTO  ,
alloc_fail  ,
CTLFLAG_RD  ,
signal_alloc_fail,
,
"signals failed to be allocated"   
)
SYSCTL_INT ( _kern  ,
OID_AUTO  ,
sugid_coredump  ,
CTLFLAG_RW  ,
sugid_coredump,
,
"Allow setuid and setgid processes to dump core"   
)
SYSCTL_INT ( _kern  ,
OID_AUTO  ,
coredump  ,
CTLFLAG_RW  ,
do_coredump,
,
"Enable/Disable coredumps"   
)
SYSCTL_INT ( _kern  ,
OID_AUTO  ,
nodump_coredump  ,
CTLFLAG_RW  ,
set_core_nodump_flag,
,
"Enable setting the NODUMP flag on coredump files"   
)
static SYSCTL_NODE ( _kern  ,
OID_AUTO  ,
sigqueue  ,
CTLFLAG_RW  ,
,
"POSIX real time signal"   
)
static
SYSCTL_PROC ( _debug  ,
OID_AUTO  ,
ncores  ,
CTLTYPE_INT|  CTLFLAG_RW,
,
sizeof(int)  ,
sysctl_debug_num_cores_check  ,
"I"  ,
""   
)
SYSCTL_STRING ( _kern  ,
OID_AUTO  ,
corefile  ,
CTLFLAG_RW  ,
corefilename  ,
sizeof(corefilename ,
"process corefile name format string"   
)
SYSINIT ( signal  ,
SI_SUB_P1003_1B  ,
SI_ORDER_FIRST+  3,
sigqueue_start  ,
NULL   
)
void tdksignal ( struct thread *  td,
int  sig,
ksiginfo_t *  ksi 
)

Definition at line 2022 of file kern_sig.c.

References tdsendsignal().

Referenced by sys_thr_kill(), and sys_thr_kill2().

Here is the call graph for this function:

Here is the caller graph for this function:

int tdsendsignal ( struct proc *  p,
struct thread *  td,
int  sig,
ksiginfo_t *  ksi 
)
void tdsigcleanup ( struct thread *  td)

Definition at line 2509 of file kern_sig.c.

References reschedule_signals(), and sigqueue_flush().

Referenced by sys_thr_exit(), and thread_suspend_check().

Here is the call graph for this function:

Here is the caller graph for this function:

void tdsignal ( struct thread *  td,
int  sig 
)

Definition at line 2011 of file kern_sig.c.

References tdsendsignal().

Referenced by dofilewrite(), kern_sendit(), nosys(), soo_write(), sys_sctp_generic_sendmsg(), and sys_sctp_generic_sendmsg_iov().

Here is the call graph for this function:

Here is the caller graph for this function:

static void tdsigwakeup ( struct thread *  td,
int  sig,
sig_t  action,
int  intrval 
)
static

Definition at line 2317 of file kern_sig.c.

References SA_CONT, SA_KILL, SA_STOP, sched_prio(), sigprop(), sigqueue_delete(), and sleepq_abort().

Referenced by reschedule_signals(), and tdsendsignal().

Here is the call graph for this function:

Here is the caller graph for this function:

void thread_stopped ( struct proc *  p)

Definition at line 2763 of file kern_sig.c.

References childproc_stopped().

Referenced by sys_thr_exit(), tdsendsignal(), thread_suspend_check(), and thread_suspend_switch().

Here is the call graph for this function:

Here is the caller graph for this function:

void trapsignal ( struct thread *  td,
ksiginfo_t *  ksi 
)

Definition at line 1884 of file kern_sig.c.

References kern_forcesigexit, postsig_done(), and tdsendsignal().

Here is the call graph for this function:

TUNABLE_INT ( "kern.sigqueue.preallocate"  ,
preallocate_siginfo 
)

Variable Documentation

char corefilename[MAXPATHLEN] = {"%N.core"}
static

Definition at line 3050 of file kern_sig.c.

Referenced by expand_name().

int do_coredump = 1
static

Definition at line 172 of file kern_sig.c.

Referenced by coredump().

int kern_forcesigexit = 1
static

Definition at line 130 of file kern_sig.c.

Referenced by trapsignal().

int kern_logsigexit = 1
static

Definition at line 125 of file kern_sig.c.

Referenced by sigexit().

uma_zone_t ksiginfo_zone = NULL
static
int max_pending_per_proc = 128
static

Definition at line 137 of file kern_sig.c.

Referenced by sigqueue_add(), and sigqueue_start().

int num_cores = 5
static

Definition at line 3015 of file kern_sig.c.

Referenced by expand_name(), and sysctl_debug_num_cores_check().

int preallocate_siginfo = 1024
static

Definition at line 141 of file kern_sig.c.

Referenced by sigqueue_start().

int set_core_nodump_flag = 0
static

Definition at line 176 of file kern_sig.c.

Referenced by coredump().

struct filterops sig_filtops
Initial value:
= {
.f_isfd = 0,
.f_attach = filt_sigattach,
.f_detach = filt_sigdetach,
.f_event = filt_signal,
}
static void filt_sigdetach(struct knote *kn)
Definition: kern_sig.c:3425
static int filt_sigattach(struct knote *kn)
Definition: kern_sig.c:3412
static int filt_signal(struct knote *kn, long hint)
Definition: kern_sig.c:3439

Definition at line 118 of file kern_sig.c.

int signal_alloc_fail = 0
static

Definition at line 150 of file kern_sig.c.

Referenced by sigqueue_add().

int signal_overflow = 0
static

Definition at line 146 of file kern_sig.c.

Referenced by sigqueue_add().

int sigproptbl[NSIG]
static

Definition at line 194 of file kern_sig.c.

Referenced by sigprop().

int sugid_coredump
static

Definition at line 168 of file kern_sig.c.

Referenced by coredump().