Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/init_main.c
Show All 40 Lines | |||||
* @(#)init_main.c 8.9 (Berkeley) 1/21/94 | * @(#)init_main.c 8.9 (Berkeley) 1/21/94 | ||||
*/ | */ | ||||
#include <sys/cdefs.h> | #include <sys/cdefs.h> | ||||
__FBSDID("$FreeBSD$"); | __FBSDID("$FreeBSD$"); | ||||
#include "opt_ddb.h" | #include "opt_ddb.h" | ||||
#include "opt_init_path.h" | #include "opt_init_path.h" | ||||
#include "opt_pax.h" | |||||
#include "opt_verbose_sysinit.h" | #include "opt_verbose_sysinit.h" | ||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <sys/kernel.h> | #include <sys/kernel.h> | ||||
#include <sys/exec.h> | #include <sys/exec.h> | ||||
#include <sys/file.h> | #include <sys/file.h> | ||||
#include <sys/filedesc.h> | #include <sys/filedesc.h> | ||||
#include <sys/jail.h> | #include <sys/jail.h> | ||||
#include <sys/ktr.h> | #include <sys/ktr.h> | ||||
#include <sys/lock.h> | #include <sys/lock.h> | ||||
#include <sys/loginclass.h> | #include <sys/loginclass.h> | ||||
#include <sys/mount.h> | #include <sys/mount.h> | ||||
#include <sys/mutex.h> | #include <sys/mutex.h> | ||||
#include <sys/syscallsubr.h> | #include <sys/syscallsubr.h> | ||||
#include <sys/sysctl.h> | #include <sys/sysctl.h> | ||||
#include <sys/pax.h> | |||||
#include <sys/proc.h> | #include <sys/proc.h> | ||||
#include <sys/racct.h> | #include <sys/racct.h> | ||||
#include <sys/resourcevar.h> | #include <sys/resourcevar.h> | ||||
#include <sys/systm.h> | #include <sys/systm.h> | ||||
#include <sys/signalvar.h> | #include <sys/signalvar.h> | ||||
#include <sys/vnode.h> | #include <sys/vnode.h> | ||||
#include <sys/sysent.h> | #include <sys/sysent.h> | ||||
#include <sys/reboot.h> | #include <sys/reboot.h> | ||||
▲ Show 20 Lines • Show All 334 Lines • ▼ Show 20 Lines | struct sysentvec null_sysvec = { | ||||
.sv_setregs = NULL, | .sv_setregs = NULL, | ||||
.sv_fixlimit = NULL, | .sv_fixlimit = NULL, | ||||
.sv_maxssiz = NULL, | .sv_maxssiz = NULL, | ||||
.sv_flags = 0, | .sv_flags = 0, | ||||
.sv_set_syscall_retval = null_set_syscall_retval, | .sv_set_syscall_retval = null_set_syscall_retval, | ||||
.sv_fetch_syscall_args = null_fetch_syscall_args, | .sv_fetch_syscall_args = null_fetch_syscall_args, | ||||
.sv_syscallnames = NULL, | .sv_syscallnames = NULL, | ||||
.sv_schedtail = NULL, | .sv_schedtail = NULL, | ||||
.sv_pax_aslr_init = NULL, | |||||
}; | }; | ||||
/* | /* | ||||
*************************************************************************** | *************************************************************************** | ||||
**** | **** | ||||
**** The two following SYSINIT's are proc0 specific glue code. I am not | **** The two following SYSINIT's are proc0 specific glue code. I am not | ||||
**** convinced that they can not be safely combined, but their order of | **** convinced that they can not be safely combined, but their order of | ||||
**** operation has been maintained as the same as the original init_main.c | **** operation has been maintained as the same as the original init_main.c | ||||
▲ Show 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | proc0_init(void *dummy __unused) | ||||
mtx_init(&session0.s_mtx, "session", NULL, MTX_DEF); | mtx_init(&session0.s_mtx, "session", NULL, MTX_DEF); | ||||
refcount_init(&session0.s_count, 1); | refcount_init(&session0.s_count, 1); | ||||
session0.s_leader = p; | session0.s_leader = p; | ||||
p->p_sysent = &null_sysvec; | p->p_sysent = &null_sysvec; | ||||
p->p_flag = P_SYSTEM | P_INMEM; | p->p_flag = P_SYSTEM | P_INMEM; | ||||
p->p_flag2 = 0; | p->p_flag2 = 0; | ||||
p->p_state = PRS_NORMAL; | p->p_state = PRS_NORMAL; | ||||
#if defined(PAX_ASLR) | |||||
p->p_pax = PAX_NOTE_ALL_DISABLED; | |||||
#endif | |||||
knlist_init_mtx(&p->p_klist, &p->p_mtx); | knlist_init_mtx(&p->p_klist, &p->p_mtx); | ||||
STAILQ_INIT(&p->p_ktr); | STAILQ_INIT(&p->p_ktr); | ||||
p->p_nice = NZERO; | p->p_nice = NZERO; | ||||
/* pid_max cannot be greater than PID_MAX */ | /* pid_max cannot be greater than PID_MAX */ | ||||
td->td_tid = PID_MAX + 1; | td->td_tid = PID_MAX + 1; | ||||
LIST_INSERT_HEAD(TIDHASH(td->td_tid), td, td_hash); | LIST_INSERT_HEAD(TIDHASH(td->td_tid), td, td_hash); | ||||
td->td_state = TDS_RUNNING; | td->td_state = TDS_RUNNING; | ||||
td->td_pri_class = PRI_TIMESHARE; | td->td_pri_class = PRI_TIMESHARE; | ||||
td->td_user_pri = PUSER; | td->td_user_pri = PUSER; | ||||
td->td_base_user_pri = PUSER; | td->td_base_user_pri = PUSER; | ||||
td->td_lend_user_pri = PRI_MAX; | td->td_lend_user_pri = PRI_MAX; | ||||
td->td_priority = PVM; | td->td_priority = PVM; | ||||
td->td_base_pri = PVM; | td->td_base_pri = PVM; | ||||
td->td_oncpu = 0; | td->td_oncpu = 0; | ||||
td->td_flags = TDF_INMEM; | td->td_flags = TDF_INMEM; | ||||
td->td_pflags = TDP_KTHREAD; | td->td_pflags = TDP_KTHREAD; | ||||
td->td_cpuset = cpuset_thread0(); | td->td_cpuset = cpuset_thread0(); | ||||
#if defined(PAX_ASLR) | |||||
td->td_pax = PAX_NOTE_ALL_DISABLED; | |||||
#endif | |||||
prison0_init(); | prison0_init(); | ||||
p->p_peers = 0; | p->p_peers = 0; | ||||
p->p_leader = p; | p->p_leader = p; | ||||
p->p_reaper = p; | p->p_reaper = p; | ||||
LIST_INIT(&p->p_reaplist); | LIST_INIT(&p->p_reaplist); | ||||
strncpy(p->p_comm, "kernel", sizeof (p->p_comm)); | strncpy(p->p_comm, "kernel", sizeof (p->p_comm)); | ||||
strncpy(td->td_name, "swapper", sizeof (td->td_name)); | strncpy(td->td_name, "swapper", sizeof (td->td_name)); | ||||
▲ Show 20 Lines • Show All 359 Lines • Show Last 20 Lines |