replace fuword() with copyin(), and suword() with copyout()

This commit is contained in:
jdolecek 2003-08-02 19:21:48 +00:00
parent 2f71595941
commit 16b74086ed
2 changed files with 20 additions and 11 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: hpux_compat.c,v 1.65 2003/06/29 22:29:17 fvdl Exp $ */
/* $NetBSD: hpux_compat.c,v 1.66 2003/08/02 19:21:48 jdolecek Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -47,7 +47,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: hpux_compat.c,v 1.65 2003/06/29 22:29:17 fvdl Exp $");
__KERNEL_RCSID(0, "$NetBSD: hpux_compat.c,v 1.66 2003/08/02 19:21:48 jdolecek Exp $");
#if defined(_KERNEL_OPT)
#include "opt_sysv.h"
@ -224,7 +224,12 @@ hpux_sys_waitpid(l, v, retval)
void *v;
register_t *retval;
{
struct hpux_sys_waitpid_args *uap = v;
struct hpux_sys_waitpid_args /* {
syscallarg(pid_t) pid;
syscallarg(int *) status;
syscallarg(int) options;
syscallarg(struct rusage *) rusage;
} */ *uap = v;
int rv, sig, xstat, error;
SCARG(uap, rusage) = 0;
@ -244,7 +249,10 @@ hpux_sys_waitpid(l, v, retval)
* pull it back, change the signal portion, and write
* it back out.
*/
rv = fuword((caddr_t)SCARG(uap, status));
error = copyin(SCARG(uap, status), &rv, sizeof(int));
if (error)
return (error);
if (WIFSTOPPED(rv)) {
sig = WSTOPSIG(rv);
rv = W_STOPCODE(bsdtohpuxsig(sig));
@ -254,7 +262,8 @@ hpux_sys_waitpid(l, v, retval)
rv = W_EXITCODE(xstat, bsdtohpuxsig(sig)) |
WCOREDUMP(rv);
}
(void)suword((caddr_t)SCARG(uap, status), rv);
error = copyout(&rv, SCARG(uap, status), sizeof(int));
}
return (error);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_machdep.c,v 1.17 2003/06/29 22:29:24 fvdl Exp $ */
/* $NetBSD: linux_machdep.c,v 1.18 2003/08/02 19:21:50 jdolecek Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.17 2003/06/29 22:29:24 fvdl Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.18 2003/08/02 19:21:50 jdolecek Exp $");
#define COMPAT_LINUX 1
@ -675,7 +675,7 @@ linux_sys_rt_sigreturn(l, v, retval)
struct linux_ucontext *ucp; /* ucontext in user space */
struct linux_ucontext tuc; /* copy of *ucp */
sigset_t mask;
int sz = 0; /* extra frame size */
int sz = 0, error; /* extra frame size */
/*
* rt_sigreturn of Linux/m68k takes no arguments.
@ -683,9 +683,9 @@ linux_sys_rt_sigreturn(l, v, retval)
* usp + 8 is a pointer to ucontext structure.
*/
frame = (struct frame *) l->l_md.md_regs;
ucp = (struct linux_ucontext *) fuword((caddr_t)frame->f_regs[SP] + 8);
if ((int) ucp & 1)
goto bad; /* error (-1) or odd address */
error = copyin((caddr_t) frame->f_regs[SP] + 8, (void *) &ucp, sizeof(void *));
if (error || (int) ucp & 1)
goto bad; /* error or odd address */
#ifdef DEBUG
if (sigdebug & SDB_FOLLOW)