diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2014-10-28 05:48:23 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2014-10-28 05:48:23 +0000 |
commit | e7562e4204dbba1811ad22e7a920524f85b5ca21 (patch) | |
tree | ba9d35f9f4fdea8552457d4bf0db7d617e938be3 | |
parent | 549232e1e4fdb29e70ae82a2e5e29101d024a8b9 (diff) |
use nanosleep() instead of hackish select(); ok dlg
-rw-r--r-- | usr.sbin/iostat/iostat.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/usr.sbin/iostat/iostat.c b/usr.sbin/iostat/iostat.c index fefb7edf4b0..c6029095fd5 100644 --- a/usr.sbin/iostat/iostat.c +++ b/usr.sbin/iostat/iostat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: iostat.c,v 1.36 2014/10/26 20:37:15 brad Exp $ */ +/* $OpenBSD: iostat.c,v 1.37 2014/10/28 05:48:22 deraadt Exp $ */ /* $NetBSD: iostat.c,v 1.10 1996/10/25 18:21:58 scottr Exp $ */ /* @@ -115,7 +115,7 @@ main(int argc, char *argv[]) { const char *errstr; int ch, hdrcnt; - struct timeval tv; + struct timespec ts; while ((ch = getopt(argc, argv, "Cc:dDIM:N:Tw:")) != -1) switch(ch) { @@ -164,8 +164,8 @@ main(int argc, char *argv[]) dkreadstats(); selectdrives(argv); - tv.tv_sec = interval; - tv.tv_usec = 0; + ts.tv_sec = interval; + ts.tv_nsec = 0; /* print a new header on sigcont */ signal(SIGCONT, sigheader); @@ -183,7 +183,7 @@ main(int argc, char *argv[]) if (reps >= 0 && --reps <= 0) break; - select(0, NULL, NULL, NULL, &tv); + nanosleep(&ts, NULL); dkreadstats(); if (last.dk_ndrive != cur.dk_ndrive) wantheader = 1; |