Date: Wed, 8 May 2002 12:46:14 -0700 (PDT) From: "Andrew R. Reiter" <arr@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 11022 for review Message-ID: <200205081946.g48JkDo66670@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://people.freebsd.org/~peter/p4db/chv.cgi?CH=11022 Change 11022 by arr@arr_shibby on 2002/05/08 12:46:11 - Comment out nanotime call while the audit_time_t is an opaque pointer. - Remove kproc code - Add in some code that makes the audit write thread an ithd ... using this to play around witht he idea of running writes to the audit log by scheduling a software interrupt. Affected files ... ... //depot/projects/trustedbsd/audit/sys/kern/kern_audit.c#38 edit Differences ... ==== //depot/projects/trustedbsd/audit/sys/kern/kern_audit.c#38 (text+ko) ==== @@ -44,6 +44,8 @@ #include <sys/kthread.h> #include <sys/unistd.h> #include <sys/audit.h> +#include <sys/bus.h> +#include <sys/interrupt.h> #include <machine/atomic.h> @@ -62,6 +64,7 @@ static uma_zone_t record_zone; static int audit_shutdown_flag = 0; static int audit_id = 0; +void *audit_h; /* swi handler */ /* * Re-add this later when handling the decrease in the pool @@ -111,7 +114,7 @@ h->ah_len = AUDIT_RECORD_SZ + evsz; h->ah_type = type; h->ah_evresult = AUDIT_EVR_FAILED; - nanotime(&h->ah_evtime); + /* nanotime(&h->ah_evtime); */ return (rec); } @@ -126,17 +129,11 @@ panic("audit_init: unable to init audit record zone"); TAILQ_INIT(&record_queue); audit_shutdown_flag = 0; + + swi_add(NULL, "audit", audit_write_thread, NULL, SWI_TTY, 0, + &audit_h); } -SYSINIT(tbsd_audit, SI_SUB_MAC, SI_ORDER_ANY, &audit_init, NULL); - -static struct proc *auditproc; -static struct kproc_desc auditdesc = { - "audit", - audit_write_thread, - &auditproc -}; -SYSINIT(audit_thread, SI_SUB_KTHREAD_UPDATE, SI_ORDER_ANY, kproc_start, - &auditdesc); +SYSINIT(tbsd_audit, SI_SUB_KTHREAD_UPDATE, SI_ORDER_ANY, &audit_init, NULL); void audit_shutdown(void) @@ -149,23 +146,21 @@ SYSUNINIT(tbsd_audit, SI_SUB_MAC, SI_ORDER_ANY, &audit_shutdown, NULL); void -audit_write_thread(void) +audit_write_thread(void *arg) { audit_record_t *ar; - mtx_lock(&audit_q_mtx); for (;;) { - ar = NULL; - if (audit_shutdown_flag) - kthread_exit(0); + mtx_lock(&audit_q_mtx); if (!TAILQ_EMPTY(&record_queue)) { ar = TAILQ_FIRST(&record_queue); TAILQ_REMOVE(&record_queue, ar, ar_next); + mtx_unlock(&audit_q_mtx); + } else { + mtx_unlock(&audit_q_mtx); + break; } - if (ar != NULL) { - audit_print_record(ar); - uma_zfree(record_zone, ar); - } - msleep(&record_queue, &audit_q_mtx, PWAIT, "record queue", 0); + audit_print_record(ar); + uma_zfree(record_zone, ar); } } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200205081946.g48JkDo66670>