[uClibc-cvs] uClibc/libc/unistd sleep.c,1.6,1.7 usleep.c,1.1,1.2

Erik Andersen andersen at uclibc.org
Tue Dec 30 10:45:48 UTC 2003


Update of /var/cvs/uClibc/libc/unistd
In directory nail:/tmp/cvs-serv6008/libc/unistd

Modified Files:
	sleep.c usleep.c 
Log Message:
Make sleep behave itself properly inthe presence of SIGCHLD


Index: sleep.c
===================================================================
RCS file: /var/cvs/uClibc/libc/unistd/sleep.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- sleep.c	14 May 2003 05:10:58 -0000	1.6
+++ sleep.c	30 Dec 2003 10:45:45 -0000	1.7
@@ -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 @@
    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;
 

Index: usleep.c
===================================================================
RCS file: /var/cvs/uClibc/libc/unistd/usleep.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- usleep.c	2 Jan 2002 12:10:01 -0000	1.1
+++ usleep.c	30 Dec 2003 10:45:45 -0000	1.2
@@ -5,9 +5,9 @@
 
 int usleep (__useconds_t usec)
 {
-	const struct timespec ts = { 
-	    tv_sec:  (long int)(usec / 1000000),
-	    tv_nsec: (long int) (usec % 1000000) * 1000ul };
-	return(nanosleep(&ts, NULL));
+    const struct timespec ts = {
+	.tv_sec = (long int) (usec / 1000000),
+	.tv_nsec = (long int) (usec % 1000000) * 1000ul
+    };
+    return(nanosleep(&ts, NULL));
 }
-




More information about the uClibc-cvs mailing list