* 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. */
| 332 | * call into the BSM assembly code to initialize it. |
| 333 | */ |
| 334 | static void |
| 335 | audit_init(void) |
| 336 | { |
| 337 | |
| 338 | audit_trail_enabled = 0; |
| 339 | audit_trail_suspended = 0; |
| 340 | audit_syscalls_enabled = false; |
| 341 | audit_panic_on_write_fail = 0; |
| 342 | audit_fail_stop = 0; |
| 343 | audit_in_failure = 0; |
| 344 | audit_argv = 0; |
| 345 | audit_arge = 0; |
| 346 | |
| 347 | audit_fstat.af_filesz = 0; /* '0' means unset, unbounded. */ |
| 348 | audit_fstat.af_currsz = 0; |
| 349 | audit_nae_mask.am_success = 0; |
| 350 | audit_nae_mask.am_failure = 0; |
| 351 | |
| 352 | TAILQ_INIT(&audit_q); |
| 353 | audit_q_len = 0; |
| 354 | audit_pre_q_len = 0; |
| 355 | audit_qctrl.aq_hiwater = AQ_HIWATER; |
| 356 | audit_qctrl.aq_lowater = AQ_LOWATER; |
| 357 | audit_qctrl.aq_bufsz = AQ_BUFSZ; |
| 358 | audit_qctrl.aq_minfree = AU_FS_MINFREE; |
| 359 | |
| 360 | audit_kinfo.ai_termid.at_type = AU_IPv4; |
| 361 | audit_kinfo.ai_termid.at_addr[0] = INADDR_ANY; |
| 362 | |
| 363 | mtx_init(&audit_mtx, "audit_mtx", NULL, MTX_DEF); |
| 364 | KINFO_LOCK_INIT(); |
| 365 | cv_init(&audit_worker_cv, "audit_worker_cv"); |
| 366 | cv_init(&audit_watermark_cv, "audit_watermark_cv"); |
| 367 | cv_init(&audit_fail_cv, "audit_fail_cv"); |
| 368 | |
| 369 | audit_record_zone = uma_zcreate("audit_record", |
| 370 | sizeof(struct kaudit_record), audit_record_ctor, |
| 371 | audit_record_dtor, NULL, NULL, UMA_ALIGN_PTR, 0); |
| 372 | |
| 373 | /* First initialisation of audit_syscalls_enabled. */ |
| 374 | audit_syscalls_enabled_update(); |
| 375 | |
| 376 | /* Initialize the BSM audit subsystem. */ |
| 377 | kau_init(); |
| 378 | |
| 379 | audit_trigger_init(); |
| 380 | |
| 381 | /* Register shutdown handler. */ |
| 382 | EVENTHANDLER_REGISTER(shutdown_pre_sync, audit_shutdown, NULL, |
| 383 | SHUTDOWN_PRI_FIRST); |
| 384 | |
| 385 | /* Start audit worker thread. */ |
| 386 | audit_worker_init(); |
| 387 | } |
| 388 | |
| 389 | SYSINIT(audit_init, SI_SUB_AUDIT, SI_ORDER_FIRST, audit_init, NULL); |
| 390 |
nothing calls this directly
no test coverage detected