Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 Mar 2006 15:37:26 GMT
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 93199 for review
Message-ID:  <200603121537.k2CFbQxk008111@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=93199

Change 93199 by rwatson@rwatson_zoo on 2006/03/12 15:36:37

	Change send_trigger() prototype to return an int, so that user
	space callers can tell if the message was successfully placed
	in the trigger queue.  This isn't quite the same as it being
	successfully received, but is close enough that we can generate
	a more useful warning message in audit(8).

Affected files ...

.. //depot/projects/trustedbsd/audit3/sys/security/audit/audit.c#17 edit
.. //depot/projects/trustedbsd/audit3/sys/security/audit/audit_private.h#20 edit
.. //depot/projects/trustedbsd/audit3/sys/security/audit/audit_syscalls.c#11 edit
.. //depot/projects/trustedbsd/audit3/sys/security/audit/audit_trigger.c#9 edit

Differences ...

==== //depot/projects/trustedbsd/audit3/sys/security/audit/audit.c#17 (text+ko) ====

@@ -307,7 +307,7 @@
 	 * then kindly suggest to the audit daemon to do something.
 	 */
 	if (mnt_stat->f_bfree < AUDIT_HARD_LIMIT_FREE_BLOCKS) {
-		send_trigger(AUDIT_TRIGGER_NO_SPACE);
+		(void)send_trigger(AUDIT_TRIGGER_NO_SPACE);
 		/* Hopefully userspace did something about all the previous
 		 * triggers that were sent prior to this critical condition.
 		 * If fail-stop is set, then we're done; goodnight Gracie.
@@ -330,7 +330,7 @@
 			temp = mnt_stat->f_blocks / (100 / 
 			    audit_qctrl.aq_minfree);
 			if (mnt_stat->f_bfree < temp)
-				send_trigger(AUDIT_TRIGGER_LOW_SPACE);
+				(void)send_trigger(AUDIT_TRIGGER_LOW_SPACE);
 		}
 
 	/* Check if the current log file is full; if so, call for
@@ -342,7 +342,7 @@
 	    (audit_file_rotate_wait == 0) && 
 	    (vattr.va_size >= audit_fstat.af_filesz)) {
 		audit_file_rotate_wait = 1;
-		send_trigger(AUDIT_TRIGGER_OPEN_NEW);
+		(void)send_trigger(AUDIT_TRIGGER_OPEN_NEW);
 	}
 
 	/*

==== //depot/projects/trustedbsd/audit3/sys/security/audit/audit_private.h#20 (text+ko) ====

@@ -295,7 +295,7 @@
  * asynchronously.
  */
 void		 audit_trigger_init(void);
-void		 send_trigger(unsigned int trigger);
+int		 send_trigger(unsigned int trigger);
 
 /*
  * General audit related functions.

==== //depot/projects/trustedbsd/audit3/sys/security/audit/audit_syscalls.c#11 (text+ko) ====

@@ -340,7 +340,7 @@
 		if ((udata.au_trigger < AUDIT_TRIGGER_MIN) ||
 		    (udata.au_trigger > AUDIT_TRIGGER_MAX))
 			return (EINVAL);
-		send_trigger(udata.au_trigger);
+		return (send_trigger(udata.au_trigger));
 		break;
 	}
 	/* Copy data back to userspace for the GET comands */

==== //depot/projects/trustedbsd/audit3/sys/security/audit/audit_trigger.c#9 (text+ko) ====

@@ -122,14 +122,14 @@
 	return (EOPNOTSUPP);
 }
 
-void
+int
 send_trigger(unsigned int trigger)
 {
 	struct trigger_info *ti;
 
 	/* If nobody's listening, we ain't talking. */
 	if (!audit_isopen)
-		return;
+		return (ENODEV);
 
 	/*
 	 * XXXAUDIT: Use a condition variable instead of msleep/wakeup?
@@ -140,6 +140,7 @@
 	TAILQ_INSERT_TAIL(&trigger_list, ti, list);
 	wakeup(&trigger_list);
 	mtx_unlock(&audit_trigger_mtx);
+	return (0);
 }
 
 static struct cdevsw audit_cdevsw = {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200603121537.k2CFbQxk008111>