summaryrefslogtreecommitdiff
path: root/libc/unistd/sleep.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2003-12-30 10:45:45 +0000
committerEric Andersen <andersen@codepoet.org>2003-12-30 10:45:45 +0000
commit5c62002cc864b92f9c1517449e197c55adb9ff44 (patch)
treec8fd2041c99369d8f54ed6be394695a02fd38919 /libc/unistd/sleep.c
parent8d532c51318bad2436880ecac972c9dfa3996c9b (diff)
Make sleep behave itself properly inthe presence of SIGCHLD
Diffstat (limited to 'libc/unistd/sleep.c')
-rw-r--r--libc/unistd/sleep.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/libc/unistd/sleep.c b/libc/unistd/sleep.c
index 2b3187ebc..20689da0e 100644
--- a/libc/unistd/sleep.c
+++ b/libc/unistd/sleep.c
@@ -23,17 +23,14 @@
#include <signal.h>
#include <unistd.h>
-#if 1
+#if 0
/* This is a quick and dirty, but not 100% compliant with
* the stupid SysV SIGCHLD vs. SIG_IGN behaviour. It is
* fine unless you are messing with SIGCHLD... */
unsigned int sleep (unsigned int sec)
{
unsigned int res;
- struct timespec ts = {
- tv_sec: (long int) sec,
- tv_nsec: 0
- };
+ struct timespec ts = { .tv_sec = (long int) seconds, .tv_nsec = 0 };
res = nanosleep(&ts, &ts);
if (res) res = (unsigned int) ts.tv_sec + (ts.tv_nsec >= 500000000L);
return res;
@@ -46,7 +43,7 @@ unsigned int sleep (unsigned int sec)
behaviour for this syscall. Therefore we have to emulate it here. */
unsigned int sleep (unsigned int seconds)
{
- struct timespec ts = { tv_sec: (long int) seconds, tv_nsec: 0 };
+ struct timespec ts = { .tv_sec = (long int) seconds, .tv_nsec = 0 };
sigset_t set, oset;
unsigned int result;