diff options
author | Niels Provos <provos@cvs.openbsd.org> | 2002-01-07 00:11:08 +0000 |
---|---|---|
committer | Niels Provos <provos@cvs.openbsd.org> | 2002-01-07 00:11:08 +0000 |
commit | 6245ec50e539f62aaaa578d2909530770993059a (patch) | |
tree | ae109d773339f4f13524195924897898f6a06737 /regress/sys | |
parent | 35239b90faa34d70e55859d1a7ee5400e5973678 (diff) |
better.
Diffstat (limited to 'regress/sys')
-rw-r--r-- | regress/sys/kern/kqueue/kqueue-pipe.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/regress/sys/kern/kqueue/kqueue-pipe.c b/regress/sys/kern/kqueue/kqueue-pipe.c index d8e48e1f991..c81ce296275 100644 --- a/regress/sys/kern/kqueue/kqueue-pipe.c +++ b/regress/sys/kern/kqueue/kqueue-pipe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kqueue-pipe.c,v 1.1 2002/01/07 00:01:00 provos Exp $ */ +/* $OpenBSD: kqueue-pipe.c,v 1.2 2002/01/07 00:11:07 provos Exp $ */ /* * Copyright 2001 Niels Provos <provos@citi.umich.edu> * All rights reserved. @@ -50,10 +50,7 @@ main(int argc, char **argv) if (fcntl(fd[1], F_SETFL, O_NONBLOCK) == -1) exit(1); - while ((n = write(fd[1], buf, sizeof(buf))) == sizeof(buf)) - ; - - if ((kq = kqueue()) == -1) + if ((kq = kqueue()) == -1) exit(1); ev.ident = fd[1]; @@ -63,7 +60,16 @@ main(int argc, char **argv) if (n == -1) exit(1); - read(fd[0], buf, sizeof(buf)); + while ((n = write(fd[1], buf, sizeof(buf))) == sizeof(buf)) + ; + + ts.tv_sec = 0; + ts.tv_nsec = 0; + n = kevent(kq, NULL, 0, &ev, 1, &ts); + if (n != 0) + exit(1); + + read(fd[0], buf, sizeof(buf)); ts.tv_sec = 0; ts.tv_nsec = 0; |