From e7562e4204dbba1811ad22e7a920524f85b5ca21 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Tue, 28 Oct 2014 05:48:23 +0000 Subject: use nanosleep() instead of hackish select(); ok dlg --- usr.sbin/iostat/iostat.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'usr.sbin') 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; -- cgit v1.2.3