POSIX.1-2001 declares usleep is obsolete. Reference: http://pubs.opengroup.org/onlinepubs/009695399/functions/usleep.html Signed-off-by: Sami Kerola <kerolasa@xxxxxx> --- libmount/src/lock.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/libmount/src/lock.c b/libmount/src/lock.c index b149b6f..5245720 100644 --- a/libmount/src/lock.c +++ b/libmount/src/lock.c @@ -597,7 +597,6 @@ void __attribute__((__noreturn__)) sig_handler(int sig) int test_lock(struct libmnt_test *ts, int argc, char *argv[]) { time_t synctime = 0; - unsigned int usecs; struct timeval tv; const char *datafile = NULL; int verbose = 0, loops = 0, l, idx = 1; @@ -645,9 +644,10 @@ int test_lock(struct libmnt_test *ts, int argc, char *argv[]) if (synctime) { gettimeofday(&tv, NULL); if (synctime && synctime - tv.tv_sec > 1) { - usecs = ((synctime - tv.tv_sec) * 1000000UL) - - (1000000UL - tv.tv_usec); - usleep(usecs); + struct timespec waittime; + waittime.tv_sec = synctime - tv.tv_sec; + waittime.tv_nsec = 1000000000L - (1000 * tv.tv_usec); + nanosleep(&waittime, NULL); } } @@ -672,8 +672,12 @@ int test_lock(struct libmnt_test *ts, int argc, char *argv[]) * simulate this via short sleep -- it's also enough to make * concurrent processes happy. */ - if (synctime) - usleep(25000); + if (synctime) { + struct timespec waittime; + waittime.tv_sec = 0; + waittime.tv_nsec = 25000000; + nanosleep(&waittime, NULL); + } } return 0; -- 1.7.12.2 -- To unsubscribe from this list: send the line "unsubscribe util-linux" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html