FreeBSD/sys/security/audit/audit.c
/*
 * Initialize the Audit subsystem: configuration state, work queue,
 * synchronization primitives, worker thread, and trigger device node.  Also
 * call into the BSM assembly code to initialize it.
 */
Initialize the Audit subsystem: configuration state, work queue,
synchronization primitives, worker thread, and trigger device node.  Also
call into the BSM assembly code to initialize it.
Initialize the Audit subsystem : configuration state work queue synchronization primitives worker thread and trigger device node . Also call into the BSM assembly code to initialize it .
static void
audit_init(void)
{
	audit_enabled = 0;
	audit_suspended = 0;
	audit_panic_on_write_fail = 0;
	audit_fail_stop = 0;
	audit_in_failure = 0;
	audit_argv = 0;
	audit_arge = 0;
	audit_fstat.af_filesz = 0;	
	audit_fstat.af_currsz = 0;
	audit_nae_mask.am_success = 0;
	audit_nae_mask.am_failure = 0;
	TAILQ_INIT(&audit_q);
	audit_q_len = 0;
	audit_pre_q_len = 0;
	audit_qctrl.aq_hiwater = AQ_HIWATER;
	audit_qctrl.aq_lowater = AQ_LOWATER;
	audit_qctrl.aq_bufsz = AQ_BUFSZ;
	audit_qctrl.aq_minfree = AU_FS_MINFREE;
	audit_kinfo.ai_termid.at_type = AU_IPv4;
	audit_kinfo.ai_termid.at_addr[0] = INADDR_ANY;
	mtx_init(&audit_mtx, "audit_mtx", NULL, MTX_DEF);
	KINFO_LOCK_INIT();
	cv_init(&audit_worker_cv, "audit_worker_cv");
	cv_init(&audit_watermark_cv, "audit_watermark_cv");
	cv_init(&audit_fail_cv, "audit_fail_cv");
	audit_record_zone = uma_zcreate("audit_record",
	    sizeof(struct kaudit_record), audit_record_ctor,
	    audit_record_dtor, NULL, NULL, UMA_ALIGN_PTR, 0);
	kau_init();
	audit_trigger_init();
	EVENTHANDLER_REGISTER(shutdown_pre_sync, audit_shutdown, NULL,
	    SHUTDOWN_PRI_FIRST);
	audit_worker_init();
}
static void audit_init ( void ) { audit_enabled = 0 ; audit_suspended = 0 ; audit_panic_on_write_fail = 0 ; audit_fail_stop = 0 ; audit_in_failure = 0 ; audit_argv = 0 ; audit_arge = 0 ; audit_fstat . af_filesz = 0 ; audit_fstat . af_currsz = 0 ; audit_nae_mask . am_success = 0 ; audit_nae_mask . am_failure = 0 ; TAILQ_INIT ( & audit_q ) ; audit_q_len = 0 ; audit_pre_q_len = 0 ; audit_qctrl . aq_hiwater = AQ_HIWATER ; audit_qctrl . aq_lowater = AQ_LOWATER ; audit_qctrl . aq_bufsz = AQ_BUFSZ ; audit_qctrl . aq_minfree = AU_FS_MINFREE ; audit_kinfo . ai_termid . at_type = AU_IPv4 ; audit_kinfo . ai_termid . at_addr [ 0 ] = INADDR_ANY ; mtx_init ( & audit_mtx , " " , NULL , MTX_DEF ) ; KINFO_LOCK_INIT ( ) ; cv_init ( & audit_worker_cv , " " ) ; cv_init ( & audit_watermark_cv , " " ) ; cv_init ( & audit_fail_cv , " " ) ; audit_record_zone = uma_zcreate ( " " , sizeof ( struct kaudit_record ) , audit_record_ctor , audit_record_dtor , NULL , NULL , UMA_ALIGN_PTR , 0 ) ; kau_init ( ) ; audit_trigger_init ( ) ; EVENTHANDLER_REGISTER ( shutdown_pre_sync , audit_shutdown , NULL , SHUTDOWN_PRI_FIRST ) ; audit_worker_init ( ) ; }
Initialize the Audit subsystem: configuration state, work queue,
 synchronization primitives, worker thread, and trigger device node.
Initialize the Audit subsystem : configuration state work queue synchronization primitives worker thread and trigger device node .
/* '0' means unset, unbounded. */ /* Initialize the BSM audit subsystem. */ /* Register shutdown handler. */ /* Start audit worker thread. */