From owner-p4-projects@FreeBSD.ORG Mon Oct 17 11:36:17 2005 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 8CCCE16A421; Mon, 17 Oct 2005 11:36:16 +0000 (GMT) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 51D7016A41F for ; Mon, 17 Oct 2005 11:36:16 +0000 (GMT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0116D43D46 for ; Mon, 17 Oct 2005 11:36:16 +0000 (GMT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id j9HBaFTQ053796 for ; Mon, 17 Oct 2005 11:36:15 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id j9HBaFfX053793 for perforce@freebsd.org; Mon, 17 Oct 2005 11:36:15 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Mon, 17 Oct 2005 11:36:15 GMT Message-Id: <200510171136.j9HBaFfX053793@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson To: Perforce Change Reviews Cc: Subject: PERFORCE change 85425 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2005 11:36:17 -0000 http://perforce.freebsd.org/chv.cgi?CH=85425 Change 85425 by rwatson@rwatson_zoo on 2005/10/17 11:35:46 Return EBUSY instead of EOPNOTSUPP if a second reader tries to open /dev/audit at the same time as an existing one. This is more consistent with other device nodes. Minor style tweaks. Affected files ... .. //depot/projects/trustedbsd/audit3/sys/security/audit/audit_trigger.c#5 edit Differences ... ==== //depot/projects/trustedbsd/audit3/sys/security/audit/audit_trigger.c#5 (text+ko) ==== @@ -61,12 +61,8 @@ if (!audit_isopen) { error = 0; audit_isopen = 1; - } else { - /* - * XXXRW: Why not EBUSY? - */ - error = EOPNOTSUPP; - } + } else + error = EBUSY; mtx_unlock(&audit_trigger_mtx); return (error); @@ -77,7 +73,7 @@ { struct trigger_info *ti; - /* Drain the queue of pending trigger events */ + /* Flush the queue of pending trigger events. */ mtx_lock(&audit_trigger_mtx); audit_isopen = 0; while (!TAILQ_EMPTY(&trigger_list)) { @@ -86,6 +82,7 @@ free(ti, M_AUDIT); } mtx_unlock(&audit_trigger_mtx); + return (0); } @@ -97,8 +94,8 @@ mtx_lock(&audit_trigger_mtx); while (TAILQ_EMPTY(&trigger_list)) { - error = msleep(&trigger_list, &audit_trigger_mtx, PSOCK | PCATCH, - "auditd", 0); + error = msleep(&trigger_list, &audit_trigger_mtx, + PSOCK | PCATCH, "auditd", 0); if (error) break; } @@ -111,15 +108,15 @@ error = uiomove(ti, sizeof *ti, uio); free(ti, M_AUDIT); } - return error; + return (error); } static int audit_write(struct cdev *dev, struct uio *uio, int ioflag) { - /* Communication is kernel->userspace only */ - return EOPNOTSUPP; + /* Communication is kernel->userspace only. */ + return (EOPNOTSUPP); } void @@ -127,7 +124,7 @@ { struct trigger_info *ti; - /* If nobody's listening, we ain't talking */ + /* If nobody's listening, we ain't talking. */ if (!audit_isopen) return; @@ -140,7 +137,6 @@ TAILQ_INSERT_TAIL(&trigger_list, ti, list); wakeup(&trigger_list); mtx_unlock(&audit_trigger_mtx); - return; } static struct cdevsw audit_cdevsw = { @@ -164,7 +160,7 @@ audit_trigger_cdev_init(void *unused) { - /* Create the special device file */ + /* Create the special device file. */ audit_dev = make_dev(&audit_cdevsw, 0, UID_ROOT, GID_KMEM, 0600, AUDITDEV_FILENAME); }