# HG changeset patch # User Jim Meyering # Date 946203378 0 # Node ID cf3d523888c54cad03d86c899d46f15c94de0b98 # Parent 644068f5da9885b96c417f2ac69c2f3d92d644d4 *** empty log message *** diff --git a/lib/nanosleep.c b/lib/nanosleep.c --- a/lib/nanosleep.c +++ b/lib/nanosleep.c @@ -22,11 +22,15 @@ #include #include +#if HAVE_UNISTD_H +# include +#endif + #include /* FIXME: is including both like this kosher? */ #include -static interrupted; +static int suspended; /* Handle SIGCONT. */ @@ -51,12 +55,12 @@ /* Sleep for USEC microseconds. */ static void -usleep (const struct timespec *ts_delay) +my_usleep (const struct timespec *ts_delay) { struct timeval tv_delay; tv_delay.tv_sec = ts_delay->tv_sec; tv_delay.tv_usec = 1000 * ts_delay->tv_nsec; - select (0, (void *) 0, (void *) 0, (void *) 0, tv_delay); + select (0, (void *) 0, (void *) 0, (void *) 0, &tv_delay); } int @@ -67,7 +71,7 @@ struct sigaction oldact, newact; #endif - interrupted = 0; + suspended = 0; /* set up sig handler -- but maybe only do this the first time? */ #ifdef SA_INTERRUPT @@ -83,9 +87,9 @@ signal (SIGCONT, sighandler); #endif - usleep (requested_delay); + my_usleep (requested_delay); - if (interrupted) + if (suspended) { /* Calculate time remaining. */ /* FIXME: the code in sleep doesn't use this, so there's no @@ -94,5 +98,5 @@ /* FIXME: Restore sig handler? */ - return interrupted; + return suspended; }