FreeBSD kernel kern code
kern_module.c File Reference
#include "opt_compat.h"
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/systm.h>
#include <sys/eventhandler.h>
#include <sys/malloc.h>
#include <sys/sysproto.h>
#include <sys/sysent.h>
#include <sys/proc.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/reboot.h>
#include <sys/sx.h>
#include <sys/module.h>
#include <sys/linker.h>
Include dependency graph for kern_module.c:

Go to the source code of this file.

Data Structures

struct  module
 
struct  module_stat_v1
 

Macros

#define MOD_EVENT(mod, type)   (mod)->handler((mod), (type), (mod)->arg)
 

Functions

 __FBSDID ("$BSDSUniX$")
 
static MALLOC_DEFINE (M_MODULE,"module","module data structures")
 
static TAILQ_HEAD (modulelist, module)
 
static void module_init (void *arg)
 
 SYSINIT (module, SI_SUB_KLD, SI_ORDER_FIRST, module_init, 0)
 
static void module_shutdown (void *arg1, int arg2)
 
void module_register_init (const void *arg)
 
int module_register (const moduledata_t *data, linker_file_t container)
 
void module_reference (module_t mod)
 
void module_release (module_t mod)
 
module_t module_lookupbyname (const char *name)
 
module_t module_lookupbyid (int modid)
 
int module_quiesce (module_t mod)
 
int module_unload (module_t mod)
 
int module_getid (module_t mod)
 
module_t module_getfnext (module_t mod)
 
const char * module_getname (module_t mod)
 
void module_setspecific (module_t mod, modspecific_t *datap)
 
linker_file_t module_file (module_t mod)
 
int sys_modnext (struct thread *td, struct modnext_args *uap)
 
int sys_modfnext (struct thread *td, struct modfnext_args *uap)
 
int sys_modstat (struct thread *td, struct modstat_args *uap)
 
int sys_modfind (struct thread *td, struct modfind_args *uap)
 
 MODULE_VERSION (kernel, __BSDSUniX_version)
 

Macro Definition Documentation

#define MOD_EVENT (   mod,
  type 
)    (mod)->handler((mod), (type), (mod)->arg)

Definition at line 61 of file kern_module.c.

Referenced by module_quiesce(), module_register_init(), module_shutdown(), and module_unload().

Function Documentation

__FBSDID ( "$BSDSUniX$"  )
static MALLOC_DEFINE ( M_MODULE  ,
"module"  ,
"module data structures"   
)
static
linker_file_t module_file ( module_t  mod)

Definition at line 303 of file kern_module.c.

module_t module_getfnext ( module_t  mod)

Definition at line 279 of file kern_module.c.

Referenced by linker_file_unload().

Here is the caller graph for this function:

int module_getid ( module_t  mod)

Definition at line 271 of file kern_module.c.

Referenced by sys_kldfirstmod(), and sys_modfind().

Here is the caller graph for this function:

const char* module_getname ( module_t  mod)

Definition at line 287 of file kern_module.c.

Referenced by linker_file_unload().

Here is the caller graph for this function:

static void module_init ( void *  arg)
static

Definition at line 83 of file kern_module.c.

References module_shutdown().

Here is the call graph for this function:

module_t module_lookupbyid ( int  modid)

Definition at line 234 of file kern_module.c.

Referenced by sys_modfnext(), sys_modnext(), and sys_modstat().

Here is the caller graph for this function:

module_t module_lookupbyname ( const char *  name)

Definition at line 218 of file kern_module.c.

Referenced by module_register(), module_register_init(), and sys_modfind().

Here is the caller graph for this function:

int module_quiesce ( module_t  mod)

Definition at line 247 of file kern_module.c.

References Giant, and MOD_EVENT.

Referenced by linker_file_unload().

Here is the caller graph for this function:

void module_reference ( module_t  mod)

Definition at line 188 of file kern_module.c.

int module_register ( const moduledata_t *  data,
linker_file_t  container 
)

Definition at line 152 of file kern_module.c.

References malloc(), module_lookupbyname(), and printf().

Referenced by linker_file_register_modules().

Here is the call graph for this function:

Here is the caller graph for this function:

void module_register_init ( const void *  arg)

Definition at line 110 of file kern_module.c.

References Giant, MOD_EVENT, module_lookupbyname(), module_release(), panic(), and printf().

Here is the call graph for this function:

void module_release ( module_t  mod)

Definition at line 198 of file kern_module.c.

References free(), and panic().

Referenced by linker_file_unload(), and module_register_init().

Here is the call graph for this function:

Here is the caller graph for this function:

void module_setspecific ( module_t  mod,
modspecific_t *  datap 
)

Definition at line 295 of file kern_module.c.

Referenced by syscall_module_handler().

Here is the caller graph for this function:

static void module_shutdown ( void *  arg1,
int  arg2 
)
static

Definition at line 95 of file kern_module.c.

References Giant, and MOD_EVENT.

Referenced by module_init().

Here is the caller graph for this function:

int module_unload ( module_t  mod)

Definition at line 260 of file kern_module.c.

References Giant, and MOD_EVENT.

Referenced by linker_file_unload().

Here is the caller graph for this function:

MODULE_VERSION ( kernel  ,
__BSDSUniX_version   
)
int sys_modfind ( struct thread *  td,
struct modfind_args *  uap 
)

Definition at line 427 of file kern_module.c.

References module_getid(), module_lookupbyname(), and name.

Here is the call graph for this function:

int sys_modfnext ( struct thread *  td,
struct modfnext_args *  uap 
)

Definition at line 344 of file kern_module.c.

References module_lookupbyid().

Here is the call graph for this function:

int sys_modnext ( struct thread *  td,
struct modnext_args *  uap 
)

Definition at line 313 of file kern_module.c.

References module_lookupbyid().

Here is the call graph for this function:

int sys_modstat ( struct thread *  td,
struct modstat_args *  uap 
)

Definition at line 374 of file kern_module.c.

References module_lookupbyid(), and name.

Here is the call graph for this function:

SYSINIT ( module  ,
SI_SUB_KLD  ,
SI_ORDER_FIRST  ,
module_init  ,
 
)
static TAILQ_HEAD ( modulelist  ,
module   
)
static

Definition at line 63 of file kern_module.c.