audit_worker.c (156889) | audit_worker.c (159261) |
---|---|
1/* 2 * Copyright (c) 1999-2005 Apple Computer, Inc. 3 * Copyright (c) 2006 Robert N. M. Watson 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 13 unchanged lines hidden (view full) --- 22 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 26 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 27 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * POSSIBILITY OF SUCH DAMAGE. 29 * | 1/* 2 * Copyright (c) 1999-2005 Apple Computer, Inc. 3 * Copyright (c) 2006 Robert N. M. Watson 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 13 unchanged lines hidden (view full) --- 22 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 26 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 27 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * POSSIBILITY OF SUCH DAMAGE. 29 * |
30 * $FreeBSD: head/sys/security/audit/audit_worker.c 156889 2006-03-19 17:34:00Z rwatson $ | 30 * $FreeBSD: head/sys/security/audit/audit_worker.c 159261 2006-06-05 13:43:57Z rwatson $ |
31 */ 32 33#include <sys/param.h> 34#include <sys/condvar.h> 35#include <sys/conf.h> 36#include <sys/file.h> 37#include <sys/filedesc.h> 38#include <sys/fcntl.h> --- 376 unchanged lines hidden (view full) --- 415 while (1) { 416 mtx_assert(&audit_mtx, MA_OWNED); 417 418 /* 419 * Wait for record or rotation events. 420 */ 421 while (!audit_replacement_flag && TAILQ_EMPTY(&audit_q)) { 422 AUDIT_PRINTF(("audit_worker waiting\n")); | 31 */ 32 33#include <sys/param.h> 34#include <sys/condvar.h> 35#include <sys/conf.h> 36#include <sys/file.h> 37#include <sys/filedesc.h> 38#include <sys/fcntl.h> --- 376 unchanged lines hidden (view full) --- 415 while (1) { 416 mtx_assert(&audit_mtx, MA_OWNED); 417 418 /* 419 * Wait for record or rotation events. 420 */ 421 while (!audit_replacement_flag && TAILQ_EMPTY(&audit_q)) { 422 AUDIT_PRINTF(("audit_worker waiting\n")); |
423 cv_wait(&audit_cv, &audit_mtx); | 423 cv_wait(&audit_worker_cv, &audit_mtx); |
424 AUDIT_PRINTF(("audit_worker woken up\n")); 425 AUDIT_PRINTF(("audit_worker: new vp = %p; value of " 426 "flag %d\n", audit_replacement_vp, 427 audit_replacement_flag)); 428 } 429 430 /* 431 * First priority: replace the audit log target if requested. --- 23 unchanged lines hidden (view full) --- 455 while ((ar = TAILQ_FIRST(&audit_q))) { 456 TAILQ_REMOVE(&audit_q, ar, k_q); 457 audit_q_len--; 458 if (audit_q_len == audit_qctrl.aq_lowater) 459 lowater_signal++; 460 TAILQ_INSERT_TAIL(&ar_worklist, ar, k_q); 461 } 462 if (lowater_signal) | 424 AUDIT_PRINTF(("audit_worker woken up\n")); 425 AUDIT_PRINTF(("audit_worker: new vp = %p; value of " 426 "flag %d\n", audit_replacement_vp, 427 audit_replacement_flag)); 428 } 429 430 /* 431 * First priority: replace the audit log target if requested. --- 23 unchanged lines hidden (view full) --- 455 while ((ar = TAILQ_FIRST(&audit_q))) { 456 TAILQ_REMOVE(&audit_q, ar, k_q); 457 audit_q_len--; 458 if (audit_q_len == audit_qctrl.aq_lowater) 459 lowater_signal++; 460 TAILQ_INSERT_TAIL(&ar_worklist, ar, k_q); 461 } 462 if (lowater_signal) |
463 cv_broadcast(&audit_commit_cv); | 463 cv_broadcast(&audit_watermark_cv); |
464 465 mtx_unlock(&audit_mtx); 466 while ((ar = TAILQ_FIRST(&ar_worklist))) { 467 TAILQ_REMOVE(&ar_worklist, ar, k_q); 468 if (audit_vp != NULL) { 469 error = audit_record_write(audit_vp, ar, 470 audit_cred, audit_td); 471 if (error && audit_panic_on_write_fail) --- 48 unchanged lines hidden (view full) --- 520 audit_replacement_cred = cred; 521 audit_replacement_flag = 1; 522 audit_replacement_vp = vp; 523 524 /* 525 * Wake up the audit worker to perform the exchange once we 526 * release the mutex. 527 */ | 464 465 mtx_unlock(&audit_mtx); 466 while ((ar = TAILQ_FIRST(&ar_worklist))) { 467 TAILQ_REMOVE(&ar_worklist, ar, k_q); 468 if (audit_vp != NULL) { 469 error = audit_record_write(audit_vp, ar, 470 audit_cred, audit_td); 471 if (error && audit_panic_on_write_fail) --- 48 unchanged lines hidden (view full) --- 520 audit_replacement_cred = cred; 521 audit_replacement_flag = 1; 522 audit_replacement_vp = vp; 523 524 /* 525 * Wake up the audit worker to perform the exchange once we 526 * release the mutex. 527 */ |
528 cv_signal(&audit_cv); | 528 cv_signal(&audit_worker_cv); |
529 530 /* 531 * Wait for the audit_worker to broadcast that a replacement has 532 * taken place; we know that once this has happened, our vnode 533 * has been replaced in, so we can return successfully. 534 */ 535 AUDIT_PRINTF(("audit_rotate_vnode: waiting for news of " 536 "replacement\n")); --- 19 unchanged lines hidden --- | 529 530 /* 531 * Wait for the audit_worker to broadcast that a replacement has 532 * taken place; we know that once this has happened, our vnode 533 * has been replaced in, so we can return successfully. 534 */ 535 AUDIT_PRINTF(("audit_rotate_vnode: waiting for news of " 536 "replacement\n")); --- 19 unchanged lines hidden --- |