1 #define _BSD_SOURCE 2 #include "time32.h" 3 #include <string.h> 4 #include <stddef.h> 5 #include <sys/wait.h> 6 7 struct compat_rusage { 8 struct timeval32 ru_utime; 9 struct timeval32 ru_stime; 10 long ru_maxrss; 11 long ru_ixrss; 12 long ru_idrss; 13 long ru_isrss; 14 long ru_minflt; 15 long ru_majflt; 16 long ru_nswap; 17 long ru_inblock; 18 long ru_oublock; 19 long ru_msgsnd; 20 long ru_msgrcv; 21 long ru_nsignals; 22 long ru_nvcsw; 23 long ru_nivcsw; 24 }; 25 __wait3_time32(int * status,int options,struct compat_rusage * usage)26pid_t __wait3_time32(int *status, int options, struct compat_rusage *usage) 27 { 28 struct rusage ru; 29 int r = wait3(status, options, usage ? &ru : 0); 30 if (!r && usage) { 31 usage->ru_utime.tv_sec = ru.ru_utime.tv_sec; 32 usage->ru_utime.tv_usec = ru.ru_utime.tv_usec; 33 usage->ru_stime.tv_sec = ru.ru_stime.tv_sec; 34 usage->ru_stime.tv_usec = ru.ru_stime.tv_usec; 35 memcpy(&usage->ru_maxrss, &ru.ru_maxrss, 36 sizeof(struct compat_rusage) - 37 offsetof(struct compat_rusage, ru_maxrss)); 38 } 39 return r; 40 } 41