FreeBSD kernel kern code
init_main.c File Reference
#include <sys/cdefs.h>
#include "opt_ddb.h"
#include "opt_init_path.h"
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/exec.h>
#include <sys/file.h>
#include <sys/filedesc.h>
#include <sys/jail.h>
#include <sys/ktr.h>
#include <sys/lock.h>
#include <sys/loginclass.h>
#include <sys/mount.h>
#include <sys/mutex.h>
#include <sys/syscallsubr.h>
#include <sys/sysctl.h>
#include <sys/proc.h>
#include <sys/racct.h>
#include <sys/resourcevar.h>
#include <sys/systm.h>
#include <sys/signalvar.h>
#include <sys/vnode.h>
#include <sys/sysent.h>
#include <sys/reboot.h>
#include <sys/sched.h>
#include <sys/sx.h>
#include <sys/sysproto.h>
#include <sys/vmmeter.h>
#include <sys/unistd.h>
#include <sys/malloc.h>
#include <sys/conf.h>
#include <sys/cpuset.h>
#include <machine/cpu.h>
#include <security/audit/audit.h>
#include <security/mac/mac_framework.h>
#include <vm/vm.h>
#include <vm/vm_param.h>
#include <vm/pmap.h>
#include <vm/vm_map.h>
#include <sys/copyright.h>
#include <ddb/ddb.h>
#include <ddb/db_sym.h>
Include dependency graph for init_main.c:

Go to the source code of this file.

Macros

#define INIT_SHUTDOWN_TIMEOUT   120
 

Functions

 __FBSDID ("$BSDSUniX$")
 
void mi_startup (void)
 
struct thread thread0 __aligned (16)
 
 SYSCTL_INT (_debug, OID_AUTO, boothowto, CTLFLAG_RD,&boothowto, 0,"Boot control flags, passed from loader")
 
 SYSCTL_INT (_debug, OID_AUTO, bootverbose, CTLFLAG_RW,&bootverbose, 0,"Control the output of verbose kernel messages")
 
 SYSINIT (placeholder, SI_SUB_DUMMY, SI_ORDER_ANY, NULL, NULL)
 
 SET_DECLARE (sysinit_set, struct sysinit)
 
void sysinit_add (struct sysinit **set, struct sysinit **set_end)
 
static void print_caddr_t (void *data)
 
static void print_version (void *data __unused)
 
 SYSINIT (announce, SI_SUB_COPYRIGHT, SI_ORDER_FIRST, print_caddr_t, copyright)
 
 SYSINIT (trademark, SI_SUB_COPYRIGHT, SI_ORDER_SECOND, print_caddr_t, trademark)
 
 SYSINIT (version, SI_SUB_COPYRIGHT, SI_ORDER_THIRD, print_version, NULL)
 
static int null_fetch_syscall_args (struct thread *td __unused, struct syscall_args *sa __unused)
 
static void null_set_syscall_retval (struct thread *td __unused, int error __unused)
 
static void proc0_init (void *dummy __unused)
 
 SYSINIT (p0init, SI_SUB_INTRINSIC, SI_ORDER_FIRST, proc0_init, NULL)
 
static void proc0_post (void *dummy __unused)
 
 SYSINIT (p0post, SI_SUB_INTRINSIC_POST, SI_ORDER_FIRST, proc0_post, NULL)
 
static void random_init (void *dummy __unused)
 
 SYSINIT (random, SI_SUB_RANDOM, SI_ORDER_FIRST, random_init, NULL)
 
 SYSCTL_STRING (_kern, OID_AUTO, init_path, CTLFLAG_RD, init_path, 0,"Path used to search the init process")
 
 SYSCTL_INT (_kern, OID_AUTO, init_shutdown_timeout, CTLFLAG_RW,&init_shutdown_timeout, 0,"Shutdown timeout of init(8). ""Unused within kernel, but used to control init(8)")
 
static void start_init (void *dummy)
 
static void create_init (const void *udata __unused)
 
 SYSINIT (init, SI_SUB_CREATE_INIT, SI_ORDER_FIRST, create_init, NULL)
 
static void kick_init (const void *udata __unused)
 
 SYSINIT (kickinit, SI_SUB_KTHREAD_INIT, SI_ORDER_FIRST, kick_init, NULL)
 

Variables

static struct session session0
 
static struct pgrp pgrp0
 
struct proc proc0
 
struct vmspace vmspace0
 
struct proc * initproc
 
int boothowto = 0
 
int bootverbose
 
struct sysinit ** sysinit
 
struct sysinit ** sysinit_end
 
struct sysinit ** newsysinit
 
struct sysinit ** newsysinit_end
 
struct sysentvec null_sysvec
 
static char init_path [MAXPATHLEN]
 
static int init_shutdown_timeout = INIT_SHUTDOWN_TIMEOUT
 

Macro Definition Documentation

#define INIT_SHUTDOWN_TIMEOUT   120

Definition at line 679 of file init_main.c.

Function Documentation

struct thread thread0 __aligned ( 16  )

Referenced by sys_ioctl().

Here is the caller graph for this function:

__FBSDID ( "$BSDSUniX$"  )
static void create_init ( const void *udata  __unused)
static

Definition at line 813 of file init_main.c.

References crcopy(), cred_update_thread(), crfree(), crget(), fork1(), initproc, panic(), and start_init().

Here is the call graph for this function:

static void kick_init ( const void *udata  __unused)
static

Definition at line 847 of file init_main.c.

References initproc, and sched_add().

Here is the call graph for this function:

void mi_startup ( void  )

Definition at line 191 of file init_main.c.

References boothowto, bootverbose, free(), Giant, newsysinit, newsysinit_end, printf(), symbol_name(), sysinit, and sysinit_end.

