Re: Problem with time package, struct rusage and wait3
Oops... small correction.
Igor
2001-07-31 Igor Khavkine <i_khavki@alcor.concordia.ca>
* sysdeps/posix/wait3.c (__wait3): Fill in the USAGE argument
if it is not NULL. This change is required for POSIX compliance.
--- glibc-2.2.3/sysdeps/posix/wait3.c.orig Tue Jul 31 10:08:05 2001
+++ glibc-2.2.3/sysdeps/posix/wait3.c Tue Jul 31 10:29:29 2001
@@ -19,6 +19,7 @@
#include <errno.h>
#include <sys/wait.h>
#include <sys/types.h>
+#include <sys/resource.h>
#include <stddef.h>
/* Wait for a child to exit. When one does, put its status in *STAT_LOC and
@@ -29,12 +30,17 @@
pid_t
__wait3 (__WAIT_STATUS stat_loc, int options, struct rusage *usage)
{
+ int err;
+
if (usage != NULL)
{
__set_errno (ENOSYS);
return (pid_t) -1;
}
- return __waitpid (WAIT_ANY, stat_loc.__iptr, options);
+ err = __waitpid (WAIT_ANY, stat_loc.__iptr, options);
+ if (!err && usage)
+ err = getrusage (RUSAGE_CHILDREN, usage);
+ return err;
}
weak_alias (__wait3, wait3)
Reply to: