From owner-p4-projects Wed May 8 12:46:22 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id D05C337B400; Wed, 8 May 2002 12:46:14 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 1670537B404 for ; Wed, 8 May 2002 12:46:14 -0700 (PDT) Received: (from perforce@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g48JkDo66670 for perforce@freebsd.org; Wed, 8 May 2002 12:46:14 -0700 (PDT) (envelope-from arr@freebsd.org) Date: Wed, 8 May 2002 12:46:14 -0700 (PDT) Message-Id: <200205081946.g48JkDo66670@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: perforce set sender to arr@freebsd.org using -f From: "Andrew R. Reiter" Subject: PERFORCE change 11022 for review To: Perforce Change Reviews Sender: owner-p4-projects@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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 #include #include +#include +#include #include @@ -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