vm: fix a null dereference on out-of-memory
[minix.git] / lib / libc / gen / minix / times.c
blobb8aa084b85828bb6b369d5ba7fb21f6281164240
1 #include <sys/cdefs.h>
2 #include "namespace.h"
4 #include <lib.h>
5 #include <sys/times.h>
7 #ifdef __weak_alias
8 __weak_alias(times, _times)
9 #endif
11 clock_t times(buf)
12 struct tms *buf;
14 message m;
16 m.m4_l5 = 0; /* return this if system is pre-1.6 */
17 if (_syscall(PM_PROC_NR, TIMES, &m) < 0) return( (clock_t) -1);
18 buf->tms_utime = m.m4_l1;
19 buf->tms_stime = m.m4_l2;
20 buf->tms_cutime = m.m4_l3;
21 buf->tms_cstime = m.m4_l4;
22 return(m.m4_l5);