Date: Tue, 7 May 2002 16:01:37 -0700 (PDT) From: "Andrew R. Reiter" <arr@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 10980 for review Message-ID: <200205072301.g47N1bI64458@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 <sys/unistd.h> #include <sys/audit.h> +#include <machine/atomic.h> + #include <vm/uma.h> #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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200205072301.g47N1bI64458>