| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | .\" $NetBSD: kqueue.2,v 1.29 2010/04/13 10:45:46 wiz Exp $ | | 1 | .\" $NetBSD: kqueue.2,v 1.30 2011/05/24 02:31:11 ryo Exp $ |
2 | .\" | | 2 | .\" |
3 | .\" Copyright (c) 2000 Jonathan Lemon | | 3 | .\" Copyright (c) 2000 Jonathan Lemon |
4 | .\" All rights reserved. | | 4 | .\" All rights reserved. |
5 | .\" | | 5 | .\" |
6 | .\" Copyright (c) 2001, 2002, 2003 The NetBSD Foundation, Inc. | | 6 | .\" Copyright (c) 2001, 2002, 2003 The NetBSD Foundation, Inc. |
7 | .\" All rights reserved. | | 7 | .\" All rights reserved. |
8 | .\" | | 8 | .\" |
9 | .\" Portions of this documentation is derived from text contributed by | | 9 | .\" Portions of this documentation is derived from text contributed by |
10 | .\" Luke Mewburn. | | 10 | .\" Luke Mewburn. |
11 | .\" | | 11 | .\" |
12 | .\" Redistribution and use in source and binary forms, with or without | | 12 | .\" Redistribution and use in source and binary forms, with or without |
13 | .\" modification, are permitted provided that the following conditions | | 13 | .\" modification, are permitted provided that the following conditions |
14 | .\" are met: | | 14 | .\" are met: |
| @@ -498,28 +498,28 @@ main(int argc, char *argv[]) | | | @@ -498,28 +498,28 @@ main(int argc, char *argv[]) |
498 | int fd, kq, nev; | | 498 | int fd, kq, nev; |
499 | struct kevent ev; | | 499 | struct kevent ev; |
500 | static const struct timespec tout = { 1, 0 }; | | 500 | static const struct timespec tout = { 1, 0 }; |
501 | | | 501 | |
502 | if ((fd = open(argv[1], O_RDONLY)) == -1) | | 502 | if ((fd = open(argv[1], O_RDONLY)) == -1) |
503 | err(1, "Cannot open `%s'", argv[1]); | | 503 | err(1, "Cannot open `%s'", argv[1]); |
504 | | | 504 | |
505 | if ((kq = kqueue()) == -1) | | 505 | if ((kq = kqueue()) == -1) |
506 | err(1, "Cannot create kqueue"); | | 506 | err(1, "Cannot create kqueue"); |
507 | | | 507 | |
508 | EV_SET(\*[Am]ev, fd, EVFILT_VNODE, EV_ADD | EV_ENABLE | EV_CLEAR, | | 508 | EV_SET(\*[Am]ev, fd, EVFILT_VNODE, EV_ADD | EV_ENABLE | EV_CLEAR, |
509 | NOTE_DELETE|NOTE_WRITE|NOTE_EXTEND|NOTE_ATTRIB|NOTE_LINK| | | 509 | NOTE_DELETE|NOTE_WRITE|NOTE_EXTEND|NOTE_ATTRIB|NOTE_LINK| |
510 | NOTE_RENAME|NOTE_REVOKE, 0, 0); | | 510 | NOTE_RENAME|NOTE_REVOKE, 0, 0); |
511 | if (kevent(kq, \*[Am]ch, 1, NULL, 0, \*[Am]tout) == -1) | | 511 | if (kevent(kq, \*[Am]ev, 1, NULL, 0, \*[Am]tout) == -1) |
512 | err(1, "kevent"); | | 512 | err(1, "kevent"); |
513 | for (;;) { | | 513 | for (;;) { |
514 | nev = kevent(kq, NULL, 0, \*[Am]ev, 1, \*[Am]tout); | | 514 | nev = kevent(kq, NULL, 0, \*[Am]ev, 1, \*[Am]tout); |
515 | if (nev == -1) | | 515 | if (nev == -1) |
516 | err(1, "kevent"); | | 516 | err(1, "kevent"); |
517 | if (nev == 0) | | 517 | if (nev == 0) |
518 | continue; | | 518 | continue; |
519 | if (ev.fflags \*[Am] NOTE_DELETE) { | | 519 | if (ev.fflags \*[Am] NOTE_DELETE) { |
520 | printf("deleted "); | | 520 | printf("deleted "); |
521 | ev.fflags \*[Am]= ~NOTE_DELETE; | | 521 | ev.fflags \*[Am]= ~NOTE_DELETE; |
522 | } | | 522 | } |
523 | if (ev.fflags \*[Am] NOTE_WRITE) { | | 523 | if (ev.fflags \*[Am] NOTE_WRITE) { |
524 | printf("written "); | | 524 | printf("written "); |
525 | ev.fflags \*[Am]= ~NOTE_WRITE; | | 525 | ev.fflags \*[Am]= ~NOTE_WRITE; |