[BACK]Return to kern_exit_43.c CVS log [TXT][DIR] Up to [local] / sys / compat / common

Annotation of sys/compat/common/kern_exit_43.c, Revision 1.1.1.1

1.1       nbrk        1: /*     $OpenBSD: kern_exit_43.c,v 1.7 2003/06/02 23:27:59 millert Exp $        */
                      2: /*     $NetBSD: kern_exit_43.c,v 1.3 1995/10/07 06:26:20 mycroft Exp $ */
                      3:
                      4: /*
                      5:  * Copyright (c) 1982, 1986, 1989, 1991, 1993
                      6:  *     The Regents of the University of California.  All rights reserved.
                      7:  * (c) UNIX System Laboratories, Inc.
                      8:  * All or some portions of this file are derived from material licensed
                      9:  * to the University of California by American Telephone and Telegraph
                     10:  * Co. or Unix System Laboratories, Inc. and are reproduced herein with
                     11:  * the permission of UNIX System Laboratories, Inc.
                     12:  *
                     13:  * Redistribution and use in source and binary forms, with or without
                     14:  * modification, are permitted provided that the following conditions
                     15:  * are met:
                     16:  * 1. Redistributions of source code must retain the above copyright
                     17:  *    notice, this list of conditions and the following disclaimer.
                     18:  * 2. Redistributions in binary form must reproduce the above copyright
                     19:  *    notice, this list of conditions and the following disclaimer in the
                     20:  *    documentation and/or other materials provided with the distribution.
                     21:  * 3. Neither the name of the University nor the names of its contributors
                     22:  *    may be used to endorse or promote products derived from this software
                     23:  *    without specific prior written permission.
                     24:  *
                     25:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     26:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     27:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     28:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     29:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     30:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     31:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     32:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     33:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     34:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     35:  * SUCH DAMAGE.
                     36:  *
                     37:  *     @(#)kern_exit.c 8.7 (Berkeley) 2/12/94
                     38:  */
                     39:
                     40: #include <sys/param.h>
                     41: #include <sys/systm.h>
                     42: #include <sys/ioctl.h>
                     43: #include <sys/proc.h>
                     44: #include <sys/tty.h>
                     45: #include <sys/time.h>
                     46: #include <sys/resource.h>
                     47: #include <sys/kernel.h>
                     48: #include <sys/proc.h>
                     49: #include <sys/buf.h>
                     50: #include <sys/wait.h>
                     51: #include <sys/file.h>
                     52: #include <sys/vnode.h>
                     53: #include <sys/syslog.h>
                     54: #include <sys/malloc.h>
                     55: #include <sys/resourcevar.h>
                     56: #include <sys/ptrace.h>
                     57: #include <sys/acct.h>
                     58:
                     59: #include <sys/mount.h>
                     60: #include <sys/syscallargs.h>
                     61:
                     62: #include <machine/cpu.h>
                     63: #include <machine/reg.h>
                     64: #include <compat/common/compat_util.h>
                     65:
                     66: #include <uvm/uvm_extern.h>
                     67: #ifdef m68k
                     68: #include <machine/frame.h>
                     69: #include <machine/psl.h>
                     70: #define GETPS(rp)      ((struct frame *)(rp))->f_sr
                     71: #else
                     72: #define GETPS(rp)      (rp)[PS]
                     73: #endif
                     74:
                     75: int
                     76: compat_43_sys_wait(p, v, retval)
                     77:        struct proc *p;
                     78:        void *v;
                     79:        register_t *retval;
                     80: {
                     81:        caddr_t sg = stackgap_init(p->p_emul);
                     82:        int error;
                     83:
                     84:        struct sys_wait4_args /* {
                     85:                syscallarg(int) pid;
                     86:                syscallarg(int *) status;
                     87:                syscallarg(int) options;
                     88:                syscallarg(struct rusage *) rusage;
                     89:        } */ a;
                     90:
                     91: #ifdef m68k
                     92:        if ((GETPS(p->p_md.md_regs) & PSL_ALLCC) != PSL_ALLCC) {
                     93:                SCARG(&a, options) = 0;
                     94:                SCARG(&a, rusage) = NULL;
                     95:        } else {
                     96:                SCARG(&a, options) = p->p_md.md_regs[R0];
                     97:                SCARG(&a, rusage) = (struct rusage *)p->p_md.md_regs[R1];
                     98:        }
                     99: #else
                    100:        SCARG(&a, options) = 0;
                    101:        SCARG(&a, rusage) = NULL;
                    102: #endif
                    103:        SCARG(&a, pid) = WAIT_ANY;
                    104:        SCARG(&a, status) = stackgap_alloc(&sg, sizeof(SCARG(&a, status)));
                    105:        if ((error = sys_wait4(p, &a, retval)) != 0)
                    106:                return error;
                    107:        return copyin(SCARG(&a, status), &retval[1], sizeof(retval[1]));
                    108: }

CVSweb