[PATCH 13/19] tailf: replace usleep with nanosleep

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



POSIX.1-2001 declares usleep is obsolete.

Reference: http://pubs.opengroup.org/onlinepubs/009695399/functions/usleep.html
Signed-off-by: Sami Kerola <kerolasa@xxxxxx>
---
 text-utils/tailf.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/text-utils/tailf.c b/text-utils/tailf.c
index 9571645..d76d53d 100644
--- a/text-utils/tailf.c
+++ b/text-utils/tailf.c
@@ -39,10 +39,10 @@
 #ifdef HAVE_INOTIFY_INIT
 #include <sys/inotify.h>
 #endif
+#include <time.h>
 
 #include "nls.h"
 #include "xalloc.h"
-#include "usleep.h"
 #include "strutils.h"
 #include "c.h"
 #include "closestream.h"
@@ -133,8 +133,11 @@ static void
 watch_file(const char *filename, off_t *size)
 {
 	do {
+		struct timespec waittime;
+		waittime.tv_sec = 0;
+		waittime.tv_nsec = 250000000;
 		roll_file(filename, size);
-		usleep(250000);
+		nanosleep(&waittime, NULL);
 	} while(1);
 }
 
-- 
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


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux