FreeBSD kernel kern code
|
#include <sys/cdefs.h>
#include "opt_ddb.h"
#include "opt_ktrace.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/sysproto.h>
#include <sys/capsicum.h>
#include <sys/eventhandler.h>
#include <sys/kernel.h>
#include <sys/ktr.h>
#include <sys/malloc.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/proc.h>
#include <sys/procdesc.h>
#include <sys/jail.h>
#include <sys/tty.h>
#include <sys/wait.h>
#include <sys/vmmeter.h>
#include <sys/vnode.h>
#include <sys/racct.h>
#include <sys/resourcevar.h>
#include <sys/sbuf.h>
#include <sys/signalvar.h>
#include <sys/sched.h>
#include <sys/sx.h>
#include <sys/syscallsubr.h>
#include <sys/sysctl.h>
#include <sys/syslog.h>
#include <sys/ptrace.h>
#include <sys/acct.h>
#include <sys/filedesc.h>
#include <sys/sdt.h>
#include <sys/shm.h>
#include <sys/sem.h>
#include <sys/sysent.h>
#include <sys/timers.h>
#include <sys/umtxvar.h>
#include <security/audit/audit.h>
#include <security/mac/mac_framework.h>
#include <vm/vm.h>
#include <vm/vm_extern.h>
#include <vm/vm_param.h>
#include <vm/pmap.h>
#include <vm/vm_map.h>
#include <vm/vm_page.h>
#include <vm/uma.h>
Go to the source code of this file.
Data Structures | |
struct | abort2_args |
Functions | |
__FBSDID ("$FreeBSD$") | |
SDT_PROVIDER_DECLARE (proc) | |
SDT_PROBE_DEFINE1 (proc,,, exit, "int") | |
SYSCTL_INT (_kern, OID_AUTO, kill_on_debugger_exit, CTLFLAG_RWTUN, &kern_kill_on_dbg_exit, 0, "Kill ptraced processes when debugger exits") | |
SYSCTL_BOOL (_kern, OID_AUTO, wait_dequeue_sigchld, CTLFLAG_RWTUN, &kern_wait_dequeue_sigchld, 0, "Dequeue SIGCHLD on wait(2) for live process") | |
struct proc * | proc_realparent (struct proc *child) |
void | reaper_abandon_children (struct proc *p, bool exiting) |
static void | reaper_clear (struct proc *p) |
void | proc_clear_orphan (struct proc *p) |
void | exit_onexit (struct proc *p) |
int | sys_exit (struct thread *td, struct exit_args *uap) |
void | exit1 (struct thread *td, int rval, int signo) |
int | sys_abort2 (struct thread *td, struct abort2_args *uap) |
int | kern_abort2 (struct thread *td, const char *why, int nargs, void **uargs) |
int | sys_wait4 (struct thread *td, struct wait4_args *uap) |
int | sys_wait6 (struct thread *td, struct wait6_args *uap) |
void | proc_reap (struct thread *td, struct proc *p, int *status, int options) |
static int | proc_to_reap (struct thread *td, struct proc *p, idtype_t idtype, id_t id, int *status, int options, struct __wrusage *wrusage, siginfo_t *siginfo, int check_only) |
int | kern_wait (struct thread *td, pid_t pid, int *status, int options, struct rusage *rusage) |
static void | report_alive_proc (struct thread *td, struct proc *p, siginfo_t *siginfo, int *status, int options, int si_code) |
int | kern_wait6 (struct thread *td, idtype_t idtype, id_t id, int *status, int options, struct __wrusage *wrusage, siginfo_t *siginfo) |
void | proc_add_orphan (struct proc *child, struct proc *parent) |
void | proc_reparent (struct proc *child, struct proc *parent, bool set_oppid) |
Variables | |
static int | kern_kill_on_dbg_exit = 1 |
static bool | kern_wait_dequeue_sigchld = 1 |
__FBSDID | ( | "$FreeBSD$" | ) |
void exit1 | ( | struct thread * | td, |
int | rval, | ||
int | signo | ||
) |
Definition at line 222 of file kern_exit.c.
References _callout_stop_safe(), acct_process(), allproc_lock, childproc_exited(), exec_free_abi_mappings(), fdescfree(), free(), funsetownlst(), Giant, initproc, itimers_exit(), kern_kill_on_dbg_exit, kern_psignal(), killjobc(), ksiginfo_alloc(), ksiginfo_free(), lim_free(), panic(), pdescfree(), pksignal(), ppeers_lock, printf(), prison_proc_free(), proc_clear_orphan(), proc_realparent(), proc_reparent(), procdesc_exit(), proctree_lock, ptrace_unsuspend(), rebooting, ruadd(), sched_exit(), seltdfini(), sigqueue_delete_proc(), sigqueue_flush(), stopprofclock(), thread_exit(), thread_single(), thread_suspend_check(), tidhash_remove(), vrele(), and wakeup().
Referenced by do_execve(), fork_return(), kern_abort2(), kproc_exit(), sigexit(), and sys_exit().
void exit_onexit | ( | struct proc * | p | ) |
Definition at line 199 of file kern_exit.c.
References umtx_thread_exit().
int kern_abort2 | ( | struct thread * | td, |
const char * | why, | ||
int | nargs, | ||
void ** | uargs | ||
) |
Definition at line 769 of file kern_exit.c.
References exit1(), log(), sbuf_cat(), sbuf_clear(), sbuf_copyin(), sbuf_data(), sbuf_delete(), sbuf_finish(), sbuf_new(), sbuf_printf(), and sbuf_trim().
Referenced by sys_abort2().
int kern_wait | ( | struct thread * | td, |
pid_t | pid, | ||
int * | status, | ||
int | options, | ||
struct rusage * | rusage | ||
) |
Definition at line 1199 of file kern_exit.c.
References kern_wait6().
Referenced by sys_wait4().
int kern_wait6 | ( | struct thread * | td, |
idtype_t | idtype, | ||
id_t | id, | ||
int * | status, | ||
int | options, | ||
struct __wrusage * | wrusage, | ||
siginfo_t * | siginfo | ||
) |
Definition at line 1275 of file kern_exit.c.
References proc_to_reap(), proctree_lock, and report_alive_proc().
Referenced by kern_wait(), and sys_wait6().
void proc_add_orphan | ( | struct proc * | child, |
struct proc * | parent | ||
) |
Definition at line 1422 of file kern_exit.c.
References child, parent, and proctree_lock.
Referenced by proc_reparent(), and procdesc_close().
void proc_clear_orphan | ( | struct proc * | p | ) |
Definition at line 181 of file kern_exit.c.
References proctree_lock.
Referenced by exit1(), proc_reap(), proc_reparent(), and procdesc_close().
struct proc * proc_realparent | ( | struct proc * | child | ) |
Definition at line 114 of file kern_exit.c.
References child, parent, and proctree_lock.
Referenced by exit1(), inferior(), jobc_parent(), kern_ptrace(), proc_reap(), reap_getpids(), and reap_status().
void proc_reap | ( | struct thread * | td, |
struct proc * | p, | ||
int * | status, | ||
int | options | ||
) |
Definition at line 911 of file kern_exit.c.
References chgproccnt(), knlist_detach(), leavepgrp(), mtx_spin_wait_unlocked(), nprocs, pargs_drop(), pksignal(), proc_clear_orphan(), proc_id_clear(), proc_realparent(), proc_reparent(), proc_unset_cred(), proc_zone, procdesc_reap(), proctree_lock, reaper_abandon_children(), reaper_clear(), ruadd(), sigacts_free(), sigqueue_take(), thread_wait(), and wakeup().
Referenced by proc_to_reap(), and procdesc_close().
void proc_reparent | ( | struct proc * | child, |
struct proc * | parent, | ||
bool | set_oppid | ||
) |
Definition at line 1444 of file kern_exit.c.
References child, parent, proc_add_orphan(), proc_clear_orphan(), proctree_lock, and sigqueue_take().
Referenced by do_fork(), exit1(), kern_ptrace(), kproc_exit(), proc_reap(), procdesc_close(), and reaper_abandon_children().
|
static |
Definition at line 1046 of file kern_exit.c.
References calccru(), calcru(), p_canwait(), proc_reap(), and proctree_lock.
Referenced by kern_wait6().
void reaper_abandon_children | ( | struct proc * | p, |
bool | exiting | ||
) |
Definition at line 135 of file kern_exit.c.
References initproc, proc_reparent(), and proctree_lock.
Referenced by proc_reap(), and reap_release().
|
static |
Definition at line 160 of file kern_exit.c.
References proc_id_clear(), and proctree_lock.
Referenced by proc_reap().
|
static |
Definition at line 1240 of file kern_exit.c.
References kern_wait_dequeue_sigchld, proctree_lock, and sigqueue_take().
Referenced by kern_wait6().
SDT_PROBE_DEFINE1 | ( | proc | , |
exit | , | ||
"int" | |||
) |
SDT_PROVIDER_DECLARE | ( | proc | ) |
int sys_abort2 | ( | struct thread * | td, |
struct abort2_args * | uap | ||
) |
Definition at line 737 of file kern_exit.c.
References abort2_args::args, kern_abort2(), abort2_args::nargs, and abort2_args::why.
int sys_exit | ( | struct thread * | td, |
struct exit_args * | uap | ||
) |
Definition at line 209 of file kern_exit.c.
References exit1().
int sys_wait4 | ( | struct thread * | td, |
struct wait4_args * | uap | ||
) |
Definition at line 850 of file kern_exit.c.
References kern_wait().
int sys_wait6 | ( | struct thread * | td, |
struct wait6_args * | uap | ||
) |
Definition at line 868 of file kern_exit.c.
References kern_wait6().
SYSCTL_BOOL | ( | _kern | , |
OID_AUTO | , | ||
wait_dequeue_sigchld | , | ||
CTLFLAG_RWTUN | , | ||
& | kern_wait_dequeue_sigchld, | ||
0 | , | ||
"Dequeue SIGCHLD on wait(2) for live process" | |||
) |
SYSCTL_INT | ( | _kern | , |
OID_AUTO | , | ||
kill_on_debugger_exit | , | ||
CTLFLAG_RWTUN | , | ||
& | kern_kill_on_dbg_exit, | ||
0 | , | ||
"Kill ptraced processes when debugger exits" | |||
) |
|
static |
Definition at line 103 of file kern_exit.c.
Referenced by exit1().
|
static |
Definition at line 108 of file kern_exit.c.
Referenced by report_alive_proc().