Module Name:    src
Committed By:   christos
Date:           Sat Oct 24 17:49:58 UTC 2009

Modified Files:
        src/lib/libc/sys: kqueue.2

Log Message:
simplify the example; only register the set of events to watch once since
it does not change. Also print that ATTR means changing times too.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/lib/libc/sys/kqueue.2

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/sys/kqueue.2
diff -u src/lib/libc/sys/kqueue.2:1.24 src/lib/libc/sys/kqueue.2:1.25
--- src/lib/libc/sys/kqueue.2:1.24	Tue Sep  1 18:12:05 2009
+++ src/lib/libc/sys/kqueue.2	Sat Oct 24 13:49:58 2009
@@ -1,4 +1,4 @@
-.\"	$NetBSD: kqueue.2,v 1.24 2009/09/01 22:12:05 wiz Exp $
+.\"	$NetBSD: kqueue.2,v 1.25 2009/10/24 17:49:58 christos Exp $
 .\"
 .\" Copyright (c) 2000 Jonathan Lemon
 .\" All rights reserved.
@@ -32,7 +32,7 @@
 .\"
 .\" $FreeBSD: src/lib/libc/sys/kqueue.2,v 1.22 2001/06/27 19:55:57 dd Exp $
 .\"
-.Dd September 1, 2009
+.Dd October 24, 2009
 .Dt KQUEUE 2
 .Os
 .Sh NAME
@@ -496,7 +496,7 @@
 main(int argc, char *argv[])
 {
         int fd, kq, nev;
-        struct kevent ev, ch;
+        struct kevent ev;
         static const struct timespec tout = { 1, 0 };
 
         if ((fd = open(argv[1], O_RDONLY)) == -1)
@@ -505,11 +505,13 @@
         if ((kq = kqueue()) == -1)
                 err(1, "Cannot create kqueue");
 
-        EV_SET(\*[Am]ch, fd, EVFILT_VNODE, EV_ADD | EV_ENABLE | EV_CLEAR,
+        EV_SET(\*[Am]ev, fd, EVFILT_VNODE, EV_ADD | EV_ENABLE | EV_CLEAR,
             NOTE_DELETE|NOTE_WRITE|NOTE_EXTEND|NOTE_ATTRIB|NOTE_LINK|
             NOTE_RENAME|NOTE_REVOKE, 0, 0);
+	if (kevent(kq, \*[Am]ch, 1, NULL, 0, \*[Am]tout) == -1)
+		err(1, "kevent");
         for (;;) {
-                nev = kevent(kq, \*[Am]ch, 1, \*[Am]ev, 1, \*[Am]tout);
+                nev = kevent(kq, NULL, 0, \*[Am]ev, 1, \*[Am]tout);
                 if (nev == -1)
                         err(1, "kevent");
                 if (nev == 0)
@@ -527,7 +529,7 @@
                         ev.fflags \*[Am]= ~NOTE_EXTEND;
                 }
                 if (ev.fflags \*[Am] NOTE_ATTRIB) {
-                        printf("chmod/chown ");
+                        printf("chmod/chown/utimes ");
                         ev.fflags \*[Am]= ~NOTE_ATTRIB;
                 }
                 if (ev.fflags \*[Am] NOTE_LINK) {

Reply via email to