cleanup cruft left from when kernel and user time_t disagreed
authorRich Felker <dalias@aerifal.cx>
Sat, 19 Feb 2011 07:28:42 +0000 (02:28 -0500)
committerRich Felker <dalias@aerifal.cx>
Sat, 19 Feb 2011 07:28:42 +0000 (02:28 -0500)
src/linux/wait3.c
src/linux/wait4.c

index d1d91b055db53d4b6032ee890170dcbac9d56c07..61c735947b473b88b27f0fa71c8725b96d31ed0b 100644 (file)
@@ -1,9 +1,8 @@
+#define _GNU_SOURCE
 #include <sys/wait.h>
 #include <sys/resource.h>
 #include "syscall.h"
 
-pid_t wait4(pid_t, int *, int, struct rusage *);
-
 pid_t wait3(int *status, int options, struct rusage *usage)
 {
        return wait4(-1, status, options, usage);
index 5dd505a987c0a764e9482e718081300a2e64e774..252beb0c917627454ff04d550502e11f3159b291 100644 (file)
@@ -1,3 +1,4 @@
+#define _GNU_SOURCE
 #include <sys/wait.h>
 #include <sys/resource.h>
 #include <string.h>
@@ -5,14 +6,5 @@
 
 pid_t wait4(pid_t pid, int *status, int options, struct rusage *usage)
 {
-       pid_t ret = syscall4(__NR_wait4, pid, (long)status, options, (long)usage);
-       /* Fixup kernel time_t... */
-       if (usage) {
-               long kusage[4];
-               memcpy(kusage, usage, sizeof kusage);
-               memmove((struct timeval *)usage + 2, (long *)usage + 4, sizeof *usage - 2*sizeof(struct timeval));
-               usage->ru_utime = (struct timeval){ kusage[0], kusage[1] };
-               usage->ru_stime = (struct timeval){ kusage[2], kusage[3] };
-       }
-       return ret;
+       return syscall4(__NR_wait4, pid, (long)status, options, (long)usage);
 }