Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/sys simplify the example; only register the set of ...
details: https://anonhg.NetBSD.org/src/rev/add40d2d7bd7
branches: trunk
changeset: 748466:add40d2d7bd7
user: christos <christos%NetBSD.org@localhost>
date: Sat Oct 24 17:49:58 2009 +0000
description:
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.
diffstat:
lib/libc/sys/kqueue.2 | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
diffs (52 lines):
diff -r c08af48bc147 -r add40d2d7bd7 lib/libc/sys/kqueue.2
--- a/lib/libc/sys/kqueue.2 Sat Oct 24 17:24:01 2009 +0000
+++ b/lib/libc/sys/kqueue.2 Sat Oct 24 17:49:58 2009 +0000
@@ -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) {
Home |
Main Index |
Thread Index |
Old Index