Merge the nathanw_sa branch.

This commit is contained in:
thorpej 2003-01-18 08:02:46 +00:00
parent 16311b53c0
commit 46141a3135
46 changed files with 780 additions and 610 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_machdep.c,v 1.25 2002/09/25 22:21:33 thorpej Exp $ */
/* $NetBSD: linux_machdep.c,v 1.26 2003/01/18 08:02:46 thorpej Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.25 2002/09/25 22:21:33 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.26 2003/01/18 08:02:46 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -62,6 +62,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.25 2002/09/25 22:21:33 thorpej E
#include <sys/mount.h>
#include <sys/vnode.h>
#include <sys/device.h>
#include <sys/sa.h>
#include <sys/syscallargs.h>
#include <sys/filedesc.h>
#include <sys/exec_elf.h>
@ -98,16 +99,16 @@ __KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.25 2002/09/25 22:21:33 thorpej E
*/
void
linux_setregs(p, epp, stack)
struct proc *p;
linux_setregs(l, epp, stack)
struct lwp *l;
struct exec_package *epp;
u_long stack;
{
#ifdef DEBUG
struct trapframe *tfp = p->p_md.md_tf;
struct trapframe *tfp = l->l_md.md_tf;
#endif
setregs(p, epp, stack);
setregs(l, epp, stack);
#ifdef DEBUG
/*
* Linux has registers set to zero on entry; for DEBUG kernels
@ -122,7 +123,8 @@ void setup_linux_rt_sigframe(tf, sig, mask)
int sig;
sigset_t *mask;
{
struct proc *p = curproc;
struct lwp *l = curlwp;
struct proc *p = l->l_proc;
struct linux_rt_sigframe *sfp, sigframe;
int onstack;
int fsize, rndfsize;
@ -166,9 +168,9 @@ void setup_linux_rt_sigframe(tf, sig, mask)
frametoreg(tf, (struct reg *)sigframe.uc.uc_mcontext.sc_regs);
sigframe.uc.uc_mcontext.sc_regs[R_SP] = alpha_pal_rdusp();
alpha_enable_fp(p, 1);
alpha_enable_fp(l, 1);
sigframe.uc.uc_mcontext.sc_fpcr = alpha_read_fpcr();
sigframe.uc.uc_mcontext.sc_fp_control = alpha_read_fp_c(p);
sigframe.uc.uc_mcontext.sc_fp_control = alpha_read_fp_c(l);
alpha_pal_wrfen(0);
sigframe.uc.uc_mcontext.sc_traparg_a0 = tf->tf_regs[FRAME_A0];
@ -197,7 +199,7 @@ void setup_linux_rt_sigframe(tf, sig, mask)
* Process has trashed its stack; give it an illegal
* instruction to halt it in its tracks.
*/
sigexit(p, SIGILL);
sigexit(l, SIGILL);
/* NOTREACHED */
}
@ -222,7 +224,8 @@ void setup_linux_sigframe(tf, sig, mask)
int sig;
sigset_t *mask;
{
struct proc *p = curproc;
struct lwp *l = curlwp;
struct proc *p = l->l_proc;
struct linux_sigframe *sfp, sigframe;
int onstack;
int fsize, rndfsize;
@ -261,12 +264,12 @@ void setup_linux_sigframe(tf, sig, mask)
frametoreg(tf, (struct reg *)sigframe.sf_sc.sc_regs);
sigframe.sf_sc.sc_regs[R_SP] = alpha_pal_rdusp();
if (p == fpcurproc) {
if (l == fpcurlwp) {
alpha_pal_wrfen(1);
savefpstate(&p->p_addr->u_pcb.pcb_fp);
savefpstate(&l->l_addr->u_pcb.pcb_fp);
alpha_pal_wrfen(0);
sigframe.sf_sc.sc_fpcr = p->p_addr->u_pcb.pcb_fp.fpr_cr;
fpcurproc = NULL;
sigframe.sf_sc.sc_fpcr = l->l_addr->u_pcb.pcb_fp.fpr_cr;
fpcurlwp = NULL;
}
/* XXX ownedfp ? etc...? */
@ -284,7 +287,7 @@ void setup_linux_sigframe(tf, sig, mask)
* Process has trashed its stack; give it an illegal
* instruction to halt it in its tracks.
*/
sigexit(p, SIGILL);
sigexit(l, SIGILL);
/* NOTREACHED */
}
@ -320,8 +323,9 @@ linux_sendsig(sig, mask, code)
sigset_t *mask;
u_long code;
{
struct proc *p = curproc;
struct trapframe *tf = p->p_md.md_tf;
struct lwp *l = curlwp;
struct proc *p = l->l_proc;
struct trapframe *tf = l->l_md.md_tf;
sig_t catcher = SIGACTION(p, sig).sa_handler;
#ifdef notyet
struct linux_emuldata *edp;
@ -354,10 +358,10 @@ linux_sendsig(sig, mask, code)
#ifdef DEBUG
if (sigdebug & SDB_FOLLOW)
printf("sendsig(%d): pc %lx, catcher %lx\n", p->p_pid,
printf("sendsig(%d): pc %lx, catcher %lx\n", l->l_proc->p_pid,
tf->tf_regs[FRAME_PC], tf->tf_regs[FRAME_A3]);
if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid)
printf("sendsig(%d): sig %d returns\n", p->p_pid, sig);
if ((sigdebug & SDB_KSTACK) && l->l_proc->p_pid == sigpid)
printf("sendsig(%d): sig %d returns\n", l->l_proc->p_pid, sig);
#endif
}
@ -372,10 +376,11 @@ linux_sendsig(sig, mask, code)
*/
int
linux_restore_sigcontext(struct proc *p, struct linux_sigcontext context,
linux_restore_sigcontext(struct lwp *l, struct linux_sigcontext context,
sigset_t *mask)
{
struct proc *p = l->l_proc;
/*
* Linux doesn't (yet) have alternate signal stacks.
* However, the OSF/1 sigcontext which they use has
@ -396,17 +401,17 @@ linux_restore_sigcontext(struct proc *p, struct linux_sigcontext context,
if (context.sc_ps != ALPHA_PSL_USERMODE)
return(EINVAL);
p->p_md.md_tf->tf_regs[FRAME_PC] = context.sc_pc;
p->p_md.md_tf->tf_regs[FRAME_PS] = context.sc_ps;
l->l_md.md_tf->tf_regs[FRAME_PC] = context.sc_pc;
l->l_md.md_tf->tf_regs[FRAME_PS] = context.sc_ps;
regtoframe((struct reg *)context.sc_regs, p->p_md.md_tf);
regtoframe((struct reg *)context.sc_regs, l->l_md.md_tf);
alpha_pal_wrusp(context.sc_regs[R_SP]);
if (p == fpcurproc)
fpcurproc = NULL;
if (l == fpcurlwp)
fpcurlwp = NULL;
/* Restore fp regs and fpr_cr */
bcopy((struct fpreg *)context.sc_fpregs, &p->p_addr->u_pcb.pcb_fp,
bcopy((struct fpreg *)context.sc_fpregs, &l->l_addr->u_pcb.pcb_fp,
sizeof(struct fpreg));
/* XXX sc_ownedfp ? */
/* XXX sc_fp_control ? */
@ -419,8 +424,8 @@ linux_restore_sigcontext(struct proc *p, struct linux_sigcontext context,
}
int
linux_sys_rt_sigreturn(p, v, retval)
struct proc *p;
linux_sys_rt_sigreturn(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -451,13 +456,13 @@ linux_sys_rt_sigreturn(p, v, retval)
/* Grab the signal mask */
linux_to_native_sigset(&mask, &sigframe.uc.uc_sigmask);
return(linux_restore_sigcontext(p, sigframe.uc.uc_mcontext, &mask));
return(linux_restore_sigcontext(l, sigframe.uc.uc_mcontext, &mask));
}
int
linux_sys_sigreturn(p, v, retval)
struct proc *p;
linux_sys_sigreturn(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -487,7 +492,7 @@ linux_sys_sigreturn(p, v, retval)
/* XXX use frame.extramask */
linux_old_to_native_sigset(&mask, frame.sf_sc.sc_mask);
return(linux_restore_sigcontext(p, frame.sf_sc, &mask));
return(linux_restore_sigcontext(l, frame.sf_sc, &mask));
}
/*
@ -518,7 +523,8 @@ linux_machdepioctl(p, v, retval)
return EINVAL;
}
SCARG(&bia, com) = com;
return sys_ioctl(p, &bia, retval);
/* XXX njwlwp */
return sys_ioctl(curlwp, &bia, retval);
}
/* XXX XAX fix this */

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_machdep.h,v 1.6 2002/02/15 16:47:58 christos Exp $ */
/* $NetBSD: linux_machdep.h,v 1.7 2003/01/18 08:02:46 thorpej Exp $ */
/*-
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@ -99,7 +99,7 @@ struct linux_rt_sigframe {
__BEGIN_DECLS
void setup_linux_rt_sigframe __P((struct trapframe *, int, sigset_t *));
void setup_linux_sigframe __P((struct trapframe *, int, sigset_t *));
int linux_restore_sigcontext __P((struct proc *, struct linux_sigcontext,
int linux_restore_sigcontext __P((struct lwp *, struct linux_sigcontext,
sigset_t *));
void linux_syscall_intern __P((struct proc *));
__END_DECLS

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_pipe.c,v 1.6 2001/11/13 02:08:34 lukem Exp $ */
/* $NetBSD: linux_pipe.c,v 1.7 2003/01/18 08:02:46 thorpej Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: linux_pipe.c,v 1.6 2001/11/13 02:08:34 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux_pipe.c,v 1.7 2003/01/18 08:02:46 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -48,6 +48,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_pipe.c,v 1.6 2001/11/13 02:08:34 lukem Exp $")
#include <sys/mount.h>
#include <sys/proc.h>
#include <sys/sa.h>
#include <sys/syscallargs.h>
#include <compat/linux/common/linux_types.h>
@ -65,16 +66,16 @@ __KERNEL_RCSID(0, "$NetBSD: linux_pipe.c,v 1.6 2001/11/13 02:08:34 lukem Exp $")
int
linux_sys_pipe(p, v, retval)
struct proc *p;
linux_sys_pipe(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
int error;
if ((error = sys_pipe(p, 0, retval)))
if ((error = sys_pipe(l, 0, retval)))
return error;
(p->p_md.md_tf)->tf_regs[FRAME_A4] = retval[1];
(l->l_md.md_tf)->tf_regs[FRAME_A4] = retval[1];
return 0;
}

View File

@ -1,4 +1,4 @@
$NetBSD: syscalls.master,v 1.41 2002/04/10 18:18:26 christos Exp $
$NetBSD: syscalls.master,v 1.42 2003/01/18 08:02:46 thorpej Exp $
;
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
@ -68,6 +68,7 @@
#include <sys/systm.h>
#include <sys/signal.h>
#include <sys/mount.h>
#include <sys/sa.h>
#include <sys/syscallargs.h>
#include <compat/linux/common/linux_types.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_commons.c,v 1.2 2002/02/17 22:03:23 bjh21 Exp $ */
/* $NetBSD: linux_commons.c,v 1.3 2003/01/18 08:02:47 thorpej Exp $ */
/*
* This file includes C files from the common
@ -13,7 +13,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(1, "$NetBSD: linux_commons.c,v 1.2 2002/02/17 22:03:23 bjh21 Exp $");
__KERNEL_RCSID(1, "$NetBSD: linux_commons.c,v 1.3 2003/01/18 08:02:47 thorpej Exp $");
#if defined(_KERNEL_OPT)
#include "opt_sysv.h"
@ -26,6 +26,7 @@ __KERNEL_RCSID(1, "$NetBSD: linux_commons.c,v 1.2 2002/02/17 22:03:23 bjh21 Exp
#include <sys/param.h>
#include <sys/mount.h>
#include <sys/signal.h>
#include <sys/sa.h>
#include <sys/syscallargs.h>
#include "../../common/linux_pipe.c"

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_machdep.c,v 1.10 2002/09/25 22:21:34 thorpej Exp $ */
/* $NetBSD: linux_machdep.c,v 1.11 2003/01/18 08:02:47 thorpej Exp $ */
/*-
* Copyright (c) 1995, 2000 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
#include <sys/param.h>
__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.10 2002/09/25 22:21:34 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.11 2003/01/18 08:02:47 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -58,6 +58,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.10 2002/09/25 22:21:34 thorpej E
#include <sys/mount.h>
#include <sys/vnode.h>
#include <sys/device.h>
#include <sys/sa.h>
#include <sys/syscallargs.h>
#include <sys/filedesc.h>
#include <sys/exec_elf.h>
@ -76,21 +77,20 @@ __KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.10 2002/09/25 22:21:34 thorpej E
#include <compat/linux/linux_syscallargs.h>
void
linux_setregs(p, epp, stack)
struct proc *p;
linux_setregs(l, epp, stack)
struct lwp *l;
struct exec_package *epp;
u_long stack;
{
/* struct pcb *pcb = &p->p_addr->u_pcb; */
setregs(p, epp, stack);
setregs(l, epp, stack);
}
static __inline struct trapframe *
process_frame(struct proc *p)
process_frame(struct lwp *l)
{
return p->p_addr->u_pcb.pcb_tf;
return l->l_addr->u_pcb.pcb_tf;
}
void
@ -99,13 +99,14 @@ linux_sendsig(sig, mask, code)
sigset_t *mask;
u_long code;
{
struct proc *p = curproc;
struct lwp *l = curlwp;
struct proc *p = l->l_proc;
struct trapframe *tf;
struct linux_sigframe *fp, frame;
int onstack;
sig_t catcher = SIGACTION(p, sig).sa_handler;
tf = process_frame(p);
tf = process_frame(l);
/*
* The Linux version of this code is in
@ -169,7 +170,7 @@ linux_sendsig(sig, mask, code)
* Process has trashed its stack; give it an illegal
* instruction to halt it in its tracks.
*/
sigexit(p, SIGILL);
sigexit(l, SIGILL);
/* NOTREACHED */
}
/*
@ -211,16 +212,17 @@ linux_sys_rt_sigreturn(p, v, retval)
#endif
int
linux_sys_sigreturn(p, v, retval)
struct proc *p;
linux_sys_sigreturn(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
struct linux_sigframe *sfp, frame;
struct proc *p = l->l_proc;
struct trapframe *tf;
sigset_t mask;
tf = process_frame(p);
tf = process_frame(l);
/*
* The trampoline code hands us the context.
@ -246,7 +248,7 @@ linux_sys_sigreturn(p, v, retval)
#endif
/* Restore register context. */
tf = process_frame(p);
tf = process_frame(l);
tf->tf_r0 = frame.sf_sc.sc_r0;
tf->tf_r1 = frame.sf_sc.sc_r1;
tf->tf_r2 = frame.sf_sc.sc_r2;
@ -315,5 +317,6 @@ linux_machdepioctl(p, v, retval)
return EINVAL;
}
SCARG(&bia, com) = com;
return sys_ioctl(p, &bia, retval);
/* XXX NJWLWP */
return sys_ioctl(curlwp, &bia, retval);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_ptrace.c,v 1.2 2002/01/27 15:11:38 bjh21 Exp $ */
/* $NetBSD: linux_ptrace.c,v 1.3 2003/01/18 08:02:47 thorpej Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.2 2002/01/27 15:11:38 bjh21 Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.3 2003/01/18 08:02:47 thorpej Exp $");
#include <sys/param.h>
#include <sys/malloc.h>
@ -46,6 +46,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.2 2002/01/27 15:11:38 bjh21 Exp $
#include <sys/proc.h>
#include <sys/ptrace.h>
#include <sys/systm.h>
#include <sys/sa.h>
#include <sys/syscallargs.h>
#include <uvm/uvm_extern.h>
@ -100,8 +101,8 @@ struct linux_reg {
#define ISSET(t, f) ((t) & (f))
int
linux_sys_ptrace_arch(p, v, retval)
struct proc *p;
linux_sys_ptrace_arch(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -111,8 +112,10 @@ linux_sys_ptrace_arch(p, v, retval)
syscallarg(int) addr;
syscallarg(int) data;
} */ *uap = v;
struct proc *p = l->l_proc;
int request, error;
struct proc *t; /* target process */
struct lwp *lt;
struct reg *regs = NULL;
struct fpreg *fpregs = NULL;
struct linux_reg *linux_regs = NULL;
@ -154,6 +157,17 @@ linux_sys_ptrace_arch(p, v, retval)
if (t->p_stat != SSTOP || !ISSET(t->p_flag, P_WAITED))
return EBUSY;
/* XXX NJWLWP
* The entire ptrace interface needs work to be useful to
* a process with multiple LWPs. For the moment, we'll
* just kluge this and fail on others.
*/
if (p->p_nlwps > 1)
return (ENOSYS);
lt = LIST_FIRST(&t->p_lwps);
*retval = 0;
switch (request) {
@ -162,7 +176,7 @@ linux_sys_ptrace_arch(p, v, retval)
MALLOC(linux_regs, struct linux_reg*, sizeof(struct linux_reg),
M_TEMP, M_WAITOK);
error = process_read_regs(t, regs);
error = process_read_regs(lt, regs);
if (error != 0)
goto out;
@ -193,7 +207,7 @@ linux_sys_ptrace_arch(p, v, retval)
regs->r_pc = linux_regs->uregs[LINUX_REG_PC];
regs->r_cpsr = linux_regs->uregs[LINUX_REG_CPSR];
error = process_write_regs(t, regs);
error = process_write_regs(lt, regs);
goto out;
default:

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_sys_machdep.c,v 1.7 2002/03/24 15:50:40 bjh21 Exp $ */
/* $NetBSD: linux_sys_machdep.c,v 1.8 2003/01/18 08:02:47 thorpej Exp $ */
/*-
* Copyright (c) 2002 Ben Harris
@ -29,7 +29,7 @@
#include <sys/param.h>
__KERNEL_RCSID(0, "$NetBSD: linux_sys_machdep.c,v 1.7 2002/03/24 15:50:40 bjh21 Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux_sys_machdep.c,v 1.8 2003/01/18 08:02:47 thorpej Exp $");
#include <sys/systm.h>
@ -42,15 +42,15 @@ __KERNEL_RCSID(0, "$NetBSD: linux_sys_machdep.c,v 1.7 2002/03/24 15:50:40 bjh21
#include <arm/cpufunc.h>
int
linux_sys_breakpoint(struct proc *p, void *v, register_t *retval)
linux_sys_breakpoint(struct lwp *l, void *v, register_t *retval)
{
trapsignal(p, SIGTRAP, 0);
trapsignal(l, SIGTRAP, 0);
return ERESTART; /* Leave PC pointing back at the breakpoint. */
}
int
linux_sys_cacheflush(struct proc *p, void *v, register_t *retval)
linux_sys_cacheflush(struct lwp *l, void *v, register_t *retval)
{
#ifndef acorn26
struct linux_sys_cacheflush_args /* {

View File

@ -1,4 +1,4 @@
$NetBSD: syscalls.master,v 1.11 2002/05/12 15:04:27 jdolecek Exp $
$NetBSD: syscalls.master,v 1.12 2003/01/18 08:02:47 thorpej Exp $
; Derived from sys/compat/linux/arch/*/syscalls.master
; and from Linux 2.4.12 arch/arm/kernel/calls.S
@ -43,6 +43,7 @@
#include <sys/systm.h>
#include <sys/signal.h>
#include <sys/mount.h>
#include <sys/sa.h>
#include <sys/syscallargs.h>
#include <compat/linux/common/linux_types.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_commons.c,v 1.6 2001/11/15 09:48:00 lukem Exp $ */
/* $NetBSD: linux_commons.c,v 1.7 2003/01/18 08:02:47 thorpej Exp $ */
/*
* This file includes C files from the common
@ -13,7 +13,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(1, "$NetBSD: linux_commons.c,v 1.6 2001/11/15 09:48:00 lukem Exp $");
__KERNEL_RCSID(1, "$NetBSD: linux_commons.c,v 1.7 2003/01/18 08:02:47 thorpej Exp $");
#if defined(_KERNEL_OPT)
#include "opt_sysv.h"
@ -26,6 +26,7 @@ __KERNEL_RCSID(1, "$NetBSD: linux_commons.c,v 1.6 2001/11/15 09:48:00 lukem Exp
#include <sys/param.h>
#include <sys/mount.h>
#include <sys/signal.h>
#include <sys/sa.h>
#include <sys/syscallargs.h>
#include "../../common/linux_pipe.c"

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_machdep.c,v 1.84 2002/12/06 03:37:19 junyoung Exp $ */
/* $NetBSD: linux_machdep.c,v 1.85 2003/01/18 08:02:47 thorpej Exp $ */
/*-
* Copyright (c) 1995, 2000 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.84 2002/12/06 03:37:19 junyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.85 2003/01/18 08:02:47 thorpej Exp $");
#if defined(_KERNEL_OPT)
#include "opt_vm86.h"
@ -62,6 +62,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.84 2002/12/06 03:37:19 junyoung
#include <sys/mount.h>
#include <sys/vnode.h>
#include <sys/device.h>
#include <sys/sa.h>
#include <sys/syscallargs.h>
#include <sys/filedesc.h>
#include <sys/exec_elf.h>
@ -105,9 +106,9 @@ __KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.84 2002/12/06 03:37:19 junyoung
#ifdef USER_LDT
#include <machine/cpu.h>
int linux_read_ldt __P((struct proc *, struct linux_sys_modify_ldt_args *,
int linux_read_ldt __P((struct lwp *, struct linux_sys_modify_ldt_args *,
register_t *));
int linux_write_ldt __P((struct proc *, struct linux_sys_modify_ldt_args *,
int linux_write_ldt __P((struct lwp *, struct linux_sys_modify_ldt_args *,
register_t *));
#endif
@ -119,7 +120,7 @@ int linux_write_ldt __P((struct proc *, struct linux_sys_modify_ldt_args *,
static struct biosdisk_info *fd2biosinfo __P((struct proc *, struct file *));
extern struct disklist *i386_alldisks;
static void linux_savecontext __P((struct proc *, struct trapframe *,
static void linux_savecontext __P((struct lwp *, struct trapframe *,
sigset_t *, struct linux_sigcontext *));
static void linux_rt_sendsig __P((int, sigset_t *, u_long));
static void linux_old_sendsig __P((int, sigset_t *, u_long));
@ -130,25 +131,25 @@ extern char linux_sigcode[], linux_rt_sigcode[];
*/
void
linux_setregs(p, epp, stack)
struct proc *p;
linux_setregs(l, epp, stack)
struct lwp *l;
struct exec_package *epp;
u_long stack;
{
struct pcb *pcb = &p->p_addr->u_pcb;
struct pcb *pcb = &l->l_addr->u_pcb;
struct trapframe *tf;
#if NNPX > 0
/* If we were using the FPU, forget about it. */
if (npxproc == p)
if (npxproc == l)
npxdrop();
#endif
#ifdef USER_LDT
pmap_ldt_cleanup(p);
pmap_ldt_cleanup(l);
#endif
p->p_md.md_flags &= ~MDP_USEDFPU;
l->l_md.md_flags &= ~MDP_USEDFPU;
if (i386_use_fxsave) {
pcb->pcb_savefpu.sv_xmm.sv_env.en_cw = __Linux_NPXCW__;
@ -156,7 +157,7 @@ linux_setregs(p, epp, stack)
} else
pcb->pcb_savefpu.sv_87.sv_env.en_cw = __Linux_NPXCW__;
tf = p->p_md.md_regs;
tf = l->l_md.md_regs;
tf->tf_gs = GSEL(GUDATA_SEL, SEL_UPL);
tf->tf_fs = GSEL(GUDATA_SEL, SEL_UPL);
tf->tf_es = GSEL(GUDATA_SEL, SEL_UPL);
@ -164,7 +165,7 @@ linux_setregs(p, epp, stack)
tf->tf_edi = 0;
tf->tf_esi = 0;
tf->tf_ebp = 0;
tf->tf_ebx = (int)p->p_psstr;
tf->tf_ebx = (int)l->l_proc->p_psstr;
tf->tf_edx = 0;
tf->tf_ecx = 0;
tf->tf_eax = 0;
@ -200,8 +201,8 @@ linux_sendsig(sig, mask, code)
static void
linux_savecontext(p, tf, mask, sc)
struct proc *p;
linux_savecontext(l, tf, mask, sc)
struct lwp *l;
struct trapframe *tf;
sigset_t *mask;
struct linux_sigcontext *sc;
@ -213,7 +214,7 @@ linux_savecontext(p, tf, mask, sc)
sc->sc_fs = tf->tf_vm86_fs;
sc->sc_es = tf->tf_vm86_es;
sc->sc_ds = tf->tf_vm86_ds;
sc->sc_eflags = get_vflags(p);
sc->sc_eflags = get_vflags(l);
} else
#endif
{
@ -237,7 +238,7 @@ linux_savecontext(p, tf, mask, sc)
sc->sc_ss = tf->tf_ss;
sc->sc_err = tf->tf_err;
sc->sc_trapno = tf->tf_trapno;
sc->sc_cr2 = p->p_addr->u_pcb.pcb_cr2;
sc->sc_cr2 = l->l_addr->u_pcb.pcb_cr2;
sc->sc_387 = NULL;
/* Save signal stack. */
@ -253,15 +254,15 @@ linux_rt_sendsig(sig, mask, code)
sigset_t *mask;
u_long code;
{
struct proc *p = curproc;
struct lwp *l = curlwp;
struct proc *p = l->l_proc;
struct trapframe *tf;
struct linux_rt_sigframe *fp, frame;
int onstack;
sig_t catcher = SIGACTION(p, sig).sa_handler;
struct sigaltstack *sas = &p->p_sigctx.ps_sigstk;
tf = p->p_md.md_regs;
tf = l->l_md.md_regs;
/* Do we need to jump onto the signal stack? */
onstack = (sas->ss_flags & (SS_DISABLE | SS_ONSTACK)) == 0 &&
(SIGACTION(p, sig).sa_flags & SA_ONSTACK) != 0;
@ -290,14 +291,14 @@ linux_rt_sendsig(sig, mask, code)
(void)memset(&frame.sf_si, 0, sizeof(frame.sf_si));
/* Save register context. */
linux_savecontext(p, tf, mask, &frame.sf_sc);
linux_savecontext(l, tf, mask, &frame.sf_sc);
if (copyout(&frame, fp, sizeof(frame)) != 0) {
/*
* Process has trashed its stack; give it an illegal
* instruction to halt it in its tracks.
*/
sigexit(p, SIGILL);
sigexit(l, SIGILL);
/* NOTREACHED */
}
@ -326,14 +327,15 @@ linux_old_sendsig(sig, mask, code)
sigset_t *mask;
u_long code;
{
struct proc *p = curproc;
struct lwp *l = curlwp;
struct proc *p = l->l_proc;
struct trapframe *tf;
struct linux_sigframe *fp, frame;
int onstack;
sig_t catcher = SIGACTION(p, sig).sa_handler;
struct sigaltstack *sas = &p->p_sigctx.ps_sigstk;
tf = p->p_md.md_regs;
tf = l->l_md.md_regs;
/* Do we need to jump onto the signal stack? */
onstack = (sas->ss_flags & (SS_DISABLE | SS_ONSTACK)) == 0 &&
@ -354,14 +356,14 @@ linux_old_sendsig(sig, mask, code)
frame.sf_handler = catcher;
frame.sf_sig = native_to_linux_signo[sig];
linux_savecontext(p, tf, mask, &frame.sf_sc);
linux_savecontext(l, tf, mask, &frame.sf_sc);
if (copyout(&frame, fp, sizeof(frame)) != 0) {
/*
* Process has trashed its stack; give it an illegal
* instruction to halt it in its tracks.
*/
sigexit(p, SIGILL);
sigexit(l, SIGILL);
/* NOTREACHED */
}
@ -394,8 +396,8 @@ linux_old_sendsig(sig, mask, code)
* a machine fault.
*/
int
linux_sys_rt_sigreturn(p, v, retval)
struct proc *p;
linux_sys_rt_sigreturn(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -404,14 +406,15 @@ linux_sys_rt_sigreturn(p, v, retval)
}
int
linux_sys_sigreturn(p, v, retval)
struct proc *p;
linux_sys_sigreturn(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
struct linux_sys_sigreturn_args /* {
syscallarg(struct linux_sigcontext *) scp;
} */ *uap = v;
struct proc *p = l->l_proc;
struct linux_sigcontext *scp, context;
struct trapframe *tf;
sigset_t mask;
@ -428,7 +431,7 @@ linux_sys_sigreturn(p, v, retval)
return EFAULT;
/* Restore register context. */
tf = p->p_md.md_regs;
tf = l->l_md.md_regs;
DPRINTF(("sigreturn enter esp=%x eip=%x\n", tf->tf_esp, tf->tf_eip));
#ifdef VM86
@ -439,7 +442,7 @@ linux_sys_sigreturn(p, v, retval)
tf->tf_vm86_fs = context.sc_fs;
tf->tf_vm86_es = context.sc_es;
tf->tf_vm86_ds = context.sc_ds;
set_vflags(p, context.sc_eflags);
set_vflags(l, context.sc_eflags);
p->p_md.md_syscall = syscall_vm86;
} else
#endif
@ -498,8 +501,8 @@ linux_sys_sigreturn(p, v, retval)
#ifdef USER_LDT
int
linux_read_ldt(p, uap, retval)
struct proc *p;
linux_read_ldt(l, uap, retval)
struct lwp *l;
struct linux_sys_modify_ldt_args /* {
syscallarg(int) func;
syscallarg(void *) ptr;
@ -507,6 +510,7 @@ linux_read_ldt(p, uap, retval)
} */ *uap;
register_t *retval;
{
struct proc *p = l->l_proc;
struct i386_get_ldt_args gl;
int error;
caddr_t sg;
@ -524,7 +528,7 @@ linux_read_ldt(p, uap, retval)
if ((error = copyout(&gl, parms, sizeof(gl))) != 0)
return (error);
if ((error = i386_get_ldt(p, parms, retval)) != 0)
if ((error = i386_get_ldt(l, parms, retval)) != 0)
return (error);
*retval *= sizeof(union descriptor);
@ -544,8 +548,8 @@ struct linux_ldt_info {
};
int
linux_write_ldt(p, uap, retval)
struct proc *p;
linux_write_ldt(l, uap, retval)
struct lwp *l;
struct linux_sys_modify_ldt_args /* {
syscallarg(int) func;
syscallarg(void *) ptr;
@ -553,6 +557,7 @@ linux_write_ldt(p, uap, retval)
} */ *uap;
register_t *retval;
{
struct proc *p = l->l_proc;
struct linux_ldt_info ldt_info;
struct segment_descriptor sd;
struct i386_set_ldt_args sl;
@ -613,7 +618,7 @@ linux_write_ldt(p, uap, retval)
if ((error = copyout(&sl, parms, sizeof(sl))) != 0)
return (error);
if ((error = i386_set_ldt(p, parms, retval)) != 0)
if ((error = i386_set_ldt(l, parms, retval)) != 0)
return (error);
*retval = 0;
@ -623,8 +628,8 @@ linux_write_ldt(p, uap, retval)
#endif /* USER_LDT */
int
linux_sys_modify_ldt(p, v, retval)
struct proc *p;
linux_sys_modify_ldt(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -637,19 +642,19 @@ linux_sys_modify_ldt(p, v, retval)
switch (SCARG(uap, func)) {
#ifdef USER_LDT
case 0:
return linux_read_ldt(p, uap, retval);
return linux_read_ldt(l, uap, retval);
case 1:
retval[0] = 1;
return linux_write_ldt(p, uap, retval);
return linux_write_ldt(l, uap, retval);
case 2:
#ifdef notyet
return (linux_read_default_ldt(p, uap, retval);
return (linux_read_default_ldt(l, uap, retval);
#else
return (ENOSYS);
#endif
case 0x11:
retval[0] = 0;
return linux_write_ldt(p, uap, retval);
return linux_write_ldt(l, uap, retval);
#endif /* USER_LDT */
default:
@ -881,7 +886,8 @@ linux_machdepioctl(p, v, retval)
break;
case LINUX_VT_GETMODE:
SCARG(&bia, com) = VT_GETMODE;
if ((error = sys_ioctl(p, &bia, retval)))
/* XXX NJWLWP */
if ((error = sys_ioctl(curlwp, &bia, retval)))
return error;
if ((error = copyin(SCARG(uap, data), (caddr_t)&lvt,
sizeof (struct vt_mode))))
@ -1014,7 +1020,8 @@ linux_machdepioctl(p, v, retval)
return error;
}
SCARG(&bia, com) = com;
return sys_ioctl(p, &bia, retval);
/* XXX NJWLWP */
return sys_ioctl(curlwp, &bia, retval);
}
/*
@ -1023,8 +1030,8 @@ linux_machdepioctl(p, v, retval)
* to rely on I/O permission maps, which are not implemented.
*/
int
linux_sys_iopl(p, v, retval)
struct proc *p;
linux_sys_iopl(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -1033,7 +1040,8 @@ linux_sys_iopl(p, v, retval)
syscallarg(int) level;
} */ *uap = v;
#endif
struct trapframe *fp = p->p_md.md_regs;
struct proc *p = l->l_proc;
struct trapframe *fp = l->l_md.md_regs;
if (suser(p->p_ucred, &p->p_acflag) != 0)
return EPERM;
@ -1047,8 +1055,8 @@ linux_sys_iopl(p, v, retval)
* just let it have the whole range.
*/
int
linux_sys_ioperm(p, v, retval)
struct proc *p;
linux_sys_ioperm(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -1057,7 +1065,8 @@ linux_sys_ioperm(p, v, retval)
syscallarg(unsigned int) hi;
syscallarg(int) val;
} */ *uap = v;
struct trapframe *fp = p->p_md.md_regs;
struct proc *p = l->l_proc;
struct trapframe *fp = l->l_md.md_regs;
if (suser(p->p_ucred, &p->p_acflag) != 0)
return EPERM;

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_ptrace.c,v 1.10 2002/12/08 11:20:22 junyoung Exp $ */
/* $NetBSD: linux_ptrace.c,v 1.11 2003/01/18 08:02:48 thorpej Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.10 2002/12/08 11:20:22 junyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.11 2003/01/18 08:02:48 thorpej Exp $");
#include <sys/param.h>
#include <sys/malloc.h>
@ -45,6 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.10 2002/12/08 11:20:22 junyoung E
#include <sys/proc.h>
#include <sys/ptrace.h>
#include <sys/systm.h>
#include <sys/sa.h>
#include <sys/syscallargs.h>
#include <uvm/uvm_extern.h>
@ -124,8 +125,8 @@ struct linux_user {
#define ISSET(t, f) ((t) & (f))
int
linux_sys_ptrace_arch(p, v, retval)
struct proc *p;
linux_sys_ptrace_arch(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -135,8 +136,10 @@ linux_sys_ptrace_arch(p, v, retval)
syscallarg(int) addr;
syscallarg(int) data;
} */ *uap = v;
struct proc *p = l->l_proc;
int request, error;
struct proc *t; /* target process */
struct lwp *lt;
struct reg *regs = NULL;
struct fpreg *fpregs = NULL;
struct linux_reg *linux_regs = NULL;
@ -183,6 +186,17 @@ linux_sys_ptrace_arch(p, v, retval)
if (t->p_stat != SSTOP || !ISSET(t->p_flag, P_WAITED))
return EBUSY;
/* XXX NJWLWP
* The entire ptrace interface needs work to be useful to
* a process with multiple LWPs. For the moment, we'll
* just kluge this and fail on others.
*/
if (p->p_nlwps > 1)
return (ENOSYS);
lt = LIST_FIRST(&t->p_lwps);
*retval = 0;
switch (request) {
@ -191,7 +205,7 @@ linux_sys_ptrace_arch(p, v, retval)
MALLOC(linux_regs, struct linux_reg*, sizeof(struct linux_reg),
M_TEMP, M_WAITOK);
error = process_read_regs(t, regs);
error = process_read_regs(lt, regs);
if (error != 0)
goto out;
@ -240,7 +254,7 @@ linux_sys_ptrace_arch(p, v, retval)
regs->r_esp = linux_regs->esp;
regs->r_ss = linux_regs->xss;
error = process_write_regs(t, regs);
error = process_write_regs(lt, regs);
goto out;
case LINUX_PTRACE_GETFPREGS:
@ -249,7 +263,7 @@ linux_sys_ptrace_arch(p, v, retval)
MALLOC(linux_fpregs, struct linux_fpctx *,
sizeof(struct linux_fpctx), M_TEMP, M_WAITOK);
error = process_read_fpregs(t, fpregs);
error = process_read_fpregs(lt, fpregs);
if (error != 0)
goto out;
@ -277,13 +291,13 @@ linux_sys_ptrace_arch(p, v, retval)
memcpy(fpregs, linux_fpregs,
min(sizeof(struct linux_fpctx), sizeof(struct fpreg)));
error = process_write_regs(t, regs);
error = process_write_regs(lt, regs);
goto out;
case LINUX_PTRACE_PEEKUSR:
addr = SCARG(uap, addr);
PHOLD(t); /* need full process info */
PHOLD(lt); /* need full process info */
error = 0;
if (addr < LUSR_OFF(lusr_startgdb)) {
/* XXX should provide appropriate register */
@ -328,7 +342,7 @@ linux_sys_ptrace_arch(p, v, retval)
error = 1;
}
PRELE(t);
PRELE(lt);
if (!error)
return 0;
@ -345,9 +359,9 @@ linux_sys_ptrace_arch(p, v, retval)
if (t->p_emul != &emul_linux)
return EINVAL;
PHOLD(t);
PHOLD(lt);
((struct linux_emuldata *)t->p_emuldata)->debugreg[off] = data;
PRELE(t);
PRELE(lt);
return (0);
}

View File

@ -1,4 +1,4 @@
$NetBSD: syscalls.master,v 1.63 2002/04/10 18:18:27 christos Exp $
$NetBSD: syscalls.master,v 1.64 2003/01/18 08:02:48 thorpej Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
@ -42,6 +42,7 @@
#include <sys/systm.h>
#include <sys/signal.h>
#include <sys/mount.h>
#include <sys/sa.h>
#include <sys/syscallargs.h>
#include <compat/linux/common/linux_types.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_machdep.c,v 1.14 2002/07/04 23:32:11 thorpej Exp $ */
/* $NetBSD: linux_machdep.c,v 1.15 2003/01/18 08:02:48 thorpej 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.14 2002/07/04 23:32:11 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.15 2003/01/18 08:02:48 thorpej Exp $");
#define COMPAT_LINUX 1
@ -50,6 +50,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.14 2002/07/04 23:32:11 thorpej E
#include <sys/mount.h>
#include <sys/signal.h>
#include <sys/signalvar.h>
#include <sys/sa.h>
#include <sys/syscallargs.h>
#include <machine/cpu.h>
@ -84,7 +85,7 @@ extern int sigpid;
void setup_linux_sigframe __P((struct frame *frame, int sig, sigset_t *mask,
caddr_t usp));
void setup_linux_rt_sigframe __P((struct frame *frame, int sig, sigset_t *mask,
caddr_t usp, struct proc *p));
caddr_t usp, struct lwp *l));
/*
* Deal with some m68k-specific things in the Linux emulation code.
@ -94,13 +95,13 @@ void setup_linux_rt_sigframe __P((struct frame *frame, int sig, sigset_t *mask,
* Setup registers on program execution.
*/
void
linux_setregs(p, epp, stack)
struct proc *p;
linux_setregs(l, epp, stack)
struct lwp *l;
struct exec_package *epp;
u_long stack;
{
setregs(p, epp, stack);
setregs(l, epp, stack);
}
/*
@ -113,7 +114,8 @@ setup_linux_sigframe(frame, sig, mask, usp)
sigset_t *mask;
caddr_t usp;
{
struct proc *p = curproc;
struct lwp *l = curlwp;
struct proc *p = l->l_proc;
struct linux_sigframe *fp, kf;
short ft;
@ -242,7 +244,7 @@ setup_linux_sigframe(frame, sig, mask, usp)
* Process has trashed its stack; give it a segmentation
* violation to halt it in its tracks.
*/
sigexit(p, SIGSEGV);
sigexit(l, SIGSEGV);
/* NOTREACHED */
}
@ -267,13 +269,14 @@ setup_linux_sigframe(frame, sig, mask, usp)
* Setup signal frame for new RT signal interface.
*/
void
setup_linux_rt_sigframe(frame, sig, mask, usp, p)
setup_linux_rt_sigframe(frame, sig, mask, usp, l)
struct frame *frame;
int sig;
sigset_t *mask;
caddr_t usp;
struct proc *p;
struct lwp *l;
{
struct proc *p = l->l_proc;
struct linux_rt_sigframe *fp, kf;
short ft;
@ -422,7 +425,7 @@ setup_linux_rt_sigframe(frame, sig, mask, usp, p)
* Process has trashed its stack; give it a segmentation
* violation to halt it in its tracks.
*/
sigexit(p, SIGSEGV);
sigexit(l, SIGSEGV);
/* NOTREACHED */
}
@ -453,13 +456,14 @@ linux_sendsig(sig, mask, code)
sigset_t *mask;
u_long code;
{
struct proc *p = curproc;
struct lwp *l = curlwp;
struct proc *p = l->l_proc;
struct frame *frame;
caddr_t usp; /* user stack for signal context */
int onstack;
sig_t catcher = SIGACTION(p, sig).sa_handler;
frame = (struct frame *)p->p_md.md_regs;
frame = (struct frame *)l->l_md.md_regs;
/* Do we need to jump onto the signal stack? */
onstack = (p->p_sigctx.ps_sigstk.ss_flags & (SS_DISABLE | SS_ONSTACK)) == 0 &&
@ -474,7 +478,7 @@ linux_sendsig(sig, mask, code)
/* Setup the signal frame (and part of the trapframe). */
if (SIGACTION(p, sig).sa_flags & SA_SIGINFO)
setup_linux_rt_sigframe(frame, sig, mask, usp, p);
setup_linux_rt_sigframe(frame, sig, mask, usp, l);
else
setup_linux_sigframe(frame, sig, mask, usp);
@ -509,11 +513,12 @@ linux_sendsig(sig, mask, code)
*/
/* ARGSUSED */
int
linux_sys_sigreturn(p, v, retval)
struct proc *p;
linux_sys_sigreturn(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
struct proc *p = l->l_proc;
struct frame *frame;
struct linux_sigc2 tsigc2; /* extra mask and sigcontext */
struct linux_sigcontext *scp; /* pointer to sigcontext */
@ -525,7 +530,7 @@ linux_sys_sigreturn(p, v, retval)
* sigreturn of Linux/m68k takes no arguments.
* The user stack points at struct linux_sigc2.
*/
frame = (struct frame *) p->p_md.md_regs;
frame = (struct frame *) l->l_md.md_regs;
usp = frame->f_regs[SP];
if (usp & 1)
goto bad;
@ -538,7 +543,7 @@ linux_sys_sigreturn(p, v, retval)
/* Grab whole of the sigcontext. */
if (copyin((caddr_t) usp, &tsigc2, sizeof tsigc2))
bad: sigexit(p, SIGSEGV);
bad: sigexit(l, SIGSEGV);
scp = &tsigc2.c_sc;
@ -660,11 +665,12 @@ bad: sigexit(p, SIGSEGV);
/* ARGSUSED */
int
linux_sys_rt_sigreturn(p, v, retval)
struct proc *p;
linux_sys_rt_sigreturn(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
struct proc *p = l->l_proc;
struct frame *frame;
struct linux_ucontext *ucp; /* ucontext in user space */
struct linux_ucontext tuc; /* copy of *ucp */
@ -676,7 +682,7 @@ linux_sys_rt_sigreturn(p, v, retval)
* usp + 4 is a pointer to siginfo structure,
* usp + 8 is a pointer to ucontext structure.
*/
frame = (struct frame *) p->p_md.md_regs;
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 */
@ -688,7 +694,7 @@ linux_sys_rt_sigreturn(p, v, retval)
/* Grab whole of the ucontext. */
if (copyin(ucp, &tuc, sizeof tuc))
bad: sigexit(p, SIGSEGV);
bad: sigexit(l, SIGSEGV);
/*
* Check kernel stack and re-enter to syscall() if needed.
@ -814,8 +820,8 @@ bad: sigexit(p, SIGSEGV);
/* ARGSUSED */
int
linux_sys_cacheflush(p, v, retval)
struct proc *p;
linux_sys_cacheflush(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -825,6 +831,7 @@ linux_sys_cacheflush(p, v, retval)
syscallarg(int) cache;
syscallarg(unsigned long) len;
} */ *uap = v;
struct proc *p = l->l_proc;
int scope, cache;
vaddr_t addr;
int len;
@ -914,5 +921,5 @@ linux_machdepioctl(p, v, retval)
return EINVAL;
}
SCARG(&bia, com) = com;
return sys_ioctl(p, &bia, retval);
return sys_ioctl(curlwp, &bia, retval);
}

View File

@ -1,4 +1,4 @@
$NetBSD: syscalls.master,v 1.39 2002/05/12 13:55:54 jdolecek Exp $
$NetBSD: syscalls.master,v 1.40 2003/01/18 08:02:49 thorpej Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
@ -43,6 +43,7 @@
#include <sys/systm.h>
#include <sys/signal.h>
#include <sys/mount.h>
#include <sys/sa.h>
#include <sys/syscallargs.h>
#include <compat/linux/common/linux_types.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_machdep.c,v 1.16 2002/09/25 22:21:35 thorpej Exp $ */
/* $NetBSD: linux_machdep.c,v 1.17 2003/01/18 08:02:49 thorpej Exp $ */
/*-
* Copyright (c) 1995, 2000, 2001 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.16 2002/09/25 22:21:35 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.17 2003/01/18 08:02:49 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -57,6 +57,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.16 2002/09/25 22:21:35 thorpej E
#include <sys/mount.h>
#include <sys/vnode.h>
#include <sys/device.h>
#include <sys/sa.h>
#include <sys/syscallargs.h>
#include <sys/filedesc.h>
#include <sys/exec_elf.h>
@ -101,12 +102,12 @@ __KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.16 2002/09/25 22:21:35 thorpej E
* entry uses NetBSD's native setregs instead of linux_setregs
*/
void
linux_setregs(p, pack, stack)
struct proc *p;
linux_setregs(l, pack, stack)
struct lwp *l;
struct exec_package *pack;
u_long stack;
{
setregs(p, pack, stack);
setregs(l, pack, stack);
return;
}
@ -125,7 +126,8 @@ linux_sendsig(sig, mask, code) /* XXX Check me */
sigset_t *mask;
u_long code;
{
struct proc *p = curproc;
struct lwp *l = curlwp;
struct proc *p = l->l_proc;
struct linux_sigframe *fp;
struct frame *f;
int i,onstack;
@ -135,7 +137,7 @@ linux_sendsig(sig, mask, code) /* XXX Check me */
#ifdef DEBUG_LINUX
printf("linux_sendsig()\n");
#endif /* DEBUG_LINUX */
f = (struct frame *)p->p_md.md_regs;
f = (struct frame *)l->l_md.md_regs;
/*
* Do we need to jump onto the signal stack?
@ -201,7 +203,7 @@ linux_sendsig(sig, mask, code) /* XXX Check me */
#ifdef DEBUG_LINUX
printf("linux_sendsig: stack trashed\n");
#endif /* DEBUG_LINUX */
sigexit(p, SIGILL);
sigexit(l, SIGILL);
/* NOTREACHED */
}
@ -233,14 +235,15 @@ linux_sendsig(sig, mask, code) /* XXX Check me */
* stack state from context left by sendsig (above).
*/
int
linux_sys_sigreturn(p, v, retval)
struct proc *p;
linux_sys_sigreturn(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
struct linux_sys_sigreturn_args /* {
syscallarg(struct linux_sigframe *) sf;
} */ *uap = v;
struct proc *p = l->l_proc;
struct linux_sigframe *sf, ksf;
struct frame *f;
sigset_t mask;
@ -261,7 +264,7 @@ linux_sys_sigreturn(p, v, retval)
return (error);
/* Restore the register context. */
f = (struct frame *)p->p_md.md_regs;
f = (struct frame *)l->l_md.md_regs;
for (i=0; i<32; i++)
f->f_regs[i] = ksf.lsf_sc.lsc_regs[i];
f->f_regs[MULLO] = ksf.lsf_sc.lsc_mdlo;
@ -282,19 +285,19 @@ linux_sys_sigreturn(p, v, retval)
int
linux_sys_rt_sigreturn(p, v, retval)
struct proc *p;
linux_sys_rt_sigreturn(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
return 0;
return (ENOSYS);
}
#if 0
int
linux_sys_modify_ldt(p, v, retval)
struct proc *p;
linux_sys_modify_ldt(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -338,8 +341,8 @@ linux_machdepioctl(p, v, retval)
* just let it have the whole range.
*/
int
linux_sys_ioperm(p, v, retval)
struct proc *p;
linux_sys_ioperm(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -356,8 +359,8 @@ linux_sys_ioperm(p, v, retval)
* wrapper linux_sys_new_uname() -> linux_sys_uname()
*/
int
linux_sys_new_uname(p, v, retval)
struct proc *p;
linux_sys_new_uname(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -380,18 +383,18 @@ linux_sys_new_uname(p, v, retval)
return copyout(&luts, SCARG(uap, up), sizeof(luts));
#else
return linux_sys_uname(p, v, retval);
return linux_sys_uname(l, v, retval);
#endif
}
/*
* In Linux, cacheflush is icurrently implemented
* In Linux, cacheflush is currently implemented
* as a whole cache flush (arguments are ignored)
* we emulate this broken beahior.
*/
int
linux_sys_cacheflush(p, v, retval)
struct proc *p;
linux_sys_cacheflush(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -405,8 +408,8 @@ linux_sys_cacheflush(p, v, retval)
* some binaries and some libraries use it.
*/
int
linux_sys_sysmips(p, v, retval)
struct proc *p;
linux_sys_sysmips(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -416,6 +419,7 @@ linux_sys_sysmips(p, v, retval)
syscallarg(int) arg2;
syscallarg(int) arg3;
} *uap = v;
struct proc *p = l->l_proc;
int error;
switch (SCARG(uap, cmd)) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_ptrace.c,v 1.3 2001/11/15 09:48:00 lukem Exp $ */
/* $NetBSD: linux_ptrace.c,v 1.4 2003/01/18 08:02:49 thorpej Exp $ */
/*-
* Copyright (c) 1999, 2001 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.3 2001/11/15 09:48:00 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.4 2003/01/18 08:02:49 thorpej Exp $");
#include <sys/param.h>
#include <sys/malloc.h>
@ -45,6 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.3 2001/11/15 09:48:00 lukem Exp $
#include <sys/proc.h>
#include <sys/ptrace.h>
#include <sys/systm.h>
#include <sys/sa.h>
#include <sys/syscallargs.h>
#include <uvm/uvm_extern.h>
@ -64,8 +65,8 @@ __KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.3 2001/11/15 09:48:00 lukem Exp $
#include <lib/libkern/libkern.h> /* for offsetof() */
int
linux_sys_ptrace_arch(p, v, retval) /* XXX write me! */
struct proc *p;
linux_sys_ptrace_arch(l, v, retval) /* XXX write me! */
struct lwp *l;
void *v;
register_t *retval;
{

View File

@ -1,4 +1,4 @@
$NetBSD: syscalls.master,v 1.9 2002/04/10 18:18:28 christos Exp $
$NetBSD: syscalls.master,v 1.10 2003/01/18 08:02:49 thorpej Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
@ -50,6 +50,7 @@
#include <sys/systm.h>
#include <sys/signal.h>
#include <sys/mount.h>
#include <sys/sa.h>
#include <sys/syscallargs.h>
#include <compat/linux/common/linux_types.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_exec_powerpc.c,v 1.8 2002/11/13 13:37:22 jdolecek Exp $ */
/* $NetBSD: linux_exec_powerpc.c,v 1.9 2003/01/18 08:02:49 thorpej Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -48,7 +48,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: linux_exec_powerpc.c,v 1.8 2002/11/13 13:37:22 jdolecek Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux_exec_powerpc.c,v 1.9 2003/01/18 08:02:49 thorpej Exp $");
#if defined (__alpha__)
#define ELFSIZE 64
@ -139,7 +139,7 @@ ELFNAME2(linux,copyargs)(p, pack, arginfo, stackp, argp)
/*
* The exec_package doesn't have a proc pointer and it's not
* exactly trivial to add one since the credentials are
* changing. XXX Linux uses curproc's credentials.
* changing. XXX Linux uses curlwp's credentials.
* Why can't we use them too?
*/
a->a_type = LINUX_AT_EGID;

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_machdep.c,v 1.19 2002/09/25 22:21:35 thorpej Exp $ */
/* $NetBSD: linux_machdep.c,v 1.20 2003/01/18 08:02:50 thorpej Exp $ */
/*-
* Copyright (c) 1995, 2000, 2001 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.19 2002/09/25 22:21:35 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.20 2003/01/18 08:02:50 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -57,6 +57,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.19 2002/09/25 22:21:35 thorpej E
#include <sys/mount.h>
#include <sys/vnode.h>
#include <sys/device.h>
#include <sys/sa.h>
#include <sys/syscallargs.h>
#include <sys/filedesc.h>
#include <sys/exec_elf.h>
@ -97,12 +98,12 @@ __KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.19 2002/09/25 22:21:35 thorpej E
* entry uses NetBSD's native setregs instead of linux_setregs
*/
void
linux_setregs(p, pack, stack)
struct proc *p;
linux_setregs(l, pack, stack)
struct lwp *l;
struct exec_package *pack;
u_long stack;
{
setregs(p, pack, stack);
setregs(l, pack, stack);
}
/*
@ -121,7 +122,8 @@ linux_sendsig(sig, mask, code) /* XXX Check me */
sigset_t *mask;
u_long code;
{
struct proc *p = curproc;
struct lwp *l = curlwp;
struct proc *p = l->l_proc;
struct trapframe *tf;
sig_t catcher = SIGACTION(p, sig).sa_handler;
struct linux_sigregs frame;
@ -131,7 +133,7 @@ linux_sendsig(sig, mask, code) /* XXX Check me */
int onstack;
int i;
tf = trapframe(p);
tf = trapframe(l);
/*
* Do we need to jump onto the signal stack?
@ -195,7 +197,7 @@ linux_sendsig(sig, mask, code) /* XXX Check me */
memset(&frame, 0, sizeof(frame));
memcpy(&frame.lgp_regs, &linux_regs, sizeof(linux_regs));
save_fpu_proc(curproc);
save_fpu_lwp(curlwp);
memcpy(&frame.lfp_regs, curpcb->pcb_fpu.fpr, sizeof(frame.lfp_regs));
/*
@ -217,7 +219,7 @@ linux_sendsig(sig, mask, code) /* XXX Check me */
* Process has trashed its stack; give it an illegal
* instruction to halt it in its tracks.
*/
sigexit(p, SIGILL);
sigexit(l, SIGILL);
/* NOTREACHED */
}
@ -230,7 +232,7 @@ linux_sendsig(sig, mask, code) /* XXX Check me */
* Process has trashed its stack; give it an illegal
* instruction to halt it in its tracks.
*/
sigexit(p, SIGILL);
sigexit(l, SIGILL);
/* NOTREACHED */
}
@ -270,14 +272,15 @@ linux_sendsig(sig, mask, code) /* XXX Check me */
* XXX not tested
*/
int
linux_sys_rt_sigreturn(p, v, retval)
struct proc *p;
linux_sys_rt_sigreturn(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
struct linux_sys_rt_sigreturn_args /* {
syscallarg(struct linux_rt_sigframe *) sfp;
} */ *uap = v;
struct proc *p = l->l_proc;
struct linux_rt_sigframe *scp, sigframe;
struct linux_sigregs sregs;
struct linux_pt_regs *lregs;
@ -301,7 +304,7 @@ linux_sys_rt_sigreturn(p, v, retval)
/*
* Make sure, fpu is sync'ed
*/
save_fpu_proc(curproc);
save_fpu_lwp(curlwp);
/*
* Restore register context.
@ -311,7 +314,7 @@ linux_sys_rt_sigreturn(p, v, retval)
return (EFAULT);
lregs = (struct linux_pt_regs *)&sregs.lgp_regs;
tf = trapframe(p);
tf = trapframe(l);
#ifdef DEBUG_LINUX
printf("linux_sys_sigreturn: trapframe=0x%lx scp=0x%lx\n",
(unsigned long)tf, (unsigned long)scp);
@ -359,14 +362,15 @@ linux_sys_rt_sigreturn(p, v, retval)
* The following needs code review for potential security issues
*/
int
linux_sys_sigreturn(p, v, retval)
struct proc *p;
linux_sys_sigreturn(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
struct linux_sys_sigreturn_args /* {
syscallarg(struct linux_sigcontext *) scp;
} */ *uap = v;
struct proc *p = l->l_proc;
struct linux_sigcontext *scp, context;
struct linux_sigregs sregs;
struct linux_pt_regs *lregs;
@ -390,7 +394,7 @@ linux_sys_sigreturn(p, v, retval)
/*
* Make sure, fpu is in sync
*/
save_fpu_proc(curproc);
save_fpu_lwp(curlwp);
/*
* Restore register context.
@ -399,7 +403,7 @@ linux_sys_sigreturn(p, v, retval)
return (EFAULT);
lregs = (struct linux_pt_regs *)&sregs.lgp_regs;
tf = trapframe(p);
tf = trapframe(l);
#ifdef DEBUG_LINUX
printf("linux_sys_sigreturn: trapframe=0x%lx scp=0x%lx\n",
(unsigned long)tf, (unsigned long)scp);
@ -499,7 +503,8 @@ linux_machdepioctl(p, v, retval)
return EINVAL;
}
SCARG(&bia, com) = com;
return sys_ioctl(p, &bia, retval);
/* XXX NJWLWP */
return sys_ioctl(curlwp, &bia, retval);
}
#if 0
/*
@ -508,8 +513,8 @@ linux_machdepioctl(p, v, retval)
* to rely on I/O permission maps, which are not implemented.
*/
int
linux_sys_iopl(p, v, retval)
struct proc *p;
linux_sys_iopl(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -528,8 +533,8 @@ linux_sys_iopl(p, v, retval)
* just let it have the whole range.
*/
int
linux_sys_ioperm(p, v, retval)
struct proc *p;
linux_sys_ioperm(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -546,22 +551,22 @@ linux_sys_ioperm(p, v, retval)
* wrapper linux_sys_new_uname() -> linux_sys_uname()
*/
int
linux_sys_new_uname(p, v, retval)
struct proc *p;
linux_sys_new_uname(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
return linux_sys_uname(p, v, retval);
return linux_sys_uname(l, v, retval);
}
/*
* wrapper linux_sys_new_select() -> linux_sys_select()
*/
int
linux_sys_new_select(p, v, retval)
struct proc *p;
linux_sys_new_select(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
return linux_sys_select(p, v, retval);
return linux_sys_select(l, v, retval);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_ptrace.c,v 1.9 2001/11/15 09:48:00 lukem Exp $ */
/* $NetBSD: linux_ptrace.c,v 1.10 2003/01/18 08:02:50 thorpej Exp $ */
/*-
* Copyright (c) 1999, 2001 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.9 2001/11/15 09:48:00 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.10 2003/01/18 08:02:50 thorpej Exp $");
#include <sys/param.h>
#include <sys/malloc.h>
@ -45,6 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_ptrace.c,v 1.9 2001/11/15 09:48:00 lukem Exp $
#include <sys/proc.h>
#include <sys/ptrace.h>
#include <sys/systm.h>
#include <sys/sa.h>
#include <sys/syscallargs.h>
#include <uvm/uvm_extern.h>
@ -102,8 +103,8 @@ struct linux_user {
#define ISSET(t, f) ((t) & (f))
int
linux_sys_ptrace_arch(p, v, retval) /* XXX Check me! (From NetBSD/i386) */
struct proc *p;
linux_sys_ptrace_arch(l, v, retval) /* XXX Check me! (From NetBSD/i386) */
struct lwp *l;
void *v;
register_t *retval;
{
@ -114,7 +115,9 @@ linux_sys_ptrace_arch(p, v, retval) /* XXX Check me! (From NetBSD/i386) */
syscallarg(int) data;
} */ *uap = v;
int request, error;
struct proc *p = l->l_proc;
struct proc *t; /* target process */
struct lwp *lt;
struct reg *regs = NULL;
struct fpreg *fpregs = NULL;
struct linux_pt_regs *linux_regs = NULL;
@ -164,6 +167,7 @@ linux_sys_ptrace_arch(p, v, retval) /* XXX Check me! (From NetBSD/i386) */
if (t->p_stat != SSTOP || !ISSET(t->p_flag, P_WAITED))
return EBUSY;
lt = LIST_FIRST(&t->p_lwps);
*retval = 0;
switch (request) {
@ -172,7 +176,7 @@ linux_sys_ptrace_arch(p, v, retval) /* XXX Check me! (From NetBSD/i386) */
MALLOC(linux_regs, struct linux_pt_regs*, sizeof(*linux_regs),
M_TEMP, M_WAITOK);
error = process_read_regs(t, regs);
error = process_read_regs(lt, regs);
if (error != 0)
goto out;
@ -214,7 +218,7 @@ linux_sys_ptrace_arch(p, v, retval) /* XXX Check me! (From NetBSD/i386) */
regs->ctr = linux_regs->lctr;
regs->pc = linux_regs->lnip; /* XXX */
error = process_write_regs(t, regs);
error = process_write_regs(lt, regs);
goto out;
case LINUX_PTRACE_GETFPREGS:
@ -223,7 +227,7 @@ linux_sys_ptrace_arch(p, v, retval) /* XXX Check me! (From NetBSD/i386) */
MALLOC(linux_fpreg, double *,
32*sizeof(double), M_TEMP, M_WAITOK);
error = process_read_fpregs(t, fpregs);
error = process_read_fpregs(lt, fpregs);
if (error != 0)
goto out;
@ -251,17 +255,17 @@ linux_sys_ptrace_arch(p, v, retval) /* XXX Check me! (From NetBSD/i386) */
memcpy(fpregs, linux_fpreg,
min(32*sizeof(double), sizeof(struct fpreg)));
error = process_write_fpregs(t, fpregs);
error = process_write_fpregs(lt, fpregs);
goto out;
case LINUX_PTRACE_PEEKUSR:
addr = SCARG(uap, addr);
MALLOC(regs, struct reg*, sizeof(struct reg), M_TEMP, M_WAITOK);
error = process_read_regs(t, regs);
error = process_read_regs(lt, regs);
if (error)
goto out;
PHOLD(t); /* need full process info */
PHOLD(lt); /* need full process info */
error = 0;
if ((addr < LUSR_OFF(lusr_startgdb)) ||
(addr > LUSR_OFF(lu_comm_end)))
@ -304,7 +308,7 @@ linux_sys_ptrace_arch(p, v, retval) /* XXX Check me! (From NetBSD/i386) */
error = 1;
}
PRELE(t);
PRELE(lt);
if (error)
goto out;
@ -320,11 +324,11 @@ linux_sys_ptrace_arch(p, v, retval) /* XXX Check me! (From NetBSD/i386) */
case LINUX_PTRACE_POKEUSR: /* XXX Not tested */
addr = SCARG(uap, addr);
MALLOC(regs, struct reg*, sizeof(struct reg), M_TEMP, M_WAITOK);
error = process_read_regs(t, regs);
error = process_read_regs(lt, regs);
if (error)
goto out;
PHOLD(t); /* need full process info */
PHOLD(lt); /* need full process info */
error = 0;
if ((addr < LUSR_OFF(lusr_startgdb)) ||
(addr > LUSR_OFF(lu_comm_end)))
@ -366,9 +370,9 @@ linux_sys_ptrace_arch(p, v, retval) /* XXX Check me! (From NetBSD/i386) */
error = 1;
}
PRELE(t);
PRELE(lt);
error = process_write_regs(t,regs);
error = process_write_regs(lt,regs);
if (error)
goto out;

View File

@ -1,4 +1,4 @@
$NetBSD: syscalls.master,v 1.13 2002/05/19 17:55:42 jdolecek Exp $
$NetBSD: syscalls.master,v 1.14 2003/01/18 08:02:50 thorpej Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
@ -72,6 +72,7 @@
#include <sys/systm.h>
#include <sys/signal.h>
#include <sys/mount.h>
#include <sys/sa.h>
#include <sys/syscallargs.h>
#include <compat/linux/common/linux_types.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_blkio.c,v 1.5 2001/11/13 02:08:48 lukem Exp $ */
/* $NetBSD: linux_blkio.c,v 1.6 2003/01/18 08:02:50 thorpej Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: linux_blkio.c,v 1.5 2001/11/13 02:08:48 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux_blkio.c,v 1.6 2003/01/18 08:02:50 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -47,6 +47,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_blkio.c,v 1.5 2001/11/13 02:08:48 lukem Exp $"
#include <sys/proc.h>
#include <sys/disklabel.h>
#include <sys/sa.h>
#include <sys/syscallargs.h>
#include <compat/linux/common/linux_types.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_break.c,v 1.50 2001/11/13 02:08:48 lukem Exp $ */
/* $NetBSD: linux_break.c,v 1.51 2003/01/18 08:02:50 thorpej Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@ -37,12 +37,13 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: linux_break.c,v 1.50 2001/11/13 02:08:48 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux_break.c,v 1.51 2003/01/18 08:02:50 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/mount.h>
#include <sys/sa.h>
#include <sys/syscallargs.h>
#include <compat/linux/common/linux_types.h>
@ -62,8 +63,8 @@ __KERNEL_RCSID(0, "$NetBSD: linux_break.c,v 1.50 2001/11/13 02:08:48 lukem Exp $
* world uses this anymore
*/
int
linux_sys_break(p, v, retval)
struct proc *p;
linux_sys_break(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_cdrom.c,v 1.13 2002/03/22 17:14:18 christos Exp $ */
/* $NetBSD: linux_cdrom.c,v 1.14 2003/01/18 08:02:51 thorpej Exp $ */
/*
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: linux_cdrom.c,v 1.13 2002/03/22 17:14:18 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux_cdrom.c,v 1.14 2003/01/18 08:02:51 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -46,6 +46,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_cdrom.c,v 1.13 2002/03/22 17:14:18 christos Ex
#include <sys/cdio.h>
#include <sys/dvdio.h>
#include <sys/sa.h>
#include <sys/syscallargs.h>
#include <compat/linux/common/linux_types.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_exec.c,v 1.60 2002/11/01 19:26:22 jdolecek Exp $ */
/* $NetBSD: linux_exec.c,v 1.61 2003/01/18 08:02:51 thorpej Exp $ */
/*-
* Copyright (c) 1994, 1995, 1998, 2000 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: linux_exec.c,v 1.60 2002/11/01 19:26:22 jdolecek Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux_exec.c,v 1.61 2003/01/18 08:02:51 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -52,6 +52,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_exec.c,v 1.60 2002/11/01 19:26:22 jdolecek Exp
#include <sys/exec_elf.h>
#include <sys/mman.h>
#include <sys/sa.h>
#include <sys/syscallargs.h>
#include <machine/cpu.h>
@ -86,8 +87,8 @@ static void linux_e_proc_init __P((struct proc *, struct vmspace *));
* to the NetBSD execve().
*/
int
linux_sys_execve(p, v, retval)
struct proc *p;
linux_sys_execve(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -96,6 +97,7 @@ linux_sys_execve(p, v, retval)
syscallarg(char **) argv;
syscallarg(char **) envp;
} */ *uap = v;
struct proc *p = l->l_proc;
struct sys_execve_args ap;
caddr_t sg;
@ -106,7 +108,7 @@ linux_sys_execve(p, v, retval)
SCARG(&ap, argp) = SCARG(uap, argp);
SCARG(&ap, envp) = SCARG(uap, envp);
return sys_execve(p, &ap, retval);
return sys_execve(l, &ap, retval);
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_exec.h,v 1.25 2002/11/21 15:20:28 jdolecek Exp $ */
/* $NetBSD: linux_exec.h,v 1.26 2003/01/18 08:02:51 thorpej Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@ -122,11 +122,11 @@ extern const struct emul emul_linux;
int linux_sysctl __P((int *, u_int, void *, size_t *, void *, size_t,
struct proc *));
void linux_setregs __P((struct proc *, struct exec_package *, u_long));
void linux_setregs __P((struct lwp *, struct exec_package *, u_long));
int exec_linux_aout_makecmds __P((struct proc *, struct exec_package *));
int linux_aout_copyargs __P((struct proc *, struct exec_package *,
struct ps_strings *, char **, void *));
void linux_trapsignal __P((struct proc *, int, u_long));
void linux_trapsignal __P((struct lwp *, int, u_long));
#ifdef EXEC_ELF32
int linux_elf32_probe __P((struct proc *, struct exec_package *, void *,

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_exec_aout.c,v 1.50 2002/10/05 22:34:04 chs Exp $ */
/* $NetBSD: linux_exec_aout.c,v 1.51 2003/01/18 08:02:51 thorpej Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: linux_exec_aout.c,v 1.50 2002/10/05 22:34:04 chs Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux_exec_aout.c,v 1.51 2003/01/18 08:02:51 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -55,6 +55,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_exec_aout.c,v 1.50 2002/10/05 22:34:04 chs Exp
#include <sys/exec_elf.h>
#include <sys/mman.h>
#include <sys/sa.h>
#include <sys/syscallargs.h>
#include <machine/cpu.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_exec_elf32.c,v 1.60 2002/11/29 19:13:16 jdolecek Exp $ */
/* $NetBSD: linux_exec_elf32.c,v 1.61 2003/01/18 08:02:51 thorpej Exp $ */
/*-
* Copyright (c) 1995, 1998, 2000, 2001 The NetBSD Foundation, Inc.
@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: linux_exec_elf32.c,v 1.60 2002/11/29 19:13:16 jdolecek Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux_exec_elf32.c,v 1.61 2003/01/18 08:02:51 thorpej Exp $");
#ifndef ELFSIZE
/* XXX should die */
@ -62,6 +62,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_exec_elf32.c,v 1.60 2002/11/29 19:13:16 jdolec
#include <sys/stat.h>
#include <sys/mman.h>
#include <sys/sa.h>
#include <sys/syscallargs.h>
#include <machine/cpu.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_fdio.c,v 1.3 2001/11/13 02:08:51 lukem Exp $ */
/* $NetBSD: linux_fdio.c,v 1.4 2003/01/18 08:02:52 thorpej Exp $ */
/*
* Copyright (c) 2000 Wasabi Systems, Inc.
@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: linux_fdio.c,v 1.3 2001/11/13 02:08:51 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux_fdio.c,v 1.4 2003/01/18 08:02:52 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -49,6 +49,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_fdio.c,v 1.3 2001/11/13 02:08:51 lukem Exp $")
#include <sys/fdio.h>
#include <sys/sa.h>
#include <sys/syscallargs.h>
#include <dev/isa/fdreg.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_file.c,v 1.55 2002/12/17 11:48:02 simonb Exp $ */
/* $NetBSD: linux_file.c,v 1.56 2003/01/18 08:02:52 thorpej Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: linux_file.c,v 1.55 2002/12/17 11:48:02 simonb Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux_file.c,v 1.56 2003/01/18 08:02:52 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -61,6 +61,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_file.c,v 1.55 2002/12/17 11:48:02 simonb Exp $
#include <sys/conf.h>
#include <sys/pipe.h>
#include <sys/sa.h>
#include <sys/syscallargs.h>
#include <compat/linux/common/linux_types.h>
@ -76,7 +77,7 @@ static int bsd_to_linux_ioflags __P((int));
static void bsd_to_linux_flock __P((struct flock *, struct linux_flock *));
static void linux_to_bsd_flock __P((struct linux_flock *, struct flock *));
static void bsd_to_linux_stat __P((struct stat *, struct linux_stat *));
static int linux_stat1 __P((struct proc *, void *, register_t *, int));
static int linux_stat1 __P((struct lwp *, void *, register_t *, int));
/*
* Some file-related calls are handled here. The usual flag conversion
@ -139,8 +140,8 @@ bsd_to_linux_ioflags(bflags)
* Just call open(2) with the TRUNC, CREAT and WRONLY flags.
*/
int
linux_sys_creat(p, v, retval)
struct proc *p;
linux_sys_creat(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -148,6 +149,7 @@ linux_sys_creat(p, v, retval)
syscallarg(const char *) path;
syscallarg(int) mode;
} */ *uap = v;
struct proc *p = l->l_proc;
struct sys_open_args oa;
caddr_t sg;
@ -158,7 +160,7 @@ linux_sys_creat(p, v, retval)
SCARG(&oa, flags) = O_CREAT | O_TRUNC | O_WRONLY;
SCARG(&oa, mode) = SCARG(uap, mode);
return sys_open(p, &oa, retval);
return sys_open(l, &oa, retval);
}
/*
@ -168,8 +170,8 @@ linux_sys_creat(p, v, retval)
* (XXX is this necessary?)
*/
int
linux_sys_open(p, v, retval)
struct proc *p;
linux_sys_open(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -178,6 +180,7 @@ linux_sys_open(p, v, retval)
syscallarg(int) flags;
syscallarg(int) mode;
} */ *uap = v;
struct proc *p = l->l_proc;
int error, fl;
struct sys_open_args boa;
caddr_t sg;
@ -195,7 +198,7 @@ linux_sys_open(p, v, retval)
SCARG(&boa, flags) = fl;
SCARG(&boa, mode) = SCARG(uap, mode);
if ((error = sys_open(p, &boa, retval)))
if ((error = sys_open(l, &boa, retval)))
return error;
/*
@ -276,8 +279,8 @@ linux_to_bsd_flock(lfp, bfp)
* because the flag values and lock structure are different.
*/
int
linux_sys_fcntl(p, v, retval)
struct proc *p;
linux_sys_fcntl(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -286,6 +289,7 @@ linux_sys_fcntl(p, v, retval)
syscallarg(int) cmd;
syscallarg(void *) arg;
} */ *uap = v;
struct proc *p = l->l_proc;
int fd, cmd, error;
u_long val;
caddr_t arg, sg;
@ -319,7 +323,7 @@ linux_sys_fcntl(p, v, retval)
SCARG(&fca, fd) = fd;
SCARG(&fca, cmd) = F_GETFL;
SCARG(&fca, arg) = arg;
if ((error = sys_fcntl(p, &fca, retval)))
if ((error = sys_fcntl(l, &fca, retval)))
return error;
retval[0] = bsd_to_linux_ioflags(retval[0]);
return 0;
@ -327,7 +331,6 @@ linux_sys_fcntl(p, v, retval)
struct file *fp = NULL;
val = linux_to_bsd_ioflags((unsigned long)SCARG(uap, arg));
/*
* Linux seems to have same semantics for sending SIGIO to the
* read side of socket, but slighly different semantics
@ -365,7 +368,7 @@ linux_sys_fcntl(p, v, retval)
SCARG(&fca, cmd) = F_SETFL;
SCARG(&fca, arg) = (caddr_t) val;
error = sys_fcntl(p, &fca, retval);
error = sys_fcntl(l, &fca, retval);
/* Now set the FASYNC flag for pipes */
if (fp) {
@ -387,7 +390,7 @@ linux_sys_fcntl(p, v, retval)
SCARG(&fca, fd) = fd;
SCARG(&fca, cmd) = F_GETLK;
SCARG(&fca, arg) = bfp;
if ((error = sys_fcntl(p, &fca, retval)))
if ((error = sys_fcntl(l, &fca, retval)))
return error;
if ((error = copyin(bfp, &bfl, sizeof bfl)))
return error;
@ -466,7 +469,7 @@ linux_sys_fcntl(p, v, retval)
SCARG(&fca, cmd) = cmd;
SCARG(&fca, arg) = arg;
return sys_fcntl(p, &fca, retval);
return sys_fcntl(l, &fca, retval);
}
/*
@ -506,8 +509,8 @@ bsd_to_linux_stat(bsp, lsp)
* by one function to avoid code duplication.
*/
int
linux_sys_fstat(p, v, retval)
struct proc *p;
linux_sys_fstat(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -515,6 +518,7 @@ linux_sys_fstat(p, v, retval)
syscallarg(int) fd;
syscallarg(linux_stat *) sp;
} */ *uap = v;
struct proc *p = l->l_proc;
struct sys___fstat13_args fsa;
struct linux_stat tmplst;
struct stat *st,tmpst;
@ -528,7 +532,7 @@ linux_sys_fstat(p, v, retval)
SCARG(&fsa, fd) = SCARG(uap, fd);
SCARG(&fsa, sb) = st;
if ((error = sys___fstat13(p, &fsa, retval)))
if ((error = sys___fstat13(l, &fsa, retval)))
return error;
if ((error = copyin(st, &tmpst, sizeof tmpst)))
@ -543,8 +547,8 @@ linux_sys_fstat(p, v, retval)
}
static int
linux_stat1(p, v, retval, dolstat)
struct proc *p;
linux_stat1(l, v, retval, dolstat)
struct lwp *l;
void *v;
register_t *retval;
int dolstat;
@ -552,6 +556,7 @@ linux_stat1(p, v, retval, dolstat)
struct sys___stat13_args sa;
struct linux_stat tmplst;
struct stat *st, tmpst;
struct proc *p = l->l_proc;
caddr_t sg;
int error;
struct linux_sys_stat_args *uap = v;
@ -566,8 +571,8 @@ linux_stat1(p, v, retval, dolstat)
SCARG(&sa, ub) = st;
SCARG(&sa, path) = SCARG(uap, path);
if ((error = (dolstat ? sys___lstat13(p, &sa, retval) :
sys___stat13(p, &sa, retval))))
if ((error = (dolstat ? sys___lstat13(l, &sa, retval) :
sys___stat13(l, &sa, retval))))
return error;
if ((error = copyin(st, &tmpst, sizeof tmpst)))
@ -582,8 +587,8 @@ linux_stat1(p, v, retval, dolstat)
}
int
linux_sys_stat(p, v, retval)
struct proc *p;
linux_sys_stat(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -592,14 +597,14 @@ linux_sys_stat(p, v, retval)
syscallarg(struct linux_stat *) sp;
} */ *uap = v;
return linux_stat1(p, uap, retval, 0);
return linux_stat1(l, uap, retval, 0);
}
/* Note: this is "newlstat" in the Linux sources */
/* (we don't bother with the old lstat currently) */
int
linux_sys_lstat(p, v, retval)
struct proc *p;
linux_sys_lstat(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -608,15 +613,15 @@ linux_sys_lstat(p, v, retval)
syscallarg(struct linux_stat *) sp;
} */ *uap = v;
return linux_stat1(p, uap, retval, 1);
return linux_stat1(l, uap, retval, 1);
}
/*
* The following syscalls are mostly here because of the alternate path check.
*/
int
linux_sys_access(p, v, retval)
struct proc *p;
linux_sys_access(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -624,16 +629,17 @@ linux_sys_access(p, v, retval)
syscallarg(const char *) path;
syscallarg(int) flags;
} */ *uap = v;
struct proc *p = l->l_proc;
caddr_t sg = stackgap_init(p, 0);
CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
return sys_access(p, uap, retval);
return sys_access(l, uap, retval);
}
int
linux_sys_unlink(p, v, retval)
struct proc *p;
linux_sys_unlink(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
@ -641,32 +647,34 @@ linux_sys_unlink(p, v, retval)
struct linux_sys_unlink_args /* {
syscallarg(const char *) path;
} */ *uap = v;
struct proc *p = l->l_proc;
caddr_t sg = stackgap_init(p, 0);
CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
return sys_unlink(p, uap, retval);
return sys_unlink(l, uap, retval);
}
int
linux_sys_chdir(p, v, retval)
struct proc *p;
linux_sys_chdir(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
struct linux_sys_chdir_args /* {
syscallarg(const char *) path;
} */ *uap = v;
struct proc *p = l->l_proc;
caddr_t sg = stackgap_init(p, 0);
CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
return sys_chdir(p, uap, retval);
return sys_chdir(l, uap, retval);
}
int
linux_sys_mknod(p, v, retval)
struct proc *p;
linux_sys_mknod(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -675,6 +683,7 @@ linux_sys_mknod(p, v, retval)
syscallarg(int) mode;
syscallarg(int) dev;
} */ *uap = v;
struct proc *p = l->l_proc;
caddr_t sg = stackgap_init(p, 0);
CHECK_ALT_CREAT(p, &sg, SCARG(uap, path));
@ -687,7 +696,7 @@ linux_sys_mknod(p, v, retval)
SCARG(&bma, path) = SCARG(uap, path);
SCARG(&bma, mode) = SCARG(uap, mode);
return sys_mkfifo(p, &bma, retval);
return sys_mkfifo(l, &bma, retval);
} else {
struct sys_mknod_args bma;
@ -700,13 +709,13 @@ linux_sys_mknod(p, v, retval)
* upper 16bit to remove any random junk.
*/
SCARG(&bma, dev) = SCARG(uap, dev) & 0xffff;
return sys_mknod(p, &bma, retval);
return sys_mknod(l, &bma, retval);
}
}
int
linux_sys_chmod(p, v, retval)
struct proc *p;
linux_sys_chmod(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -714,17 +723,18 @@ linux_sys_chmod(p, v, retval)
syscallarg(const char *) path;
syscallarg(int) mode;
} */ *uap = v;
struct proc *p = l->l_proc;
caddr_t sg = stackgap_init(p, 0);
CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
return sys_chmod(p, uap, retval);
return sys_chmod(l, uap, retval);
}
#if defined(__i386__) || defined(__m68k__) || defined(__arm__)
int
linux_sys_chown16(p, v, retval)
struct proc *p;
linux_sys_chown16(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -733,6 +743,7 @@ linux_sys_chown16(p, v, retval)
syscallarg(int) uid;
syscallarg(int) gid;
} */ *uap = v;
struct proc *p = l->l_proc;
struct sys___posix_chown_args bca;
caddr_t sg = stackgap_init(p, 0);
@ -744,12 +755,12 @@ linux_sys_chown16(p, v, retval)
SCARG(&bca, gid) = ((linux_gid_t)SCARG(uap, gid) == (linux_gid_t)-1) ?
(gid_t)-1 : SCARG(uap, gid);
return sys___posix_chown(p, &bca, retval);
return sys___posix_chown(l, &bca, retval);
}
int
linux_sys_fchown16(p, v, retval)
struct proc *p;
linux_sys_fchown16(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -766,12 +777,12 @@ linux_sys_fchown16(p, v, retval)
SCARG(&bfa, gid) = ((linux_gid_t)SCARG(uap, gid) == (linux_gid_t)-1) ?
(gid_t)-1 : SCARG(uap, gid);
return sys___posix_fchown(p, &bfa, retval);
return sys___posix_fchown(l, &bfa, retval);
}
int
linux_sys_lchown16(p, v, retval)
struct proc *p;
linux_sys_lchown16(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -780,6 +791,7 @@ linux_sys_lchown16(p, v, retval)
syscallarg(int) uid;
syscallarg(int) gid;
} */ *uap = v;
struct proc *p = l->l_proc;
struct sys___posix_lchown_args bla;
caddr_t sg = stackgap_init(p, 0);
@ -791,14 +803,14 @@ linux_sys_lchown16(p, v, retval)
SCARG(&bla, gid) = ((linux_gid_t)SCARG(uap, gid) == (linux_gid_t)-1) ?
(gid_t)-1 : SCARG(uap, gid);
return sys___posix_lchown(p, &bla, retval);
return sys___posix_lchown(l, &bla, retval);
}
#endif /* __i386__ || __m68k__ || __arm__ */
#if defined (__i386__) || defined (__m68k__) || \
defined (__powerpc__) || defined (__mips__) || defined(__arm__)
int
linux_sys_chown(p, v, retval)
struct proc *p;
linux_sys_chown(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -807,16 +819,17 @@ linux_sys_chown(p, v, retval)
syscallarg(int) uid;
syscallarg(int) gid;
} */ *uap = v;
struct proc *p = l->l_proc;
caddr_t sg = stackgap_init(p, 0);
CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
return sys___posix_chown(p, uap, retval);
return sys___posix_chown(l, uap, retval);
}
int
linux_sys_lchown(p, v, retval)
struct proc *p;
linux_sys_lchown(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -825,17 +838,18 @@ linux_sys_lchown(p, v, retval)
syscallarg(int) uid;
syscallarg(int) gid;
} */ *uap = v;
struct proc *p = l->l_proc;
caddr_t sg = stackgap_init(p, 0);
CHECK_ALT_SYMLINK(p, &sg, SCARG(uap, path));
return sys___posix_lchown(p, uap, retval);
return sys___posix_lchown(l, uap, retval);
}
#endif /* __i386__ || __m68k__ || __powerpc__ || __mips__ || __arm__ */
int
linux_sys_rename(p, v, retval)
struct proc *p;
linux_sys_rename(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -843,17 +857,18 @@ linux_sys_rename(p, v, retval)
syscallarg(const char *) from;
syscallarg(const char *) to;
} */ *uap = v;
struct proc *p = l->l_proc;
caddr_t sg = stackgap_init(p, 0);
CHECK_ALT_EXIST(p, &sg, SCARG(uap, from));
CHECK_ALT_CREAT(p, &sg, SCARG(uap, to));
return sys___posix_rename(p, uap, retval);
return sys___posix_rename(l, uap, retval);
}
int
linux_sys_mkdir(p, v, retval)
struct proc *p;
linux_sys_mkdir(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -861,32 +876,34 @@ linux_sys_mkdir(p, v, retval)
syscallarg(const char *) path;
syscallarg(int) mode;
} */ *uap = v;
struct proc *p = l->l_proc;
caddr_t sg = stackgap_init(p, 0);
CHECK_ALT_CREAT(p, &sg, SCARG(uap, path));
return sys_mkdir(p, uap, retval);
return sys_mkdir(l, uap, retval);
}
int
linux_sys_rmdir(p, v, retval)
struct proc *p;
linux_sys_rmdir(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
struct linux_sys_rmdir_args /* {
syscallarg(const char *) path;
} */ *uap = v;
struct proc *p = l->l_proc;
caddr_t sg = stackgap_init(p, 0);
CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
return sys_rmdir(p, uap, retval);
return sys_rmdir(l, uap, retval);
}
int
linux_sys_symlink(p, v, retval)
struct proc *p;
linux_sys_symlink(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -894,17 +911,18 @@ linux_sys_symlink(p, v, retval)
syscallarg(const char *) path;
syscallarg(const char *) to;
} */ *uap = v;
struct proc *p = l->l_proc;
caddr_t sg = stackgap_init(p, 0);
CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
CHECK_ALT_CREAT(p, &sg, SCARG(uap, to));
return sys_symlink(p, uap, retval);
return sys_symlink(l, uap, retval);
}
int
linux_sys_link(p, v, retval)
struct proc *p;
linux_sys_link(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -912,17 +930,18 @@ linux_sys_link(p, v, retval)
syscallarg(const char *) path;
syscallarg(const char *) link;
} */ *uap = v;
struct proc *p = l->l_proc;
caddr_t sg = stackgap_init(p, 0);
CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
CHECK_ALT_CREAT(p, &sg, SCARG(uap, link));
return sys_link(p, uap, retval);
return sys_link(l, uap, retval);
}
int
linux_sys_readlink(p, v, retval)
struct proc *p;
linux_sys_readlink(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -931,16 +950,17 @@ linux_sys_readlink(p, v, retval)
syscallarg(char *) buf;
syscallarg(int) count;
} */ *uap = v;
struct proc *p = l->l_proc;
caddr_t sg = stackgap_init(p, 0);
CHECK_ALT_SYMLINK(p, &sg, SCARG(uap, name));
return sys_readlink(p, uap, retval);
return sys_readlink(l, uap, retval);
}
int
linux_sys_truncate(p, v, retval)
struct proc *p;
linux_sys_truncate(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -948,11 +968,12 @@ linux_sys_truncate(p, v, retval)
syscallarg(const char *) path;
syscallarg(long) length;
} */ *uap = v;
struct proc *p = l->l_proc;
caddr_t sg = stackgap_init(p, 0);
CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
return compat_43_sys_truncate(p, uap, retval);
return compat_43_sys_truncate(l, uap, retval);
}
/*
@ -962,8 +983,8 @@ linux_sys_truncate(p, v, retval)
* (syscall #148 on the arm)
*/
int
linux_sys_fdatasync(p, v, retval)
struct proc *p;
linux_sys_fdatasync(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -972,15 +993,15 @@ linux_sys_fdatasync(p, v, retval)
syscallarg(int) fd;
} */ *uap = v;
#endif
return sys_fsync(p, v, retval);
return sys_fsync(l, v, retval);
}
/*
* pread(2).
*/
int
linux_sys_pread(p, v, retval)
struct proc *p;
linux_sys_pread(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -997,15 +1018,15 @@ linux_sys_pread(p, v, retval)
SCARG(&pra, nbyte) = SCARG(uap, nbyte);
SCARG(&pra, offset) = SCARG(uap, offset);
return sys_read(p, &pra, retval);
return sys_read(l, &pra, retval);
}
/*
* pwrite(2).
*/
int
linux_sys_pwrite(p, v, retval)
struct proc *p;
linux_sys_pwrite(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -1022,5 +1043,5 @@ linux_sys_pwrite(p, v, retval)
SCARG(&pra, nbyte) = SCARG(uap, nbyte);
SCARG(&pra, offset) = SCARG(uap, offset);
return sys_write(p, &pra, retval);
return sys_write(l, &pra, retval);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_file64.c,v 1.18 2002/05/20 06:45:11 jdolecek Exp $ */
/* $NetBSD: linux_file64.c,v 1.19 2003/01/18 08:02:52 thorpej Exp $ */
/*-
* Copyright (c) 1995, 1998, 2000 The NetBSD Foundation, Inc.
@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: linux_file64.c,v 1.18 2002/05/20 06:45:11 jdolecek Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux_file64.c,v 1.19 2003/01/18 08:02:52 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -59,6 +59,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_file64.c,v 1.18 2002/05/20 06:45:11 jdolecek E
#include <sys/tty.h>
#include <sys/conf.h>
#include <sys/sa.h>
#include <sys/syscallargs.h>
#include <compat/linux/common/linux_types.h>
@ -73,7 +74,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_file64.c,v 1.18 2002/05/20 06:45:11 jdolecek E
#ifndef alpha
static void bsd_to_linux_stat __P((struct stat *, struct linux_stat64 *));
static int linux_do_stat64 __P((struct proc *, void *, register_t *, int));
static int linux_do_stat64 __P((struct lwp *, void *, register_t *, int));
/*
* Convert a NetBSD stat structure to a Linux stat structure.
@ -114,8 +115,8 @@ bsd_to_linux_stat(bsp, lsp)
* by one function to avoid code duplication.
*/
int
linux_sys_fstat64(p, v, retval)
struct proc *p;
linux_sys_fstat64(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -123,6 +124,7 @@ linux_sys_fstat64(p, v, retval)
syscallarg(int) fd;
syscallarg(struct linux_stat64 *) sp;
} */ *uap = v;
struct proc *p = l->l_proc;
struct sys___fstat13_args fsa;
struct linux_stat64 tmplst;
struct stat *st,tmpst;
@ -136,7 +138,7 @@ linux_sys_fstat64(p, v, retval)
SCARG(&fsa, fd) = SCARG(uap, fd);
SCARG(&fsa, sb) = st;
if ((error = sys___fstat13(p, &fsa, retval)))
if ((error = sys___fstat13(l, &fsa, retval)))
return error;
if ((error = copyin(st, &tmpst, sizeof tmpst)))
@ -151,12 +153,13 @@ linux_sys_fstat64(p, v, retval)
}
static int
linux_do_stat64(p, v, retval, dolstat)
struct proc *p;
linux_do_stat64(l, v, retval, dolstat)
struct lwp *l;
void *v;
register_t *retval;
int dolstat;
{
struct proc *p = l->l_proc;
struct sys___stat13_args sa;
struct linux_stat64 tmplst;
struct stat *st, tmpst;
@ -171,8 +174,8 @@ linux_do_stat64(p, v, retval, dolstat)
SCARG(&sa, ub) = st;
SCARG(&sa, path) = SCARG(uap, path);
if ((error = (dolstat ? sys___lstat13(p, &sa, retval) :
sys___stat13(p, &sa, retval))))
if ((error = (dolstat ? sys___lstat13(l, &sa, retval) :
sys___stat13(l, &sa, retval))))
return error;
if ((error = copyin(st, &tmpst, sizeof tmpst)))
@ -187,8 +190,8 @@ linux_do_stat64(p, v, retval, dolstat)
}
int
linux_sys_stat64(p, v, retval)
struct proc *p;
linux_sys_stat64(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -197,12 +200,12 @@ linux_sys_stat64(p, v, retval)
syscallarg(struct linux_stat64 *) sp;
} */ *uap = v;
return linux_do_stat64(p, uap, retval, 0);
return linux_do_stat64(l, uap, retval, 0);
}
int
linux_sys_lstat64(p, v, retval)
struct proc *p;
linux_sys_lstat64(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -211,12 +214,12 @@ linux_sys_lstat64(p, v, retval)
syscallarg(struct linux_stat64 *) sp;
} */ *uap = v;
return linux_do_stat64(p, uap, retval, 1);
return linux_do_stat64(l, uap, retval, 1);
}
int
linux_sys_truncate64(p, v, retval)
struct proc *p;
linux_sys_truncate64(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -224,11 +227,12 @@ linux_sys_truncate64(p, v, retval)
syscallarg(const char *) path;
syscallarg(off_t) length;
} */ *uap = v;
struct proc *p = l->l_proc;
caddr_t sg = stackgap_init(p, 0);
CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
return sys_truncate(p, uap, retval);
return sys_truncate(l, uap, retval);
}
#if !defined(__m68k__)
@ -284,8 +288,8 @@ linux_to_bsd_flock64(bfp, lfp)
}
int
linux_sys_fcntl64(p, v, retval)
struct proc *p;
linux_sys_fcntl64(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -294,6 +298,7 @@ linux_sys_fcntl64(p, v, retval)
syscallarg(int) cmd;
syscallarg(void *) arg;
} */ *uap = v;
struct proc *p = l->l_proc;
struct sys_fcntl_args fca;
struct linux_flock64 lfl;
struct flock bfl, *bfp;
@ -315,7 +320,7 @@ linux_sys_fcntl64(p, v, retval)
SCARG(&fca, fd) = fd;
SCARG(&fca, cmd) = F_GETLK;
SCARG(&fca, arg) = bfp;
if ((error = sys_fcntl(p, &fca, retval)) != 0)
if ((error = sys_fcntl(l, &fca, retval)) != 0)
return error;
if ((error = copyin(bfp, &bfl, sizeof bfl)) != 0)
return error;
@ -334,9 +339,9 @@ linux_sys_fcntl64(p, v, retval)
SCARG(&fca, fd) = fd;
SCARG(&fca, cmd) = cmd;
SCARG(&fca, arg) = bfp;
return sys_fcntl(p, &fca, retval);
return sys_fcntl(l, &fca, retval);
default:
return linux_sys_fcntl(p, v, retval);
return linux_sys_fcntl(l, v, retval);
}
}
#endif /* !m68k */
@ -358,8 +363,8 @@ linux_sys_fcntl64(p, v, retval)
* Note that this doesn't handle union-mounted filesystems.
*/
int
linux_sys_getdents64(p, v, retval)
struct proc *p;
linux_sys_getdents64(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -368,6 +373,7 @@ linux_sys_getdents64(p, v, retval)
syscallarg(struct linux_dirent64 *) dent;
syscallarg(unsigned int) count;
} */ *uap = v;
struct proc *p = l->l_proc;
struct dirent *bdp;
struct vnode *vp;
caddr_t inp, buf; /* BSD-format */

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_hdio.c,v 1.4 2002/03/16 20:43:53 christos Exp $ */
/* $NetBSD: linux_hdio.c,v 1.5 2003/01/18 08:02:52 thorpej Exp $ */
/*
* Copyright (c) 2000 Wasabi Systems, Inc.
@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: linux_hdio.c,v 1.4 2002/03/16 20:43:53 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux_hdio.c,v 1.5 2003/01/18 08:02:52 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -51,6 +51,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_hdio.c,v 1.4 2002/03/16 20:43:53 christos Exp
#include <dev/ic/wdcreg.h>
#include <sys/ataio.h>
#include <sys/sa.h>
#include <sys/syscallargs.h>
#include <compat/linux/common/linux_types.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_ioctl.c,v 1.30 2002/10/22 11:55:10 simonb Exp $ */
/* $NetBSD: linux_ioctl.c,v 1.31 2003/01/18 08:02:52 thorpej Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: linux_ioctl.c,v 1.30 2002/10/22 11:55:10 simonb Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux_ioctl.c,v 1.31 2003/01/18 08:02:52 thorpej Exp $");
#if defined(_KERNEL_OPT)
#include "sequencer.h"
@ -57,6 +57,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_ioctl.c,v 1.30 2002/10/22 11:55:10 simonb Exp
#include <net/if.h>
#include <sys/sockio.h>
#include <sys/sa.h>
#include <sys/syscallargs.h>
#include <compat/linux/common/linux_types.h>
@ -76,8 +77,8 @@ __KERNEL_RCSID(0, "$NetBSD: linux_ioctl.c,v 1.30 2002/10/22 11:55:10 simonb Exp
* work there and converting back the data afterwards.
*/
int
linux_sys_ioctl(p, v, retval)
struct proc *p;
linux_sys_ioctl(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -86,6 +87,7 @@ linux_sys_ioctl(p, v, retval)
syscallarg(u_long) com;
syscallarg(caddr_t) data;
} */ *uap = v;
struct proc *p = l->l_proc;
switch (LINUX_IOCGROUP(SCARG(uap, com))) {
case 'M':

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_ipc.c,v 1.27 2002/04/03 11:54:37 fvdl Exp $ */
/* $NetBSD: linux_ipc.c,v 1.28 2003/01/18 08:02:53 thorpej Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: linux_ipc.c,v 1.27 2002/04/03 11:54:37 fvdl Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux_ipc.c,v 1.28 2003/01/18 08:02:53 thorpej Exp $");
#if defined(_KERNEL_OPT)
#include "opt_sysv.h"
@ -51,6 +51,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_ipc.c,v 1.27 2002/04/03 11:54:37 fvdl Exp $");
#include <sys/systm.h>
#include <sys/mount.h>
#include <sys/sa.h>
#include <sys/syscallargs.h>
#include <compat/linux/common/linux_types.h>
@ -164,8 +165,8 @@ linux_to_bsd_semid_ds(ls, bs)
* just need to frob the `cmd' and convert the semid_ds and semun.
*/
int
linux_sys_semctl(p, v, retval)
struct proc *p;
linux_sys_semctl(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -175,6 +176,7 @@ linux_sys_semctl(p, v, retval)
syscallarg(int) cmd;
syscallarg(union linux_semun) arg;
} */ *uap = v;
struct proc *p = l->l_proc;
struct semid_ds sembuf;
struct linux_semid_ds lsembuf;
union __semun semun;
@ -298,8 +300,8 @@ bsd_to_linux_msqid_ds(bmp, lmp)
}
int
linux_sys_msgctl(p, v, retval)
struct proc *p;
linux_sys_msgctl(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -308,6 +310,7 @@ linux_sys_msgctl(p, v, retval)
syscallarg(int) cmd;
syscallarg(struct linux_msqid_ds *) buf;
} */ *uap = v;
struct proc *p = l->l_proc;
caddr_t sg;
struct sys___msgctl13_args nua;
struct msqid_ds *bmp, bm;
@ -321,7 +324,7 @@ linux_sys_msgctl(p, v, retval)
bmp = stackgap_alloc(p, &sg, sizeof (struct msqid_ds));
SCARG(&nua, cmd) = IPC_STAT;
SCARG(&nua, buf) = bmp;
if ((error = sys___msgctl13(p, &nua, retval)))
if ((error = sys___msgctl13(l, &nua, retval)))
return error;
if ((error = copyin(bmp, &bm, sizeof bm)))
return error;
@ -345,7 +348,7 @@ linux_sys_msgctl(p, v, retval)
default:
return EINVAL;
}
return sys___msgctl13(p, &nua, retval);
return sys___msgctl13(l, &nua, retval);
}
#endif /* SYSVMSG */
@ -356,8 +359,8 @@ linux_sys_msgctl(p, v, retval)
* handled by libc, apparently.
*/
int
linux_sys_shmat(p, v, retval)
struct proc *p;
linux_sys_shmat(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -367,6 +370,7 @@ linux_sys_shmat(p, v, retval)
syscallarg(int) shmflg;
syscallarg(u_long *) raddr;
} */ *uap = v;
struct proc *p = l->l_proc;
int error;
vaddr_t attach_va;
u_long raddr;
@ -435,8 +439,8 @@ bsd_to_linux_shmid_ds(bsp, lsp)
* The usual structure conversion and massaging is done.
*/
int
linux_sys_shmctl(p, v, retval)
struct proc *p;
linux_sys_shmctl(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -445,6 +449,7 @@ linux_sys_shmctl(p, v, retval)
syscallarg(int) cmd;
syscallarg(struct linux_shmid_ds *) buf;
} */ *uap = v;
struct proc *p = l->l_proc;
caddr_t sg;
struct sys___shmctl13_args nua;
struct shmid_ds *bsp, bs;
@ -458,7 +463,7 @@ linux_sys_shmctl(p, v, retval)
bsp = stackgap_alloc(p, &sg, sizeof(struct shmid_ds));
SCARG(&nua, cmd) = IPC_STAT;
SCARG(&nua, buf) = bsp;
if ((error = sys___shmctl13(p, &nua, retval)))
if ((error = sys___shmctl13(l, &nua, retval)))
return error;
if ((error = copyin(SCARG(&nua, buf), &bs, sizeof bs)))
return error;
@ -493,6 +498,6 @@ linux_sys_shmctl(p, v, retval)
default:
return EINVAL;
}
return sys___shmctl13(p, &nua, retval);
return sys___shmctl13(l, &nua, retval);
}
#endif /* SYSVSHM */

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_ipccall.c,v 1.22 2001/11/15 09:48:01 lukem Exp $ */
/* $NetBSD: linux_ipccall.c,v 1.23 2003/01/18 08:02:53 thorpej Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: linux_ipccall.c,v 1.22 2001/11/15 09:48:01 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux_ipccall.c,v 1.23 2003/01/18 08:02:53 thorpej Exp $");
#if defined(_KERNEL_OPT)
#include "opt_sysv.h"
@ -52,6 +52,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_ipccall.c,v 1.22 2001/11/15 09:48:01 lukem Exp
/* real syscalls */
#include <sys/mount.h>
#include <sys/sa.h>
#include <sys/syscallargs.h>
/* sys_ipc + args prototype */
@ -86,8 +87,8 @@ __KERNEL_RCSID(0, "$NetBSD: linux_ipccall.c,v 1.22 2001/11/15 09:48:01 lukem Exp
*/
int
linux_sys_ipc(p, v, retval)
struct proc *p;
linux_sys_ipc(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -102,9 +103,9 @@ linux_sys_ipc(p, v, retval)
switch (SCARG(uap, what)) {
#ifdef SYSVSEM
case LINUX_SYS_semop:
return linux_semop(p, uap, retval);
return linux_semop(l, uap, retval);
case LINUX_SYS_semget:
return linux_semget(p, uap, retval);
return linux_semget(l, uap, retval);
case LINUX_SYS_semctl: {
struct linux_sys_semctl_args bsa;
union linux_semun arg;
@ -118,16 +119,16 @@ linux_sys_ipc(p, v, retval)
return error;
SCARG(&bsa, arg) = arg;
return linux_sys_semctl(p, &bsa, retval);
return linux_sys_semctl(l, &bsa, retval);
}
#endif
#ifdef SYSVMSG
case LINUX_SYS_msgsnd:
return linux_msgsnd(p, uap, retval);
return linux_msgsnd(l, uap, retval);
case LINUX_SYS_msgrcv:
return linux_msgrcv(p, uap, retval);
return linux_msgrcv(l, uap, retval);
case LINUX_SYS_msgget:
return linux_msgget(p, uap, retval);
return linux_msgget(l, uap, retval);
case LINUX_SYS_msgctl: {
struct linux_sys_msgctl_args bsa;
@ -135,7 +136,7 @@ linux_sys_ipc(p, v, retval)
SCARG(&bsa, cmd) = SCARG(uap, a2);
SCARG(&bsa, buf) = (struct linux_msqid_ds *)SCARG(uap, ptr);
return linux_sys_msgctl(p, &bsa, retval);
return linux_sys_msgctl(l, &bsa, retval);
}
#endif
#ifdef SYSVSHM
@ -148,12 +149,12 @@ linux_sys_ipc(p, v, retval)
/* XXX passing pointer inside int here */
SCARG(&bsa, raddr) = (u_long *)SCARG(uap, a3);
return linux_sys_shmat(p, &bsa, retval);
return linux_sys_shmat(l, &bsa, retval);
}
case LINUX_SYS_shmdt:
return linux_shmdt(p, uap, retval);
return linux_shmdt(l, uap, retval);
case LINUX_SYS_shmget:
return linux_shmget(p, uap, retval);
return linux_shmget(l, uap, retval);
case LINUX_SYS_shmctl: {
struct linux_sys_shmctl_args bsa;
@ -161,7 +162,7 @@ linux_sys_ipc(p, v, retval)
SCARG(&bsa, cmd) = SCARG(uap, a2);
SCARG(&bsa, buf) = (struct linux_shmid_ds *)SCARG(uap, ptr);
return linux_sys_shmctl(p, &bsa, retval);
return linux_sys_shmctl(l, &bsa, retval);
}
#endif
default:
@ -171,8 +172,8 @@ linux_sys_ipc(p, v, retval)
#ifdef SYSVSEM
inline int
linux_semop(p, uap, retval)
struct proc *p;
linux_semop(l, uap, retval)
struct lwp *l;
struct linux_sys_ipc_args /* {
syscallarg(int) what;
syscallarg(int) a1;
@ -188,12 +189,12 @@ linux_semop(p, uap, retval)
SCARG(&bsa, sops) = (struct sembuf *)SCARG(uap, ptr);
SCARG(&bsa, nsops) = SCARG(uap, a2);
return sys_semop(p, &bsa, retval);
return sys_semop(l, &bsa, retval);
}
inline int
linux_semget(p, uap, retval)
struct proc *p;
linux_semget(l, uap, retval)
struct lwp *l;
struct linux_sys_ipc_args /* {
syscallarg(int) what;
syscallarg(int) a1;
@ -209,7 +210,7 @@ linux_semget(p, uap, retval)
SCARG(&bsa, nsems) = SCARG(uap, a2);
SCARG(&bsa, semflg) = SCARG(uap, a3);
return sys_semget(p, &bsa, retval);
return sys_semget(l, &bsa, retval);
}
#endif /* SYSVSEM */
@ -217,8 +218,8 @@ linux_semget(p, uap, retval)
#ifdef SYSVMSG
inline int
linux_msgsnd(p, uap, retval)
struct proc *p;
linux_msgsnd(l, uap, retval)
struct lwp *l;
struct linux_sys_ipc_args /* {
syscallarg(int) what;
syscallarg(int) a1;
@ -235,12 +236,12 @@ linux_msgsnd(p, uap, retval)
SCARG(&bma, msgsz) = SCARG(uap, a2);
SCARG(&bma, msgflg) = SCARG(uap, a3);
return sys_msgsnd(p, &bma, retval);
return sys_msgsnd(l, &bma, retval);
}
inline int
linux_msgrcv(p, uap, retval)
struct proc *p;
linux_msgrcv(l, uap, retval)
struct lwp *l;
struct linux_sys_ipc_args /* {
syscallarg(int) what;
syscallarg(int) a1;
@ -263,12 +264,12 @@ linux_msgrcv(p, uap, retval)
SCARG(&bma, msgtyp) = kluge.type;
SCARG(&bma, msgflg) = SCARG(uap, a3);
return sys_msgrcv(p, &bma, retval);
return sys_msgrcv(l, &bma, retval);
}
inline int
linux_msgget(p, uap, retval)
struct proc *p;
linux_msgget(l, uap, retval)
struct lwp *l;
struct linux_sys_ipc_args /* {
syscallarg(int) what;
syscallarg(int) a1;
@ -283,7 +284,7 @@ linux_msgget(p, uap, retval)
SCARG(&bma, key) = (key_t)SCARG(uap, a1);
SCARG(&bma, msgflg) = SCARG(uap, a2);
return sys_msgget(p, &bma, retval);
return sys_msgget(l, &bma, retval);
}
#endif /* SYSVMSG */
@ -294,8 +295,8 @@ linux_msgget(p, uap, retval)
* the extra indirection by the linux_ipc system call.
*/
inline int
linux_shmdt(p, uap, retval)
struct proc *p;
linux_shmdt(l, uap, retval)
struct lwp *l;
struct linux_sys_ipc_args /* {
syscallarg(int) what;
syscallarg(int) a1;
@ -309,15 +310,15 @@ linux_shmdt(p, uap, retval)
SCARG(&bsa, shmaddr) = SCARG(uap, ptr);
return sys_shmdt(p, &bsa, retval);
return sys_shmdt(l, &bsa, retval);
}
/*
* Same story as shmdt.
*/
inline int
linux_shmget(p, uap, retval)
struct proc *p;
linux_shmget(l, uap, retval)
struct lwp *l;
struct linux_sys_ipc_args /* {
syscallarg(int) what;
syscallarg(int) a1;
@ -333,7 +334,7 @@ linux_shmget(p, uap, retval)
SCARG(&bsa, size) = SCARG(uap, a2);
SCARG(&bsa, shmflg) = SCARG(uap, a3);
return sys_shmget(p, &bsa, retval);
return sys_shmget(l, &bsa, retval);
}
#endif /* SYSVSHM */

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_ipccall.h,v 1.7 1999/01/10 15:05:36 tron Exp $ */
/* $NetBSD: linux_ipccall.h,v 1.8 2003/01/18 08:02:53 thorpej Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@ -66,27 +66,27 @@
# ifdef SYSVSEM
inline int linux_semop __P((struct proc *, struct linux_sys_ipc_args *,
inline int linux_semop __P((struct lwp *, struct linux_sys_ipc_args *,
register_t *));
inline int linux_semget __P((struct proc *, struct linux_sys_ipc_args *,
inline int linux_semget __P((struct lwp *, struct linux_sys_ipc_args *,
register_t *));
# endif
# ifdef SYSVMSG
inline int linux_msgsnd __P((struct proc *, struct linux_sys_ipc_args *,
inline int linux_msgsnd __P((struct lwp *, struct linux_sys_ipc_args *,
register_t *));
inline int linux_msgrcv __P((struct proc *, struct linux_sys_ipc_args *,
inline int linux_msgrcv __P((struct lwp *, struct linux_sys_ipc_args *,
register_t *));
inline int linux_msgget __P((struct proc *, struct linux_sys_ipc_args *,
inline int linux_msgget __P((struct lwp *, struct linux_sys_ipc_args *,
register_t *));
# endif
# ifdef SYSVSHM
inline int linux_shmdt __P((struct proc *, struct linux_sys_ipc_args *,
inline int linux_shmdt __P((struct lwp *, struct linux_sys_ipc_args *,
register_t *));
inline int linux_shmget __P((struct proc *, struct linux_sys_ipc_args *,
inline int linux_shmget __P((struct lwp *, struct linux_sys_ipc_args *,
register_t *));
# endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_llseek.c,v 1.26 2001/11/13 02:08:54 lukem Exp $ */
/* $NetBSD: linux_llseek.c,v 1.27 2003/01/18 08:02:53 thorpej Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: linux_llseek.c,v 1.26 2001/11/13 02:08:54 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux_llseek.c,v 1.27 2003/01/18 08:02:53 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -46,6 +46,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_llseek.c,v 1.26 2001/11/13 02:08:54 lukem Exp
#include <sys/malloc.h>
#include <sys/conf.h>
#include <sys/sa.h>
#include <sys/syscallargs.h>
#include <compat/linux/common/linux_types.h>
@ -62,8 +63,8 @@ __KERNEL_RCSID(0, "$NetBSD: linux_llseek.c,v 1.26 2001/11/13 02:08:54 lukem Exp
* This appears to be part of a Linux attempt to switch to 64 bits file sizes.
*/
int
linux_sys_llseek(p, v, retval)
struct proc *p;
linux_sys_llseek(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -84,7 +85,7 @@ linux_sys_llseek(p, v, retval)
SCARG(&bla, offset) = off;
SCARG(&bla, whence) = SCARG(uap, whence);
if ((error = sys_lseek(p, &bla, retval)))
if ((error = sys_lseek(l, &bla, retval)))
return error;
if ((error = copyout(retval, SCARG(uap, res), sizeof (off_t))))

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_misc.c,v 1.115 2002/12/16 19:37:03 christos Exp $ */
/* $NetBSD: linux_misc.c,v 1.116 2003/01/18 08:02:53 thorpej 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.115 2002/12/16 19:37:03 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.116 2003/01/18 08:02:53 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -99,6 +99,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.115 2002/12/16 19:37:03 christos Ex
#include <sys/ptrace.h>
#include <machine/ptrace.h>
#include <sys/sa.h>
#include <sys/syscallargs.h>
#include <compat/linux/common/linux_types.h>
@ -198,8 +199,8 @@ bsd_to_linux_wstat(st)
* This is very much the same as waitpid()
*/
int
linux_sys_wait4(p, v, retval)
struct proc *p;
linux_sys_wait4(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -209,6 +210,7 @@ linux_sys_wait4(p, v, retval)
syscallarg(int) options;
syscallarg(struct rusage *) rusage;
} */ *uap = v;
struct proc *p = l->l_proc;
struct sys_wait4_args w4a;
int error, *status, tstat, options, linux_options;
caddr_t sg;
@ -240,7 +242,7 @@ linux_sys_wait4(p, v, retval)
SCARG(&w4a, options) = options;
SCARG(&w4a, rusage) = SCARG(uap, rusage);
if ((error = sys_wait4(p, &w4a, retval)))
if ((error = sys_wait4(l, &w4a, retval)))
return error;
sigdelset(&p->p_sigctx.ps_siglist, SIGCHLD);
@ -261,14 +263,15 @@ linux_sys_wait4(p, v, retval)
* done in the kernel in Linux. NetBSD does it in the library.
*/
int
linux_sys_brk(p, v, retval)
struct proc *p;
linux_sys_brk(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
struct linux_sys_brk_args /* {
syscallarg(char *) nsize;
} */ *uap = v;
struct proc *p = l->l_proc;
char *nbrk = SCARG(uap, nsize);
struct sys_obreak_args oba;
struct vmspace *vm = p->p_vmspace;
@ -276,7 +279,7 @@ linux_sys_brk(p, v, retval)
SCARG(&oba, nsize) = nbrk;
if ((caddr_t) nbrk > vm->vm_daddr && sys_obreak(p, &oba, retval) == 0)
if ((caddr_t) nbrk > vm->vm_daddr && sys_obreak(l, &oba, retval) == 0)
ed->p_break = (char*)nbrk;
else
nbrk = ed->p_break;
@ -328,8 +331,8 @@ bsd_to_linux_statfs(bsp, lsp)
* Implement the fs stat functions. Straightforward.
*/
int
linux_sys_statfs(p, v, retval)
struct proc *p;
linux_sys_statfs(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -337,6 +340,7 @@ linux_sys_statfs(p, v, retval)
syscallarg(const char *) path;
syscallarg(struct linux_statfs *) sp;
} */ *uap = v;
struct proc *p = l->l_proc;
struct statfs btmp, *bsp;
struct linux_statfs ltmp;
struct sys_statfs_args bsa;
@ -351,7 +355,7 @@ linux_sys_statfs(p, v, retval)
SCARG(&bsa, path) = SCARG(uap, path);
SCARG(&bsa, buf) = bsp;
if ((error = sys_statfs(p, &bsa, retval)))
if ((error = sys_statfs(l, &bsa, retval)))
return error;
if ((error = copyin((caddr_t) bsp, (caddr_t) &btmp, sizeof btmp)))
@ -363,8 +367,8 @@ linux_sys_statfs(p, v, retval)
}
int
linux_sys_fstatfs(p, v, retval)
struct proc *p;
linux_sys_fstatfs(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -372,6 +376,7 @@ linux_sys_fstatfs(p, v, retval)
syscallarg(int) fd;
syscallarg(struct linux_statfs *) sp;
} */ *uap = v;
struct proc *p = l->l_proc;
struct statfs btmp, *bsp;
struct linux_statfs ltmp;
struct sys_fstatfs_args bsa;
@ -384,7 +389,7 @@ linux_sys_fstatfs(p, v, retval)
SCARG(&bsa, fd) = SCARG(uap, fd);
SCARG(&bsa, buf) = bsp;
if ((error = sys_fstatfs(p, &bsa, retval)))
if ((error = sys_fstatfs(l, &bsa, retval)))
return error;
if ((error = copyin((caddr_t) bsp, (caddr_t) &btmp, sizeof btmp)))
@ -402,8 +407,8 @@ linux_sys_fstatfs(p, v, retval)
* long, and an extra domainname field.
*/
int
linux_sys_uname(p, v, retval)
struct proc *p;
linux_sys_uname(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -430,8 +435,8 @@ linux_sys_uname(p, v, retval)
* Only called directly on machines with >= 6 free regs.
*/
int
linux_sys_mmap(p, v, retval)
struct proc *p;
linux_sys_mmap(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -465,12 +470,12 @@ linux_sys_mmap(p, v, retval)
SCARG(&cma, pad) = 0;
SCARG(&cma, pos) = (off_t)SCARG(uap, offset);
return sys_mmap(p, &cma, retval);
return sys_mmap(l, &cma, retval);
}
int
linux_sys_mremap(p, v, retval)
struct proc *p;
linux_sys_mremap(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -508,7 +513,7 @@ linux_sys_mremap(p, v, retval)
SCARG(&mua, addr) = (caddr_t)SCARG(uap, old_address) +
new_size;
SCARG(&mua, len) = old_size - new_size;
error = sys_munmap(p, &mua, retval);
error = sys_munmap(l, &mua, retval);
*retval = error ? 0 : (register_t)SCARG(uap, old_address);
return (error);
}
@ -521,8 +526,8 @@ linux_sys_mremap(p, v, retval)
}
int
linux_sys_msync(p, v, retval)
struct proc *p;
linux_sys_msync(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -539,12 +544,12 @@ linux_sys_msync(p, v, retval)
SCARG(&bma, len) = SCARG(uap, len);
SCARG(&bma, flags) = SCARG(uap, fl);
return sys___msync13(p, &bma, retval);
return sys___msync13(l, &bma, retval);
}
int
linux_sys_mprotect(p, v, retval)
struct proc *p;
linux_sys_mprotect(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -556,7 +561,7 @@ linux_sys_mprotect(p, v, retval)
unsigned long end, start = (unsigned long)SCARG(uap, start), len;
int prot = SCARG(uap, prot);
struct vm_map_entry *entry;
struct vm_map *map = &p->p_vmspace->vm_map;
struct vm_map *map = &l->l_proc->p_vmspace->vm_map;
if (start & PAGE_MASK)
return EINVAL;
@ -591,14 +596,15 @@ linux_sys_mprotect(p, v, retval)
#define CONVTCK(r) (r.tv_sec * hz + r.tv_usec / (1000000 / hz))
int
linux_sys_times(p, v, retval)
struct proc *p;
linux_sys_times(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
struct linux_sys_times_args /* {
syscallarg(struct times *) tms;
} */ *uap = v;
struct proc *p = l->l_proc;
struct timeval t;
int error, s;
@ -642,8 +648,8 @@ linux_sys_times(p, v, retval)
* Note that this doesn't handle union-mounted filesystems.
*/
int
linux_sys_getdents(p, v, retval)
struct proc *p;
linux_sys_getdents(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -652,6 +658,7 @@ linux_sys_getdents(p, v, retval)
syscallarg(struct linux_dirent *) dent;
syscallarg(unsigned int) count;
} */ *uap = v;
struct proc *p = l->l_proc;
struct dirent *bdp;
struct vnode *vp;
caddr_t inp, buf; /* BSD-format */
@ -802,8 +809,8 @@ out1:
* this.
*/
int
linux_sys_select(p, v, retval)
struct proc *p;
linux_sys_select(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -815,7 +822,7 @@ linux_sys_select(p, v, retval)
syscallarg(struct timeval *) timeout;
} */ *uap = v;
return linux_select1(p, retval, SCARG(uap, nfds), SCARG(uap, readfds),
return linux_select1(l, retval, SCARG(uap, nfds), SCARG(uap, readfds),
SCARG(uap, writefds), SCARG(uap, exceptfds), SCARG(uap, timeout));
}
@ -826,14 +833,15 @@ linux_sys_select(p, v, retval)
* 2) select never returns ERESTART on Linux, always return EINTR
*/
int
linux_select1(p, retval, nfds, readfds, writefds, exceptfds, timeout)
struct proc *p;
linux_select1(l, retval, nfds, readfds, writefds, exceptfds, timeout)
struct lwp *l;
register_t *retval;
int nfds;
fd_set *readfds, *writefds, *exceptfds;
struct timeval *timeout;
{
struct sys_select_args bsa;
struct proc *p = l->l_proc;
struct timeval tv0, tv1, utv, *tvp;
caddr_t sg;
int error;
@ -873,7 +881,7 @@ linux_select1(p, retval, nfds, readfds, writefds, exceptfds, timeout)
microtime(&tv0);
}
error = sys_select(p, &bsa, retval);
error = sys_select(l, &bsa, retval);
if (error) {
/*
* See fs/select.c in the Linux kernel. Without this,
@ -911,14 +919,15 @@ linux_select1(p, retval, nfds, readfds, writefds, exceptfds, timeout)
* and return the value.
*/
int
linux_sys_getpgid(p, v, retval)
struct proc *p;
linux_sys_getpgid(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
struct linux_sys_getpgid_args /* {
syscallarg(int) pid;
} */ *uap = v;
struct proc *p = l->l_proc;
struct proc *targp;
if (SCARG(uap, pid) != 0 && SCARG(uap, pid) != p->p_pid) {
@ -939,8 +948,8 @@ linux_sys_getpgid(p, v, retval)
* ELF binaries run in Linux mode, not SVR4 mode.
*/
int
linux_sys_personality(p, v, retval)
struct proc *p;
linux_sys_personality(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -959,8 +968,8 @@ linux_sys_personality(p, v, retval)
* The calls are here because of type conversions.
*/
int
linux_sys_setreuid16(p, v, retval)
struct proc *p;
linux_sys_setreuid16(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -975,12 +984,12 @@ linux_sys_setreuid16(p, v, retval)
SCARG(&bsa, euid) = ((linux_uid_t)SCARG(uap, euid) == (linux_uid_t)-1) ?
(uid_t)-1 : SCARG(uap, euid);
return sys_setreuid(p, &bsa, retval);
return sys_setreuid(l, &bsa, retval);
}
int
linux_sys_setregid16(p, v, retval)
struct proc *p;
linux_sys_setregid16(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -995,12 +1004,12 @@ linux_sys_setregid16(p, v, retval)
SCARG(&bsa, egid) = ((linux_gid_t)SCARG(uap, egid) == (linux_gid_t)-1) ?
(uid_t)-1 : SCARG(uap, egid);
return sys_setregid(p, &bsa, retval);
return sys_setregid(l, &bsa, retval);
}
int
linux_sys_setresuid16(p, v, retval)
struct proc *p;
linux_sys_setresuid16(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -1018,12 +1027,12 @@ linux_sys_setresuid16(p, v, retval)
SCARG(&lsa, suid) = ((linux_uid_t)SCARG(uap, suid) == (linux_uid_t)-1) ?
(uid_t)-1 : SCARG(uap, suid);
return linux_sys_setresuid(p, &lsa, retval);
return linux_sys_setresuid(l, &lsa, retval);
}
int
linux_sys_setresgid16(p, v, retval)
struct proc *p;
linux_sys_setresgid16(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -1041,12 +1050,12 @@ linux_sys_setresgid16(p, v, retval)
SCARG(&lsa, sgid) = ((linux_gid_t)SCARG(uap, sgid) == (linux_gid_t)-1) ?
(gid_t)-1 : SCARG(uap, sgid);
return linux_sys_setresgid(p, &lsa, retval);
return linux_sys_setresgid(l, &lsa, retval);
}
int
linux_sys_getgroups16(p, v, retval)
struct proc *p;
linux_sys_getgroups16(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -1054,6 +1063,7 @@ linux_sys_getgroups16(p, v, retval)
syscallarg(int) gidsetsize;
syscallarg(linux_gid_t *) gidset;
} */ *uap = v;
struct proc *p = l->l_proc;
caddr_t sg;
int n, error, i;
struct sys_getgroups_args bsa;
@ -1077,7 +1087,7 @@ linux_sys_getgroups16(p, v, retval)
return ENOMEM;
SCARG(&bsa, gidsetsize) = n;
SCARG(&bsa, gidset) = bset;
error = sys_getgroups(p, &bsa, retval);
error = sys_getgroups(l, &bsa, retval);
if (error != 0)
goto out;
error = copyin(bset, kbset, n * sizeof (gid_t));
@ -1098,8 +1108,8 @@ out:
}
int
linux_sys_setgroups16(p, v, retval)
struct proc *p;
linux_sys_setgroups16(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -1107,6 +1117,7 @@ linux_sys_setgroups16(p, v, retval)
syscallarg(int) gidsetsize;
syscallarg(linux_gid_t *) gidset;
} */ *uap = v;
struct proc *p = l->l_proc;
caddr_t sg;
int n;
int error, i;
@ -1133,7 +1144,7 @@ linux_sys_setgroups16(p, v, retval)
goto out;
SCARG(&bsa, gidsetsize) = n;
SCARG(&bsa, gidset) = bset;
error = sys_setgroups(p, &bsa, retval);
error = sys_setgroups(l, &bsa, retval);
out:
if (lset != NULL)
@ -1151,19 +1162,20 @@ out:
* If modification is requested, refuse.
*/
int
linux_sys_setfsuid(p, v, retval)
struct proc *p;
linux_sys_setfsuid(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
struct linux_sys_setfsuid_args /* {
syscallarg(uid_t) uid;
} */ *uap = v;
struct proc *p = l->l_proc;
uid_t uid;
uid = SCARG(uap, uid);
if (p->p_cred->p_ruid != uid)
return sys_nosys(p, v, retval);
return sys_nosys(l, v, retval);
else
return (0);
}
@ -1171,18 +1183,18 @@ linux_sys_setfsuid(p, v, retval)
/* XXX XXX XXX */
#ifndef alpha
int
linux_sys_getfsuid(p, v, retval)
struct proc *p;
linux_sys_getfsuid(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
return sys_getuid(p, v, retval);
return sys_getuid(l, v, retval);
}
#endif
int
linux_sys_setresuid(p, v, retval)
struct proc *p;
linux_sys_setresuid(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -1191,6 +1203,7 @@ linux_sys_setresuid(p, v, retval)
syscallarg(uid_t) euid;
syscallarg(uid_t) suid;
} */ *uap = v;
struct proc *p = l->l_proc;
struct pcred *pc = p->p_cred;
uid_t ruid, euid, suid;
int error;
@ -1251,8 +1264,8 @@ linux_sys_setresuid(p, v, retval)
}
int
linux_sys_getresuid(p, v, retval)
struct proc *p;
linux_sys_getresuid(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -1261,6 +1274,7 @@ linux_sys_getresuid(p, v, retval)
syscallarg(uid_t *) euid;
syscallarg(uid_t *) suid;
} */ *uap = v;
struct proc *p = l->l_proc;
struct pcred *pc = p->p_cred;
int error;
@ -1283,8 +1297,8 @@ linux_sys_getresuid(p, v, retval)
}
int
linux_sys_ptrace(p, v, retval)
struct proc *p;
linux_sys_ptrace(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -1320,7 +1334,7 @@ linux_sys_ptrace(p, v, retval)
if (request == LINUX_PTRACE_CONT && SCARG(uap, addr)==0)
SCARG(&pta, addr) = (caddr_t) 1;
error = sys_ptrace(p, &pta, retval);
error = sys_ptrace(l, &pta, retval);
if (error)
return error;
switch (request) {
@ -1338,11 +1352,11 @@ linux_sys_ptrace(p, v, retval)
else
ptr++;
return LINUX_SYS_PTRACE_ARCH(p, uap, retval);
return LINUX_SYS_PTRACE_ARCH(l, uap, retval);
}
int
linux_sys_reboot(struct proc *p, void *v, register_t *retval)
linux_sys_reboot(struct lwp *l, void *v, register_t *retval)
{
struct linux_sys_reboot_args /* {
syscallarg(int) magic1;
@ -1354,6 +1368,7 @@ linux_sys_reboot(struct proc *p, void *v, register_t *retval)
syscallarg(int) opt;
syscallarg(char *) bootstr;
} */ sra;
struct proc *p = l->l_proc;
int error;
if ((error = suser(p->p_ucred, &p->p_acflag)) != 0)
@ -1389,15 +1404,15 @@ linux_sys_reboot(struct proc *p, void *v, register_t *retval)
return(EINVAL);
}
return(sys_reboot(p, &sra, retval));
return(sys_reboot(l, &sra, retval));
}
/*
* Copy of compat_12_sys_swapon().
*/
int
linux_sys_swapon(p, v, retval)
struct proc *p;
linux_sys_swapon(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -1409,15 +1424,15 @@ linux_sys_swapon(p, v, retval)
SCARG(&ua, cmd) = SWAP_ON;
SCARG(&ua, arg) = (void *)SCARG(uap, name);
SCARG(&ua, misc) = 0; /* priority */
return (sys_swapctl(p, &ua, retval));
return (sys_swapctl(l, &ua, retval));
}
/*
* Stop swapping to the file or block device specified by path.
*/
int
linux_sys_swapoff(p, v, retval)
struct proc *p;
linux_sys_swapoff(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -1428,7 +1443,7 @@ linux_sys_swapoff(p, v, retval)
SCARG(&ua, cmd) = SWAP_OFF;
SCARG(&ua, arg) = (void *)SCARG(uap, path);
return (sys_swapctl(p, &ua, retval));
return (sys_swapctl(l, &ua, retval));
}
/*
@ -1436,8 +1451,8 @@ linux_sys_swapoff(p, v, retval)
*/
/* ARGSUSED */
int
linux_sys_setdomainname(p, v, retval)
struct proc *p;
linux_sys_setdomainname(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -1445,6 +1460,7 @@ linux_sys_setdomainname(p, v, retval)
syscallarg(char *) domainname;
syscallarg(int) len;
} */ *uap = v;
struct proc *p = l->l_proc;
int name;
int error;
@ -1460,8 +1476,8 @@ linux_sys_setdomainname(p, v, retval)
*/
/* ARGSUSED */
int
linux_sys_sysinfo(p, v, retval)
struct proc *p;
linux_sys_sysinfo(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -1539,8 +1555,8 @@ linux_to_bsd_limit(lim)
int
linux_sys_getrlimit(p, v, retval)
struct proc *p;
linux_sys_getrlimit(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -1548,6 +1564,7 @@ linux_sys_getrlimit(p, v, retval)
syscallarg(int) which;
syscallarg(struct orlimit *) rlp;
} */ *uap = v;
struct proc *p = l->l_proc;
caddr_t sg = stackgap_init(p, 0);
struct sys_getrlimit_args ap;
struct rlimit rl;
@ -1558,7 +1575,7 @@ linux_sys_getrlimit(p, v, retval)
if ((error = SCARG(&ap, which)) < 0)
return -error;
SCARG(&ap, rlp) = stackgap_alloc(p, &sg, sizeof rl);
if ((error = sys_getrlimit(p, &ap, retval)) != 0)
if ((error = sys_getrlimit(l, &ap, retval)) != 0)
return error;
if ((error = copyin(SCARG(&ap, rlp), &rl, sizeof(rl))) != 0)
return error;
@ -1567,8 +1584,8 @@ linux_sys_getrlimit(p, v, retval)
}
int
linux_sys_setrlimit(p, v, retval)
struct proc *p;
linux_sys_setrlimit(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -1576,6 +1593,7 @@ linux_sys_setrlimit(p, v, retval)
syscallarg(int) which;
syscallarg(struct orlimit *) rlp;
} */ *uap = v;
struct proc *p = l->l_proc;
caddr_t sg = stackgap_init(p, 0);
struct sys_setrlimit_args ap;
struct rlimit rl;
@ -1592,18 +1610,18 @@ linux_sys_setrlimit(p, v, retval)
/* XXX: alpha complains about this */
if ((error = copyout(&rl, (void *)SCARG(&ap, rlp), sizeof(rl))) != 0)
return error;
return sys_setrlimit(p, &ap, retval);
return sys_setrlimit(l, &ap, retval);
}
#ifndef __mips__
/* XXX: this doesn't look 100% common, at least mips doesn't have it */
int
linux_sys_ugetrlimit(p, v, retval)
struct proc *p;
linux_sys_ugetrlimit(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
return linux_sys_getrlimit(p, v, retval);
return linux_sys_getrlimit(l, v, retval);
}
#endif
@ -1613,8 +1631,8 @@ linux_sys_ugetrlimit(p, v, retval)
* This is the way Linux does it and glibc depends on this behaviour.
*/
int
linux_sys_nosys(p, v, retval)
struct proc *p;
linux_sys_nosys(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_misc.h,v 1.7 2002/02/20 17:03:04 christos Exp $ */
/* $NetBSD: linux_misc.h,v 1.8 2003/01/18 08:02:53 thorpej Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -112,7 +112,7 @@ struct linux_sysinfo {
#ifdef _KERNEL
__BEGIN_DECLS
void bsd_to_linux_wstat __P((int *));
int linux_select1 __P((struct proc *, register_t *, int, fd_set *, fd_set *,
int linux_select1 __P((struct lwp *, register_t *, int, fd_set *, fd_set *,
fd_set *, struct timeval *));
__END_DECLS
#endif /* !_KERNEL */

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_misc_notalpha.c,v 1.63 2002/04/03 14:28:36 tron Exp $ */
/* $NetBSD: linux_misc_notalpha.c,v 1.64 2003/01/18 08:02:54 thorpej Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: linux_misc_notalpha.c,v 1.63 2002/04/03 14:28:36 tron Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux_misc_notalpha.c,v 1.64 2003/01/18 08:02:54 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -52,8 +52,10 @@ __KERNEL_RCSID(0, "$NetBSD: linux_misc_notalpha.c,v 1.63 2002/04/03 14:28:36 tro
#include <sys/ptrace.h>
#include <sys/resource.h>
#include <sys/resourcevar.h>
#include <sys/time.h>
#include <sys/wait.h>
#include <sys/sa.h>
#include <sys/syscallargs.h>
#include <compat/linux/common/linux_types.h>
@ -78,39 +80,49 @@ __KERNEL_RCSID(0, "$NetBSD: linux_misc_notalpha.c,v 1.63 2002/04/03 14:28:36 tro
* Fiddle with the timers to make it work.
*/
int
linux_sys_alarm(p, v, retval)
struct proc *p;
linux_sys_alarm(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
struct linux_sys_alarm_args /* {
syscallarg(unsigned int) secs;
} */ *uap = v;
struct proc *p = l->l_proc;
int s;
struct itimerval *itp, it;
struct ptimer *ptp;
itp = &p->p_realtimer;
if (p->p_timers && p->p_timers->pts_timers[ITIMER_REAL])
itp = &p->p_timers->pts_timers[ITIMER_REAL]->pt_time;
else
itp = NULL;
s = splclock();
/*
* Clear any pending timer alarms.
*/
callout_stop(&p->p_realit_ch);
timerclear(&itp->it_interval);
if (timerisset(&itp->it_value) &&
timercmp(&itp->it_value, &time, >))
timersub(&itp->it_value, &time, &itp->it_value);
/*
* Return how many seconds were left (rounded up)
*/
retval[0] = itp->it_value.tv_sec;
if (itp->it_value.tv_usec)
retval[0]++;
if (itp) {
callout_stop(&p->p_timers->pts_timers[ITIMER_REAL]->pt_ch);
timerclear(&itp->it_interval);
if (timerisset(&itp->it_value) &&
timercmp(&itp->it_value, &time, >))
timersub(&itp->it_value, &time, &itp->it_value);
/*
* Return how many seconds were left (rounded up)
*/
retval[0] = itp->it_value.tv_sec;
if (itp->it_value.tv_usec)
retval[0]++;
} else {
retval[0] = 0;
}
/*
* alarm(0) just resets the timer.
*/
if (SCARG(uap, secs) == 0) {
timerclear(&itp->it_value);
if (itp)
timerclear(&itp->it_value);
splx(s);
return 0;
}
@ -126,24 +138,35 @@ linux_sys_alarm(p, v, retval)
return (EINVAL);
}
if (p->p_timers == NULL)
timers_alloc(p);
ptp = p->p_timers->pts_timers[ITIMER_REAL];
if (ptp == NULL) {
ptp = pool_get(&ptimer_pool, PR_WAITOK);
ptp->pt_ev.sigev_notify = SIGEV_SIGNAL;
ptp->pt_ev.sigev_signo = SIGALRM;
ptp->pt_type = CLOCK_REALTIME;
callout_init(&ptp->pt_ch);
}
if (timerisset(&it.it_value)) {
/*
* Don't need to check hzto() return value, here.
* callout_reset() does it for us.
*/
timeradd(&it.it_value, &time, &it.it_value);
callout_reset(&p->p_realit_ch, hzto(&it.it_value),
realitexpire, p);
callout_reset(&ptp->pt_ch, hzto(&it.it_value),
realtimerexpire, ptp);
}
p->p_realtimer = it;
ptp->pt_time = it;
splx(s);
return 0;
}
int
linux_sys_nice(p, v, retval)
struct proc *p;
linux_sys_nice(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -155,7 +178,7 @@ linux_sys_nice(p, v, retval)
SCARG(&bsa, which) = PRIO_PROCESS;
SCARG(&bsa, who) = 0;
SCARG(&bsa, prio) = SCARG(uap, incr);
return sys_setpriority(p, &bsa, retval);
return sys_setpriority(l, &bsa, retval);
}
/*
@ -168,8 +191,8 @@ linux_sys_nice(p, v, retval)
* really is the reclen, not the namelength.
*/
int
linux_sys_readdir(p, v, retval)
struct proc *p;
linux_sys_readdir(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -180,7 +203,7 @@ linux_sys_readdir(p, v, retval)
} */ *uap = v;
SCARG(uap, count) = 1;
return linux_sys_getdents(p, uap, retval);
return linux_sys_getdents(l, uap, retval);
}
/*
@ -188,8 +211,8 @@ linux_sys_readdir(p, v, retval)
* need to deal with it.
*/
int
linux_sys_time(p, v, retval)
struct proc *p;
linux_sys_time(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -215,8 +238,8 @@ linux_sys_time(p, v, retval)
* and pass it on.
*/
int
linux_sys_utime(p, v, retval)
struct proc *p;
linux_sys_utime(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -224,6 +247,7 @@ linux_sys_utime(p, v, retval)
syscallarg(const char *) path;
syscallarg(struct linux_utimbuf *)times;
} */ *uap = v;
struct proc *p = l->l_proc;
caddr_t sg;
int error;
struct sys_utimes_args ua;
@ -249,7 +273,7 @@ linux_sys_utime(p, v, retval)
else
SCARG(&ua, tptr) = NULL;
return sys_utimes(p, &ua, retval);
return sys_utimes(l, &ua, retval);
}
/*
@ -258,8 +282,8 @@ linux_sys_utime(p, v, retval)
* it to what Linux wants.
*/
int
linux_sys_waitpid(p, v, retval)
struct proc *p;
linux_sys_waitpid(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -268,6 +292,7 @@ linux_sys_waitpid(p, v, retval)
syscallarg(int *) status;
syscallarg(int) options;
} */ *uap = v;
struct proc *p = l->l_proc;
struct sys_wait4_args w4a;
int error, *status, tstat;
caddr_t sg;
@ -283,7 +308,7 @@ linux_sys_waitpid(p, v, retval)
SCARG(&w4a, options) = SCARG(uap, options);
SCARG(&w4a, rusage) = NULL;
if ((error = sys_wait4(p, &w4a, retval)))
if ((error = sys_wait4(l, &w4a, retval)))
return error;
sigdelset(&p->p_sigctx.ps_siglist, SIGCHLD);
@ -300,8 +325,8 @@ linux_sys_waitpid(p, v, retval)
}
int
linux_sys_setresgid(p, v, retval)
struct proc *p;
linux_sys_setresgid(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -310,6 +335,7 @@ linux_sys_setresgid(p, v, retval)
syscallarg(gid_t) egid;
syscallarg(gid_t) sgid;
} */ *uap = v;
struct proc *p = l->l_proc;
struct pcred *pc = p->p_cred;
gid_t rgid, egid, sgid;
int error;
@ -367,8 +393,8 @@ linux_sys_setresgid(p, v, retval)
}
int
linux_sys_getresgid(p, v, retval)
struct proc *p;
linux_sys_getresgid(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -377,6 +403,7 @@ linux_sys_getresgid(p, v, retval)
syscallarg(gid_t *) egid;
syscallarg(gid_t *) sgid;
} */ *uap = v;
struct proc *p = l->l_proc;
struct pcred *pc = p->p_cred;
int error;
@ -403,14 +430,15 @@ linux_sys_getresgid(p, v, retval)
* need to deal with it.
*/
int
linux_sys_stime(p, v, retval)
struct proc *p;
linux_sys_stime(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
struct linux_sys_time_args /* {
linux_time_t *t;
} */ *uap = v;
struct proc *p = l->l_proc;
struct timeval atv;
linux_time_t tt;
int error;

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_mmap.h,v 1.13 2002/03/22 15:21:29 christos Exp $ */
/* $NetBSD: linux_mmap.h,v 1.14 2003/01/18 08:04:37 thorpej Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -89,7 +89,7 @@ struct linux_sys_mmap_args {
#ifdef _KERNEL
__BEGIN_DECLS
int linux_sys_mmap __P((struct proc *p, void *v, register_t *retval));
int linux_sys_mmap __P((struct lwp *p, void *v, register_t *retval));
__END_DECLS
#endif /* !_KERNEL */

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_msg.h,v 1.5 1998/10/04 00:02:37 fvdl Exp $ */
/* $NetBSD: linux_msg.h,v 1.6 2003/01/18 08:04:37 thorpej Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@ -108,7 +108,7 @@ struct linux_sys_msgctl_args {
#ifdef SYSVMSG
#ifdef _KERNEL
__BEGIN_DECLS
int linux_sys_msgctl __P((struct proc *, void *, register_t *));
int linux_sys_msgctl __P((struct lwp *, void *, register_t *));
void linux_to_bsd_msqid_ds __P((struct linux_msqid_ds *,
struct msqid_ds *));
void bsd_to_linux_msqid_ds __P((struct msqid_ds *,

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_oldmmap.c,v 1.60 2002/12/17 10:42:02 tron Exp $ */
/* $NetBSD: linux_oldmmap.c,v 1.61 2003/01/18 08:04:38 thorpej Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@ -37,12 +37,13 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: linux_oldmmap.c,v 1.60 2002/12/17 10:42:02 tron Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux_oldmmap.c,v 1.61 2003/01/18 08:04:38 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/mount.h>
#include <sys/sa.h>
#include <sys/syscallargs.h>
#include <uvm/uvm_param.h>
@ -70,8 +71,8 @@ __KERNEL_RCSID(0, "$NetBSD: linux_oldmmap.c,v 1.60 2002/12/17 10:42:02 tron Exp
* They just pass everything in a structure.
*/
int
linux_sys_old_mmap(p, v, retval)
struct proc *p;
linux_sys_old_mmap(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -97,6 +98,6 @@ linux_sys_old_mmap(p, v, retval)
DPRINTF(("old_mmap(%p, %d, %d, %d, %d, %d)\n",
lmap.lm_addr, lmap.lm_len, lmap.lm_prot, lmap.lm_flags,
lmap.lm_fd, lmap.lm_pos));
return linux_sys_mmap(p, &nlmap, retval);
return linux_sys_mmap(l, &nlmap, retval);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_oldselect.c,v 1.52 2001/11/13 02:08:56 lukem Exp $ */
/* $NetBSD: linux_oldselect.c,v 1.53 2003/01/18 08:04:38 thorpej Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@ -37,12 +37,13 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: linux_oldselect.c,v 1.52 2001/11/13 02:08:56 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux_oldselect.c,v 1.53 2003/01/18 08:04:38 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/mount.h>
#include <sys/sa.h>
#include <sys/syscallargs.h>
#include <compat/linux/common/linux_types.h>
@ -62,8 +63,8 @@ __KERNEL_RCSID(0, "$NetBSD: linux_oldselect.c,v 1.52 2001/11/13 02:08:56 lukem E
* in registers on the i386 like Linux wants to.
*/
int
linux_sys_oldselect(p, v, retval)
struct proc *p;
linux_sys_oldselect(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{
@ -76,7 +77,7 @@ linux_sys_oldselect(p, v, retval)
if ((error = copyin(SCARG(uap, lsp), &ls, sizeof(ls))))
return error;
return linux_select1(p, retval, ls.nfds, ls.readfds, ls.writefds,
return linux_select1(l, retval, ls.nfds, ls.readfds, ls.writefds,
ls.exceptfds, ls.timeout);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_olduname.c,v 1.57 2001/11/13 02:08:57 lukem Exp $ */
/* $NetBSD: linux_olduname.c,v 1.58 2003/01/18 08:04:38 thorpej Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: linux_olduname.c,v 1.57 2001/11/13 02:08:57 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux_olduname.c,v 1.58 2003/01/18 08:04:38 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -46,6 +46,7 @@ __KERNEL_RCSID(0, "$NetBSD: linux_olduname.c,v 1.57 2001/11/13 02:08:57 lukem Ex
#include <sys/mman.h>
#include <sys/mount.h>
#include <sys/sa.h>
#include <sys/syscallargs.h>
#include <compat/linux/common/linux_types.h>
@ -60,8 +61,8 @@ __KERNEL_RCSID(0, "$NetBSD: linux_olduname.c,v 1.57 2001/11/13 02:08:57 lukem Ex
/* Alpha: XXX Only if we assume osf_utsname is used by Linux programs. */
int
linux_sys_olduname(p, v, retval)
struct proc *p;
linux_sys_olduname(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
{