From owner-p4-projects Wed May 1 9:57:35 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 8A75437B419; Wed, 1 May 2002 09:57:23 -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 B629F37B417 for ; Wed, 1 May 2002 09:57:22 -0700 (PDT) Received: (from perforce@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g41GvMx23613 for perforce@freebsd.org; Wed, 1 May 2002 09:57:22 -0700 (PDT) (envelope-from arr@freebsd.org) Date: Wed, 1 May 2002 09:57:22 -0700 (PDT) Message-Id: <200205011657.g41GvMx23613@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 10584 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=10584 Change 10584 by arr@arr_shibby on 2002/05/01 09:56:35 - Clean up some comments to make clear their purpose. - Move ar_next to top of audit_record data structure. - Make the enqueue function (commented out currently) into an inline. - General cleanup. Affected files ... ... //depot/projects/trustedbsd/audit/sys/kern/kern_audit.c#26 edit ... //depot/projects/trustedbsd/audit/sys/sys/audit.h#16 edit Differences ... ==== //depot/projects/trustedbsd/audit/sys/kern/kern_audit.c#26 (text+ko) ==== @@ -47,15 +47,17 @@ #include -#define AUDLOG "/var/log/audit" - static struct mtx audit_mtx; static struct audit_record_list record_queue; static uma_zone_t record_zone; static int audit_shutdown_flag = 0; static int audit_id = 0; -/* readd this later. - static size_t pool_size = 32; + +/* + * Re-add this later when handling the decrease in the pool + * size can be properly handled. + * + * static size_t pool_size = 32; */ audit_record_t * @@ -69,6 +71,15 @@ z = record_zone; mtx_unlock(&audit_mtx); + /* + * XXX: + * Think about changing over to where we do not have to pass + * in a size value, but rather, we can use the ``int type'' + * value to lookup in a table (or something). + * + * evsz = ev_size_tab[type]; + */ + rec = uma_zalloc(z, M_ZERO); h = &rec->ar_hdr; h->ah_v = AUDIT_VERSION; @@ -116,8 +127,9 @@ } SYSUNINIT(tbsd_audit, SI_ORDER_ANY, SI_SUB_MAC, &audit_shutdown, NULL); -/* -static void +/* +static __inline +void audit_record_enqueue(audit_record_t *ar) { @@ -147,10 +159,13 @@ ar = NULL; TAILQ_REMOVE(&record_queue, ar, ar_next); - /* Check flag here and hope it doesnt change. */ + /* + * If we don't exit, we might try to zfree + * an object that no longer has a zone.. Oof. + */ if (audit_shutdown_flag) kthread_exit(0); - + if (ar) { z = record_zone; uma_zfree(z, ar); ==== //depot/projects/trustedbsd/audit/sys/sys/audit.h#16 (text+ko) ==== @@ -92,18 +92,16 @@ } audit_object_t; #define AUDIT_OBJ_LEN sizeof(audit_object_t) -struct aud_sysctl_enable { - int as_ret; /* return value */ - int as_val; /* new value */ -}; typedef struct audit_record { + TAILQ_ENTRY(audit_record) ar_next; struct audit_header ar_hdr; struct audit_subject ar_subj; struct audit_object ar_obj; + union audit_evinfo { - struct aud_sysctl_enable sysctlenable; + struct chmod_info av_chmod; } ar_evinfo; - TAILQ_ENTRY(audit_record) ar_next; + } audit_record_t; TAILQ_HEAD(audit_record_list, audit_record); @@ -111,7 +109,7 @@ #define AUD_CHMOD 1 #define AUD_CHOWN 2 -#define AUD_DUP 3 +#define AUD_DUP 3 #define AUD_EXEC 4 #define AUD_EXIT 5 #define AUD_FORK 6 @@ -127,8 +125,6 @@ #define AUD_SETGID 16 #define AUD_UNLINK 17 #define AUD_UTIME 18 -#define AUD_SYSCTL_ENABLE 200 - struct chmod_info { char ci_path[MAXPATHLEN]; To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message