1 #include <errno.h> 2 #include "getrusage.h" 3 fio_getrusage(struct rusage * ru)4int fio_getrusage(struct rusage *ru) 5 { 6 #ifdef CONFIG_RUSAGE_THREAD 7 if (!getrusage(RUSAGE_THREAD, ru)) 8 return 0; 9 if (errno != EINVAL) 10 return -1; 11 /* Fall through to RUSAGE_SELF */ 12 #endif 13 return getrusage(RUSAGE_SELF, ru); 14 } 15