PERFORCE change 93583 for review

Robert Watson rwatson at FreeBSD.org
Sun Mar 19 18:30:16 UTC 2006


http://perforce.freebsd.org/chv.cgi?CH=93583

Change 93583 by rwatson at rwatson_peppercorn on 2006/03/19 18:24:38

	Rename audit_cv to audit_worker_cv, as it wakes up the audit
	worker.
	
	Rename audit_commit_cv to audit_watermark_cv, since it is there to
	wake up threads waiting on hitting the low watermark.  Describe
	properly in comment.

Affected files ...

.. //depot/projects/trustedbsd/audit3/sys/security/audit/audit.c#24 edit
.. //depot/projects/trustedbsd/audit3/sys/security/audit/audit_private.h#24 edit
.. //depot/projects/trustedbsd/audit3/sys/security/audit/audit_worker.c#4 edit

Differences ...

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

@@ -136,16 +136,14 @@
  * either new records are in the queue, or a log replacement is taking
  * place.
  */
-struct cv		audit_cv;
+struct cv		audit_worker_cv;
 
 /*
- * Condition variable to signal to the worker that it has work to do:
- * either new records are in the queue, or a log replacement is taking
- * place.
- *
- * XXXRW: This description is incorrect.
+ * Condition variable to flag when crossing the low watermark, meaning that
+ * threads blocked due to hitting the high watermark can wake up and continue
+ * to commit records.
  */
-struct cv		audit_commit_cv;
+struct cv		audit_watermark_cv;
 
 /*
  * Condition variable for  auditing threads wait on when in fail-stop mode.
@@ -241,8 +239,8 @@
 	audit_qctrl.aq_minfree = AU_FS_MINFREE;
 
 	mtx_init(&audit_mtx, "audit_mtx", NULL, MTX_DEF);
-	cv_init(&audit_cv, "audit_cv");
-	cv_init(&audit_commit_cv, "audit_commit_cv");
+	cv_init(&audit_worker_cv, "audit_worker_cv");
+	cv_init(&audit_watermark_cv, "audit_watermark_cv");
 	cv_init(&audit_fail_cv, "audit_fail_cv");
 
 	audit_record_zone = uma_zcreate("audit_record_zone",
@@ -429,7 +427,7 @@
 	while (audit_q_len >= audit_qctrl.aq_hiwater) {
 		AUDIT_PRINTF(("audit_commit: sleeping to wait for "
 		   "audit queue to drain below high water mark\n"));
-		cv_wait(&audit_commit_cv, &audit_mtx);
+		cv_wait(&audit_watermark_cv, &audit_mtx);
 		AUDIT_PRINTF(("audit_commit: woke up waiting for "
 		   "audit queue draining\n"));
 	}
@@ -437,7 +435,7 @@
 	TAILQ_INSERT_TAIL(&audit_q, ar, k_q);
 	audit_q_len++;
 	audit_pre_q_len--;
-	cv_signal(&audit_cv);
+	cv_signal(&audit_worker_cv);
 	mtx_unlock(&audit_mtx);
 }
 

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

@@ -278,8 +278,8 @@
  * be abstracted so that only accessor methods are exposed.
  */
 extern struct mtx		audit_mtx;
-extern struct cv		audit_commit_cv;
-extern struct cv		audit_cv;
+extern struct cv		audit_watermark_cv;
+extern struct cv		audit_worker_cv;
 extern struct kaudit_queue	audit_q;
 extern int			audit_q_len;
 extern int			audit_pre_q_len;

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

@@ -420,7 +420,7 @@
 		 */
 		while (!audit_replacement_flag && TAILQ_EMPTY(&audit_q)) {
 			AUDIT_PRINTF(("audit_worker waiting\n"));
-			cv_wait(&audit_cv, &audit_mtx);
+			cv_wait(&audit_worker_cv, &audit_mtx);
 			AUDIT_PRINTF(("audit_worker woken up\n"));
 			AUDIT_PRINTF(("audit_worker: new vp = %p; value of "
 			    "flag %d\n", audit_replacement_vp,
@@ -460,7 +460,7 @@
 			TAILQ_INSERT_TAIL(&ar_worklist, ar, k_q);
 		}
 		if (lowater_signal)
-			cv_broadcast(&audit_commit_cv);
+			cv_broadcast(&audit_watermark_cv);
 
 		mtx_unlock(&audit_mtx);
 		while ((ar = TAILQ_FIRST(&ar_worklist))) {
@@ -525,7 +525,7 @@
 	 * Wake up the audit worker to perform the exchange once we
 	 * release the mutex.
 	 */
-	cv_signal(&audit_cv);
+	cv_signal(&audit_worker_cv);
 
 	/*
 	 * Wait for the audit_worker to broadcast that a replacement has


More information about the trustedbsd-cvs mailing list