|
FreeBSD kernel kern code
|
#include <sys/cdefs.h>#include "opt_kdtrace.h"#include "opt_ktrace.h"#include "opt_kstack_pages.h"#include "opt_procdesc.h"#include <sys/param.h>#include <sys/systm.h>#include <sys/sysproto.h>#include <sys/eventhandler.h>#include <sys/fcntl.h>#include <sys/filedesc.h>#include <sys/jail.h>#include <sys/kernel.h>#include <sys/kthread.h>#include <sys/sysctl.h>#include <sys/lock.h>#include <sys/malloc.h>#include <sys/mutex.h>#include <sys/priv.h>#include <sys/proc.h>#include <sys/procdesc.h>#include <sys/pioctl.h>#include <sys/ptrace.h>#include <sys/racct.h>#include <sys/resourcevar.h>#include <sys/sched.h>#include <sys/syscall.h>#include <sys/vmmeter.h>#include <sys/vnode.h>#include <sys/acct.h>#include <sys/ktr.h>#include <sys/ktrace.h>#include <sys/unistd.h>#include <sys/sdt.h>#include <sys/sx.h>#include <sys/sysent.h>#include <sys/signalvar.h>#include <security/audit/audit.h>#include <security/mac/mac_framework.h>#include <vm/vm.h>#include <vm/pmap.h>#include <vm/vm_map.h>#include <vm/vm_extern.h>#include <vm/uma.h>
Go to the source code of this file.
Data Structures | |
| struct | fork_args |
Functions | |
| __FBSDID ("$BSDSUniX$") | |
| SDT_PROVIDER_DECLARE (proc) | |
| SDT_PROBE_DEFINE3 (proc, kernel,, create,"struct proc *","struct proc *","int") | |
| int | sys_fork (struct thread *td, struct fork_args *uap) |
| int | sys_pdfork (struct thread *td, struct pdfork_args *uap) |
| int | sys_vfork (struct thread *td, struct vfork_args *uap) |
| int | sys_rfork (struct thread *td, struct rfork_args *uap) |
| SYSCTL_INT (_kern, OID_AUTO, lastpid, CTLFLAG_RD,&lastpid, 0,"Last used PID") | |
| static int | sysctl_kern_randompid (SYSCTL_HANDLER_ARGS) |
| SYSCTL_PROC (_kern, OID_AUTO, randompid, CTLTYPE_INT|CTLFLAG_RW, 0, 0, sysctl_kern_randompid,"I","Random PID modulus") | |
| static int | fork_findpid (int flags) |
| static int | fork_norfproc (struct thread *td, int flags) |
| static void | do_fork (struct thread *td, int flags, struct proc *p2, struct thread *td2, struct vmspace *vm2, int pdflags) |
| int | fork1 (struct thread *td, int flags, int pages, struct proc **procp, int *procdescp, int pdflags) |
| void | fork_exit (void(*callout)(void *, struct trapframe *), void *arg, struct trapframe *frame) |
| void | fork_return (struct thread *td, struct trapframe *frame) |
Variables | |
| int | nprocs = 1 |
| int | lastpid = 0 |
| static int | randompid = 0 |
| __FBSDID | ( | "$BSDSUniX$" | ) |
|
static |
Definition at line 369 of file kern_fork.c.
References allproc, allproc_lock, crhold(), fd, fdcopy(), fdinit(), fdshare(), filedesc_to_leader_alloc(), fork_findpid(), initproc, kern_psignal(), knote_fork(), lim_fork(), microuptime(), nprocs, pargs_hold(), ppeers_lock, prison_proc_hold(), proc0, proctree_lock, pstats_fork(), sched_add(), sched_fork(), sigacts_alloc(), sigacts_copy(), sigacts_hold(), startprofclock(), ticks, tidhash_add(), and vref().
Referenced by fork1().


| int fork1 | ( | struct thread * | td, |
| int | flags, | ||
| int | pages, | ||
| struct proc ** | procp, | ||
| int * | procdescp, | ||
| int | pdflags | ||
| ) |
Definition at line 759 of file kern_fork.c.
References allproc_lock, chgproccnt(), do_fork(), falloc(), fork_norfproc(), hz, knlist_init_mtx(), lim_cur(), maxproc, nprocs, pause(), ppsratecheck(), printf(), priv_check_cred(), proc_linkup(), proc_zone, proctree_lock, racct_proc_exit(), racct_proc_fork(), racct_proc_fork_done(), thread_alloc(), and thread_alloc_stack().
Referenced by create_init(), kproc_create(), sys_fork(), sys_pdfork(), sys_rfork(), and sys_vfork().


| void fork_exit | ( | void(*)(void *, struct trapframe *) | callout, |
| void * | arg, | ||
| struct trapframe * | frame | ||
| ) |
Definition at line 968 of file kern_fork.c.
References Giant, kthread_exit(), printf(), sched_fork_exit(), and thread_stash().

|
static |
Definition at line 227 of file kern_fork.c.
References allproc, allproc_lock, lastpid, pid_max, proctree_lock, randompid, and zombproc.
Referenced by do_fork().

|
static |
Definition at line 319 of file kern_fork.c.
References fdfree(), fdinit(), fdunshare(), thread_single(), and thread_single_end().
Referenced by fork1().


| void fork_return | ( | struct thread * | td, |
| struct trapframe * | frame | ||
| ) |
Definition at line 1024 of file kern_fork.c.
References Giant, proc_reparent(), proctree_lock, ptracestop(), and userret().

| SDT_PROBE_DEFINE3 | ( | proc | , |
| kernel | , | ||
| create | , | ||
| "struct proc *" | , | ||
| "struct proc *" | , | ||
| "int" | |||
| ) |
| SDT_PROVIDER_DECLARE | ( | proc | ) |
| int sys_fork | ( | struct thread * | td, |
| struct fork_args * | uap | ||
| ) |
Definition at line 104 of file kern_fork.c.
References fork1().

| int sys_pdfork | ( | struct thread * | td, |
| struct pdfork_args * | uap | ||
| ) |
| int sys_rfork | ( | struct thread * | td, |
| struct rfork_args * | uap | ||
| ) |
Definition at line 166 of file kern_fork.c.
References fork1().

| int sys_vfork | ( | struct thread * | td, |
| struct vfork_args * | uap | ||
| ) |
Definition at line 147 of file kern_fork.c.
References fork1().

| SYSCTL_INT | ( | _kern | , |
| OID_AUTO | , | ||
| lastpid | , | ||
| CTLFLAG_RD | , | ||
| & | lastpid, | ||
| 0 | , | ||
| "Last used PID" | |||
| ) |
|
static |
Definition at line 200 of file kern_fork.c.
References allproc_lock, pid_max, randompid, sysctl_handle_int(), and sysctl_wire_old_buffer().

| SYSCTL_PROC | ( | _kern | , |
| OID_AUTO | , | ||
| randompid | , | ||
| CTLTYPE_INT| | CTLFLAG_RW, | ||
| 0 | , | ||
| 0 | , | ||
| sysctl_kern_randompid | , | ||
| "I" | , | ||
| "Random PID modulus" | |||
| ) |
| int lastpid = 0 |
Definition at line 185 of file kern_fork.c.
Referenced by fork_findpid().
| int nprocs = 1 |
Definition at line 184 of file kern_fork.c.
Referenced by do_fork(), fork1(), and proc_reap().
|
static |
Definition at line 197 of file kern_fork.c.
Referenced by fork_findpid(), and sysctl_kern_randompid().