linux_sys_times(): if tms is NULL, just return the number of ticks since
boot, don't error out; this matches what Linux does Fixes problem reported in kern/19027
This commit is contained in:
parent
64f7cc2afc
commit
081a94b01c
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: linux_misc.c,v 1.111 2002/09/23 05:03:03 simonb Exp $ */
|
||||
/* $NetBSD: linux_misc.c,v 1.112 2002/11/13 08:27:10 jdolecek Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1995, 1998, 1999 The NetBSD Foundation, Inc.
|
||||
@ -64,7 +64,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.111 2002/09/23 05:03:03 simonb Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.112 2002/11/13 08:27:10 jdolecek Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -600,19 +600,22 @@ linux_sys_times(p, v, retval)
|
||||
syscallarg(struct times *) tms;
|
||||
} */ *uap = v;
|
||||
struct timeval t;
|
||||
struct linux_tms ltms;
|
||||
struct rusage ru;
|
||||
int error, s;
|
||||
|
||||
calcru(p, &ru.ru_utime, &ru.ru_stime, NULL);
|
||||
ltms.ltms_utime = CONVTCK(ru.ru_utime);
|
||||
ltms.ltms_stime = CONVTCK(ru.ru_stime);
|
||||
if (SCARG(uap, tms)) {
|
||||
struct linux_tms ltms;
|
||||
struct rusage ru;
|
||||
|
||||
ltms.ltms_cutime = CONVTCK(p->p_stats->p_cru.ru_utime);
|
||||
ltms.ltms_cstime = CONVTCK(p->p_stats->p_cru.ru_stime);
|
||||
calcru(p, &ru.ru_utime, &ru.ru_stime, NULL);
|
||||
ltms.ltms_utime = CONVTCK(ru.ru_utime);
|
||||
ltms.ltms_stime = CONVTCK(ru.ru_stime);
|
||||
|
||||
if ((error = copyout(<ms, SCARG(uap, tms), sizeof ltms)))
|
||||
return error;
|
||||
ltms.ltms_cutime = CONVTCK(p->p_stats->p_cru.ru_utime);
|
||||
ltms.ltms_cstime = CONVTCK(p->p_stats->p_cru.ru_stime);
|
||||
|
||||
if ((error = copyout(<ms, SCARG(uap, tms), sizeof ltms)))
|
||||
return error;
|
||||
}
|
||||
|
||||
s = splclock();
|
||||
timersub(&time, &boottime, &t);
|
||||
|
Loading…
Reference in New Issue
Block a user