FreeBSD kernel kern code
kern_module.c File Reference
#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
 
struct  module_stat_v2
 

Macros

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

Functions

 __FBSDID ("$FreeBSD$")
 
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, NULL)
 
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, __FreeBSD_version)
 

Macro Definition Documentation

◆ MOD_EVENT

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

Definition at line 61 of file kern_module.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ MALLOC_DEFINE()

static MALLOC_DEFINE ( M_MODULE  ,
"module"  ,
"module data structures"   
)
static

◆ module_file()

linker_file_t module_file ( module_t  mod)

Definition at line 299 of file kern_module.c.

◆ module_getfnext()

module_t module_getfnext ( module_t  mod)

Definition at line 275 of file kern_module.c.

Referenced by linker_file_unload().

Here is the caller graph for this function:

◆ module_getid()

int module_getid ( module_t  mod)

Definition at line 267 of file kern_module.c.

Referenced by sys_kldfirstmod(), and sys_modfind().

Here is the caller graph for this function:

◆ module_getname()

const char * module_getname ( module_t  mod)

Definition at line 283 of file kern_module.c.

Referenced by linker_file_unload().

Here is the caller graph for this function:

◆ module_init()

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_lookupbyid()

module_t module_lookupbyid ( int  modid)

Definition at line 230 of file kern_module.c.

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

Here is the caller graph for this function:

◆ module_lookupbyname()

module_t module_lookupbyname ( const char *  name)

Definition at line 214 of file kern_module.c.

References name.

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

Here is the caller graph for this function:

◆ module_quiesce()

int module_quiesce ( module_t  mod)

Definition at line 243 of file kern_module.c.

References Giant, and MOD_EVENT.

Referenced by linker_file_unload().

Here is the caller graph for this function:

◆ module_reference()

void module_reference ( module_t  mod)

Definition at line 184 of file kern_module.c.

◆ module_register()

int module_register ( const moduledata_t *  data,
linker_file_t  container 
)

Definition at line 152 of file kern_module.c.

References data, 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:

◆ module_register_init()

void module_register_init ( const void *  arg)

Definition at line 110 of file kern_module.c.

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

Here is the call graph for this function:

◆ module_release()

void module_release ( module_t  mod)

Definition at line 194 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:

◆ module_setspecific()

void module_setspecific ( module_t  mod,
modspecific_t *  datap 
)

Definition at line 291 of file kern_module.c.

Referenced by kern_syscall_module_handler().

Here is the caller graph for this function:

◆ module_shutdown()

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:

◆ module_unload()

int module_unload ( module_t  mod)

Definition at line 256 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()

MODULE_VERSION ( kernel  ,
__FreeBSD_version   
)

◆ sys_modfind()

int sys_modfind ( struct thread *  td,
struct modfind_args *  uap 
)

Definition at line 450 of file kern_module.c.

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

Here is the call graph for this function:

◆ sys_modfnext()

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

Definition at line 340 of file kern_module.c.

References module_lookupbyid().

Here is the call graph for this function:

◆ sys_modnext()

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

Definition at line 309 of file kern_module.c.

References module_lookupbyid().

Here is the call graph for this function:

◆ sys_modstat()

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

Definition at line 378 of file kern_module.c.

References module_stat_v2::data, data, module_stat_v2::id, module_lookupbyid(), name, module_stat_v2::refs, module_stat_v1::version, and module_stat_v2::version.

Here is the call graph for this function:

◆ SYSINIT()

SYSINIT ( module  ,
SI_SUB_KLD  ,
SI_ORDER_FIRST  ,
module_init  ,
NULL   
)

◆ TAILQ_HEAD()

static TAILQ_HEAD ( modulelist  ,
module   
)
static

Definition at line 63 of file kern_module.c.