From a5bd7939961aaa6e39f3b298e556063cfd97d75a Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Fri, 24 Jan 2014 13:04:14 +0100 Subject: include/c.h: prefer nanosleep() over usleep() Let's use nanosleep() although if usleep() exists. The nanosleep function does no interact with signals and other timers. The patch introduces xusleep() as replacement to libc (or our fallback) usleep(). Yes, we don't want to use struct timespec + nanosleep() everywhere in code as nano-time resolution is useless for us. The patch also enlarges delays in some busy wait loops. It seems enough to try read/write 4x per second. Signed-off-by: Karel Zak --- term-utils/agetty.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'term-utils/agetty.c') diff --git a/term-utils/agetty.c b/term-utils/agetty.c index baa1b38cb..7c0579c63 100644 --- a/term-utils/agetty.c +++ b/term-utils/agetty.c @@ -1589,7 +1589,7 @@ static char *get_logname(struct options *op, struct termios *tp, struct chardata /* The terminal could be open with O_NONBLOCK when * -L (force CLOCAL) is specified... */ if (errno == EINTR || errno == EAGAIN) { - usleep(250000); + xusleep(250000); continue; } switch (errno) { -- cgit v1.2.3-55-g7522