Here is the call graph for this function:

static int null_fetch_syscall_args ( struct thread *td  __unused,
struct syscall_args *sa  __unused 
)
static

Definition at line 359 of file init_main.c.

References panic().

Here is the call graph for this function:

static void null_set_syscall_retval ( struct thread *td  __unused,
int error  __unused 
)
static

Definition at line 367 of file init_main.c.

References panic().

Here is the call graph for this function:

static void print_caddr_t ( void *  data)
static

Definition at line 316 of file init_main.c.

References printf().

Here is the call graph for this function:

static void print_version ( void *data  __unused)
static

Definition at line 322 of file init_main.c.

References printf().

Here is the call graph for this function:

static void proc0_post ( void *dummy  __unused)
static

Definition at line 593 of file init_main.c.

References allproc_lock, cpu_ticks, microuptime(), nanotime(), rufetch(), and ticks.

Here is the call graph for this function:

static void random_init ( void *dummy  __unused)
static

Definition at line 631 of file init_main.c.

SET_DECLARE ( sysinit_set  ,
struct sysinit   
)
static void start_init ( void *  dummy)
static

Definition at line 691 of file init_main.c.

References execve_args::argv, boothowto, bootverbose, execve_args::envv, execve_args::fname, freeenv(), getenv(), Giant, panic(), path, printf(), suword, sys_execve(), ucp, and vfs_mountroot().

Referenced by create_init().

Here is the call graph for this function:

Here is the caller graph for this function:

SYSCTL_INT ( _debug  ,
OID_AUTO  ,
boothowto  ,
CTLFLAG_RD  ,
boothowto,
,
"Boot control  flags,
passed from loader"   
)
SYSCTL_INT ( _debug  ,
OID_AUTO  ,
bootverbose  ,
CTLFLAG_RW  ,
bootverbose,
,
"Control the output of verbose kernel messages"   
)
SYSCTL_INT ( _kern  ,
OID_AUTO  ,
init_shutdown_timeout  ,
CTLFLAG_RW  ,
init_shutdown_timeout,
,
"Shutdown timeout of init(8). ""Unused within  kernel,
but used to control init(8)"   
)
SYSCTL_STRING ( _kern  ,
OID_AUTO  ,
init_path  ,
CTLFLAG_RD  ,
init_path  ,
,
"Path used to search the init process"   
)
SYSINIT ( placeholder  ,
SI_SUB_DUMMY  ,
SI_ORDER_ANY  ,
NULL  ,
NULL   
)
SYSINIT ( announce  ,
SI_SUB_COPYRIGHT  ,
SI_ORDER_FIRST  ,
print_caddr_t  ,
copyright   
)
SYSINIT ( trademark  ,
SI_SUB_COPYRIGHT  ,
SI_ORDER_SECOND  ,
print_caddr_t  ,
trademark   
)
SYSINIT ( version  ,
SI_SUB_COPYRIGHT  ,
SI_ORDER_THIRD  ,
print_version  ,
NULL   
)
SYSINIT ( p0init  ,
SI_SUB_INTRINSIC  ,
SI_ORDER_FIRST  ,
proc0_init  ,
NULL   
)
SYSINIT ( p0post  ,
SI_SUB_INTRINSIC_POST  ,
SI_ORDER_FIRST  ,
proc0_post  ,
NULL   
)
SYSINIT ( random  ,
SI_SUB_RANDOM  ,
SI_ORDER_FIRST  ,
random_init  ,
NULL   
)
SYSINIT ( init  ,
SI_SUB_CREATE_INIT  ,
SI_ORDER_FIRST  ,
create_init  ,
NULL   
)
SYSINIT ( kickinit  ,
SI_SUB_KTHREAD_INIT  ,
SI_ORDER_FIRST  ,
kick_init  ,
NULL   
)
void sysinit_add ( struct sysinit **  set,
struct sysinit **  set_end 
)

Definition at line 131 of file init_main.c.

References count, free(), malloc(), newsysinit, newsysinit_end, panic(), set, sysinit, and sysinit_end.

Referenced by linker_preload().

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

int boothowto = 0

Definition at line 104 of file init_main.c.

Referenced by mi_startup(), STAILQ_HEAD(), start_init(), and vfs_mountroot_conf0().

char init_path[MAXPATHLEN]
static
Initial value:
=
"/sbin/init:/sbin/oinit:/sbin/init.bak:/rescue/init:/stand/sysinstall"

Definition at line 665 of file init_main.c.

int init_shutdown_timeout = INIT_SHUTDOWN_TIMEOUT
static

Definition at line 681 of file init_main.c.

struct proc* initproc
struct sysinit** newsysinit

Definition at line 124 of file init_main.c.

Referenced by mi_startup(), and sysinit_add().

struct sysinit ** newsysinit_end

Definition at line 124 of file init_main.c.

Referenced by mi_startup(), and sysinit_add().

struct sysentvec null_sysvec

Definition at line 373 of file init_main.c.

Referenced by proc0_init().

struct pgrp pgrp0
static

Definition at line 98 of file init_main.c.

Referenced by proc0_init().

struct proc proc0

Definition at line 99 of file init_main.c.

Referenced by do_fork(), kproc_create(), kthread_add(), mutex_init(), proc0_init(), schedinit(), and wakeup().

struct session session0
static

Definition at line 97 of file init_main.c.

Referenced by proc0_init().

struct sysinit** sysinit
struct sysinit ** sysinit_end

Definition at line 123 of file init_main.c.

Referenced by mi_startup(), and sysinit_add().

struct vmspace vmspace0

Definition at line 101 of file init_main.c.

Referenced by proc0_init().