From owner-p4-projects Tue May 7 16: 1:48 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 1737137B403; Tue, 7 May 2002 16:01:38 -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 999C037B407 for ; Tue, 7 May 2002 16:01:37 -0700 (PDT) Received: (from perforce@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g47N1bI64458 for perforce@freebsd.org; Tue, 7 May 2002 16:01:37 -0700 (PDT) (envelope-from arr@freebsd.org) Date: Tue, 7 May 2002 16:01:37 -0700 (PDT) Message-Id: <200205072301.g47N1bI64458@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 10980 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=10980 Change 10980 by arr@arr_shibby on 2002/05/07 16:01:29 - Include atomic.h - Add a KASSERT() in audit_record_init - Use an atomic operation to increment the audit record id global variable. - Remove some remnants related to the _audit_print_record() move. Affected files ... ... //depot/projects/trustedbsd/audit/sys/kern/kern_audit.c#36 edit Differences ... ==== //depot/projects/trustedbsd/audit/sys/kern/kern_audit.c#36 (text+ko) ==== @@ -45,6 +45,8 @@ #include #include +#include + #include #include "opt_audit.h" @@ -61,8 +63,6 @@ static int audit_shutdown_flag = 0; static int audit_id = 0; -static __inline void _audit_print_record(audit_record_t *); - #ifdef AUDIT_DEBUG #define audit_print_record(ar) _audit_print_record((ar)) #else @@ -91,14 +91,15 @@ */ rec = uma_zalloc(record_zone, M_NOWAIT|M_ZERO); + KASSERT(rec != NULL, ("audit_record_init")); h = &rec->ar_hdr; h->ah_v = AUDIT_VERSION; - h->ah_id = audit_id++; + atomic_add_int(&audit_id, 1); + h->ah_id = audit_id; h->ah_len = AUDIT_RECORD_SZ + evsz; h->ah_type = type; h->ah_evresult = AUDIT_EVR_FAILED; nanotime(&h->ah_evtime); - return (rec); } @@ -135,21 +136,6 @@ }; SYSUNINIT(tbsd_audit, SI_SUB_MAC, SI_ORDER_ANY, &audit_shutdown, NULL); -static __inline -void -_audit_print_record(audit_record_t *ar) -{ - audit_header_t *ah; - audit_subject_t *as; - audit_object_t *ao; - - ah = &ar->ar_hdr; - as = &ar->ar_subj; - ao = &ar->ar_obj; - - printf("AUDIT RECORD! TYPE: %d\n", ah->ah_type); -} - void audit_write_thread(void) { To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message