PERFORCE change 85425 for review
Robert Watson
rwatson at FreeBSD.org
Mon Oct 17 11:36:15 GMT 2005
http://perforce.freebsd.org/chv.cgi?CH=85425
Change 85425 by rwatson at 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);
}
To Unsubscribe: send mail to majordomo at trustedbsd.org
with "unsubscribe trustedbsd-cvs" in the body of the message
More information about the trustedbsd-cvs
mailing list