Convert linux/linux32 wait(4) to use a compat50 rusage structure.

This commit is contained in:
njoly 2009-01-17 22:28:52 +00:00
parent 38068400a9
commit 25a76c08aa
12 changed files with 37 additions and 29 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_time_50.c,v 1.3 2009/01/14 22:50:12 njoly Exp $ */
/* $NetBSD: kern_time_50.c,v 1.4 2009/01/17 22:28:52 njoly Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -36,7 +36,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_time_50.c,v 1.3 2009/01/14 22:50:12 njoly Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_time_50.c,v 1.4 2009/01/17 22:28:52 njoly Exp $");
#ifdef _KERNEL_OPT
#include "opt_ntp.h"
@ -640,7 +640,7 @@ compat_50_sys___sigtimedwait(struct lwp *l,
tscopyin, tscopyout);
}
static void
void
rusage_to_rusage50(const struct rusage *ru, struct rusage50 *ru50)
{
(void)memcpy(&ru50->ru_first, &ru->ru_first,

View File

@ -1,4 +1,4 @@
$NetBSD: syscalls.master,v 1.67 2009/01/15 23:48:50 njoly Exp $
$NetBSD: syscalls.master,v 1.68 2009/01/17 22:28:52 njoly Exp $
;
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
@ -590,7 +590,7 @@
364 NOARGS { int|compat_50_sys||getrusage(int who, \
struct rusage50 *rusage); }
365 STD { int|linux_sys||wait4(int pid, int *status, \
int options, struct rusage *rusage); }
int options, struct rusage50 *rusage); }
366 UNIMPL adjtimex
367 NOARGS { int|sys||__getcwd(char *bufp, size_t length); }
368 UNIMPL capget

View File

@ -1,4 +1,4 @@
$NetBSD: syscalls.master,v 1.29 2009/01/15 23:48:50 njoly Exp $
$NetBSD: syscalls.master,v 1.30 2009/01/17 22:28:52 njoly Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
@ -180,7 +180,7 @@
char **envp); }
60 NOARGS { int|sys||exit(int rval); }
61 STD { int|linux_sys||wait4(int pid, int *status, \
int options, struct rusage *rusage); }
int options, struct rusage50 *rusage); }
62 STD { int|linux_sys||kill(int pid, int signum); }
63 STD { int|linux_sys||uname(struct linux_utsname *up); }
#ifdef SYSVSEM

View File

@ -1,4 +1,4 @@
$NetBSD: syscalls.master,v 1.40 2009/01/15 23:48:50 njoly Exp $
$NetBSD: syscalls.master,v 1.41 2009/01/17 22:28:52 njoly Exp $
; Derived from sys/compat/linux/arch/*/syscalls.master
; and from Linux 2.4.12 arch/arm/kernel/calls.S
@ -210,7 +210,7 @@
112 UNIMPL idle
113 UNIMPL syscall
114 STD { int|linux_sys||wait4(int pid, int *status, \
int options, struct rusage *rusage); }
int options, struct rusage50 *rusage); }
115 STD { int|linux_sys||swapoff(const char *path); }
116 STD { int|linux_sys||sysinfo(struct linux_sysinfo *arg); }
117 STD { int|linux_sys||ipc(int what, int a1, int a2, int a3, \

View File

@ -1,4 +1,4 @@
$NetBSD: syscalls.master,v 1.98 2009/01/13 22:27:43 pooka Exp $
$NetBSD: syscalls.master,v 1.99 2009/01/17 22:28:52 njoly Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
@ -219,7 +219,7 @@
112 UNIMPL idle
113 UNIMPL vm86old
114 STD { int|linux_sys||wait4(int pid, int *status, \
int options, struct rusage *rusage); }
int options, struct rusage50 *rusage); }
115 STD { int|linux_sys||swapoff(const char *path); }
116 STD { int|linux_sys||sysinfo(struct linux_sysinfo *arg); }
117 STD { int|linux_sys||ipc(int what, int a1, int a2, int a3, \

View File

@ -1,4 +1,4 @@
$NetBSD: syscalls.master,v 1.65 2009/01/13 22:27:43 pooka Exp $
$NetBSD: syscalls.master,v 1.66 2009/01/17 22:28:52 njoly Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
@ -230,7 +230,7 @@
112 UNIMPL idle
113 UNIMPL vm86old
114 STD { int|linux_sys||wait4(int pid, int *status, \
int options, struct rusage *rusage); }
int options, struct rusage50 *rusage); }
115 STD { int|linux_sys||swapoff(const char *path); }
116 STD { int|linux_sys||sysinfo(struct linux_sysinfo *arg); }
117 STD { int|linux_sys||ipc(int what, int a1, int a2, int a3, \

View File

@ -1,4 +1,4 @@
$NetBSD: syscalls.master,v 1.33 2009/01/15 23:48:50 njoly Exp $
$NetBSD: syscalls.master,v 1.34 2009/01/17 22:28:52 njoly Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
@ -207,7 +207,7 @@
112 UNIMPL idle
113 UNIMPL vm86old
114 STD { int|linux_sys||wait4(int pid, int *status, \
int options, struct rusage *rusage); }
int options, struct rusage50 *rusage); }
115 STD { int|linux_sys||swapoff(const char *path); }
116 STD { int|linux_sys||sysinfo(struct linux_sysinfo *arg); }
117 STD { int|linux_sys||ipc(int what, int a1, int a2, int a3, \

View File

@ -1,4 +1,4 @@
$NetBSD: syscalls.master,v 1.41 2009/01/15 23:48:50 njoly Exp $
$NetBSD: syscalls.master,v 1.42 2009/01/17 22:28:52 njoly Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
@ -236,7 +236,7 @@
112 UNIMPL idle
113 UNIMPL vm86old
114 STD { int|linux_sys||wait4(int pid, int *status, \
int options, struct rusage *rusage); }
int options, struct rusage50 *rusage); }
115 STD { int|linux_sys||swapoff(const char *path); }
116 STD { int|linux_sys||sysinfo(struct linux_sysinfo *arg); }
117 STD { int|linux_sys||ipc(int what, int a1, int a2, int a3, \

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_misc.c,v 1.203 2009/01/11 02:45:48 christos Exp $ */
/* $NetBSD: linux_misc.c,v 1.204 2009/01/17 22:28:53 njoly Exp $ */
/*-
* Copyright (c) 1995, 1998, 1999, 2008 The NetBSD Foundation, Inc.
@ -57,7 +57,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.203 2009/01/11 02:45:48 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.204 2009/01/17 22:28:53 njoly Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -99,6 +99,8 @@ __KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.203 2009/01/11 02:45:48 christos Ex
#include <sys/syscall.h>
#include <sys/syscallargs.h>
#include <compat/sys/resource.h>
#include <compat/linux/common/linux_machdep.h>
#include <compat/linux/common/linux_types.h>
#include <compat/linux/common/linux_signal.h>
@ -215,10 +217,11 @@ linux_sys_wait4(struct lwp *l, const struct linux_sys_wait4_args *uap, register_
syscallarg(int) pid;
syscallarg(int *) status;
syscallarg(int) options;
syscallarg(struct rusage *) rusage;
syscallarg(struct rusage50 *) rusage;
} */
int error, status, options, linux_options, was_zombie;
struct rusage ru;
struct rusage50 ru50;
int pid = SCARG(uap, pid);
proc_t *p;
@ -255,8 +258,10 @@ linux_sys_wait4(struct lwp *l, const struct linux_sys_wait4_args *uap, register_
sigdelset(&p->p_sigpend.sp_set, SIGCHLD); /* XXXAD ksiginfo leak */
mutex_exit(p->p_lock);
if (SCARG(uap, rusage) != NULL)
if (SCARG(uap, rusage) != NULL) {
rusage_to_rusage50(&ru, &ru50);
error = copyout(&ru, SCARG(uap, rusage), sizeof(ru));
}
if (error == 0 && SCARG(uap, status) != NULL) {
status = bsd_to_linux_wstat(status);

View File

@ -1,4 +1,4 @@
$NetBSD: syscalls.master,v 1.47 2009/01/16 13:10:47 njoly Exp $
$NetBSD: syscalls.master,v 1.48 2009/01/17 22:28:53 njoly Exp $
; NetBSD i386 COMPAT_LINUX32 system call name/number "master" file.
; (See syscalls.conf to see what it is processed into.)
@ -213,7 +213,7 @@
112 UNIMPL idle
113 UNIMPL vm86old
114 STD { int|linux32_sys||wait4(int pid, netbsd32_intp status, \
int options, netbsd32_rusagep_t rusage); }
int options, netbsd32_rusage50p_t rusage); }
115 STD { int|linux32_sys||swapoff(netbsd32_charp path); }
116 STD { int|linux32_sys||sysinfo(linux32_sysinfop_t arg); }
117 STD { int|linux32_sys||ipc(int what, int a1, int a2, int a3, \

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux32_wait.c,v 1.9 2008/11/19 18:36:04 ad Exp $ */
/* $NetBSD: linux32_wait.c,v 1.10 2009/01/17 22:28:53 njoly Exp $ */
/*-
* Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved.
@ -33,7 +33,7 @@
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: linux32_wait.c,v 1.9 2008/11/19 18:36:04 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux32_wait.c,v 1.10 2009/01/17 22:28:53 njoly Exp $");
#include <sys/types.h>
#include <sys/param.h>
@ -97,11 +97,11 @@ linux32_sys_wait4(struct lwp *l, const struct linux32_sys_wait4_args *uap, regis
syscallarg(int) pid;
syscallarg(netbsd32_intp) status;
syscallarg(int) options;
syscallarg(netbsd32_rusagep_t) rusage;
syscallarg(netbsd32_rusage50p_t) rusage;
} */
int error, status, linux_options, options, was_zombie;
struct rusage ru;
struct netbsd32_rusage ru32;
struct netbsd32_rusage50 ru32;
proc_t *p;
int pid;
@ -132,7 +132,7 @@ linux32_sys_wait4(struct lwp *l, const struct linux32_sys_wait4_args *uap, regis
mutex_exit(p->p_lock);
if (SCARG_P32(uap, rusage) != NULL) {
netbsd32_from_rusage(&ru, &ru32);
netbsd32_from_rusage50(&ru, &ru32);
error = copyout(&ru32, SCARG_P32(uap, rusage), sizeof(ru32));
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: resource.h,v 1.2 2009/01/11 02:45:50 christos Exp $ */
/* $NetBSD: resource.h,v 1.3 2009/01/17 22:28:53 njoly Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
@ -56,6 +56,9 @@ struct rusage50 {
long ru_nvcsw; /* voluntary context switches */
long ru_nivcsw; /* involuntary " */
};
void rusage_to_rusage50(const struct rusage *, struct rusage50 *);
#ifndef _KERNEL
__BEGIN_DECLS
int getrusage(int, struct rusage50 *);