Mercurial > hg > octave-nkf > gnulib-hg
comparison lib/nanosleep.c @ 5159:a535859efd14
Merge from coreutils.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Sat, 07 Aug 2004 00:09:38 +0000 |
parents | 4e59cddb690f |
children | 6962b5c5069f |
comparison
equal
deleted
inserted
replaced
5158:c710d6c89900 | 5159:a535859efd14 |
---|---|
21 | 21 |
22 /* Undefine nanosleep here so any prototype is not redefined to be a | 22 /* Undefine nanosleep here so any prototype is not redefined to be a |
23 prototype for rpl_nanosleep. (they'd conflict e.g., on alpha-dec-osf3.2) */ | 23 prototype for rpl_nanosleep. (they'd conflict e.g., on alpha-dec-osf3.2) */ |
24 #undef nanosleep | 24 #undef nanosleep |
25 | 25 |
26 #include <stdbool.h> | |
26 #include <stdio.h> | 27 #include <stdio.h> |
27 #include <sys/types.h> | 28 #include <sys/types.h> |
28 #include <signal.h> | 29 #include <signal.h> |
29 | 30 |
30 #include <errno.h> | 31 #include <errno.h> |
31 #ifndef errno | |
32 extern int errno; | |
33 #endif | |
34 | 32 |
35 #if HAVE_UNISTD_H | 33 #if HAVE_UNISTD_H |
36 # include <unistd.h> | 34 # include <unistd.h> |
37 #endif | 35 #endif |
38 | 36 |
75 | 73 |
76 int | 74 int |
77 rpl_nanosleep (const struct timespec *requested_delay, | 75 rpl_nanosleep (const struct timespec *requested_delay, |
78 struct timespec *remaining_delay) | 76 struct timespec *remaining_delay) |
79 { | 77 { |
80 static int initialized; | 78 static bool initialized; |
81 | 79 |
82 #ifdef SA_NOCLDSTOP | 80 #ifdef SA_NOCLDSTOP |
83 struct sigaction oldact, newact; | 81 struct sigaction oldact, newact; |
84 #endif | 82 #endif |
85 | 83 |
98 sigaction (SIGCONT, &newact, NULL); | 96 sigaction (SIGCONT, &newact, NULL); |
99 #else | 97 #else |
100 if (signal (SIGCONT, SIG_IGN) != SIG_IGN) | 98 if (signal (SIGCONT, SIG_IGN) != SIG_IGN) |
101 signal (SIGCONT, sighandler); | 99 signal (SIGCONT, sighandler); |
102 #endif | 100 #endif |
103 initialized = 1; | 101 initialized = true; |
104 } | 102 } |
105 | 103 |
106 my_usleep (requested_delay); | 104 my_usleep (requested_delay); |
107 | 105 |
108 if (suspended) | 106 if (suspended) |