diff options
Diffstat (limited to 'sys')
61 files changed, 0 insertions, 14901 deletions
diff --git a/sys/arch/i386/i386/svr4_machdep.c b/sys/arch/i386/i386/svr4_machdep.c deleted file mode 100644 index dd53247a300..00000000000 --- a/sys/arch/i386/i386/svr4_machdep.c +++ /dev/null @@ -1,480 +0,0 @@ -/* $OpenBSD: svr4_machdep.c,v 1.29 2011/04/18 21:44:55 guenther Exp $ */ -/* $NetBSD: svr4_machdep.c,v 1.24 1996/05/03 19:42:26 christos Exp $ */ - -/* - * Copyright (c) 1994 Christos Zoulas - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/namei.h> -#include <sys/proc.h> -#include <sys/user.h> -#include <sys/filedesc.h> -#include <sys/ioctl.h> -#include <sys/mount.h> -#include <sys/kernel.h> -#include <sys/signal.h> -#include <sys/signalvar.h> -#include <sys/malloc.h> - -#include <sys/syscallargs.h> -#include <compat/svr4/svr4_types.h> -#include <compat/svr4/svr4_ucontext.h> -#include <compat/svr4/svr4_syscallargs.h> -#include <compat/svr4/svr4_util.h> - -#include <machine/cpu.h> -#include <machine/cpufunc.h> -#include <machine/psl.h> -#include <machine/reg.h> -#include <machine/specialreg.h> -#include <machine/sysarch.h> -#include <machine/vm86.h> -#include <machine/svr4_machdep.h> - -static void svr4_getsiginfo(union svr4_siginfo *, int, u_long, int, caddr_t); - -void -svr4_getcontext(struct proc *p, struct svr4_ucontext *uc, int mask, - int oonstack) -{ - struct trapframe *tf = p->p_md.md_regs; - struct sigacts *psp = p->p_sigacts; - svr4_greg_t *r = uc->uc_mcontext.greg; - struct svr4_sigaltstack *s = &uc->uc_stack; - struct sigaltstack *sf = &psp->ps_sigstk; - - bzero(uc, sizeof(struct svr4_ucontext)); - - /* - * Set the general purpose registers - */ -#ifdef VM86 - if (tf->tf_eflags & PSL_VM) { - r[SVR4_X86_GS] = tf->tf_vm86_gs; - r[SVR4_X86_FS] = tf->tf_vm86_fs; - r[SVR4_X86_ES] = tf->tf_vm86_es; - r[SVR4_X86_DS] = tf->tf_vm86_ds; - r[SVR4_X86_EFL] = get_vflags(p); - } else -#endif - { - r[SVR4_X86_FS] = tf->tf_fs; - r[SVR4_X86_GS] = tf->tf_gs; - r[SVR4_X86_ES] = tf->tf_es; - r[SVR4_X86_DS] = tf->tf_ds; - r[SVR4_X86_EFL] = tf->tf_eflags; - } - r[SVR4_X86_EDI] = tf->tf_edi; - r[SVR4_X86_ESI] = tf->tf_esi; - r[SVR4_X86_EBP] = tf->tf_ebp; - r[SVR4_X86_ESP] = tf->tf_esp; - r[SVR4_X86_EBX] = tf->tf_ebx; - r[SVR4_X86_EDX] = tf->tf_edx; - r[SVR4_X86_ECX] = tf->tf_ecx; - r[SVR4_X86_EAX] = tf->tf_eax; - r[SVR4_X86_TRAPNO] = 0; - r[SVR4_X86_ERR] = 0; - r[SVR4_X86_EIP] = tf->tf_eip; - r[SVR4_X86_CS] = tf->tf_cs; - r[SVR4_X86_UESP] = 0; - r[SVR4_X86_SS] = tf->tf_ss; - - /* - * Set the signal stack - */ - bsd_to_svr4_sigaltstack(sf, s); - - /* - * Set the signal mask - */ - bsd_to_svr4_sigset(&mask, &uc->uc_sigmask); - - /* - * Set the flags - */ - uc->uc_flags = SVR4_UC_ALL; -} - - -/* - * Set to ucontext specified. - * has been taken. Reset signal mask and - * stack state from context. - * Return to previous pc and psl as specified by - * context left by sendsig. Check carefully to - * make sure that the user has not modified the - * psl to gain improper privileges or to cause - * a machine fault. - */ -int -svr4_setcontext(struct proc *p, struct svr4_ucontext *uc) -{ - struct sigacts *psp = p->p_sigacts; - struct trapframe *tf; - svr4_greg_t *r = uc->uc_mcontext.greg; - struct svr4_sigaltstack *s = &uc->uc_stack; - struct sigaltstack *sf = &psp->ps_sigstk; - int mask; - - /* - * XXX: - * Should we check the value of flags to determine what to restore? - * What to do with uc_link? - * What to do with floating point stuff? - * Should we bother with the rest of the registers that we - * set to 0 right now? - */ - - tf = p->p_md.md_regs; - - /* - * Restore register context. - */ -#ifdef VM86 - if (r[SVR4_X86_EFL] & PSL_VM) { - tf->tf_vm86_gs = r[SVR4_X86_GS]; - tf->tf_vm86_fs = r[SVR4_X86_FS]; - tf->tf_vm86_es = r[SVR4_X86_ES]; - tf->tf_vm86_ds = r[SVR4_X86_DS]; - set_vflags(p, r[SVR4_X86_EFL]); - } else -#endif - { - /* - * Check for security violations. If we're returning to - * protected mode, the CPU will validate the segment registers - * automatically and generate a trap on violations. We handle - * the trap, rather than doing all of the checking here. - */ - if (((r[SVR4_X86_EFL] ^ tf->tf_eflags) & PSL_USERSTATIC) != 0 || - !USERMODE(r[SVR4_X86_CS], r[SVR4_X86_EFL])) - return (EINVAL); - - tf->tf_fs = r[SVR4_X86_FS]; - tf->tf_gs = r[SVR4_X86_GS]; - tf->tf_es = r[SVR4_X86_ES]; - tf->tf_ds = r[SVR4_X86_DS]; - tf->tf_eflags = r[SVR4_X86_EFL]; - } - tf->tf_edi = r[SVR4_X86_EDI]; - tf->tf_esi = r[SVR4_X86_ESI]; - tf->tf_ebp = r[SVR4_X86_EBP]; - tf->tf_ebx = r[SVR4_X86_EBX]; - tf->tf_edx = r[SVR4_X86_EDX]; - tf->tf_ecx = r[SVR4_X86_ECX]; - tf->tf_eax = r[SVR4_X86_EAX]; - tf->tf_eip = r[SVR4_X86_EIP]; - tf->tf_cs = r[SVR4_X86_CS]; - tf->tf_ss = r[SVR4_X86_SS]; - tf->tf_esp = r[SVR4_X86_ESP]; - - /* - * restore signal stack - */ - svr4_to_bsd_sigaltstack(s, sf); - - /* - * restore signal mask - */ - svr4_to_bsd_sigset(&uc->uc_sigmask, &mask); - p->p_sigmask = mask & ~sigcantmask; - - return EJUSTRETURN; -} - - -static void -svr4_getsiginfo(union svr4_siginfo *si, int sig, u_long code, int type, - caddr_t addr) -{ - si->svr4_si_signo = bsd_to_svr4_sig[sig]; - si->svr4_si_errno = 0; - si->svr4_si_addr = addr; - - si->svr4_si_code = 0; - si->svr4_si_trap = 0; - - switch (sig) { - case SIGSEGV: - switch (type) { - case SEGV_ACCERR: - si->svr4_si_code = SVR4_SEGV_ACCERR; - si->svr4_si_trap = SVR4_T_PROTFLT; - break; - case SEGV_MAPERR: - si->svr4_si_code = SVR4_SEGV_MAPERR; - si->svr4_si_trap = SVR4_T_SEGNPFLT; - break; - } - break; - case SIGBUS: - switch (type) { - case BUS_ADRALN: - si->svr4_si_code = SVR4_BUS_ADRALN; - si->svr4_si_trap = SVR4_T_ALIGNFLT; - break; - } - break; - case SIGTRAP: - switch (type) { - case TRAP_BRKPT: - si->svr4_si_code = SVR4_TRAP_BRKPT; - si->svr4_si_trap = SVR4_T_BPTFLT; - break; - case TRAP_TRACE: - si->svr4_si_code = SVR4_TRAP_TRACE; - si->svr4_si_trap = SVR4_T_TRCTRAP; - break; - } - break; - case SIGEMT: - switch (type) { - } - break; - case SIGILL: - switch (type) { - case ILL_PRVOPC: - si->svr4_si_code = SVR4_ILL_PRVOPC; - si->svr4_si_trap = SVR4_T_PRIVINFLT; - break; - case ILL_BADSTK: - si->svr4_si_code = SVR4_ILL_BADSTK; - si->svr4_si_trap = SVR4_T_STKFLT; - break; - } - break; - case SIGFPE: - switch (type) { - case FPE_INTOVF: - si->svr4_si_code = SVR4_FPE_INTOVF; - si->svr4_si_trap = SVR4_T_DIVIDE; - break; - case FPE_FLTDIV: - si->svr4_si_code = SVR4_FPE_FLTDIV; - si->svr4_si_trap = SVR4_T_DIVIDE; - break; - case FPE_FLTOVF: - si->svr4_si_code = SVR4_FPE_FLTOVF; - si->svr4_si_trap = SVR4_T_DIVIDE; - break; - case FPE_FLTSUB: - si->svr4_si_code = SVR4_FPE_FLTSUB; - si->svr4_si_trap = SVR4_T_BOUND; - break; - case FPE_FLTINV: - si->svr4_si_code = SVR4_FPE_FLTINV; - si->svr4_si_trap = SVR4_T_FPOPFLT; - break; - } - break; - } -} - - -/* - * Send an interrupt to process. - * - * Stack is set up to allow sigcode stored - * in u. to call routine. After the handler is - * done svr4 will call setcontext for us - * with the user context we just set up, and we - * will return to the user pc, psl. - */ -void -svr4_sendsig(sig_t catcher, int sig, int mask, u_long code, int type, - union sigval val) -{ - struct proc *p = curproc; - struct trapframe *tf; - struct svr4_sigframe *fp, frame; - struct sigacts *psp = p->p_sigacts; - int oonstack; - - tf = p->p_md.md_regs; - oonstack = psp->ps_sigstk.ss_flags & SS_ONSTACK; - - /* - * Allocate space for the signal handler context. - */ - if ((psp->ps_flags & SAS_ALTSTACK) && !oonstack && - (psp->ps_sigonstack & sigmask(sig))) { - fp = (struct svr4_sigframe *)((char *)psp->ps_sigstk.ss_sp + - psp->ps_sigstk.ss_size - sizeof(struct svr4_sigframe)); - psp->ps_sigstk.ss_flags |= SS_ONSTACK; - } else { - fp = (struct svr4_sigframe *)tf->tf_esp - 1; - } - - /* - * Build the argument list for the signal handler. - * Notes: - * - we always build the whole argument list, even when we - * don't need to [when SA_SIGINFO is not set, we don't need - * to pass all sf_si and sf_uc] - * - we don't pass the correct signal address [we need to - * modify many kernel files to enable that] - */ - - svr4_getcontext(p, &frame.sf_uc, mask, oonstack); - svr4_getsiginfo(&frame.sf_si, sig, code, type, val.sival_ptr); - - frame.sf_signum = frame.sf_si.svr4_si_signo; - frame.sf_sip = &fp->sf_si; - frame.sf_ucp = &fp->sf_uc; - frame.sf_handler = catcher; -#ifdef DEBUG_SVR4 - printf("sig = %d, sip %p, ucp = %p, handler = %p\n", - frame.sf_signum, frame.sf_sip, frame.sf_ucp, frame.sf_handler); -#endif - - 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); - /* NOTREACHED */ - } - - /* - * Build context to run handler in. - */ - tf->tf_es = GSEL(GUDATA_SEL, SEL_UPL); - tf->tf_ds = GSEL(GUDATA_SEL, SEL_UPL); - tf->tf_eip = p->p_sigcode; - tf->tf_cs = GSEL(GUCODE_SEL, SEL_UPL); - tf->tf_eflags &= ~(PSL_T|PSL_D|PSL_VM|PSL_AC); - tf->tf_esp = (int)fp; - tf->tf_ss = GSEL(GUDATA_SEL, SEL_UPL); -} - - -/* - * sysi86 - */ -int -svr4_sys_sysarch(struct proc *p, void *v, register_t *retval) -{ - struct svr4_sys_sysarch_args *uap = v; - int error; -#ifdef USER_LDT - caddr_t sg = stackgap_init(p->p_emul); -#endif - *retval = 0; /* XXX: What to do */ - - switch (SCARG(uap, op)) { - case SVR4_SYSARCH_FPHW: - return 0; - - case SVR4_SYSARCH_DSCR: -#ifdef USER_LDT - if (user_ldt_enable == 0) - return (ENOSYS); - else { - struct i386_set_ldt_args sa, *sap; - struct sys_sysarch_args ua; - - struct svr4_ssd ssd; - union descriptor bsd; - - if ((error = copyin(SCARG(uap, a1), &ssd, - sizeof(ssd))) != 0) { - printf("Cannot copy arg1\n"); - return error; - } - - printf("s=%x, b=%x, l=%x, a1=%x a2=%x\n", - ssd.selector, ssd.base, ssd.limit, - ssd.access1, ssd.access2); - - /* We can only set ldt's for now. */ - if (!ISLDT(ssd.selector)) { - printf("Not an ldt\n"); - return EPERM; - } - - /* Oh, well we don't cleanup either */ - if (ssd.access1 == 0) - return 0; - - bsd.sd.sd_lobase = ssd.base & 0xffffff; - bsd.sd.sd_hibase = (ssd.base >> 24) & 0xff; - - bsd.sd.sd_lolimit = ssd.limit & 0xffff; - bsd.sd.sd_hilimit = (ssd.limit >> 16) & 0xf; - - bsd.sd.sd_type = ssd.access1 & 0x1f; - bsd.sd.sd_dpl = (ssd.access1 >> 5) & 0x3; - bsd.sd.sd_p = (ssd.access1 >> 7) & 0x1; - - bsd.sd.sd_xx = ssd.access2 & 0x3; - bsd.sd.sd_def32 = (ssd.access2 >> 2) & 0x1; - bsd.sd.sd_gran = (ssd.access2 >> 3)& 0x1; - - sa.start = IDXSEL(ssd.selector); - sa.desc = stackgap_alloc(&sg, sizeof(union descriptor)); - sa.num = 1; - sap = stackgap_alloc(&sg, - sizeof(struct i386_set_ldt_args)); - - if ((error = copyout(&sa, sap, sizeof(sa))) != 0) { - printf("Cannot copyout args\n"); - return error; - } - - SCARG(&ua, op) = I386_SET_LDT; - SCARG(&ua, parms) = (char *) sap; - - if ((error = copyout(&bsd, sa.desc, sizeof(bsd))) != 0) { - printf("Cannot copyout desc\n"); - return error; - } - - return sys_sysarch(p, &ua, retval); - } -#endif - case SVR4_SYSARCH_GOSF: - { - /* just as SCO Openserver 5.0 says */ - char features[] = {1,1,1,1,1,1,1,1,2,1,1,1}; - - if ((error = copyout(features, SCARG(uap, a1), - sizeof(features))) != 0) { - printf("Cannot copyout vector\n"); - return error; - } - - return 0; - } - - default: - printf("svr4_sysarch(%d), a1 %p\n", SCARG(uap, op), - SCARG(uap, a1)); - return 0; - } -} diff --git a/sys/arch/i386/include/svr4_machdep.h b/sys/arch/i386/include/svr4_machdep.h deleted file mode 100644 index dfd506fd5cc..00000000000 --- a/sys/arch/i386/include/svr4_machdep.h +++ /dev/null @@ -1,119 +0,0 @@ -/* $OpenBSD: svr4_machdep.h,v 1.8 2011/03/23 16:54:35 pirofti Exp $ */ -/* $NetBSD: svr4_machdep.h,v 1.5 1995/03/31 02:51:37 christos Exp $ */ - -/* - * Copyright (c) 1994 Christos Zoulas - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _MACHINE_SVR4_MACHDEP_H_ -#define _MACHINE_SVR4_MACHDEP_H_ - -#include <compat/svr4/svr4_types.h> - -/* - * Machine dependent portions [X86] - */ - -#define SVR4_X86_GS 0 -#define SVR4_X86_FS 1 -#define SVR4_X86_ES 2 -#define SVR4_X86_DS 3 -#define SVR4_X86_EDI 4 -#define SVR4_X86_ESI 5 -#define SVR4_X86_EBP 6 -#define SVR4_X86_ESP 7 -#define SVR4_X86_EBX 8 -#define SVR4_X86_EDX 9 -#define SVR4_X86_ECX 10 -#define SVR4_X86_EAX 11 -#define SVR4_X86_TRAPNO 12 -#define SVR4_X86_ERR 13 -#define SVR4_X86_EIP 14 -#define SVR4_X86_CS 15 -#define SVR4_X86_EFL 16 -#define SVR4_X86_UESP 17 -#define SVR4_X86_SS 18 -#define SVR4_X86_MAXREG 19 - - -typedef int svr4_greg_t; -typedef svr4_greg_t svr4_gregset_t[SVR4_X86_MAXREG]; - -typedef struct { - int f_x87[62]; /* x87 registers */ - long f_weitek[33]; /* weitek */ -} svr4_fregset_t; - -struct svr4_ucontext; - -#ifdef _KERNEL -void svr4_getcontext(struct proc *, struct svr4_ucontext *, int, int); -int svr4_setcontext(struct proc *, struct svr4_ucontext *); -void svr4_sendsig(sig_t, int, int, u_long, int, union sigval); -#endif - -typedef struct { - svr4_gregset_t greg; - svr4_fregset_t freg; -} svr4_mcontext_t; - -/* - * SYSARCH numbers - */ -#define SVR4_SYSARCH_FPHW 40 -#define SVR4_SYSARCH_DSCR 75 - -struct svr4_ssd { - unsigned int selector; - unsigned int base; - unsigned int limit; - unsigned int access1; - unsigned int access2; -}; - -#define SVR4_SYSARCH_GOSF 114 /* get OS features vector */ - -/* - * Processor traps - */ -#define SVR4_T_DIVIDE 0 -#define SVR4_T_TRCTRAP 1 -#define SVR4_T_NMI 2 -#define SVR4_T_BPTFLT 3 -#define SVR4_T_OFLOW 4 -#define SVR4_T_BOUND 5 -#define SVR4_T_PRIVINFLT 6 -#define SVR4_T_DNA 7 -#define SVR4_T_DOUBLEFLT 8 -#define SVR4_T_FPOPFLT 9 -#define SVR4_T_TSSFLT 10 -#define SVR4_T_SEGNPFLT 11 -#define SVR4_T_STKFLT 12 -#define SVR4_T_PROTFLT 13 -#define SVR4_T_PAGEFLT 14 -#define SVR4_T_ALIGNFLT 17 - -#endif /* !_MACHINE_SVR4_MACHDEP_H_ */ diff --git a/sys/arch/solbourne/include/svr4_machdep.h b/sys/arch/solbourne/include/svr4_machdep.h deleted file mode 100644 index be706d0bfa5..00000000000 --- a/sys/arch/solbourne/include/svr4_machdep.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $OpenBSD: svr4_machdep.h,v 1.1 2005/04/19 21:30:18 miod Exp $ */ -/* public domain */ -#include <sparc/svr4_machdep.h>
\ No newline at end of file diff --git a/sys/arch/sparc/include/svr4_machdep.h b/sys/arch/sparc/include/svr4_machdep.h deleted file mode 100644 index b2f730cd6d5..00000000000 --- a/sys/arch/sparc/include/svr4_machdep.h +++ /dev/null @@ -1,128 +0,0 @@ -/* $OpenBSD: svr4_machdep.h,v 1.8 2011/03/23 16:54:37 pirofti Exp $ */ -/* $NetBSD: svr4_machdep.h,v 1.4 1996/03/31 22:21:45 pk Exp $ */ - -/* - * Copyright (c) 1994 Christos Zoulas - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _MACHINE_SVR4_MACHDEP_H_ -#define _MACHINE_SVR4_MACHDEP_H_ - -#include <compat/svr4/svr4_types.h> - -/* - * Machine dependent portions [SPARC] - */ - -#define SVR4_SPARC_PSR 0 -#define SVR4_SPARC_PC 1 -#define SVR4_SPARC_nPC 2 -#define SVR4_SPARC_Y 3 -#define SVR4_SPARC_G1 4 -#define SVR4_SPARC_G2 5 -#define SVR4_SPARC_G3 6 -#define SVR4_SPARC_G4 7 -#define SVR4_SPARC_G5 8 -#define SVR4_SPARC_G6 9 -#define SVR4_SPARC_G7 10 -#define SVR4_SPARC_O0 11 -#define SVR4_SPARC_O1 12 -#define SVR4_SPARC_O2 13 -#define SVR4_SPARC_O3 14 -#define SVR4_SPARC_O4 15 -#define SVR4_SPARC_O5 16 -#define SVR4_SPARC_O6 17 -#define SVR4_SPARC_O7 18 -#define SVR4_SPARC_MAXREG 19 - -#define SVR4_SPARC_SP SVR4_SPARC_O6 -#define SVR4_SPARC_PS SVR4_SPARC_PSR - -#define SVR4_SPARC_MAXWIN 31 - -typedef int svr4_greg_t; - -typedef struct { - svr4_greg_t rwin_lo[8]; - svr4_greg_t rwin_in[8]; -} svr4_rwindow_t; - -typedef struct { - int cnt; - int *sp[SVR4_SPARC_MAXWIN]; - svr4_rwindow_t win[SVR4_SPARC_MAXWIN]; -} svr4_gwindow_t; - -typedef svr4_greg_t svr4_gregset_t[SVR4_SPARC_MAXREG]; - -typedef struct { - union { - u_int fp_ri[32]; - double fp_rd[16]; - } fpu_regs; - void *fp_q; - unsigned fp_fsr; - u_char fp_nqel; - u_char fp_nqsize; - u_char fp_busy; -} svr4_fregset_t; - -typedef struct { - svr4_gregset_t greg; - svr4_gwindow_t *gwin; - svr4_fregset_t freg; - long pad[21]; -} svr4_mcontext_t; - -struct svr4_ucontext; - -void svr4_getcontext(struct proc *, struct svr4_ucontext *, - int, int); -int svr4_setcontext(struct proc *p, struct svr4_ucontext *); -void svr4_sendsig(sig_t, int, int, u_long, int, union sigval); -int svr4_trap(int, struct proc *); - -/* - * Processor traps - */ -#define SVR4_T_DIVIDE 0 -#define SVR4_T_TRCTRAP 1 -#define SVR4_T_NMI 2 -#define SVR4_T_BPTFLT 3 -#define SVR4_T_OFLOW 4 -#define SVR4_T_BOUND 5 -#define SVR4_T_PRIVINFLT 6 -#define SVR4_T_DNA 7 -#define SVR4_T_DOUBLEFLT 8 -#define SVR4_T_FPOPFLT 9 -#define SVR4_T_TSSFLT 10 -#define SVR4_T_SEGNPFLT 11 -#define SVR4_T_STKFLT 12 -#define SVR4_T_PROTFLT 13 -#define SVR4_T_PAGEFLT 14 -#define SVR4_T_ALIGNFLT 17 - -#endif /* !_MACHINE_SVR4_MACHDEP_H_ */ diff --git a/sys/arch/sparc/sparc/svr4_machdep.c b/sys/arch/sparc/sparc/svr4_machdep.c deleted file mode 100644 index e1514f427fc..00000000000 --- a/sys/arch/sparc/sparc/svr4_machdep.c +++ /dev/null @@ -1,618 +0,0 @@ -/* $OpenBSD: svr4_machdep.c,v 1.17 2011/04/18 21:44:55 guenther Exp $ */ -/* $NetBSD: svr4_machdep.c,v 1.24 1997/07/29 10:04:45 fair Exp $ */ - -/* - * Copyright (c) 1994 Christos Zoulas - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/namei.h> -#include <sys/proc.h> -#include <sys/filedesc.h> -#include <sys/ioctl.h> -#include <sys/mount.h> -#include <sys/kernel.h> -#include <sys/signal.h> -#include <sys/signalvar.h> -#include <sys/malloc.h> -#include <sys/buf.h> -#include <sys/exec.h> - -#include <sys/syscallargs.h> -#include <compat/svr4/svr4_types.h> -#include <compat/svr4/svr4_ucontext.h> -#include <compat/svr4/svr4_syscallargs.h> -#include <compat/svr4/svr4_util.h> - -#include <machine/cpu.h> -#include <machine/psl.h> -#include <machine/reg.h> -#include <machine/trap.h> -#include <machine/svr4_machdep.h> - -static void svr4_getsiginfo(union svr4_siginfo *, int, u_long, int, caddr_t); - -#ifdef DEBUG -extern int sigdebug; -extern int sigpid; -#define SDB_FOLLOW 0x01 /* XXX: dup from machdep.c */ -#define SDB_KSTACK 0x02 -#define SDB_FPSTATE 0x04 -#endif - -#ifdef DEBUG_SVR4 -static void svr4_printcontext(const char *, struct svr4_ucontext *); - -static void -svr4_printcontext(fun, uc) - const char *fun; - struct svr4_ucontext *uc; -{ - svr4_greg_t *r = uc->uc_mcontext.greg; - struct svr4_sigaltstack *s = &uc->uc_stack; - - printf("%s at %p\n", fun, uc); - - printf("Regs: "); - printf("PSR = 0x%x ", r[SVR4_SPARC_PSR]); - printf("PC = 0x%x ", r[SVR4_SPARC_PC]); - printf("nPC = 0x%x ", r[SVR4_SPARC_nPC]); - printf("Y = 0x%x ", r[SVR4_SPARC_Y]); - printf("G1 = 0x%x ", r[SVR4_SPARC_G1]); - printf("G2 = 0x%x ", r[SVR4_SPARC_G2]); - printf("G3 = 0x%x ", r[SVR4_SPARC_G3]); - printf("G4 = 0x%x ", r[SVR4_SPARC_G4]); - printf("G5 = 0x%x ", r[SVR4_SPARC_G5]); - printf("G6 = 0x%x ", r[SVR4_SPARC_G6]); - printf("G7 = 0x%x ", r[SVR4_SPARC_G7]); - printf("O0 = 0x%x ", r[SVR4_SPARC_O0]); - printf("O1 = 0x%x ", r[SVR4_SPARC_O1]); - printf("O2 = 0x%x ", r[SVR4_SPARC_O2]); - printf("O3 = 0x%x ", r[SVR4_SPARC_O3]); - printf("O4 = 0x%x ", r[SVR4_SPARC_O4]); - printf("O5 = 0x%x ", r[SVR4_SPARC_O5]); - printf("O6 = 0x%x ", r[SVR4_SPARC_O6]); - printf("O7 = 0x%x ", r[SVR4_SPARC_O7]); - printf("\n"); - - printf("Signal Stack: sp %p, size %d, flags 0x%x\n", - s->ss_sp, s->ss_size, s->ss_flags); - - printf("Flags: 0x%lx\n", uc->uc_flags); -} -#endif - -void -svr4_getcontext(p, uc, mask, oonstack) - struct proc *p; - struct svr4_ucontext *uc; - int mask, oonstack; -{ - struct trapframe *tf = (struct trapframe *)p->p_md.md_tf; - svr4_greg_t *r = uc->uc_mcontext.greg; - struct svr4_sigaltstack *s = &uc->uc_stack; -#ifdef FPU_CONTEXT - svr4_fregset_t *f = &uc->uc_mcontext.freg; - struct fpstate *fps = p->p_md.md_fpstate; -#endif - - write_user_windows(); - if (rwindow_save(p)) - sigexit(p, SIGILL); - - bzero(uc, sizeof(struct svr4_ucontext)); - - /* - * Get the general purpose registers - */ - r[SVR4_SPARC_PSR] = tf->tf_psr; - r[SVR4_SPARC_PC] = tf->tf_pc; - r[SVR4_SPARC_nPC] = tf->tf_npc; - r[SVR4_SPARC_Y] = tf->tf_y; - r[SVR4_SPARC_G1] = tf->tf_global[1]; - r[SVR4_SPARC_G2] = tf->tf_global[2]; - r[SVR4_SPARC_G3] = tf->tf_global[3]; - r[SVR4_SPARC_G4] = tf->tf_global[4]; - r[SVR4_SPARC_G5] = tf->tf_global[5]; - r[SVR4_SPARC_G6] = tf->tf_global[6]; - r[SVR4_SPARC_G7] = tf->tf_global[7]; - r[SVR4_SPARC_O0] = tf->tf_out[0]; - r[SVR4_SPARC_O1] = tf->tf_out[1]; - r[SVR4_SPARC_O2] = tf->tf_out[2]; - r[SVR4_SPARC_O3] = tf->tf_out[3]; - r[SVR4_SPARC_O4] = tf->tf_out[4]; - r[SVR4_SPARC_O5] = tf->tf_out[5]; - r[SVR4_SPARC_O6] = tf->tf_out[6]; - r[SVR4_SPARC_O7] = tf->tf_out[7]; - -#ifdef FPU_CONTEXT - /* - * Get the floating point registers - */ - bcopy(fps->fs_regs, f->fpu_regs, sizeof(fps->fs_regs)); - f->fp_nqsize = sizeof(struct fp_qentry); - f->fp_nqel = fps->fs_qsize; - f->fp_fsr = fps->fs_fsr; - if (f->fp_q != NULL) { - size_t sz = f->fp_nqel * f->fp_nqsize; - if (sz > sizeof(fps->fs_queue)) { -#ifdef DIAGNOSTIC - printf("svr4_getcontext: fp_queue too large\n"); -#endif - return; - } - if (copyout(fps->fs_queue, f->fp_q, sz) != 0) { -#ifdef DIAGNOSTIC - printf("svr4_getcontext: copy of fp_queue failed %d\n", - error); -#endif - return; - } - } - f->fp_busy = 0; /* XXX: How do we determine that? */ -#endif - - /* - * Set the signal stack to something reasonable - */ - /* XXX: Don't really know what to do with this */ - s->ss_sp = (char *) ((r[SVR4_SPARC_SP] & ~0xfff) - 8192); - s->ss_size = 8192; - s->ss_flags = 0; - - /* - * Get the signal mask - */ - bsd_to_svr4_sigset(&mask, &uc->uc_sigmask); - - /* - * Get the flags - */ - uc->uc_flags = SVR4_UC_CPU|SVR4_UC_SIGMASK|SVR4_UC_STACK; - -#ifdef DEBUG_SVR4 - svr4_printcontext("getcontext", uc); -#endif -} - - -/* - * Set to ucontext specified. - * has been taken. Reset signal mask and - * stack state from context. - * Return to previous pc and psl as specified by - * context left by sendsig. Check carefully to - * make sure that the user has not modified the - * psl to gain improper privileges or to cause - * a machine fault. - * This is almost like sigreturn() and it shows. - */ -int -svr4_setcontext(p, uc) - struct proc *p; - struct svr4_ucontext *uc; -{ - struct sigacts *psp = p->p_sigacts; - register struct trapframe *tf; - svr4_greg_t *r = uc->uc_mcontext.greg; - struct svr4_sigaltstack *s = &uc->uc_stack; - struct sigaltstack *sf = &psp->ps_sigstk; - int mask; -#ifdef FPU_CONTEXT - svr4_fregset_t *f = &uc->uc_mcontext.freg; - struct fpstate *fps = p->p_md.md_fpstate; -#endif - -#ifdef DEBUG_SVR4 - svr4_printcontext("setcontext", uc); -#endif - - write_user_windows(); - if (rwindow_save(p)) - sigexit(p, SIGILL); - -#ifdef DEBUG - if (sigdebug & SDB_FOLLOW) - printf("svr4_setcontext: %s[%d], svr4_ucontext %p\n", - p->p_comm, p->p_pid, uc); -#endif - - tf = (struct trapframe *)p->p_md.md_tf; - - /* - * Restore register context. - */ - if (uc->uc_flags & SVR4_UC_CPU) { - /* - * Only the icc bits in the psr are used, so it need not be - * verified. pc and npc must be multiples of 4. This is all - * that is required; if it holds, just do it. - */ - if (((r[SVR4_SPARC_PC] | r[SVR4_SPARC_nPC]) & 3) != 0) { -#ifdef DEBUG_SVR4 - printf("svr4_setcontext: pc or npc are not multiples of 4!\n"); -#endif - return EINVAL; - } - - /* take only psr ICC field */ - tf->tf_psr = (tf->tf_psr & ~PSR_ICC) | - (r[SVR4_SPARC_PSR] & PSR_ICC); - tf->tf_pc = r[SVR4_SPARC_PC]; - tf->tf_npc = r[SVR4_SPARC_nPC]; - tf->tf_y = r[SVR4_SPARC_Y]; - - /* Restore everything */ - tf->tf_global[1] = r[SVR4_SPARC_G1]; - tf->tf_global[2] = r[SVR4_SPARC_G2]; - tf->tf_global[3] = r[SVR4_SPARC_G3]; - tf->tf_global[4] = r[SVR4_SPARC_G4]; - tf->tf_global[5] = r[SVR4_SPARC_G5]; - tf->tf_global[6] = r[SVR4_SPARC_G6]; - tf->tf_global[7] = r[SVR4_SPARC_G7]; - - tf->tf_out[0] = r[SVR4_SPARC_O0]; - tf->tf_out[1] = r[SVR4_SPARC_O1]; - tf->tf_out[2] = r[SVR4_SPARC_O2]; - tf->tf_out[3] = r[SVR4_SPARC_O3]; - tf->tf_out[4] = r[SVR4_SPARC_O4]; - tf->tf_out[5] = r[SVR4_SPARC_O5]; - tf->tf_out[6] = r[SVR4_SPARC_O6]; - tf->tf_out[7] = r[SVR4_SPARC_O7]; - } - - -#ifdef FPU_CONTEXT - if (uc->uc_flags & SVR4_UC_FPU) { - /* - * Set the floating point registers - */ - int error; - size_t sz = f->fp_nqel * f->fp_nqsize; - if (sz > sizeof(fps->fs_queue)) { -#ifdef DIAGNOSTIC - printf("svr4_setcontext: fp_queue too large\n"); -#endif - return EINVAL; - } - bcopy(f->fpu_regs, fps->fs_regs, sizeof(fps->fs_regs)); - fps->fs_qsize = f->fp_nqel; - fps->fs_fsr = f->fp_fsr; - if (f->fp_q != NULL) { - size_t sz = f->fp_nqel * f->fp_nqsize; - if (sz > sizeof(fps->fs_queue)) { -#ifdef DIAGNOSTIC - printf("svr4_setcontext: fp_queue too large\n"); -#endif - return (EINVAL); - } - if ((error = copyin(f->fp_q, fps->fs_queue, sz)) != 0) { -#ifdef DIAGNOSTIC - printf("svr4_setcontext: copy of fp_queue failed\n"); -#endif - return error; - } - } - } -#endif - - if (uc->uc_flags & SVR4_UC_STACK) { - /* - * restore signal stack - */ - svr4_to_bsd_sigaltstack(s, sf); - } - - if (uc->uc_flags & SVR4_UC_SIGMASK) { - /* - * restore signal mask - */ - svr4_to_bsd_sigset(&uc->uc_sigmask, &mask); - p->p_sigmask = mask & ~sigcantmask; - } - - return EJUSTRETURN; -} - -/* - * map the native sig/type code into the svr4 siginfo as best we can - */ -static void -svr4_getsiginfo(si, sig, code, type, addr) - union svr4_siginfo *si; - int sig; - u_long code; - int type; - caddr_t addr; -{ - si->svr4_si_signo = bsd_to_svr4_sig[sig]; - si->svr4_si_errno = 0; - si->svr4_si_addr = addr; - /* - * we can do this direct map as they are the same as all sparc - * architectures. - */ - si->svr4_si_trap = code; - - si->svr4_si_code = 0; - si->svr4_si_trap = 0; - - switch (sig) { - case SIGSEGV: - switch (type) { - case SEGV_ACCERR: - si->svr4_si_code = SVR4_SEGV_ACCERR; - si->svr4_si_trap = SVR4_T_PROTFLT; - break; - case SEGV_MAPERR: - si->svr4_si_code = SVR4_SEGV_MAPERR; - si->svr4_si_trap = SVR4_T_SEGNPFLT; - break; - } - break; - case SIGBUS: - switch (type) { - case BUS_ADRALN: - si->svr4_si_code = SVR4_BUS_ADRALN; - si->svr4_si_trap = SVR4_T_ALIGNFLT; - break; - } - break; - case SIGTRAP: - switch (type) { - case TRAP_BRKPT: - si->svr4_si_code = SVR4_TRAP_BRKPT; - si->svr4_si_trap = SVR4_T_BPTFLT; - break; - case TRAP_TRACE: - si->svr4_si_code = SVR4_TRAP_TRACE; - si->svr4_si_trap = SVR4_T_TRCTRAP; - break; - } - break; - case SIGEMT: - switch (type) { - } - break; - case SIGILL: - switch (type) { - case ILL_PRVOPC: - si->svr4_si_code = SVR4_ILL_PRVOPC; - si->svr4_si_trap = SVR4_T_PRIVINFLT; - break; - case ILL_BADSTK: - si->svr4_si_code = SVR4_ILL_BADSTK; - si->svr4_si_trap = SVR4_T_STKFLT; - break; - } - break; - case SIGFPE: - switch (type) { - case FPE_INTOVF: - si->svr4_si_code = SVR4_FPE_INTOVF; - si->svr4_si_trap = SVR4_T_DIVIDE; - break; - case FPE_FLTDIV: - si->svr4_si_code = SVR4_FPE_FLTDIV; - si->svr4_si_trap = SVR4_T_DIVIDE; - break; - case FPE_FLTOVF: - si->svr4_si_code = SVR4_FPE_FLTOVF; - si->svr4_si_trap = SVR4_T_DIVIDE; - break; - case FPE_FLTSUB: - si->svr4_si_code = SVR4_FPE_FLTSUB; - si->svr4_si_trap = SVR4_T_BOUND; - break; - case FPE_FLTINV: - si->svr4_si_code = SVR4_FPE_FLTINV; - si->svr4_si_trap = SVR4_T_FPOPFLT; - break; - } - break; - } -} - -/* - * Send an interrupt to process. - * - * Stack is set up to allow sigcode stored - * in u. to call routine. After the handler is - * done svr4 will call setcontext for us - * with the user context we just set up, and we - * will return to the user pc, psl. - */ -void -svr4_sendsig(catcher, sig, mask, code, type, val) - sig_t catcher; - int sig, mask; - u_long code; - int type; - union sigval val; -{ - register struct proc *p = curproc; - register struct trapframe *tf; - struct svr4_sigframe *fp, frame; - struct sigacts *psp = p->p_sigacts; - int oonstack, oldsp, newsp, caddr; - - tf = (struct trapframe *)p->p_md.md_tf; - oldsp = tf->tf_out[6]; - oonstack = psp->ps_sigstk.ss_flags & SS_ONSTACK; - - /* - * Allocate space for the signal handler context. - */ - if ((psp->ps_flags & SAS_ALTSTACK) && !oonstack && - (psp->ps_sigonstack & sigmask(sig))) { - fp = (struct svr4_sigframe *)(psp->ps_sigstk.ss_sp + - psp->ps_sigstk.ss_size); - psp->ps_sigstk.ss_flags |= SS_ONSTACK; - } else { - fp = (struct svr4_sigframe *)oldsp; - } - - /* - * Subtract off one signal frame and align. - */ - fp = (struct svr4_sigframe *) ((int) (fp - 1) & ~7); - - /* - * Build the argument list for the signal handler. - */ - svr4_getsiginfo(&frame.sf_si, sig, code, type, val.sival_ptr); - svr4_getcontext(p, &frame.sf_uc, mask, oonstack); - frame.sf_signum = frame.sf_si.svr4_si_signo; - frame.sf_sip = &fp->sf_si; - frame.sf_ucp = &fp->sf_uc; - frame.sf_handler = catcher; - - DPRINTF(("svr4_sendsig signum=%d si = %x uc = %x handler = %x\n", - frame.sf_signum, frame.sf_sip, - frame.sf_ucp, frame.sf_handler)); - /* - * Modify the signal context to be used by sigreturn. - */ - frame.sf_uc.uc_mcontext.greg[SVR4_SPARC_SP] = oldsp; - - newsp = (int)fp - sizeof(struct rwindow); - write_user_windows(); - - if (rwindow_save(p) || copyout(&frame, fp, sizeof(frame)) != 0 || - copyout(&oldsp, &((struct rwindow *)newsp)->rw_in[6], - sizeof(register_t)) != 0) { - /* - * Process has trashed its stack; give it an illegal - * instruction to halt it in its tracks. - */ -#ifdef DEBUG - if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid) - printf("svr4_sendsig: window save or copyout error\n"); -#endif - sigexit(p, SIGILL); - /* NOTREACHED */ - } - - /* - * Build context to run handler in. - */ - caddr = p->p_sigcode; - tf->tf_global[1] = (int)catcher; - - tf->tf_pc = caddr; - tf->tf_npc = caddr + 4; - tf->tf_out[6] = newsp; -} - - -#define ADVANCE (n = tf->tf_npc, tf->tf_pc = n, tf->tf_npc = n + 4) -int -svr4_trap(type, p) - int type; - struct proc *p; -{ - int n; - struct trapframe *tf = p->p_md.md_tf; - extern struct emul emul_svr4; - - if (p->p_emul != &emul_svr4) - return 0; - - switch (type) { - case T_SVR4_GETCC: - uprintf("T_SVR4_GETCC\n"); - break; - - case T_SVR4_SETCC: - uprintf("T_SVR4_SETCC\n"); - break; - - case T_SVR4_GETPSR: - tf->tf_out[0] = tf->tf_psr; - break; - - case T_SVR4_SETPSR: - uprintf("T_SVR4_SETPSR\n"); - break; - - case T_SVR4_GETHRTIME: - /* - * this list like gethrtime(3). To implement this - * correctly we need a timer that does not get affected - * adjtime(), or settimeofday(). For now we use - * microtime, and convert to nanoseconds... - */ - /*FALLTHROUGH*/ - case T_SVR4_GETHRVTIME: - /* - * This is like gethrvtime(3). Since we don't have lwp - * we massage microtime() output - */ - { - struct timeval tv; - - microtime(&tv); - tf->tf_out[0] = tv.tv_sec; - tf->tf_out[1] = tv.tv_usec * 1000; - } - break; - - case T_SVR4_GETHRESTIME: - { - /* I assume this is like gettimeofday(3) */ - struct timeval tv; - - microtime(&tv); - tf->tf_out[0] = tv.tv_sec; - tf->tf_out[1] = tv.tv_usec; - } - break; - - default: - return 0; - } - - ADVANCE; - return 1; -} - -/* - */ -int -svr4_sys_sysarch(p, v, retval) - struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_sysarch_args *uap = v; - - switch (SCARG(uap, op)) { - default: - printf("(sparc) svr4_sysarch(%d)\n", SCARG(uap, op)); - return EINVAL; - } -} diff --git a/sys/compat/svr4/Makefile b/sys/compat/svr4/Makefile deleted file mode 100644 index 36e691a00d3..00000000000 --- a/sys/compat/svr4/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -# $OpenBSD: Makefile,v 1.3 2001/08/26 03:23:44 deraadt Exp $ -# $NetBSD: Makefile,v 1.1 1995/10/14 20:24:14 christos Exp $ - -DEP= syscalls.conf syscalls.master ../../kern/makesyscalls.sh -OBJS= svr4_sysent.c svr4_syscalls.c svr4_syscall.h svr4_syscallargs.h - -${OBJS}: ${DEP} - sh ../../kern/makesyscalls.sh syscalls.conf syscalls.master diff --git a/sys/compat/svr4/files.svr4 b/sys/compat/svr4/files.svr4 deleted file mode 100644 index 4c61c7657bf..00000000000 --- a/sys/compat/svr4/files.svr4 +++ /dev/null @@ -1,27 +0,0 @@ -# $OpenBSD: files.svr4,v 1.9 2000/08/23 16:30:53 brad Exp $ -# $NetBSD: files.svr4,v 1.7 1996/05/05 17:14:25 mrg Exp $ -# -# Config.new file description for machine-independent SVR4 compat code. -# Included by ports that need it. - -# ports should define any machine-specific files they need in their -# own file lists. - -file compat/svr4/svr4_errno.c compat_svr4 -file compat/svr4/svr4_exec.c compat_svr4 -file compat/svr4/svr4_fcntl.c compat_svr4 -file compat/svr4/svr4_filio.c compat_svr4 -file compat/svr4/svr4_ioctl.c compat_svr4 -file compat/svr4/svr4_ipc.c compat_svr4 -file compat/svr4/svr4_jioctl.c compat_svr4 -file compat/svr4/svr4_misc.c compat_svr4 -file compat/svr4/svr4_net.c compat_svr4 -file compat/svr4/svr4_signal.c compat_svr4 -file compat/svr4/svr4_socket.c compat_svr4 -file compat/svr4/svr4_sockio.c compat_svr4 -file compat/svr4/svr4_stat.c compat_svr4 -file compat/svr4/svr4_stream.c compat_svr4 -file compat/svr4/svr4_syscalls.c compat_svr4 & syscall_debug -file compat/svr4/svr4_sysent.c compat_svr4 -file compat/svr4/svr4_termios.c compat_svr4 -file compat/svr4/svr4_ttold.c compat_svr4 diff --git a/sys/compat/svr4/svr4_acl.h b/sys/compat/svr4/svr4_acl.h deleted file mode 100644 index 03f6c62553a..00000000000 --- a/sys/compat/svr4/svr4_acl.h +++ /dev/null @@ -1,45 +0,0 @@ -/* $OpenBSD: svr4_acl.h,v 1.1 1997/02/13 19:45:16 niklas Exp $ */ -/* $NetBSD: svr4_acl.h,v 1.1 1996/12/06 03:23:30 christos Exp $ */ - -/* - * Copyright (c) 1996 Christos Zoulas. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Christos Zoulas. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#ifndef _SVR4_ACL_H_ -#define _SVR4_ACL_H_ - -typedef struct svr4_aclent { - int a_type; - svr4_uid_t a_id; - svr4_o_mode_t a_perm; -} svr4_aclent_t; - -#define SVR4_SYS_GETACL 1 -#define SVR4_SYS_SETACL 2 -#define SVR4_SYS_GETACLCNT 3 - -#endif /* !_SVR4_ACL_H_ */ diff --git a/sys/compat/svr4/svr4_dirent.h b/sys/compat/svr4/svr4_dirent.h deleted file mode 100644 index eae4e448512..00000000000 --- a/sys/compat/svr4/svr4_dirent.h +++ /dev/null @@ -1,53 +0,0 @@ -/* $OpenBSD: svr4_dirent.h,v 1.3 2000/06/24 21:00:29 fgsch Exp $ */ -/* $NetBSD: svr4_dirent.h,v 1.4 1995/10/07 06:27:37 mycroft Exp $ */ - -/* - * Copyright (c) 1994 Christos Zoulas - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _SVR4_DIRENT_H_ -#define _SVR4_DIRENT_H_ - -#define SVR4_MAXNAMLEN 512 - -struct svr4_dirent { - svr4_ino_t d_ino; - svr4_off_t d_off; - u_short d_reclen; - char d_name[SVR4_MAXNAMLEN + 1]; -}; - -struct svr4_dirent64 { - svr4_ino64_t d_ino; - svr4_off64_t d_off; - u_short d_reclen; - char d_name[SVR4_MAXNAMLEN + 1]; -}; - -#define SVR4_NAMEOFF(dp) ((char *)&(dp)->d_name - (char *)dp) -#define SVR4_RECLEN(de,namlen) ALIGN((SVR4_NAMEOFF(de) + (namlen) + 1)) - -#endif /* !_SVR4_DIRENT_H_ */ diff --git a/sys/compat/svr4/svr4_errno.c b/sys/compat/svr4/svr4_errno.c deleted file mode 100644 index 746a55ffdb2..00000000000 --- a/sys/compat/svr4/svr4_errno.c +++ /dev/null @@ -1,132 +0,0 @@ -/* $OpenBSD: svr4_errno.c,v 1.5 2009/10/28 16:38:43 jsg Exp $ */ -/* $NetBSD: svr4_errno.c,v 1.7 1998/10/23 04:06:00 erh Exp $ */ - -/* - * Copyright (c) 1994 Christos Zoulas - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * Translate error codes. - */ - -#include <sys/errno.h> -#include <compat/svr4/svr4_errno.h> - - -int native_to_svr4_errno[1 + ELAST] = { - 0, - SVR4_EPERM, - SVR4_ENOENT, - SVR4_ESRCH, - SVR4_EINTR, - SVR4_EIO, - SVR4_ENXIO, - SVR4_E2BIG, - SVR4_ENOEXEC, - SVR4_EBADF, - SVR4_ECHILD, - SVR4_EDEADLK, - SVR4_ENOMEM, - SVR4_EACCES, - SVR4_EFAULT, - SVR4_ENOTBLK, - SVR4_EBUSY, - SVR4_EEXIST, - SVR4_EXDEV, - SVR4_ENODEV, - SVR4_ENOTDIR, - SVR4_EISDIR, - SVR4_EINVAL, - SVR4_ENFILE, - SVR4_EMFILE, - SVR4_ENOTTY, - SVR4_ETXTBSY, - SVR4_EFBIG, - SVR4_ENOSPC, - SVR4_ESPIPE, - SVR4_EROFS, - SVR4_EMLINK, - SVR4_EPIPE, - SVR4_EDOM, - SVR4_ERANGE, - SVR4_EAGAIN, - SVR4_EINPROGRESS, - SVR4_EALREADY, - SVR4_ENOTSOCK, - SVR4_EDESTADDRREQ, - SVR4_EMSGSIZE, - SVR4_EPROTOTYPE, - SVR4_ENOPROTOOPT, - SVR4_EPROTONOSUPPORT, - SVR4_ESOCKTNOSUPPORT, - SVR4_EOPNOTSUPP, - SVR4_EPFNOSUPPORT, - SVR4_EAFNOSUPPORT, - SVR4_EADDRINUSE, - SVR4_EADDRNOTAVAIL, - SVR4_ENETDOWN, - SVR4_ENETUNREACH, - SVR4_ENETRESET, - SVR4_ECONNABORTED, - SVR4_ECONNRESET, - SVR4_ENOBUFS, - SVR4_EISCONN, - SVR4_ENOTCONN, - SVR4_ESHUTDOWN, - SVR4_ETOOMANYREFS, - SVR4_ETIMEDOUT, - SVR4_ECONNREFUSED, - SVR4_ELOOP, - SVR4_ENAMETOOLONG, - SVR4_EHOSTDOWN, - SVR4_EHOSTUNREACH, - SVR4_ENOTEMPTY, - SVR4_EPROCLIM, - SVR4_EUSERS, - SVR4_EDQUOT, - SVR4_ESTALE, - SVR4_EREMOTE, - SVR4_EBADRPC, - SVR4_ERPCMISMATCH, - SVR4_EPROGUNAVAIL, - SVR4_EPROGMISMATCH, - SVR4_EPROCUNAVAIL, - SVR4_ENOLCK, - SVR4_ENOSYS, - SVR4_EFTYPE, - SVR4_EAUTH, - SVR4_ENEEDAUTH, - SVR4_ENOSYS, /* EIPSEC */ - SVR4_ENOSYS, /* ENOATTR */ - SVR4_EILSEQ, - SVR4_ENOSYS, /* ENOMEDIUM */ - SVR4_ENOSYS, /* EMEDIUMTYPE */ - SVR4_EOVERFLOW, - SVR4_ENOSYS, /* ECANCELED */ - SVR4_EIDRM, - SVR4_ENOMSG, - SVR4_ENOSYS /* ENOTSUP */ -}; diff --git a/sys/compat/svr4/svr4_errno.h b/sys/compat/svr4/svr4_errno.h deleted file mode 100644 index 78c2e0de1aa..00000000000 --- a/sys/compat/svr4/svr4_errno.h +++ /dev/null @@ -1,174 +0,0 @@ -/* $OpenBSD: svr4_errno.h,v 1.3 2000/08/23 16:36:06 brad Exp $ */ -/* $NetBSD: svr4_errno.h,v 1.5 1998/10/24 19:35:36 mrg Exp $ */ - -/* - * Copyright (c) 1994 Christos Zoulas - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _SVR4_ERRNO_H_ -#define _SVR4_ERRNO_H_ - -#define SVR4_EPERM 1 -#define SVR4_ENOENT 2 -#define SVR4_ESRCH 3 -#define SVR4_EINTR 4 -#define SVR4_EIO 5 -#define SVR4_ENXIO 6 -#define SVR4_E2BIG 7 -#define SVR4_ENOEXEC 8 -#define SVR4_EBADF 9 -#define SVR4_ECHILD 10 -#define SVR4_EAGAIN 11 -#define SVR4_ENOMEM 12 -#define SVR4_EACCES 13 -#define SVR4_EFAULT 14 -#define SVR4_ENOTBLK 15 -#define SVR4_EBUSY 16 -#define SVR4_EEXIST 17 -#define SVR4_EXDEV 18 -#define SVR4_ENODEV 19 -#define SVR4_ENOTDIR 20 -#define SVR4_EISDIR 21 -#define SVR4_EINVAL 22 -#define SVR4_ENFILE 23 -#define SVR4_EMFILE 24 -#define SVR4_ENOTTY 25 -#define SVR4_ETXTBSY 26 -#define SVR4_EFBIG 27 -#define SVR4_ENOSPC 28 -#define SVR4_ESPIPE 29 -#define SVR4_EROFS 30 -#define SVR4_EMLINK 31 -#define SVR4_EPIPE 32 -#define SVR4_EDOM 33 -#define SVR4_ERANGE 34 -#define SVR4_ENOMSG 35 -#define SVR4_EIDRM 36 -#define SVR4_ECHRNG 37 -#define SVR4_EL2NSYNC 38 -#define SVR4_EL3HLT 39 -#define SVR4_EL3RST 40 -#define SVR4_ELNRNG 41 -#define SVR4_EUNATCH 42 -#define SVR4_ENOCSI 43 -#define SVR4_EL2HLT 44 -#define SVR4_EDEADLK 45 -#define SVR4_ENOLCK 46 -#define SVR4_EBADE 50 -#define SVR4_EBADR 51 -#define SVR4_EXFULL 52 -#define SVR4_ENOANO 53 -#define SVR4_EBADRQC 54 -#define SVR4_EBADSLT 55 -#define SVR4_EDEADLOCK 56 -#define SVR4_EBFONT 57 -#define SVR4_ENOSTR 60 -#define SVR4_ENODATA 61 -#define SVR4_ETIME 62 -#define SVR4_ENOSR 63 -#define SVR4_ENONET 64 -#define SVR4_ENOPKG 65 -#define SVR4_EREMOTE 66 -#define SVR4_ENOLINK 67 -#define SVR4_EADV 68 -#define SVR4_ESRMNT 69 -#define SVR4_ECOMM 70 -#define SVR4_EPROTO 71 -#define SVR4_EMULTIHOP 74 -#define SVR4_EBADMSG 77 -#define SVR4_ENAMETOOLONG 78 -#define SVR4_EOVERFLOW 79 -#define SVR4_ENOTUNIQ 80 -#define SVR4_EBADFD 81 -#define SVR4_EREMCHG 82 -#define SVR4_ELIBACC 83 -#define SVR4_ELIBBAD 84 -#define SVR4_ELIBSCN 85 -#define SVR4_ELIBMAX 86 -#define SVR4_ELIBEXEC 87 -#define SVR4_EILSEQ 88 -#define SVR4_ENOSYS 89 -#define SVR4_ELOOP 90 -#define SVR4_ERESTART 91 -#define SVR4_ESTRPIPE 92 -#define SVR4_ENOTEMPTY 93 -#define SVR4_EUSERS 94 -#define SVR4_ENOTSOCK 95 -#define SVR4_EDESTADDRREQ 96 -#define SVR4_EMSGSIZE 97 -#define SVR4_EPROTOTYPE 98 -#define SVR4_ENOPROTOOPT 99 -#define SVR4_EPROTONOSUPPORT 120 -#define SVR4_ESOCKTNOSUPPORT 121 -#define SVR4_EOPNOTSUPP 122 -#define SVR4_EPFNOSUPPORT 123 -#define SVR4_EAFNOSUPPORT 124 -#define SVR4_EADDRINUSE 125 -#define SVR4_EADDRNOTAVAIL 126 -#define SVR4_ENETDOWN 127 -#define SVR4_ENETUNREACH 128 -#define SVR4_ENETRESET 129 -#define SVR4_ECONNABORTED 130 -#define SVR4_ECONNRESET 131 -#define SVR4_ENOBUFS 132 -#define SVR4_EISCONN 133 -#define SVR4_ENOTCONN 134 -#define SVR4_EUCLEAN 135 -#define SVR4_ENOTNAM 137 -#define SVR4_ENAVAIL 138 -#define SVR4_EISNAM 139 -#define SVR4_EREMOTEIO 140 -#define SVR4_EINIT 141 -#define SVR4_EREMDEV 142 -#define SVR4_ESHUTDOWN 143 -#define SVR4_ETOOMANYREFS 144 -#define SVR4_ETIMEDOUT 145 -#define SVR4_ECONNREFUSED 146 -#define SVR4_EHOSTDOWN 147 -#define SVR4_EHOSTUNREACH 148 -#define SVR4_EWOULDBLOCK SVR4_EAGAIN -#define SVR4_EALREADY 149 -#define SVR4_EINPROGRESS 150 -#define SVR4_ESTALE 151 -#define SVR4_EIORESID 500 - -/* - * These ones are not translated... - */ -#define SVR4_EPROCLIM SVR4_ENOSYS -#define SVR4_EDQUOT SVR4_ENOSYS -#define SVR4_EBADRPC SVR4_ENOSYS -#define SVR4_ERPCMISMATCH SVR4_ENOSYS -#define SVR4_EPROGUNAVAIL SVR4_ENOSYS -#define SVR4_EPROGMISMATCH SVR4_ENOSYS -#define SVR4_EPROCUNAVAIL SVR4_ENOSYS -#define SVR4_EFTYPE SVR4_ENOSYS -#define SVR4_EAUTH SVR4_ENOSYS -#define SVR4_ENEEDAUTH SVR4_ENOSYS - -extern int native_to_svr4_errno[]; - -#endif /* !_SVR4_ERRNO_H_ */ diff --git a/sys/compat/svr4/svr4_exec.c b/sys/compat/svr4/svr4_exec.c deleted file mode 100644 index fd047282d39..00000000000 --- a/sys/compat/svr4/svr4_exec.c +++ /dev/null @@ -1,146 +0,0 @@ -/* $OpenBSD: svr4_exec.c,v 1.17 2009/03/05 19:52:24 kettenis Exp $ */ -/* $NetBSD: svr4_exec.c,v 1.16 1995/10/14 20:24:20 christos Exp $ */ - -/* - * Copyright (c) 1994 Christos Zoulas - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/proc.h> -#include <sys/malloc.h> -#include <sys/namei.h> -#include <sys/vnode.h> -#include <sys/core.h> -#include <sys/exec.h> -#include <sys/exec_elf.h> -#include <sys/exec_olf.h> - -#include <sys/mman.h> -#include <uvm/uvm_extern.h> - -#include <machine/cpu.h> -#include <machine/reg.h> -#include <machine/svr4_machdep.h> - -#include <compat/svr4/svr4_util.h> -#include <compat/svr4/svr4_syscall.h> -#include <compat/svr4/svr4_exec.h> -#include <compat/svr4/svr4_errno.h> - -static void *svr4_copyargs(struct exec_package *, struct ps_strings *, - void *, void *); - -const char svr4_emul_path[] = "/emul/svr4"; -extern char svr4_sigcode[], svr4_esigcode[]; -extern struct sysent svr4_sysent[]; -#ifdef SYSCALL_DEBUG -extern char *svr4_syscallnames[]; -#endif - -struct emul emul_svr4 = { - "svr4", - native_to_svr4_errno, - svr4_sendsig, - SVR4_SYS_syscall, - SVR4_SYS_MAXSYSCALL, - svr4_sysent, -#ifdef SYSCALL_DEBUG - svr4_syscallnames, -#else - NULL, -#endif - SVR4_AUX_ARGSIZ, - svr4_copyargs, - setregs, - exec_elf32_fixup, - coredump_trad, - svr4_sigcode, - svr4_esigcode, -}; - -static void * -svr4_copyargs(pack, arginfo, stack, argp) - struct exec_package *pack; - struct ps_strings *arginfo; - void *stack; - void *argp; -{ - AuxInfo *a; - - if (!(a = (AuxInfo *)elf32_copyargs(pack, arginfo, stack, argp))) - return (NULL); -#ifdef SVR4_COMPAT_SOLARIS2 - if (pack->ep_emul_arg) { - a->au_id = AUX_sun_uid; - a->au_v = p->p_ucred->cr_uid; - a++; - - a->au_id = AUX_sun_ruid; - a->au_v = p->p_cred->ruid; - a++; - - a->au_id = AUX_sun_gid; - a->au_v = p->p_ucred->cr_gid; - a++; - - a->au_id = AUX_sun_rgid; - a->au_v = p->p_cred->rgid; - a++; - } -#endif - return (a); -} - -int -svr4_elf_probe(p, epp, itp, pos, os) - struct proc *p; - struct exec_package *epp; - char *itp; - u_long *pos; - u_int8_t *os; -{ - char *bp; - int error; - size_t len; - - if (!(emul_svr4.e_flags & EMUL_ENABLED)) - return (ENOEXEC); - - if (itp) { - if ((error = emul_find(p, NULL, svr4_emul_path, itp, &bp, 0))) - return (error); - if ((error = copystr(bp, itp, MAXPATHLEN, &len))) - return (error); - free(bp, M_TEMP); - } - epp->ep_emul = &emul_svr4; - *pos = SVR4_INTERP_ADDR; - if (*os == OOS_NULL) - *os = OOS_SVR4; - return (0); -} diff --git a/sys/compat/svr4/svr4_exec.h b/sys/compat/svr4/svr4_exec.h deleted file mode 100644 index 84e0fb82a4c..00000000000 --- a/sys/compat/svr4/svr4_exec.h +++ /dev/null @@ -1,68 +0,0 @@ -/* $OpenBSD: svr4_exec.h,v 1.6 2002/03/14 01:26:51 millert Exp $ */ -/* $NetBSD: svr4_exec.h,v 1.7 1995/07/02 06:16:06 christos Exp $ */ - -/* - * Copyright (c) 1994 Christos Zoulas - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _SVR4_EXEC_H_ -#define _SVR4_EXEC_H_ - -#ifdef SVR4_COMPAT_SOLARIS2 -# define SVR4_AUX_ARGSIZ (sizeof(AuxInfo) * 12 / sizeof(char *)) -#else -# define SVR4_AUX_ARGSIZ (sizeof(AuxInfo) * 8 / sizeof(char *)) -#endif - -/* - * The following is horrible; there must be a better way. I need to - * play with brk(2) a bit more. - */ -#ifdef __i386__ -/* - * I cannot load the interpreter after the data segment because brk(2) - * breaks. I have to load it somewhere before. Programs start at - * 0x08000000 so I load the interpreter far before. - */ -#define SVR4_INTERP_ADDR 0x01000000 -#endif - -#ifdef __sparc__ -/* - * Here programs load at 0x00010000, so I load the interpreter far after - * the end of the data segment. - */ -#define SVR4_INTERP_ADDR 0x10000000 -#endif - -#ifndef SVR4_INTERP_ADDR -# define SVR4_INTERP_ADDR 0 -#endif - -int svr4_elf_probe(struct proc *, struct exec_package *, char *, u_long *, - u_int8_t *); - -#endif /* !_SVR4_EXEC_H_ */ diff --git a/sys/compat/svr4/svr4_fcntl.c b/sys/compat/svr4/svr4_fcntl.c deleted file mode 100644 index eb4d927222f..00000000000 --- a/sys/compat/svr4/svr4_fcntl.c +++ /dev/null @@ -1,653 +0,0 @@ -/* $OpenBSD: svr4_fcntl.c,v 1.23 2010/07/26 01:56:27 guenther Exp $ */ -/* $NetBSD: svr4_fcntl.c,v 1.14 1995/10/14 20:24:24 christos Exp $ */ - -/* - * Copyright (c) 1997 Theo de Raadt - * Copyright (c) 1994 Christos Zoulas - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/namei.h> -#include <sys/proc.h> -#include <sys/file.h> -#include <sys/stat.h> -#include <sys/vnode.h> -#include <sys/filedesc.h> -#include <sys/ioctl.h> -#include <sys/kernel.h> -#include <sys/mount.h> -#include <sys/malloc.h> -#include <sys/poll.h> -#include <sys/syscallargs.h> - -#include <compat/svr4/svr4_types.h> -#include <compat/svr4/svr4_signal.h> -#include <compat/svr4/svr4_syscallargs.h> -#include <compat/svr4/svr4_util.h> -#include <compat/svr4/svr4_fcntl.h> - -static u_long svr4_to_bsd_cmd(u_long); -static int svr4_to_bsd_flags(int); -static int bsd_to_svr4_flags(int); -static void bsd_to_svr4_flock(struct flock *, struct svr4_flock *); -static void svr4_to_bsd_flock(struct svr4_flock *, struct flock *); -static void bsd_to_svr3_flock(struct flock *, struct svr4_flock_svr3 *); -static void svr3_to_bsd_flock(struct svr4_flock_svr3 *, struct flock *); -static int fd_truncate(struct proc *, int, struct flock *, register_t *); - -static u_long -svr4_to_bsd_cmd(cmd) - u_long cmd; -{ - switch (cmd) { - case SVR4_F_DUPFD: - return F_DUPFD; - case SVR4_F_GETFD: - return F_GETFD; - case SVR4_F_SETFD: - return F_SETFD; - case SVR4_F_GETFL: - return F_GETFL; - case SVR4_F_SETFL: - return F_SETFL; - case SVR4_F_GETLK: - case SVR4_F_GETLK_SVR3: - return F_GETLK; - case SVR4_F_SETLK: - return F_SETLK; - case SVR4_F_SETLKW: - return F_SETLKW; - default: - return -1; - } -} - - -static int -svr4_to_bsd_flags(l) - int l; -{ - int r = 0; - r |= (l & SVR4_O_RDONLY) ? O_RDONLY : 0; - r |= (l & SVR4_O_WRONLY) ? O_WRONLY : 0; - r |= (l & SVR4_O_RDWR) ? O_RDWR : 0; - r |= (l & SVR4_O_NDELAY) ? O_NONBLOCK : 0; - r |= (l & SVR4_O_APPEND) ? O_APPEND : 0; -#if 0 - /* Dellism ??? */ - r |= (l & SVR4_O_RAIOSIG) ? O_ASYNC : 0; -#endif - r |= (l & SVR4_O_SYNC) ? O_FSYNC : 0; - r |= (l & SVR4_O_RSYNC) ? O_RSYNC : 0; - r |= (l & SVR4_O_DSYNC) ? O_DSYNC : 0; - r |= (l & SVR4_O_NONBLOCK) ? O_NONBLOCK : 0; - r |= (l & SVR4_O_PRIV) ? O_EXLOCK : 0; - r |= (l & SVR4_O_CREAT) ? O_CREAT : 0; - r |= (l & SVR4_O_TRUNC) ? O_TRUNC : 0; - r |= (l & SVR4_O_EXCL) ? O_EXCL : 0; - r |= (l & SVR4_O_NOCTTY) ? O_NOCTTY : 0; - return r; -} - - -static int -bsd_to_svr4_flags(l) - int l; -{ - int r = 0; - r |= (l & O_RDONLY) ? SVR4_O_RDONLY : 0; - r |= (l & O_WRONLY) ? SVR4_O_WRONLY : 0; - r |= (l & O_RDWR) ? SVR4_O_RDWR : 0; - r |= (l & O_NDELAY) ? SVR4_O_NONBLOCK : 0; - r |= (l & O_APPEND) ? SVR4_O_APPEND : 0; -#if 0 - /* Dellism ??? */ - r |= (l & O_ASYNC) ? SVR4_O_RAIOSIG : 0; -#endif - r |= (l & O_FSYNC) ? SVR4_O_SYNC : 0; - r |= (l & O_RSYNC) ? SVR4_O_RSYNC : 0; - r |= (l & O_DSYNC) ? SVR4_O_DSYNC : 0; - r |= (l & O_NONBLOCK) ? SVR4_O_NONBLOCK : 0; - r |= (l & O_EXLOCK) ? SVR4_O_PRIV : 0; - r |= (l & O_CREAT) ? SVR4_O_CREAT : 0; - r |= (l & O_TRUNC) ? SVR4_O_TRUNC : 0; - r |= (l & O_EXCL) ? SVR4_O_EXCL : 0; - r |= (l & O_NOCTTY) ? SVR4_O_NOCTTY : 0; - return r; -} - -static void -bsd_to_svr4_flock(iflp, oflp) - struct flock *iflp; - struct svr4_flock *oflp; -{ - switch (iflp->l_type) { - case F_RDLCK: - oflp->l_type = SVR4_F_RDLCK; - break; - case F_WRLCK: - oflp->l_type = SVR4_F_WRLCK; - break; - case F_UNLCK: - oflp->l_type = SVR4_F_UNLCK; - break; - default: - oflp->l_type = -1; - break; - } - - oflp->l_whence = (short) iflp->l_whence; - oflp->l_start = (svr4_off_t) iflp->l_start; - oflp->l_len = (svr4_off_t) iflp->l_len; - oflp->l_sysid = 0; - oflp->l_pid = (svr4_pid_t) iflp->l_pid; -} - -static void -svr4_to_bsd_flock(iflp, oflp) - struct svr4_flock *iflp; - struct flock *oflp; -{ - switch (iflp->l_type) { - case SVR4_F_RDLCK: - oflp->l_type = F_RDLCK; - break; - case SVR4_F_WRLCK: - oflp->l_type = F_WRLCK; - break; - case SVR4_F_UNLCK: - oflp->l_type = F_UNLCK; - break; - default: - oflp->l_type = -1; - break; - } - - oflp->l_whence = iflp->l_whence; - oflp->l_start = (off_t) iflp->l_start; - oflp->l_len = (off_t) iflp->l_len; - oflp->l_pid = (pid_t) iflp->l_pid; -} - -static void -bsd_to_svr3_flock(iflp, oflp) - struct flock *iflp; - struct svr4_flock_svr3 *oflp; -{ - switch (iflp->l_type) { - case F_RDLCK: - oflp->l_type = SVR4_F_RDLCK; - break; - case F_WRLCK: - oflp->l_type = SVR4_F_WRLCK; - break; - case F_UNLCK: - oflp->l_type = SVR4_F_UNLCK; - break; - default: - oflp->l_type = -1; - break; - } - - oflp->l_whence = (short) iflp->l_whence; - oflp->l_start = (svr4_off_t) iflp->l_start; - oflp->l_len = (svr4_off_t) iflp->l_len; - oflp->l_sysid = 0; - oflp->l_pid = (svr4_pid_t) iflp->l_pid; -} - - -static void -svr3_to_bsd_flock(iflp, oflp) - struct svr4_flock_svr3 *iflp; - struct flock *oflp; -{ - switch (iflp->l_type) { - case SVR4_F_RDLCK: - oflp->l_type = F_RDLCK; - break; - case SVR4_F_WRLCK: - oflp->l_type = F_WRLCK; - break; - case SVR4_F_UNLCK: - oflp->l_type = F_UNLCK; - break; - default: - oflp->l_type = -1; - break; - } - - oflp->l_whence = iflp->l_whence; - oflp->l_start = (off_t) iflp->l_start; - oflp->l_len = (off_t) iflp->l_len; - oflp->l_pid = (pid_t) iflp->l_pid; -} - -static int -fd_truncate(p, fd, flp, retval) - struct proc *p; - int fd; - struct flock *flp; - register_t *retval; -{ - struct filedesc *fdp = p->p_fd; - struct file *fp; - off_t start, length; - struct vnode *vp; - struct vattr vattr; - int error; - struct sys_ftruncate_args ft; - - /* - * We only support truncating the file. - */ - if ((fp = fd_getfile(fdp, fd)) == NULL) - return EBADF; - - vp = (struct vnode *)fp->f_data; - if (fp->f_type != DTYPE_VNODE || vp->v_type == VFIFO) - return ESPIPE; - - FREF(fp); - - if ((error = VOP_GETATTR(vp, &vattr, p->p_ucred, p)) != 0) - goto out; - - length = vattr.va_size; - - switch (flp->l_whence) { - case SEEK_CUR: - start = fp->f_offset + flp->l_start; - break; - - case SEEK_END: - start = flp->l_start + length; - break; - - case SEEK_SET: - start = flp->l_start; - break; - - default: - error = EINVAL; - goto out; - } - - if (start + flp->l_len < length) { - /* We don't support free'ing in the middle of the file */ - error = EINVAL; - goto out; - } - - SCARG(&ft, fd) = fd; - SCARG(&ft, length) = start; - - error = sys_ftruncate(p, &ft, retval); -out: - FRELE(fp); - return (error); -} - -int -svr4_sys_open(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_open_args *uap = v; - int error; - struct sys_open_args cup; - - caddr_t sg = stackgap_init(p->p_emul); - - SCARG(&cup, flags) = svr4_to_bsd_flags(SCARG(uap, flags)); - - if (SCARG(&cup, flags) & O_CREAT) - SVR4_CHECK_ALT_CREAT(p, &sg, SCARG(uap, path)); - else - SVR4_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path)); - - SCARG(&cup, path) = SCARG(uap, path); - SCARG(&cup, mode) = SCARG(uap, mode); - error = sys_open(p, &cup, retval); - - if (error) - return error; - - if (!(SCARG(&cup, flags) & O_NOCTTY) && SESS_LEADER(p->p_p) && - !(p->p_p->ps_flags & PS_CONTROLT)) { - struct filedesc *fdp = p->p_fd; - struct file *fp; - - if ((fp = fd_getfile(fdp, *retval)) == NULL) - return (EBADF); - FREF(fp); - /* ignore any error, just give it a try */ - if (fp->f_type == DTYPE_VNODE) - (fp->f_ops->fo_ioctl) (fp, TIOCSCTTY, (caddr_t) 0, p); - FRELE(fp); - } - return 0; -} - -int -svr4_sys_open64(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - return svr4_sys_open(p, v, retval); -} - -int -svr4_sys_creat(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_creat_args *uap = v; - struct sys_open_args cup; - - caddr_t sg = stackgap_init(p->p_emul); - SVR4_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path)); - - SCARG(&cup, path) = SCARG(uap, path); - SCARG(&cup, mode) = SCARG(uap, mode); - SCARG(&cup, flags) = O_WRONLY | O_CREAT | O_TRUNC; - - return sys_open(p, &cup, retval); -} - -int -svr4_sys_creat64(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - return (svr4_sys_creat(p, v, retval)); -} - -int -svr4_sys_llseek(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_llseek_args *uap = v; - struct sys_lseek_args ap; - - SCARG(&ap, fd) = SCARG(uap, fd); - -#if BYTE_ORDER == BIG_ENDIAN - SCARG(&ap, offset) = (((long long) SCARG(uap, offset1)) << 32) | - SCARG(uap, offset2); -#else - SCARG(&ap, offset) = (((long long) SCARG(uap, offset2)) << 32) | - SCARG(uap, offset1); -#endif - SCARG(&ap, whence) = SCARG(uap, whence); - - return sys_lseek(p, &ap, retval); -} - -int -svr4_sys_access(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_access_args *uap = v; - struct sys_access_args cup; - - caddr_t sg = stackgap_init(p->p_emul); - SVR4_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path)); - - SCARG(&cup, path) = SCARG(uap, path); - SCARG(&cup, flags) = SCARG(uap, flags); - - return sys_access(p, &cup, retval); -} - -int -svr4_sys_pread(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_pread_args *uap = v; - struct sys_pread_args pra; - - SCARG(&pra, fd) = SCARG(uap, fd); - SCARG(&pra, buf) = SCARG(uap, buf); - SCARG(&pra, nbyte) = SCARG(uap, nbyte); - SCARG(&pra, offset) = SCARG(uap, off); - - return (sys_pread(p, &pra, retval)); -} - -int -svr4_sys_pread64(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_pread64_args *uap = v; - struct sys_pread_args pra; - - SCARG(&pra, fd) = SCARG(uap, fd); - SCARG(&pra, buf) = SCARG(uap, buf); - SCARG(&pra, nbyte) = SCARG(uap, nbyte); - SCARG(&pra, offset) = SCARG(uap, off); - - return (sys_pread(p, &pra, retval)); -} - -int -svr4_sys_pwrite(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_pwrite_args *uap = v; - struct sys_pwrite_args pwa; - - SCARG(&pwa, fd) = SCARG(uap, fd); - SCARG(&pwa, buf) = SCARG(uap, buf); - SCARG(&pwa, nbyte) = SCARG(uap, nbyte); - SCARG(&pwa, offset) = SCARG(uap, off); - - return (sys_pwrite(p, &pwa, retval)); -} - -int -svr4_sys_pwrite64(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_pwrite64_args *uap = v; - struct sys_pwrite_args pwa; - - SCARG(&pwa, fd) = SCARG(uap, fd); - SCARG(&pwa, buf) = SCARG(uap, buf); - SCARG(&pwa, nbyte) = SCARG(uap, nbyte); - SCARG(&pwa, offset) = SCARG(uap, off); - - return (sys_pwrite(p, &pwa, retval)); -} - -int -svr4_sys_fcntl(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_fcntl_args *uap = v; - int error; - struct sys_fcntl_args fa; - - SCARG(&fa, fd) = SCARG(uap, fd); - SCARG(&fa, cmd) = svr4_to_bsd_cmd(SCARG(uap, cmd)); - - switch (SCARG(&fa, cmd)) { - case F_DUPFD: - case F_GETFD: - case F_SETFD: - SCARG(&fa, arg) = SCARG(uap, arg); - return sys_fcntl(p, &fa, retval); - - case F_GETFL: - SCARG(&fa, arg) = SCARG(uap, arg); - error = sys_fcntl(p, &fa, retval); - if (error) - return error; - *retval = bsd_to_svr4_flags(*retval); - return error; - - case F_SETFL: - { - /* - * we must save the O_ASYNC flag, as that is - * handled by ioctl(_, I_SETSIG, _) emulation. - */ - register_t flags; - int cmd; - - cmd = SCARG(&fa, cmd); /* save it for a while */ - - SCARG(&fa, cmd) = F_GETFL; - if ((error = sys_fcntl(p, &fa, &flags)) != 0) - return error; - flags &= O_ASYNC; - flags |= svr4_to_bsd_flags((u_long) SCARG(uap, arg)); - SCARG(&fa, cmd) = cmd; - SCARG(&fa, arg) = (void *) flags; - return sys_fcntl(p, &fa, retval); - } - - case F_GETLK: - if (SCARG(uap, cmd) == SVR4_F_GETLK_SVR3) { - struct svr4_flock_svr3 ifl; - struct flock *flp, fl; - caddr_t sg = stackgap_init(p->p_emul); - - flp = stackgap_alloc(&sg, sizeof(*flp)); - error = copyin((caddr_t)SCARG(uap, arg), (caddr_t)&ifl, - sizeof ifl); - if (error) - return error; - svr3_to_bsd_flock(&ifl, &fl); - - error = copyout(&fl, flp, sizeof fl); - if (error) - return error; - - SCARG(&fa, fd) = SCARG(uap, fd); - SCARG(&fa, cmd) = F_GETLK; - SCARG(&fa, arg) = (void *)flp; - error = sys_fcntl(p, &fa, retval); - if (error) - return error; - - error = copyin(flp, &fl, sizeof fl); - if (error) - return error; - - bsd_to_svr3_flock(&fl, &ifl); - - return copyout((caddr_t)&ifl, (caddr_t)SCARG(uap, arg), - sizeof ifl); - } - /*FALLTHROUGH*/ - case F_SETLK: - case F_SETLKW: - { - struct svr4_flock ifl; - struct flock *flp, fl; - caddr_t sg = stackgap_init(p->p_emul); - - flp = stackgap_alloc(&sg, sizeof(struct flock)); - SCARG(&fa, arg) = (void *) flp; - - error = copyin(SCARG(uap, arg), &ifl, sizeof ifl); - if (error) - return error; - - svr4_to_bsd_flock(&ifl, &fl); - - error = copyout(&fl, flp, sizeof fl); - if (error) - return error; - - error = sys_fcntl(p, &fa, retval); - if (error || SCARG(&fa, cmd) != F_GETLK) - return error; - - error = copyin(flp, &fl, sizeof fl); - if (error) - return error; - - bsd_to_svr4_flock(&fl, &ifl); - - return copyout(&ifl, SCARG(uap, arg), sizeof ifl); - } - case -1: - switch (SCARG(uap, cmd)) { - case SVR4_F_DUP2FD: - { - struct sys_dup2_args du; - - SCARG(&du, from) = SCARG(uap, fd); - SCARG(&du, to) = (int)SCARG(uap, arg); - error = sys_dup2(p, &du, retval); - if (error) - return error; - *retval = SCARG(&du, to); - return 0; - } - case SVR4_F_FREESP: - { - struct svr4_flock ifl; - struct flock fl; - - error = copyin(SCARG(uap, arg), &ifl, - sizeof ifl); - if (error) - return error; - svr4_to_bsd_flock(&ifl, &fl); - return fd_truncate(p, SCARG(uap, fd), &fl, - retval); - } - - default: - return ENOSYS; - } - - default: - return ENOSYS; - } -} diff --git a/sys/compat/svr4/svr4_fcntl.h b/sys/compat/svr4/svr4_fcntl.h deleted file mode 100644 index d72dcedc17c..00000000000 --- a/sys/compat/svr4/svr4_fcntl.h +++ /dev/null @@ -1,125 +0,0 @@ -/* $OpenBSD: svr4_fcntl.h,v 1.4 2000/08/23 19:31:34 fgsch Exp $ */ -/* $NetBSD: svr4_fcntl.h,v 1.3 1994/10/29 00:43:19 christos Exp $ */ - -/* - * Copyright (c) 1994 Christos Zoulas - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _SVR4_FCNTL_H_ -#define _SVR4_FCNTL_H_ - -#include <compat/svr4/svr4_types.h> -#include <sys/fcntl.h> - -#define SVR4_O_RDONLY 0x0000 -#define SVR4_O_WRONLY 0x0001 -#define SVR4_O_RDWR 0x0002 -#define SVR4_O_ACCMODE 0x0003 -#define SVR4_O_NDELAY 0x0004 -#define SVR4_O_APPEND 0x0008 -#define SVR4_O_SYNC 0x0010 -#if 0 -/* Dellism ??? */ -#define SVR4_O_RAIOSIG 0x0020 -#endif -#define SVR4_O_DSYNC 0x0040 -#define SVR4_O_NONBLOCK 0x0080 -#define SVR4_O_CREAT 0x0100 -#define SVR4_O_TRUNC 0x0200 -#define SVR4_O_EXCL 0x0400 -#define SVR4_O_NOCTTY 0x0800 -#define SVR4_O_PRIV 0x1000 -#define SVR4_O_LARGEFILE 0x2000 -#define SVR4_O_RSYNC 0x8000 - - -#define SVR4_FD_CLOEXEC 1 - -#define SVR4_F_DUPFD 0 -#define SVR4_F_GETFD 1 -#define SVR4_F_SETFD 2 -#define SVR4_F_GETFL 3 -#define SVR4_F_SETFL 4 -#define SVR4_F_GETLK_SVR3 5 -#define SVR4_F_SETLK 6 -#define SVR4_F_SETLKW 7 -#define SVR4_F_CHKFL 8 -#define SVR4_F_DUP2FD 9 -#define SVR4_F_ALLOCSP 10 -#define SVR4_F_FREESP 11 - -#define SVR4_F_GETLK 14 -#define SVR4_F_RSETLK 20 -#define SVR4_F_RGETLK 21 -#define SVR4_F_RSETLKW 22 -#define SVR4_F_GETOWN 23 -#define SVR4_F_SETOWN 24 - -#define SVR4_F_CHSIZE_XENIX 0x6000 -#define SVR4_F_RDCHK_XENIX 0x6001 -#define SVR4_F_LK_UNLCK_XENIX 0x6300 -#define SVR4_F_LK_LOCK_XENIX 0x7200 -#define SVR4_F_LK_NBLCK_XENIX 0x6200 -#define SVR4_F_LK_RLCK_XENIX 0x7100 -#define SVR4_F_LK_NBRLCK_XENIX 0x6100 - -#define SVR4_LK_CMDTYPE(x) (((x) >> 12) & 0x7) -#define SVR4_LK_LCKTYPE(x) (((x) >> 8) & 0x7) - -#define SVR4_F_RDLCK 1 -#define SVR4_F_WRLCK 2 -#define SVR4_F_UNLCK 3 - -struct svr4_flock_svr3 { - short l_type; - short l_whence; - svr4_off_t l_start; - svr4_off_t l_len; - short l_sysid; - svr4_o_pid_t l_pid; -}; - -struct svr4_flock { - short l_type; - short l_whence; - svr4_off_t l_start; - svr4_off_t l_len; - long l_sysid; - svr4_pid_t l_pid; - long pad[4]; -}; - -struct svr4_flock64 { - short l_type; - short l_whence; - svr4_off64_t l_start; - svr4_off64_t l_len; - long l_sysid; - svr4_pid_t l_pid; - long pad[4]; -}; - -#endif /* !_SVR4_FCNTL_H_ */ diff --git a/sys/compat/svr4/svr4_filio.c b/sys/compat/svr4/svr4_filio.c deleted file mode 100644 index 127f3f6ad6c..00000000000 --- a/sys/compat/svr4/svr4_filio.c +++ /dev/null @@ -1,108 +0,0 @@ -/* $OpenBSD: svr4_filio.c,v 1.5 2002/03/14 01:26:51 millert Exp $ */ -/* $NetBSD: svr4_filio.c,v 1.5 1996/04/11 12:54:40 christos Exp $ */ - -/* - * Copyright (c) 1994 Christos Zoulas - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/param.h> -#include <sys/proc.h> -#include <sys/systm.h> -#include <sys/file.h> -#include <sys/filedesc.h> -#include <sys/ioctl.h> -#include <sys/termios.h> -#include <sys/tty.h> -#include <sys/socket.h> -#include <sys/mount.h> -#include <net/if.h> -#include <sys/malloc.h> - -#include <sys/syscallargs.h> - -#include <compat/svr4/svr4_types.h> -#include <compat/svr4/svr4_util.h> -#include <compat/svr4/svr4_signal.h> -#include <compat/svr4/svr4_syscallargs.h> -#include <compat/svr4/svr4_stropts.h> -#include <compat/svr4/svr4_ioctl.h> -#include <compat/svr4/svr4_filio.h> - - -int -svr4_fil_ioctl(fp, p, retval, fd, cmd, data) - struct file *fp; - struct proc *p; - register_t *retval; - int fd; - u_long cmd; - caddr_t data; -{ - int error; - int num; - struct filedesc *fdp = p->p_fd; - int (*ctl)(struct file *, u_long, caddr_t, struct proc *) = - fp->f_ops->fo_ioctl; - - *retval = 0; - - switch (cmd) { - case SVR4_FIOCLEX: - fdp->fd_ofileflags[fd] |= UF_EXCLOSE; - return 0; - - case SVR4_FIONCLEX: - fdp->fd_ofileflags[fd] &= ~UF_EXCLOSE; - return 0; - - case SVR4_FIOGETOWN: - case SVR4_FIOSETOWN: - case SVR4_FIOASYNC: - case SVR4_FIONBIO: - case SVR4_FIONREAD: - if ((error = copyin(data, &num, sizeof(num))) != 0) - return error; - - switch (cmd) { - case SVR4_FIOGETOWN: cmd = FIOGETOWN; break; - case SVR4_FIOSETOWN: cmd = FIOSETOWN; break; - case SVR4_FIOASYNC: cmd = FIOASYNC; break; - case SVR4_FIONBIO: cmd = FIONBIO; break; - case SVR4_FIONREAD: cmd = FIONREAD; break; - } - - error = (*ctl)(fp, cmd, (caddr_t) &num, p); - - if (error) - return error; - - return copyout(&num, data, sizeof(num)); - - default: - DPRINTF(("Unknown svr4 filio %lx\n", cmd)); - return 0; /* ENOSYS really */ - } -} diff --git a/sys/compat/svr4/svr4_filio.h b/sys/compat/svr4/svr4_filio.h deleted file mode 100644 index ba9c3775e25..00000000000 --- a/sys/compat/svr4/svr4_filio.h +++ /dev/null @@ -1,45 +0,0 @@ -/* $OpenBSD: svr4_filio.h,v 1.2 1996/08/02 20:35:38 niklas Exp $ */ -/* $NetBSD: svr4_filio.h,v 1.2 1994/11/18 02:53:45 christos Exp $ */ - -/* - * Copyright (c) 1994 Christos Zoulas - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _SVR4_FILIO_H_ -#define _SVR4_FILIO_H_ - -#define SVR4_FIOC ('f' << 8) - -#define SVR4_FIOCLEX SVR4_IO('f', 1) -#define SVR4_FIONCLEX SVR4_IO('f', 2) - -#define SVR4_FIOGETOWN SVR4_IOR('f', 123, int) -#define SVR4_FIOSETOWN SVR4_IOW('f', 124, int) -#define SVR4_FIOASYNC SVR4_IOW('f', 125, int) -#define SVR4_FIONBIO SVR4_IOW('f', 126, int) -#define SVR4_FIONREAD SVR4_IOR('f', 127, int) - -#endif /* !_SVR4_FILIO_H_ */ diff --git a/sys/compat/svr4/svr4_fuser.h b/sys/compat/svr4/svr4_fuser.h deleted file mode 100644 index 33197c9479a..00000000000 --- a/sys/compat/svr4/svr4_fuser.h +++ /dev/null @@ -1,54 +0,0 @@ -/* $OpenBSD: svr4_fuser.h,v 1.2 1996/08/02 20:35:38 niklas Exp $ */ -/* $NetBSD: svr4_fuser.h,v 1.3 1994/10/29 00:43:20 christos Exp $ */ - -/* - * Copyright (c) 1994 Christos Zoulas - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _SVR4_FUSER_H_ -#define _SVR4_FUSER_H_ - -#include <compat/svr4/svr4_types.h> - -struct svr4_f_user { - svr4_pid_t fu_pid; - int fu_flags; - uid_t fu_uid; -}; - - -#define SVR4_F_FILE_ONLY 1 -#define SVR4_F_CONTAINED 2 - -#define SVR4_F_CDIR 0x01 -#define SVR4_F_RDIR 0x02 -#define SVR4_F_TEXT 0x04 -#define SVR4_F_MAP 0x08 -#define SVR4_F_OPEN 0x10 -#define SVR4_F_TRACE 0x20 -#define SVR4_F_TTY 0x40 - -#endif /* !_SVR4_FUSER_H_ */ diff --git a/sys/compat/svr4/svr4_hrt.h b/sys/compat/svr4/svr4_hrt.h deleted file mode 100644 index da82458c547..00000000000 --- a/sys/compat/svr4/svr4_hrt.h +++ /dev/null @@ -1,87 +0,0 @@ -/* $OpenBSD: svr4_hrt.h,v 1.2 1996/08/02 20:35:39 niklas Exp $ */ -/* $NetBSD: svr4_hrt.h,v 1.1 1994/11/18 02:56:09 christos Exp $ */ - -/* - * Copyright (c) 1994 Christos Zoulas - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _SVR4_HRT_H_ -#define _SVR4_HRT_H_ - -#define SVR4_HRT_CNTL 0 -#define SVR4_HRT_CNTL_RES 0 -#define SVR4_HRT_CNTL_TOFD 1 -#define SVR4_HRT_CNTL_START 2 -#define SVR4_HRT_CNTL_GET 3 - -#define SVR4_HRT_ALRM 1 -#define SVR4_HRT_ALRM_DO 4 -#define SVR4_HRT_ALRM_REP 5 -#define SVR4_HRT_ALRM_TOD 6 -#define SVR4_HRT_ALRM_FUTREP 7 -#define SVR4_HRT_ALRM_TODREP 8 -#define SVR4_HRT_ALRM_PEND 9 - -#define SVR4_HRT_SLP 2 -#define SVR4_HRT_SLP_INT 10 -#define SVR4_HRT_SLP_TOD 11 - -#define SVR4_HRT_BSD 12 -#define SVR4_HRT_BSD_PEND 13 -#define SVR4_HRT_BSD_REP1 14 -#define SVR4_HRT_BSD_REP2 15 -#define SVR4_HRT_BSD_CANCEL 16 - -#define SVR4_HRT_CAN 3 - -#define SVR4_HRT_SEC 1 -#define SVR4_HRT_MSEC 1000 -#define SVR4_HRT_USEC 1000000 -#define SVR4_HRT_NSEC 1000000000 - -#define SVR4_HRT_TRUNC 0 -#define SVR4_HRT_RND 1 - -typedef struct { - u_long i_word1; - u_long i_word2; - int i_clock; -} svr4_hrt_interval_t; - -typedef struct { - u_long h_sec; - long h_rem; - u_long h_res; -} svr4_hrt_time_t; - -#define SVR4_HRT_DONE 1 -#define SVR4_HRT_ERROR 2 - -#define SVR4_HRT_CLK_STD 1 -#define SVR4_HRT_CLK_USERVIRT 2 -#define SVR4_HRT_CLK_PROCVIRT 4 - -#endif /* !_SVR4_HRT_H_ */ diff --git a/sys/compat/svr4/svr4_ioctl.c b/sys/compat/svr4/svr4_ioctl.c deleted file mode 100644 index de394b5d94e..00000000000 --- a/sys/compat/svr4/svr4_ioctl.c +++ /dev/null @@ -1,159 +0,0 @@ -/* $OpenBSD: svr4_ioctl.c,v 1.12 2002/11/06 09:57:18 niklas Exp $ */ -/* $NetBSD: svr4_ioctl.c,v 1.16 1996/04/11 12:54:41 christos Exp $ */ - -/* - * Copyright (c) 1994 Christos Zoulas - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/param.h> -#include <sys/proc.h> -#include <sys/systm.h> -#include <sys/file.h> -#include <sys/filedesc.h> -#include <sys/ioctl.h> -#include <sys/termios.h> -#include <sys/tty.h> -#include <sys/socket.h> -#include <sys/mount.h> -#include <net/if.h> -#include <sys/malloc.h> - -#include <sys/syscallargs.h> - -#include <compat/svr4/svr4_types.h> -#include <compat/svr4/svr4_util.h> -#include <compat/svr4/svr4_signal.h> -#include <compat/svr4/svr4_syscallargs.h> -#include <compat/svr4/svr4_stropts.h> -#include <compat/svr4/svr4_ioctl.h> -#include <compat/svr4/svr4_jioctl.h> -#include <compat/svr4/svr4_termios.h> -#include <compat/svr4/svr4_ttold.h> -#include <compat/svr4/svr4_filio.h> -#include <compat/svr4/svr4_sockio.h> - -#ifdef DEBUG_SVR4 -static void svr4_decode_cmd(u_long, char *, char *, int *, int *); -/* - * Decode an ioctl command symbolically - */ -static void -svr4_decode_cmd(cmd, dir, c, num, argsiz) - u_long cmd; - char *dir, *c; - int *num, *argsiz; -{ - if (cmd & SVR4_IOC_VOID) - *dir++ = 'V'; - if (cmd & SVR4_IOC_IN) - *dir++ = 'R'; - if (cmd & SVR4_IOC_OUT) - *dir++ = 'W'; - *dir = '\0'; - if (cmd & SVR4_IOC_INOUT) - *argsiz = (cmd >> 16) & 0xff; - else - *argsiz = -1; - - *c = (cmd >> 8) & 0xff; - *num = cmd & 0xff; -} -#endif - -int -svr4_sys_ioctl(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_ioctl_args *uap = v; - struct file *fp; - struct filedesc *fdp; - u_long cmd; - int (*fun)(struct file *, struct proc *, register_t *, - int, u_long, caddr_t); - int error = 0; -#ifdef DEBUG_SVR4 - char dir[4]; - char c; - int num; - int argsiz; - - svr4_decode_cmd(SCARG(uap, com), dir, &c, &num, &argsiz); - - uprintf("svr4_ioctl(%d, _IO%s(%c, %d, %d), %p);\n", SCARG(uap, fd), - dir, c, num, argsiz, SCARG(uap, data)); -#endif - fdp = p->p_fd; - cmd = SCARG(uap, com); - - if ((fp = fd_getfile(fdp, SCARG(uap, fd))) == NULL) - return EBADF; - - if ((fp->f_flag & (FREAD | FWRITE)) == 0) - return EBADF; - - switch (cmd & 0xff00) { - case SVR4_tIOC: - fun = svr4_ttold_ioctl; - break; - - case SVR4_TIOC: - fun = svr4_term_ioctl; - break; - - case SVR4_STR: - fun = svr4_stream_ioctl; - break; - - case SVR4_FIOC: - fun = svr4_fil_ioctl; - break; - - case SVR4_SIOC: - fun = svr4_sock_ioctl; - break; - - case SVR4_jIOC: - fun = svr4_jerq_ioctl; - break; - - case SVR4_XIOC: - /* We do not support those */ - error = EINVAL; - goto out; - - default: - DPRINTF(("Unimplemented ioctl %lx\n", cmd)); - error = 0; /* XXX: really ENOSYS */ - goto out; - } - FREF(fp); - error = (*fun)(fp, p, retval, SCARG(uap, fd), cmd, SCARG(uap, data)); - FRELE(fp); -out: - return (error); -} diff --git a/sys/compat/svr4/svr4_ioctl.h b/sys/compat/svr4/svr4_ioctl.h deleted file mode 100644 index 9b5b8d6f7d6..00000000000 --- a/sys/compat/svr4/svr4_ioctl.h +++ /dev/null @@ -1,64 +0,0 @@ -/* $OpenBSD: svr4_ioctl.h,v 1.5 2002/03/14 01:26:51 millert Exp $ */ -/* $NetBSD: svr4_ioctl.h,v 1.5 1996/04/11 12:54:43 christos Exp $ */ - -/* - * Copyright (c) 1994 Christos Zoulas - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _SVR4_IOCTL_H_ -#define _SVR4_IOCTL_H_ - -#define SVR4_IOC_VOID 0x20000000 -#define SVR4_IOC_OUT 0x40000000 -#define SVR4_IOC_IN 0x80000000 -#define SVR4_IOC_INOUT (SVR4_IOC_IN|SVR4_IOC_OUT) - -#define SVR4_IOC(inout,group,num,len) \ - (inout | ((len & 0xff) << 16) | ((group) << 8) | (num)) - -#define SVR4_XIOC ('X' << 8) - -#define SVR4_IO(g,n) SVR4_IOC(SVR4_IOC_VOID, (g), (n), 0) -#define SVR4_IOR(g,n,t) SVR4_IOC(SVR4_IOC_OUT, (g), (n), sizeof(t)) -#define SVR4_IOW(g,n,t) SVR4_IOC(SVR4_IOC_IN, (g), (n), sizeof(t)) -#define SVR4_IOWR(g,n,t) SVR4_IOC(SVR4_IOC_INOUT,(g), (n), sizeof(t)) - -int svr4_stream_ti_ioctl(struct file *, struct proc *, register_t *, - int, u_long, caddr_t); -int svr4_stream_ioctl(struct file *, struct proc *, register_t *, - int, u_long, caddr_t); -int svr4_term_ioctl(struct file *, struct proc *, register_t *, - int, u_long, caddr_t); -int svr4_ttold_ioctl(struct file *, struct proc *, register_t *, - int, u_long, caddr_t); -int svr4_fil_ioctl(struct file *, struct proc *, register_t *, - int, u_long, caddr_t); -int svr4_sock_ioctl(struct file *, struct proc *, register_t *, - int, u_long, caddr_t); -int svr4_jerq_ioctl(struct file *, struct proc *, register_t *, - int, u_long, caddr_t); - -#endif /* !_SVR4_IOCTL_H_ */ diff --git a/sys/compat/svr4/svr4_ipc.c b/sys/compat/svr4/svr4_ipc.c deleted file mode 100644 index 3118a415873..00000000000 --- a/sys/compat/svr4/svr4_ipc.c +++ /dev/null @@ -1,757 +0,0 @@ -/* $OpenBSD: svr4_ipc.c,v 1.9 2002/03/14 01:26:51 millert Exp $ */ -/* $NetBSD: svr4_ipc.c,v 1.3 1997/03/30 17:21:02 christos Exp $ */ - -/* - * Copyright (c) 1995 Christos Zoulas. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Christos Zoulas. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Mostly stolen from: linux_ipc.c,v 1.4 1995/06/24 20:20:22 christos Exp - */ - -#include <sys/types.h> -#include <sys/param.h> -#include <sys/kernel.h> -#include <sys/shm.h> -#include <sys/msg.h> -#include <sys/sem.h> -#include <sys/proc.h> -#include <sys/uio.h> -#include <sys/time.h> -#include <sys/malloc.h> -#include <sys/mman.h> -#include <sys/systm.h> -#include <sys/stat.h> - -#include <sys/mount.h> -#include <sys/syscallargs.h> - -#include <compat/svr4/svr4_types.h> -#include <compat/svr4/svr4_signal.h> -#include <compat/svr4/svr4_syscallargs.h> -#include <compat/svr4/svr4_util.h> -#include <compat/svr4/svr4_ipc.h> - -#if defined(SYSVMSG) || defined(SYSVSHM) || defined(SYSVSEM) -static void svr4_to_bsd_ipc_perm(const struct svr4_ipc_perm *, - struct ipc_perm *); -static void bsd_to_svr4_ipc_perm(const struct ipc_perm *, - struct svr4_ipc_perm *); -#endif - -#ifdef SYSVSEM -static void bsd_to_svr4_semid_ds(const struct semid_ds *, - struct svr4_semid_ds *); -static void svr4_to_bsd_semid_ds(const struct svr4_semid_ds *, - struct semid_ds *); -static int svr4_semop(struct proc *, void *, register_t *); -static int svr4_semget(struct proc *, void *, register_t *); -static int svr4_semctl(struct proc *, void *, register_t *); -#endif - -#ifdef SYSVMSG -static void bsd_to_svr4_msqid_ds(const struct msqid_ds *, - struct svr4_msqid_ds *); -static void svr4_to_bsd_msqid_ds(const struct svr4_msqid_ds *, - struct msqid_ds *); -static int svr4_msgsnd(struct proc *, void *, register_t *); -static int svr4_msgrcv(struct proc *, void *, register_t *); -static int svr4_msgget(struct proc *, void *, register_t *); -static int svr4_msgctl(struct proc *, void *, register_t *); -#endif - -#ifdef SYSVSHM -static void bsd_to_svr4_shmid_ds(const struct shmid_ds *, - struct svr4_shmid_ds *); -static void svr4_to_bsd_shmid_ds(const struct svr4_shmid_ds *, - struct shmid_ds *); -static int svr4_shmat(struct proc *, void *, register_t *); -static int svr4_shmdt(struct proc *, void *, register_t *); -static int svr4_shmget(struct proc *, void *, register_t *); -static int svr4_shmctl(struct proc *, void *, register_t *); -#endif - -#if defined(SYSVMSG) || defined(SYSVSHM) || defined(SYSVSEM) - -static void -svr4_to_bsd_ipc_perm(spp, bpp) - const struct svr4_ipc_perm *spp; - struct ipc_perm *bpp; -{ - bpp->key = spp->key; - bpp->uid = spp->uid; - bpp->gid = spp->gid; - bpp->cuid = spp->cuid; - bpp->cgid = spp->cgid; - bpp->mode = spp->mode; - bpp->seq = spp->seq; -} - -static void -bsd_to_svr4_ipc_perm(bpp, spp) - const struct ipc_perm *bpp; - struct svr4_ipc_perm *spp; -{ - spp->key = bpp->key; - spp->uid = bpp->uid; - spp->gid = bpp->gid; - spp->cuid = bpp->cuid; - spp->cgid = bpp->cgid; - spp->mode = bpp->mode; - spp->seq = bpp->seq; -} -#endif - -#ifdef SYSVSEM -static void -bsd_to_svr4_semid_ds(bds, sds) - const struct semid_ds *bds; - struct svr4_semid_ds *sds; -{ - bsd_to_svr4_ipc_perm(&bds->sem_perm, &sds->sem_perm); - sds->sem_base = (struct svr4_sem *) bds->sem_base; - sds->sem_nsems = bds->sem_nsems; - sds->sem_otime = bds->sem_otime; - sds->sem_pad1 = bds->sem_pad1; - sds->sem_ctime = bds->sem_ctime; - sds->sem_pad2 = bds->sem_pad2; -} - -static void -svr4_to_bsd_semid_ds(sds, bds) - const struct svr4_semid_ds *sds; - struct semid_ds *bds; -{ - svr4_to_bsd_ipc_perm(&sds->sem_perm, &bds->sem_perm); - bds->sem_base = (struct sem *) sds->sem_base; - bds->sem_nsems = sds->sem_nsems; - bds->sem_otime = sds->sem_otime; - bds->sem_pad1 = sds->sem_pad1; - bds->sem_ctime = sds->sem_ctime; - bds->sem_pad2 = sds->sem_pad2; -} - -struct svr4_sys_semctl_args { - syscallarg(int) what; - syscallarg(int) semid; - syscallarg(int) semnum; - syscallarg(int) cmd; - syscallarg(void *) arg; -}; - -static int -svr4_semctl(p, v, retval) - struct proc *p; - void *v; - register_t *retval; -{ - int error; - struct svr4_sys_semctl_args *uap = v; - struct sys___semctl_args ap; - struct svr4_semid_ds ss; - struct semid_ds bs; - caddr_t sg = stackgap_init(p->p_emul); - - SCARG(&ap, semid) = SCARG(uap, semid); - SCARG(&ap, semnum) = SCARG(uap, semnum); - - switch (SCARG(uap, cmd)) { - case SVR4_SEM_GETZCNT: - case SVR4_SEM_GETNCNT: - case SVR4_SEM_GETPID: - case SVR4_SEM_GETVAL: - switch (SCARG(uap, cmd)) { - case SVR4_SEM_GETZCNT: - SCARG(&ap, cmd) = GETZCNT; - break; - case SVR4_SEM_GETNCNT: - SCARG(&ap, cmd) = GETNCNT; - break; - case SVR4_SEM_GETPID: - SCARG(&ap, cmd) = GETPID; - break; - case SVR4_SEM_GETVAL: - SCARG(&ap, cmd) = GETVAL; - break; - } - return sys___semctl(p, &ap, retval); - - case SVR4_SEM_SETVAL: - SCARG(&ap, arg)->val = (int) SCARG(uap, arg); - SCARG(&ap, cmd) = SETVAL; - return sys___semctl(p, &ap, retval); - - case SVR4_SEM_GETALL: - SCARG(&ap, arg)->array = SCARG(uap, arg); - SCARG(&ap, cmd) = GETVAL; - return sys___semctl(p, &ap, retval); - - case SVR4_SEM_SETALL: - SCARG(&ap, arg)->array = SCARG(uap, arg); - SCARG(&ap, cmd) = SETVAL; - return sys___semctl(p, &ap, retval); - - case SVR4_IPC_STAT: - SCARG(&ap, cmd) = IPC_STAT; - SCARG(&ap, arg)->buf = stackgap_alloc(&sg, sizeof(bs)); - if ((error = sys___semctl(p, &ap, retval)) != 0) - return error; - error = copyin(SCARG(&ap, arg)->buf, &bs, sizeof bs); - if (error) - return error; - bsd_to_svr4_semid_ds(&bs, &ss); - return copyout(&ss, SCARG(uap, arg), sizeof ss); - - case SVR4_IPC_SET: - SCARG(&ap, cmd) = IPC_SET; - SCARG(&ap, arg)->buf = stackgap_alloc(&sg, sizeof(bs)); - error = copyin(SCARG(uap, arg), (caddr_t) &ss, sizeof ss); - if (error) - return error; - svr4_to_bsd_semid_ds(&ss, &bs); - error = copyout(&bs, SCARG(&ap, arg)->buf, sizeof bs); - if (error) - return error; - return sys___semctl(p, &ap, retval); - - case SVR4_IPC_RMID: - SCARG(&ap, cmd) = IPC_RMID; - SCARG(&ap, arg)->buf = stackgap_alloc(&sg, sizeof(bs)); - error = copyin(SCARG(uap, arg), &ss, sizeof ss); - if (error) - return error; - svr4_to_bsd_semid_ds(&ss, &bs); - error = copyout(&bs, SCARG(&ap, arg)->buf, sizeof bs); - if (error) - return error; - return sys___semctl(p, &ap, retval); - - default: - return EINVAL; - } -} - -struct svr4_sys_semget_args { - syscallarg(int) what; - syscallarg(svr4_key_t) key; - syscallarg(int) nsems; - syscallarg(int) semflg; -}; - -static int -svr4_semget(p, v, retval) - struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_semget_args *uap = v; - struct sys_semget_args ap; - - SCARG(&ap, key) = SCARG(uap, key); - SCARG(&ap, nsems) = SCARG(uap, nsems); - SCARG(&ap, semflg) = SCARG(uap, semflg); - - return sys_semget(p, &ap, retval); -} - -struct svr4_sys_semop_args { - syscallarg(int) what; - syscallarg(int) semid; - syscallarg(struct svr4_sembuf *) sops; - syscallarg(u_int) nsops; -}; - -static int -svr4_semop(p, v, retval) - struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_semop_args *uap = v; - struct sys_semop_args ap; - - SCARG(&ap, semid) = SCARG(uap, semid); - /* These are the same */ - SCARG(&ap, sops) = (struct sembuf *) SCARG(uap, sops); - SCARG(&ap, nsops) = SCARG(uap, nsops); - - return sys_semop(p, &ap, retval); -} - -int -svr4_sys_semsys(p, v, retval) - struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_semsys_args *uap = v; - - DPRINTF(("svr4_semsys(%d)\n", SCARG(uap, what))); - - switch (SCARG(uap, what)) { - case SVR4_semctl: - return svr4_semctl(p, v, retval); - case SVR4_semget: - return svr4_semget(p, v, retval); - case SVR4_semop: - return svr4_semop(p, v, retval); - default: - return EINVAL; - } -} -#endif - -#ifdef SYSVMSG -static void -bsd_to_svr4_msqid_ds(bds, sds) - const struct msqid_ds *bds; - struct svr4_msqid_ds *sds; -{ - bsd_to_svr4_ipc_perm(&bds->msg_perm, &sds->msg_perm); - sds->msg_first = (struct svr4_msg *) bds->msg_first; - sds->msg_last = (struct svr4_msg *) bds->msg_last; - sds->msg_cbytes = bds->msg_cbytes; - sds->msg_qnum = bds->msg_qnum; - sds->msg_qbytes = bds->msg_qbytes; - sds->msg_lspid = bds->msg_lspid; - sds->msg_lrpid = bds->msg_lrpid; - sds->msg_stime = bds->msg_stime; - sds->msg_pad1 = bds->msg_pad1; - sds->msg_rtime = bds->msg_rtime; - sds->msg_pad2 = bds->msg_pad2; - sds->msg_ctime = bds->msg_ctime; - sds->msg_pad3 = bds->msg_pad3; - - /* use the padding for the rest of the fields */ - { - const short *pad = (const short *) bds->msg_pad4; - sds->msg_cv = pad[0]; - sds->msg_qnum_cv = pad[1]; - } -} - -static void -svr4_to_bsd_msqid_ds(sds, bds) - const struct svr4_msqid_ds *sds; - struct msqid_ds *bds; -{ - svr4_to_bsd_ipc_perm(&sds->msg_perm, &bds->msg_perm); - bds->msg_first = (struct msg *) sds->msg_first; - bds->msg_last = (struct msg *) sds->msg_last; - bds->msg_cbytes = sds->msg_cbytes; - bds->msg_qnum = sds->msg_qnum; - bds->msg_qbytes = sds->msg_qbytes; - bds->msg_lspid = sds->msg_lspid; - bds->msg_lrpid = sds->msg_lrpid; - bds->msg_stime = sds->msg_stime; - bds->msg_pad1 = sds->msg_pad1; - bds->msg_rtime = sds->msg_rtime; - bds->msg_pad2 = sds->msg_pad2; - bds->msg_ctime = sds->msg_ctime; - bds->msg_pad3 = sds->msg_pad3; - - /* use the padding for the rest of the fields */ - { - short *pad = (short *) bds->msg_pad4; - pad[0] = sds->msg_cv; - pad[1] = sds->msg_qnum_cv; - } -} - -struct svr4_sys_msgsnd_args { - syscallarg(int) what; - syscallarg(int) msqid; - syscallarg(void *) msgp; - syscallarg(size_t) msgsz; - syscallarg(int) msgflg; -}; - -static int -svr4_msgsnd(p, v, retval) - struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_msgsnd_args *uap = v; - struct sys_msgsnd_args ap; - - SCARG(&ap, msqid) = SCARG(uap, msqid); - SCARG(&ap, msgp) = SCARG(uap, msgp); - SCARG(&ap, msgsz) = SCARG(uap, msgsz); - SCARG(&ap, msgflg) = SCARG(uap, msgflg); - - return sys_msgsnd(p, &ap, retval); -} - -struct svr4_sys_msgrcv_args { - syscallarg(int) what; - syscallarg(int) msqid; - syscallarg(void *) msgp; - syscallarg(size_t) msgsz; - syscallarg(long) msgtyp; - syscallarg(int) msgflg; -}; - -static int -svr4_msgrcv(p, v, retval) - struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_msgrcv_args *uap = v; - struct sys_msgrcv_args ap; - - SCARG(&ap, msqid) = SCARG(uap, msqid); - SCARG(&ap, msgp) = SCARG(uap, msgp); - SCARG(&ap, msgsz) = SCARG(uap, msgsz); - SCARG(&ap, msgtyp) = SCARG(uap, msgtyp); - SCARG(&ap, msgflg) = SCARG(uap, msgflg); - - return sys_msgrcv(p, &ap, retval); -} - -struct svr4_sys_msgget_args { - syscallarg(int) what; - syscallarg(svr4_key_t) key; - syscallarg(int) msgflg; -}; - -static int -svr4_msgget(p, v, retval) - struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_msgget_args *uap = v; - struct sys_msgget_args ap; - - SCARG(&ap, key) = SCARG(uap, key); - SCARG(&ap, msgflg) = SCARG(uap, msgflg); - - return sys_msgget(p, &ap, retval); -} - -struct svr4_sys_msgctl_args { - syscallarg(int) what; - syscallarg(int) msqid; - syscallarg(int) cmd; - syscallarg(struct svr4_msqid_ds *) buf; -}; - -static int -svr4_msgctl(p, v, retval) - struct proc *p; - void *v; - register_t *retval; -{ - int error; - struct svr4_sys_msgctl_args *uap = v; - struct sys_msgctl_args ap; - struct svr4_msqid_ds ss; - struct msqid_ds bs; - caddr_t sg = stackgap_init(p->p_emul); - - SCARG(&ap, msqid) = SCARG(uap, msqid); - SCARG(&ap, cmd) = SCARG(uap, cmd); - SCARG(&ap, buf) = stackgap_alloc(&sg, sizeof(bs)); - - switch (SCARG(uap, cmd)) { - case SVR4_IPC_STAT: - SCARG(&ap, cmd) = IPC_STAT; - if ((error = sys_msgctl(p, &ap, retval)) != 0) - return error; - error = copyin(SCARG(&ap, buf), &bs, sizeof bs); - if (error) - return error; - bsd_to_svr4_msqid_ds(&bs, &ss); - return copyout(&ss, SCARG(uap, buf), sizeof ss); - - case SVR4_IPC_SET: - SCARG(&ap, cmd) = IPC_SET; - error = copyin(SCARG(uap, buf), &ss, sizeof ss); - if (error) - return error; - svr4_to_bsd_msqid_ds(&ss, &bs); - error = copyout(&bs, SCARG(&ap, buf), sizeof bs); - if (error) - return error; - return sys_msgctl(p, &ap, retval); - - case SVR4_IPC_RMID: - SCARG(&ap, cmd) = IPC_RMID; - error = copyin(SCARG(uap, buf), &ss, sizeof ss); - if (error) - return error; - svr4_to_bsd_msqid_ds(&ss, &bs); - error = copyout(&bs, SCARG(&ap, buf), sizeof bs); - if (error) - return error; - return sys_msgctl(p, &ap, retval); - - default: - return EINVAL; - } -} - -int -svr4_sys_msgsys(p, v, retval) - struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_msgsys_args *uap = v; - - DPRINTF(("svr4_msgsys(%d)\n", SCARG(uap, what))); - - switch (SCARG(uap, what)) { - case SVR4_msgsnd: - return svr4_msgsnd(p, v, retval); - case SVR4_msgrcv: - return svr4_msgrcv(p, v, retval); - case SVR4_msgget: - return svr4_msgget(p, v, retval); - case SVR4_msgctl: - return svr4_msgctl(p, v, retval); - default: - return EINVAL; - } -} -#endif - -#ifdef SYSVSHM - -static void -bsd_to_svr4_shmid_ds(bds, sds) - const struct shmid_ds *bds; - struct svr4_shmid_ds *sds; -{ - bsd_to_svr4_ipc_perm(&bds->shm_perm, &sds->shm_perm); - sds->shm_segsz = bds->shm_segsz; - sds->shm_lkcnt = 0; - sds->shm_lpid = bds->shm_lpid; - sds->shm_cpid = bds->shm_cpid; - sds->shm_amp = bds->shm_internal; - sds->shm_nattch = bds->shm_nattch; - sds->shm_cnattch = 0; - sds->shm_atime = bds->shm_atime; - sds->shm_pad1 = 0; - sds->shm_dtime = bds->shm_dtime; - sds->shm_pad2 = 0; - sds->shm_ctime = bds->shm_ctime; - sds->shm_pad3 = 0; -} - -static void -svr4_to_bsd_shmid_ds(sds, bds) - const struct svr4_shmid_ds *sds; - struct shmid_ds *bds; -{ - svr4_to_bsd_ipc_perm(&sds->shm_perm, &bds->shm_perm); - bds->shm_segsz = sds->shm_segsz; - bds->shm_lpid = sds->shm_lpid; - bds->shm_cpid = sds->shm_cpid; - bds->shm_internal = sds->shm_amp; - bds->shm_nattch = sds->shm_nattch; - bds->shm_atime = sds->shm_atime; - bds->shm_dtime = sds->shm_dtime; - bds->shm_ctime = sds->shm_ctime; -} - -struct svr4_sys_shmat_args { - syscallarg(int) what; - syscallarg(int) shmid; - syscallarg(void *) shmaddr; - syscallarg(int) shmflg; -}; - -static int -svr4_shmat(p, v, retval) - struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_shmat_args *uap = v; - struct sys_shmat_args ap; - - SCARG(&ap, shmid) = SCARG(uap, shmid); - SCARG(&ap, shmaddr) = SCARG(uap, shmaddr); - SCARG(&ap, shmflg) = SCARG(uap, shmflg); - - return sys_shmat(p, &ap, retval); -} - -struct svr4_sys_shmdt_args { - syscallarg(int) what; - syscallarg(void *) shmaddr; -}; - -static int -svr4_shmdt(p, v, retval) - struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_shmdt_args *uap = v; - struct sys_shmdt_args ap; - - SCARG(&ap, shmaddr) = SCARG(uap, shmaddr); - - return sys_shmdt(p, &ap, retval); -} - -struct svr4_sys_shmget_args { - syscallarg(int) what; - syscallarg(key_t) key; - syscallarg(int) size; - syscallarg(int) shmflg; -}; - -static int -svr4_shmget(p, v, retval) - struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_shmget_args *uap = v; - struct sys_shmget_args ap; - - SCARG(&ap, key) = SCARG(uap, key); - SCARG(&ap, size) = SCARG(uap, size); - SCARG(&ap, shmflg) = SCARG(uap, shmflg); - - return sys_shmget(p, &ap, retval); -} - -struct svr4_sys_shmctl_args { - syscallarg(int) what; - syscallarg(int) shmid; - syscallarg(int) cmd; - syscallarg(struct svr4_shmid_ds *) buf; -}; - -int -svr4_shmctl(p, v, retval) - struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_shmctl_args *uap = v; - int error; - caddr_t sg = stackgap_init(p->p_emul); - struct sys_shmctl_args ap; - struct shmid_ds bs; - struct svr4_shmid_ds ss; - - SCARG(&ap, shmid) = SCARG(uap, shmid); - - if (SCARG(uap, buf) != NULL) { - SCARG(&ap, buf) = stackgap_alloc(&sg, sizeof (struct shmid_ds)); - switch (SCARG(uap, cmd)) { - case SVR4_IPC_SET: - case SVR4_IPC_RMID: - case SVR4_SHM_LOCK: - case SVR4_SHM_UNLOCK: - error = copyin(SCARG(uap, buf), (caddr_t) &ss, - sizeof ss); - if (error) - return error; - svr4_to_bsd_shmid_ds(&ss, &bs); - error = copyout(&bs, SCARG(&ap, buf), sizeof bs); - if (error) - return error; - break; - default: - break; - } - } - else - SCARG(&ap, buf) = NULL; - - - switch (SCARG(uap, cmd)) { - case SVR4_IPC_STAT: - SCARG(&ap, cmd) = IPC_STAT; - if ((error = sys_shmctl(p, &ap, retval)) != 0) - return error; - if (SCARG(uap, buf) == NULL) - return 0; - error = copyin(SCARG(&ap, buf), &bs, sizeof bs); - if (error) - return error; - bsd_to_svr4_shmid_ds(&bs, &ss); - return copyout(&ss, SCARG(uap, buf), sizeof ss); - - case SVR4_IPC_SET: - SCARG(&ap, cmd) = IPC_SET; - return sys_shmctl(p, &ap, retval); - - case SVR4_IPC_RMID: - case SVR4_SHM_LOCK: - case SVR4_SHM_UNLOCK: - switch (SCARG(uap, cmd)) { - case SVR4_IPC_RMID: - SCARG(&ap, cmd) = IPC_RMID; - break; - case SVR4_SHM_LOCK: - SCARG(&ap, cmd) = SHM_LOCK; - break; - case SVR4_SHM_UNLOCK: - SCARG(&ap, cmd) = SHM_UNLOCK; - break; - default: - return EINVAL; - } - return sys_shmctl(p, &ap, retval); - - default: - return EINVAL; - } -} - -int -svr4_sys_shmsys(p, v, retval) - struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_shmsys_args *uap = v; - - DPRINTF(("svr4_shmsys(%d)\n", SCARG(uap, what))); - - switch (SCARG(uap, what)) { - case SVR4_shmat: - return svr4_shmat(p, v, retval); - case SVR4_shmdt: - return svr4_shmdt(p, v, retval); - case SVR4_shmget: - return svr4_shmget(p, v, retval); - case SVR4_shmctl: - return svr4_shmctl(p, v, retval); - default: - return ENOSYS; - } -} -#endif /* SYSVSHM */ diff --git a/sys/compat/svr4/svr4_ipc.h b/sys/compat/svr4/svr4_ipc.h deleted file mode 100644 index 23d81634785..00000000000 --- a/sys/compat/svr4/svr4_ipc.h +++ /dev/null @@ -1,176 +0,0 @@ -/* $OpenBSD: svr4_ipc.h,v 1.2 1996/08/02 20:35:40 niklas Exp $ */ -/* $NetBSD: svr4_ipc.h,v 1.1 1995/10/14 20:24:32 christos Exp $ */ - -/* - * Copyright (c) 1995 Christos Zoulas. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Christos Zoulas. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _SVR4_IPC_H_ -#define _SVR4_IPC_H_ - -/* - * General IPC - */ -#define SVR4_IPC_RMID 10 -#define SVR4_IPC_SET 11 -#define SVR4_IPC_STAT 12 - -struct svr4_ipc_perm { - svr4_uid_t uid; - svr4_gid_t gid; - svr4_uid_t cuid; - svr4_gid_t cgid; - svr4_mode_t mode; - u_long seq; - svr4_key_t key; - long pad[4]; -}; - -/* - * Message queues - */ -#define SVR4_msgget 0 -#define SVR4_msgctl 1 -#define SVR4_msgrcv 2 -#define SVR4_msgsnd 3 - -struct svr4_msg { - struct svr4_msg *msg_next; - long msg_type; - u_short msg_ts; - short msg_spot; -}; - -struct svr4_msqid_ds { - struct svr4_ipc_perm msg_perm; - struct svr4_msg *msg_first; - struct svr4_msg *msg_last; - u_long msg_cbytes; - u_long msg_qnum; - u_long msg_qbytes; - svr4_pid_t msg_lspid; - svr4_pid_t msg_lrpid; - svr4_time_t msg_stime; - long msg_pad1; - svr4_time_t msg_rtime; - long msg_pad2; - svr4_time_t msg_ctime; - long msg_pad3; - short msg_cv; - short msg_qnum_cv; - long msg_pad4[3]; -}; - -struct svr4_msgbuf { - long mtype; /* message type */ - char mtext[1]; /* message text */ -}; - -struct svr4_msginfo { - int msgmap; - int msgmax; - int msgmnb; - int msgmni; - int msgssz; - int msgtql; - u_short msgseg; -}; - -/* - * Shared memory - */ -#define SVR4_shmat 0 -#define SVR4_shmctl 1 -#define SVR4_shmdt 2 -#define SVR4_shmget 3 - -/* shmctl() operations */ -#define SVR4_SHM_LOCK 3 -#define SVR4_SHM_UNLOCK 4 - -struct svr4_shmid_ds { - struct svr4_ipc_perm shm_perm; - int shm_segsz; - void *shm_amp; - u_short shm_lkcnt; - svr4_pid_t shm_lpid; - svr4_pid_t shm_cpid; - u_long shm_nattch; - u_long shm_cnattch; - svr4_time_t shm_atime; - long shm_pad1; - svr4_time_t shm_dtime; - long shm_pad2; - svr4_time_t shm_ctime; - long shm_pad3; - long shm_pad4[4]; -}; - -/* - * Semaphores - */ -#define SVR4_semctl 0 -#define SVR4_semget 1 -#define SVR4_semop 2 - -/* semctl() operations */ -#define SVR4_SEM_GETNCNT 3 -#define SVR4_SEM_GETPID 4 -#define SVR4_SEM_GETVAL 5 -#define SVR4_SEM_GETALL 6 -#define SVR4_SEM_GETZCNT 7 -#define SVR4_SEM_SETVAL 8 -#define SVR4_SEM_SETALL 9 - -struct svr4_sem { - u_short semval; - svr4_pid_t sempid; - u_short semncnt; - u_short semzcnt; - u_short semncnt_cv; - u_short semzcnt_cv; -}; - -struct svr4_semid_ds { - struct svr4_ipc_perm sem_perm; - struct svr4_sem *sem_base; - u_short sem_nsems; - svr4_time_t sem_otime; - long sem_pad1; - svr4_time_t sem_ctime; - long sem_pad2; - long sem_pad3[4]; -}; - -struct svr4_sembuf { - u_short sem_num; - short sem_op; - short sem_flg; -}; - -#endif /* _SVR4_IPC_H */ diff --git a/sys/compat/svr4/svr4_jioctl.c b/sys/compat/svr4/svr4_jioctl.c deleted file mode 100644 index 23529e99737..00000000000 --- a/sys/compat/svr4/svr4_jioctl.c +++ /dev/null @@ -1,77 +0,0 @@ -/* $OpenBSD: svr4_jioctl.c,v 1.2 2002/03/14 01:26:51 millert Exp $ */ - -/* - * Copyright (c) 1997 Niklas Hallqvist - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * Deal with the "j" svr4 ioctls ("j" stands for "jerq", the first windowing - * terminal). - */ - -#include <sys/types.h> -#include <sys/param.h> -#include <sys/errno.h> -#include <sys/file.h> -#include <sys/proc.h> -#include <sys/systm.h> -#include <sys/ttycom.h> - -#include <compat/svr4/svr4_ioctl.h> -#include <compat/svr4/svr4_jioctl.h> -#include <compat/svr4/svr4_util.h> - -int -svr4_jerq_ioctl(fp, p, retval, fd, cmd, data) - struct file *fp; - struct proc *p; - register_t *retval; - int fd; - u_long cmd; - caddr_t data; -{ - struct svr4_jwinsize jws; - struct winsize ws; - int error; - int (*ctl)(struct file *, u_long, caddr_t, struct proc *) = - fp->f_ops->fo_ioctl; - - switch (cmd) { - case SVR4_JWINSIZE: - error = (*ctl)(fp, TIOCGWINSZ, (caddr_t)&ws, p); - if (error) - return (error); - jws.bytesx = ws.ws_col; - jws.bytesy = ws.ws_row; - jws.bitsx = ws.ws_xpixel; - jws.bitsy = ws.ws_ypixel; - return (copyout(&jws, data, sizeof (jws))); - - default: - DPRINTF(("Unimplemented ioctl %lx\n", cmd)); - return (EINVAL); - } -} diff --git a/sys/compat/svr4/svr4_jioctl.h b/sys/compat/svr4/svr4_jioctl.h deleted file mode 100644 index b537a0dd5d4..00000000000 --- a/sys/compat/svr4/svr4_jioctl.h +++ /dev/null @@ -1,78 +0,0 @@ -/* $OpenBSD: svr4_jioctl.h,v 1.1 1997/11/04 07:45:34 niklas Exp $ */ - -/* - * Copyright (c) 1997 Niklas Hallqvist - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * Deal with the "j" svr4 ioctls ("j" stands for "jerq", the first windowing - * terminal). - */ - -#ifndef _SVR4_SYS_JIOCTL_H_ -#define _SVR4_SYS_JIOCTL_H_ - -#define SVR4_jIOC ('j' << 8) - -#define SVR4_JBOOT (SVR4_jIOC|1) -#define SVR4_JTERM (SVR4_jIOC|2) -#define SVR4_JMPX (SVR4_jIOC|3) -#define SVR4_JTIMO (SVR4_jIOC|4) -#define SVR4_JWINSIZE (SVR4_jIOC|5) -#define SVR4_JTIMOM (SVR4_jIOC|6) -#define SVR4_JZOMBOOT (SVR4_jIOC|7) -#define SVR4_JAGENT (SVR4_jIOC|9) -#define SVR4_JTRUN (SVR4_jIOC|10) -#define SVR4_JXTPROTO (SVR4_jIOC|11) - -struct svr4_jwinsize { - u_int8_t bytesx, bytesy; - u_int16_t bitsx, bitsy; -}; - -struct svr4_jerqmsg { - u_int8_t cmd, chan; -}; - -#define SVR4_C_SENDCHAR 1 -#define SVR4_C_NEW 2 -#define SVR4_C_UNBLK 3 -#define SVR4_C_DELETE 4 -#define SVR4_C_EXIT 5 -#define SVR4_C_DEFUNCT 6 -#define SVR4_C_SENDCHARS 7 -#define SVR4_C_RESHAPE 8 -#define SVR4_C_RUN 9 -#define SVR4_C_NOFLOW 10 -#define SVR4_C_YESFLOW 11 - -struct svr4_bagent { - u_int32_t size; - void *src; - void *dest; -}; - -#endif /* _SVR4_SYS_JIOCTL_H_ */ diff --git a/sys/compat/svr4/svr4_misc.c b/sys/compat/svr4/svr4_misc.c deleted file mode 100644 index c5d64488cf4..00000000000 --- a/sys/compat/svr4/svr4_misc.c +++ /dev/null @@ -1,1456 +0,0 @@ -/* $OpenBSD: svr4_misc.c,v 1.57 2011/07/04 20:35:35 deraadt Exp $ */ -/* $NetBSD: svr4_misc.c,v 1.42 1996/12/06 03:22:34 christos Exp $ */ - -/* - * Copyright (c) 1994 Christos Zoulas - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * SVR4 compatibility module. - * - * SVR4 system calls that are implemented differently in BSD are - * handled here. - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/exec.h> -#include <sys/exec_olf.h> -#include <sys/namei.h> -#include <sys/dirent.h> -#include <sys/proc.h> -#include <sys/sched.h> -#include <sys/file.h> -#include <sys/stat.h> -#include <sys/time.h> -#include <sys/filedesc.h> -#include <sys/ioctl.h> -#include <sys/kernel.h> -#include <sys/malloc.h> -#include <sys/mbuf.h> -#include <sys/ktrace.h> -#include <sys/mman.h> -#include <sys/mount.h> -#include <sys/pool.h> -#include <sys/resource.h> -#include <sys/resourcevar.h> -#include <sys/socket.h> -#include <sys/vnode.h> -#include <sys/uio.h> -#include <sys/wait.h> -#include <sys/utsname.h> -#include <sys/unistd.h> -#include <sys/times.h> -#include <sys/sem.h> -#include <sys/msg.h> -#include <sys/ptrace.h> -#include <sys/signalvar.h> -#include <sys/specdev.h> - -#include <netinet/in.h> -#include <sys/syscallargs.h> - -#include <compat/svr4/svr4_types.h> -#include <compat/svr4/svr4_signal.h> -#include <compat/svr4/svr4_syscallargs.h> -#include <compat/svr4/svr4_util.h> -#include <compat/svr4/svr4_time.h> -#include <compat/svr4/svr4_dirent.h> -#include <compat/svr4/svr4_ulimit.h> -#include <compat/svr4/svr4_hrt.h> -#include <compat/svr4/svr4_wait.h> -#include <compat/svr4/svr4_statvfs.h> -#include <compat/svr4/svr4_sysconfig.h> -#include <compat/svr4/svr4_acl.h> - -#include <compat/common/compat_dir.h> - -#include <uvm/uvm_extern.h> - -static __inline clock_t timeval_to_clock_t(struct timeval *); -static int svr4_setinfo(struct proc *, int, svr4_siginfo_t *); - -struct svr4_hrtcntl_args; -static int svr4_hrtcntl(struct proc *, struct svr4_hrtcntl_args *, - register_t *); -static void bsd_statfs_to_svr4_statvfs(const struct statfs *, - struct svr4_statvfs *); -static void bsd_statfs_to_svr4_statvfs64(const struct statfs *, - struct svr4_statvfs64 *); -static struct process *svr4_prfind(pid_t pid); - -static int svr4_mknod(struct proc *, register_t *, char *, - svr4_mode_t, svr4_dev_t); - -int -svr4_sys_wait(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_wait_args *uap = v; - struct sys_wait4_args w4; - int error; - size_t sz = sizeof(*SCARG(&w4, status)); - - SCARG(&w4, rusage) = NULL; - SCARG(&w4, options) = 0; - - if (SCARG(uap, status) == NULL) { - caddr_t sg = stackgap_init(p->p_emul); - SCARG(&w4, status) = stackgap_alloc(&sg, sz); - } - else - SCARG(&w4, status) = SCARG(uap, status); - - SCARG(&w4, pid) = WAIT_ANY; - - if ((error = sys_wait4(p, &w4, retval)) != 0) - return error; - - /* - * It looks like wait(2) on svr4/solaris/2.4 returns - * the status in retval[1], and the pid on retval[0]. - * NB: this can break if register_t stops being an int. - */ - return copyin(SCARG(&w4, status), &retval[1], sz); -} - - -int -svr4_sys_execv(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_execv_args /* { - syscallarg(char *) path; - syscallarg(char **) argv; - } */ *uap = v; - struct sys_execve_args ap; - caddr_t sg; - - sg = stackgap_init(p->p_emul); - SVR4_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path)); - - SCARG(&ap, path) = SCARG(uap, path); - SCARG(&ap, argp) = SCARG(uap, argp); - SCARG(&ap, envp) = NULL; - - return sys_execve(p, &ap, retval); -} - - -int -svr4_sys_execve(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_execve_args /* { - syscallarg(char *) path; - syscallarg(char **) argv; - syscallarg(char **) envp; - } */ *uap = v; - struct sys_execve_args ap; - caddr_t sg; - - sg = stackgap_init(p->p_emul); - SVR4_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path)); - - SCARG(&ap, path) = SCARG(uap, path); - SCARG(&ap, argp) = SCARG(uap, argp); - SCARG(&ap, envp) = SCARG(uap, envp); - - return sys_execve(p, &ap, retval); -} - - -int -svr4_sys_time(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_time_args *uap = v; - int error = 0; - struct timeval tv; - - microtime(&tv); - if (SCARG(uap, t)) - error = copyout(&tv.tv_sec, SCARG(uap, t), - sizeof(*(SCARG(uap, t)))); - *retval = (int) tv.tv_sec; - - return error; -} - - -/* - * Read SVR4-style directory entries. We suck them into kernel space so - * that they can be massaged before being copied out to user code. Like - * SunOS, we squish out `empty' entries. - * - * This is quite ugly, but what do you expect from compatibility code? - */ - -int svr4_readdir_callback(void *, struct dirent *, off_t); -int svr4_readdir64_callback(void *, struct dirent *, off_t); - -struct svr4_readdir_callback_args { - caddr_t outp; - int resid; -}; - -int -svr4_readdir_callback(arg, bdp, cookie) - void *arg; - struct dirent *bdp; - off_t cookie; -{ - struct svr4_dirent idb; - struct svr4_readdir_callback_args *cb = arg; - int svr4_reclen; - int error; - - svr4_reclen = SVR4_RECLEN(&idb, bdp->d_namlen); - if (cb->resid < svr4_reclen) - return (ENOMEM); - - idb.d_ino = (svr4_ino_t)bdp->d_fileno; - idb.d_off = (svr4_off_t)cookie; - idb.d_reclen = (u_short)svr4_reclen; - strlcpy(idb.d_name, bdp->d_name, sizeof(idb.d_name)); - if ((error = copyout((caddr_t)&idb, cb->outp, svr4_reclen))) - return (error); - - cb->outp += svr4_reclen; - cb->resid -= svr4_reclen; - - return (0); -} - -int -svr4_readdir64_callback(arg, bdp, cookie) - void *arg; - struct dirent *bdp; - off_t cookie; -{ - struct svr4_dirent64 idb; - struct svr4_readdir_callback_args *cb = arg; - int svr4_reclen; - int error; - - svr4_reclen = SVR4_RECLEN(&idb, bdp->d_namlen); - if (cb->resid < svr4_reclen) - return (ENOMEM); - - /* - * Massage in place to make a SVR4-shaped dirent (otherwise - * we have to worry about touching user memory outside of - * the copyout() call). - */ - idb.d_ino = (svr4_ino64_t)bdp->d_fileno; - idb.d_off = (svr4_off64_t)cookie; - idb.d_reclen = (u_short)svr4_reclen; - strlcpy(idb.d_name, bdp->d_name, sizeof(idb.d_name)); - if ((error = copyout((caddr_t)&idb, cb->outp, svr4_reclen))) - return (error); - - cb->outp += svr4_reclen; - cb->resid -= svr4_reclen; - - return (0); -} - - -int -svr4_sys_getdents(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_getdents_args *uap = v; - struct svr4_readdir_callback_args args; - struct file *fp; - int error; - - if ((error = getvnode(p->p_fd, SCARG(uap, fd), &fp)) != 0) - return (error); - - args.resid = SCARG(uap, nbytes); - args.outp = (caddr_t)SCARG(uap, buf); - - error = readdir_with_callback(fp, &fp->f_offset, SCARG(uap, nbytes), - svr4_readdir_callback, &args); - FRELE(fp); - if (error) - return (error); - - *retval = SCARG(uap, nbytes) - args.resid; - - return (0); -} - -int -svr4_sys_getdents64(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_getdents64_args *uap = v; - struct svr4_readdir_callback_args args; - struct file *fp; - int error; - - if ((error = getvnode(p->p_fd, SCARG(uap, fd), &fp)) != 0) - return (error); - - args.resid = SCARG(uap, nbytes); - args.outp = (caddr_t)SCARG(uap, dp); - - error = readdir_with_callback(fp, &fp->f_offset, SCARG(uap, nbytes), - svr4_readdir64_callback, &args); - FRELE(fp); - if (error) - return (error); - - *retval = SCARG(uap, nbytes) - args.resid; - - return (0); -} - -int -svr4_sys_mmap(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_mmap_args *uap = v; - struct sys_mmap_args mm; - void *rp; -#define _MAP_NEW 0x80000000 - /* - * Verify the arguments. - */ - if (SCARG(uap, prot) & ~(PROT_READ | PROT_WRITE | PROT_EXEC)) - return EINVAL; /* XXX still needed? */ - - if (SCARG(uap, len) == 0) - return EINVAL; - - SCARG(&mm, prot) = SCARG(uap, prot); - SCARG(&mm, len) = SCARG(uap, len); - SCARG(&mm, flags) = SCARG(uap, flags) & ~_MAP_NEW; - SCARG(&mm, fd) = SCARG(uap, fd); - SCARG(&mm, addr) = SCARG(uap, addr); - SCARG(&mm, pos) = SCARG(uap, pos); - - rp = (void *) round_page((vaddr_t)p->p_vmspace->vm_daddr + BRKSIZ); - if ((SCARG(&mm, flags) & MAP_FIXED) == 0 && - SCARG(&mm, addr) != 0 && SCARG(&mm, addr) < rp) - SCARG(&mm, addr) = rp; - - return sys_mmap(p, &mm, retval); -} - -int -svr4_sys_mmap64(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_mmap64_args *uap = v; - struct sys_mmap_args mm; - void *rp; -#define _MAP_NEW 0x80000000 - /* - * Verify the arguments. - */ - if (SCARG(uap, prot) & ~(PROT_READ | PROT_WRITE | PROT_EXEC)) - return EINVAL; /* XXX still needed? */ - - if (SCARG(uap, len) == 0) - return EINVAL; - - SCARG(&mm, prot) = SCARG(uap, prot); - SCARG(&mm, len) = SCARG(uap, len); - SCARG(&mm, flags) = SCARG(uap, flags) & ~_MAP_NEW; - SCARG(&mm, fd) = SCARG(uap, fd); - SCARG(&mm, addr) = SCARG(uap, addr); - SCARG(&mm, pos) = SCARG(uap, pos); - - rp = (void *) round_page((vaddr_t)p->p_vmspace->vm_daddr + BRKSIZ); - if ((SCARG(&mm, flags) & MAP_FIXED) == 0 && - SCARG(&mm, addr) != 0 && SCARG(&mm, addr) < rp) - SCARG(&mm, addr) = rp; - - return sys_mmap(p, &mm, retval); -} - -int -svr4_sys_fchroot(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_fchroot_args *uap = v; - struct filedesc *fdp = p->p_fd; - struct vnode *vp; - struct file *fp; - int error; - - if ((error = suser(p, 0)) != 0) - return error; - if ((error = getvnode(fdp, SCARG(uap, fd), &fp)) != 0) - return error; - - vp = (struct vnode *) fp->f_data; - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); - if (vp->v_type != VDIR) - error = ENOTDIR; - else - error = VOP_ACCESS(vp, VEXEC, p->p_ucred, p); - VOP_UNLOCK(vp, 0, p); - if (error) { - FRELE(fp); - return error; - } - vref(vp); - if (fdp->fd_rdir != NULL) - vrele(fdp->fd_rdir); - fdp->fd_rdir = vp; - FRELE(fp); - return 0; -} - -static int -svr4_mknod(p, retval, path, mode, dev) - struct proc *p; - register_t *retval; - char *path; - svr4_mode_t mode; - svr4_dev_t dev; -{ - caddr_t sg = stackgap_init(p->p_emul); - - SVR4_CHECK_ALT_EXIST(p, &sg, path); - - if (S_ISFIFO(mode)) { - struct sys_mkfifo_args ap; - SCARG(&ap, path) = path; - SCARG(&ap, mode) = mode; - return sys_mkfifo(p, &ap, retval); - } else { - struct sys_mknod_args ap; - SCARG(&ap, path) = path; - SCARG(&ap, mode) = mode; - SCARG(&ap, dev) = dev; - return sys_mknod(p, &ap, retval); - } -} - - -int -svr4_sys_mknod(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_mknod_args *uap = v; - return svr4_mknod(p, retval, - SCARG(uap, path), SCARG(uap, mode), - svr4_to_bsd_odev_t(SCARG(uap, dev))); -} - - -int -svr4_sys_xmknod(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_xmknod_args *uap = v; - return svr4_mknod(p, retval, - SCARG(uap, path), SCARG(uap, mode), - svr4_to_bsd_dev_t(SCARG(uap, dev))); -} - - -int -svr4_sys_vhangup(p, v, retval) - struct proc *p; - void *v; - register_t *retval; -{ - return 0; -} - - -int -svr4_sys_sysconfig(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_sysconfig_args *uap = v; - extern int maxfiles; - - switch (SCARG(uap, name)) { - case SVR4_CONFIG_UNUSED: - *retval = 0; - break; - case SVR4_CONFIG_NGROUPS: - *retval = NGROUPS_MAX; - break; - case SVR4_CONFIG_CHILD_MAX: - *retval = maxproc; - break; - case SVR4_CONFIG_OPEN_FILES: - *retval = maxfiles; - break; - case SVR4_CONFIG_POSIX_VER: - *retval = 198808; - break; - case SVR4_CONFIG_PAGESIZE: - *retval = NBPG; - break; - case SVR4_CONFIG_CLK_TCK: - *retval = 60; /* should this be `hz', ie. 100? */ - break; - case SVR4_CONFIG_XOPEN_VER: - *retval = 2; /* XXX: What should that be? */ - break; - case SVR4_CONFIG_PROF_TCK: - *retval = 60; /* XXX: What should that be? */ - break; - case SVR4_CONFIG_NPROC_CONF: - *retval = 1; /* Only one processor for now */ - break; - case SVR4_CONFIG_NPROC_ONLN: - *retval = 1; /* And it better be online */ - break; - case SVR4_CONFIG_AIO_LISTIO_MAX: - case SVR4_CONFIG_AIO_MAX: - case SVR4_CONFIG_AIO_PRIO_DELTA_MAX: - *retval = 0; /* No aio support */ - break; - case SVR4_CONFIG_DELAYTIMER_MAX: - *retval = 0; /* No delaytimer support */ - break; -#ifdef SYSVMSG - case SVR4_CONFIG_MQ_OPEN_MAX: - *retval = msginfo.msgmni; - break; -#endif - case SVR4_CONFIG_MQ_PRIO_MAX: - *retval = 0; /* XXX: Don't know */ - break; - case SVR4_CONFIG_RTSIG_MAX: - *retval = 0; - break; -#ifdef SYSVSEM - case SVR4_CONFIG_SEM_NSEMS_MAX: - *retval = seminfo.semmni; - break; - case SVR4_CONFIG_SEM_VALUE_MAX: - *retval = seminfo.semvmx; - break; -#endif - case SVR4_CONFIG_SIGQUEUE_MAX: - *retval = 0; /* XXX: Don't know */ - break; - case SVR4_CONFIG_SIGRT_MIN: - case SVR4_CONFIG_SIGRT_MAX: - *retval = 0; /* No real time signals */ - break; - case SVR4_CONFIG_TIMER_MAX: - *retval = 3; /* XXX: real, virtual, profiling */ - break; - case SVR4_CONFIG_PHYS_PAGES: - *retval = uvmexp.npages; - break; - case SVR4_CONFIG_AVPHYS_PAGES: - *retval = uvmexp.active; /* XXX: active instead of avg */ - break; - default: - return EINVAL; - } - return 0; -} - -#define SVR4_RLIMIT_NOFILE 5 /* Other RLIMIT_* are the same */ -#define SVR4_RLIMIT_VMEM 6 /* Other RLIMIT_* are the same */ -#define SVR4_RLIM_NLIMITS 7 - -int -svr4_sys_getrlimit(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_getrlimit_args *uap = v; - struct compat_43_sys_getrlimit_args ap; - - if (SCARG(uap, which) >= SVR4_RLIM_NLIMITS) - return EINVAL; - - if (SCARG(uap, which) == SVR4_RLIMIT_NOFILE) - SCARG(uap, which) = RLIMIT_NOFILE; - if (SCARG(uap, which) == SVR4_RLIMIT_VMEM) - SCARG(uap, which) = RLIMIT_RSS; - - SCARG(&ap, which) = SCARG(uap, which); - SCARG(&ap, rlp) = SCARG(uap, rlp); - - return compat_43_sys_getrlimit(p, &ap, retval); -} - -int -svr4_sys_setrlimit(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_setrlimit_args *uap = v; - struct compat_43_sys_setrlimit_args ap; - - if (SCARG(uap, which) >= SVR4_RLIM_NLIMITS) - return EINVAL; - - if (SCARG(uap, which) == SVR4_RLIMIT_NOFILE) - SCARG(uap, which) = RLIMIT_NOFILE; - if (SCARG(uap, which) == SVR4_RLIMIT_VMEM) - SCARG(uap, which) = RLIMIT_RSS; - - SCARG(&ap, which) = SCARG(uap, which); - SCARG(&ap, rlp) = SCARG(uap, rlp); - - return compat_43_sys_setrlimit(p, uap, retval); -} - - -/* ARGSUSED */ -int -svr4_sys_break(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_break_args *uap = v; - register struct vmspace *vm = p->p_vmspace; - vaddr_t new, old; - int error; - register int diff; - - old = (vaddr_t) vm->vm_daddr; - new = round_page((vaddr_t)SCARG(uap, nsize)); - diff = new - old; - - DPRINTF(("break(1): old %lx new %lx diff %x\n", old, new, diff)); - - if (diff > p->p_rlimit[RLIMIT_DATA].rlim_cur) - return ENOMEM; - - old = round_page(old + ptoa(vm->vm_dsize)); - DPRINTF(("break(2): dsize = %x ptoa %x\n", - vm->vm_dsize, ptoa(vm->vm_dsize))); - - diff = new - old; - DPRINTF(("break(3): old %lx new %lx diff %x\n", old, new, diff)); - - if (diff > 0) { - error = uvm_map(&vm->vm_map, &old, diff, NULL, UVM_UNKNOWN_OFFSET, - 0, UVM_MAPFLAG(UVM_PROT_ALL, UVM_PROT_ALL, UVM_INH_COPY, - UVM_ADV_NORMAL, - UVM_FLAG_AMAPPAD|UVM_FLAG_FIXED| - UVM_FLAG_OVERLAY|UVM_FLAG_COPYONW)); - if (error) { - uprintf("sbrk: grow failed, return = %d\n", error); - return error; - } - vm->vm_dsize += atop(diff); - } else if (diff < 0) { - diff = -diff; - uvm_deallocate(&vm->vm_map, new, diff); - vm->vm_dsize -= atop(diff); - } - return 0; -} - -static __inline clock_t -timeval_to_clock_t(tv) - struct timeval *tv; -{ - return tv->tv_sec * hz + tv->tv_usec / (1000000 / hz); -} - -int -svr4_sys_times(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_times_args *uap = v; - int error; - struct tms tms; - struct timeval t; - struct rusage *ru; - struct rusage r; - struct sys_getrusage_args ga; - - caddr_t sg = stackgap_init(p->p_emul); - ru = stackgap_alloc(&sg, sizeof(struct rusage)); - - SCARG(&ga, who) = RUSAGE_SELF; - SCARG(&ga, rusage) = ru; - - error = sys_getrusage(p, &ga, retval); - if (error) - return error; - - if ((error = copyin(ru, &r, sizeof r)) != 0) - return error; - - tms.tms_utime = timeval_to_clock_t(&r.ru_utime); - tms.tms_stime = timeval_to_clock_t(&r.ru_stime); - - SCARG(&ga, who) = RUSAGE_CHILDREN; - error = sys_getrusage(p, &ga, retval); - if (error) - return error; - - if ((error = copyin(ru, &r, sizeof r)) != 0) - return error; - - tms.tms_cutime = timeval_to_clock_t(&r.ru_utime); - tms.tms_cstime = timeval_to_clock_t(&r.ru_stime); - - microtime(&t); - *retval = timeval_to_clock_t(&t); - - return copyout(&tms, SCARG(uap, tp), sizeof(tms)); -} - - -int -svr4_sys_ulimit(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_ulimit_args *uap = v; - - switch (SCARG(uap, cmd)) { - case SVR4_GFILLIM: - *retval = p->p_rlimit[RLIMIT_FSIZE].rlim_cur / 512; - return 0; - - case SVR4_SFILLIM: - { - int error; - struct sys_setrlimit_args srl; - struct rlimit krl; - caddr_t sg = stackgap_init(p->p_emul); - struct rlimit *url = (struct rlimit *) - stackgap_alloc(&sg, sizeof *url); - - krl.rlim_cur = SCARG(uap, newlimit) * 512; - krl.rlim_max = p->p_rlimit[RLIMIT_FSIZE].rlim_max; - - error = copyout(&krl, url, sizeof(*url)); - if (error) - return error; - - SCARG(&srl, which) = RLIMIT_FSIZE; - SCARG(&srl, rlp) = url; - - error = sys_setrlimit(p, &srl, retval); - if (error) - return error; - - *retval = p->p_rlimit[RLIMIT_FSIZE].rlim_cur; - return 0; - } - - case SVR4_GMEMLIM: - { - struct vmspace *vm = p->p_vmspace; - *retval = (long) vm->vm_daddr + - p->p_rlimit[RLIMIT_DATA].rlim_cur; - return 0; - } - - case SVR4_GDESLIM: - *retval = p->p_rlimit[RLIMIT_NOFILE].rlim_cur; - return 0; - - default: - return EINVAL; - } -} - - -static struct process * -svr4_prfind(pid_t pid) -{ - struct process *pr; - struct proc *p; - - /* look in the live processes */ - if ((pr = prfind(pid)) != NULL) - return pr; - - /* look in the zombies */ - LIST_FOREACH(p, &zombproc, p_list) - if (p->p_pid == pid) - return p->p_flag & P_THREAD ? NULL : p->p_p; - - return NULL; -} - - -int -svr4_sys_pgrpsys(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_pgrpsys_args *uap = v; - struct process *pr = p->p_p; - int error; - - switch (SCARG(uap, cmd)) { - case 0: /* getpgrp() */ - *retval = pr->ps_pgrp->pg_id; - return 0; - - case 1: /* setpgrp() */ - { - struct sys_setpgid_args sa; - - SCARG(&sa, pid) = 0; - SCARG(&sa, pgid) = 0; - if ((error = sys_setpgid(p, &sa, retval)) != 0) - return error; - *retval = pr->ps_pgrp->pg_id; - return 0; - } - - case 2: /* getsid(pid) */ - if (SCARG(uap, pid) != 0 && - (pr = svr4_prfind(SCARG(uap, pid))) == NULL) - return ESRCH; - /* - * we return the pid of the session leader for this - * process - */ - *retval = (register_t)pr->ps_session->s_leader->ps_pid; - return 0; - - case 3: /* setsid() */ - return sys_setsid(p, NULL, retval); - - case 4: /* getpgid(pid) */ - - if (SCARG(uap, pid) != 0 && - (pr = svr4_prfind(SCARG(uap, pid))) == NULL) - return ESRCH; - - *retval = (int)pr->ps_pgrp->pg_id; - return 0; - - case 5: /* setpgid(pid, pgid); */ - { - struct sys_setpgid_args sa; - - SCARG(&sa, pid) = SCARG(uap, pid); - SCARG(&sa, pgid) = SCARG(uap, pgid); - return sys_setpgid(p, &sa, retval); - } - - default: - return EINVAL; - } -} - -struct svr4_hrtcntl_args { - syscallarg(int) cmd; - syscallarg(int) fun; - syscallarg(int) clk; - syscallarg(svr4_hrt_interval_t *) iv; - syscallarg(svr4_hrt_time_t *) ti; -}; - -static int -svr4_hrtcntl(p, uap, retval) - register struct proc *p; - register struct svr4_hrtcntl_args *uap; - register_t *retval; -{ - switch (SCARG(uap, fun)) { - case SVR4_HRT_CNTL_RES: - DPRINTF(("htrcntl(RES)\n")); - *retval = SVR4_HRT_USEC; - return 0; - - case SVR4_HRT_CNTL_TOFD: - DPRINTF(("htrcntl(TOFD)\n")); - { - struct timeval tv; - svr4_hrt_time_t t; - if (SCARG(uap, clk) != SVR4_HRT_CLK_STD) { - DPRINTF(("clk == %d\n", SCARG(uap, clk))); - return EINVAL; - } - if (SCARG(uap, ti) == NULL) { - DPRINTF(("ti NULL\n")); - return EINVAL; - } - microtime(&tv); - t.h_sec = tv.tv_sec; - t.h_rem = tv.tv_usec; - t.h_res = SVR4_HRT_USEC; - return copyout(&t, SCARG(uap, ti), sizeof(t)); - } - - case SVR4_HRT_CNTL_START: - DPRINTF(("htrcntl(START)\n")); - return ENOSYS; - - case SVR4_HRT_CNTL_GET: - DPRINTF(("htrcntl(GET)\n")); - return ENOSYS; - default: - DPRINTF(("Bad htrcntl command %d\n", SCARG(uap, fun))); - return ENOSYS; - } -} - -int -svr4_sys_hrtsys(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_hrtsys_args *uap = v; - - switch (SCARG(uap, cmd)) { - case SVR4_HRT_CNTL: - return svr4_hrtcntl(p, (struct svr4_hrtcntl_args *) uap, - retval); - - case SVR4_HRT_ALRM: - DPRINTF(("hrtalarm\n")); - return ENOSYS; - - case SVR4_HRT_SLP: - DPRINTF(("hrtsleep\n")); - return ENOSYS; - - case SVR4_HRT_CAN: - DPRINTF(("hrtcancel\n")); - return ENOSYS; - - default: - DPRINTF(("Bad hrtsys command %d\n", SCARG(uap, cmd))); - return EINVAL; - } -} - -static int -svr4_setinfo(p, st, s) - struct proc *p; - int st; - svr4_siginfo_t *s; -{ - svr4_siginfo_t i; - - bzero(&i, sizeof(i)); - - i.svr4_si_signo = SVR4_SIGCHLD; - i.svr4_si_errno = 0; /* XXX? */ - - if (p) { - i.svr4_si_pid = p->p_pid; - if (p->p_stat == SZOMB) { - i.svr4_si_stime = p->p_ru->ru_stime.tv_sec; - i.svr4_si_utime = p->p_ru->ru_utime.tv_sec; - } else { - i.svr4_si_stime = p->p_stats->p_ru.ru_stime.tv_sec; - i.svr4_si_utime = p->p_stats->p_ru.ru_utime.tv_sec; - } - } - - if (WIFEXITED(st)) { - i.svr4_si_status = WEXITSTATUS(st); - i.svr4_si_code = SVR4_CLD_EXITED; - } - else if (WIFSTOPPED(st)) { - i.svr4_si_status = bsd_to_svr4_sig[WSTOPSIG(st)]; - - if (i.svr4_si_status == SVR4_SIGCONT) - i.svr4_si_code = SVR4_CLD_CONTINUED; - else - i.svr4_si_code = SVR4_CLD_STOPPED; - } else { - i.svr4_si_status = bsd_to_svr4_sig[WTERMSIG(st)]; - - if (WCOREDUMP(st)) - i.svr4_si_code = SVR4_CLD_DUMPED; - else - i.svr4_si_code = SVR4_CLD_KILLED; - } - - DPRINTF(("siginfo [pid %ld signo %d code %d errno %d status %d]\n", - i.svr4_si_pid, i.svr4_si_signo, i.svr4_si_code, - i.svr4_si_errno, i.svr4_si_status)); - - return copyout(&i, s, sizeof(i)); -} - - -int -svr4_sys_waitsys(q, v, retval) - struct proc *q; - void *v; - register_t *retval; -{ - struct svr4_sys_waitsys_args *uap = v; - int nfound; - int error; - struct process *pr; - struct proc *p; - - switch (SCARG(uap, grp)) { - case SVR4_P_PID: - break; - - case SVR4_P_PGID: - SCARG(uap, id) = -q->p_p->ps_pgid; - break; - - case SVR4_P_ALL: - SCARG(uap, id) = WAIT_ANY; - break; - - default: - return (EINVAL); - } - - DPRINTF(("waitsys(%d, %d, %p, %x)\n", SCARG(uap, grp), SCARG(uap, id), - SCARG(uap, info), SCARG(uap, options))); - -loop: - nfound = 0; - LIST_FOREACH(pr, &q->p_p->ps_children, ps_sibling) { - p = pr->ps_mainproc; - if (SCARG(uap, id) != WAIT_ANY && - p->p_pid != SCARG(uap, id) && - pr->ps_pgid != -SCARG(uap, id)) { - DPRINTF(("pid %d pgid %d != %d\n", p->p_pid, - pr->ps_pgid, SCARG(uap, id))); - continue; - } - nfound++; - if (p->p_stat == SZOMB && - ((SCARG(uap, options) & (SVR4_WEXITED|SVR4_WTRAPPED)))) { - *retval = 0; - DPRINTF(("found %d\n", p->p_pid)); - error = svr4_setinfo(p, p->p_xstat, SCARG(uap, info)); - if (error) - return (error); - - if ((SCARG(uap, options) & SVR4_WNOWAIT)) { - DPRINTF(("Don't wait\n")); - return (0); - } - proc_finish_wait(q, p); - return (0); - } - if (p->p_stat == SSTOP && (p->p_flag & P_WAITED) == 0 && - (p->p_flag & P_TRACED || - (SCARG(uap, options) & (SVR4_WSTOPPED|SVR4_WCONTINUED)))) { - DPRINTF(("jobcontrol %d\n", p->p_pid)); - if (((SCARG(uap, options) & SVR4_WNOWAIT)) == 0) - atomic_setbits_int(&p->p_flag, P_WAITED); - *retval = 0; - return (svr4_setinfo(p, W_STOPCODE(p->p_xstat), - SCARG(uap, info))); - } - } - - if (nfound == 0) - return (ECHILD); - - if (SCARG(uap, options) & SVR4_WNOHANG) { - *retval = 0; - if ((error = svr4_setinfo(NULL, 0, SCARG(uap, info))) != 0) - return (error); - return (0); - } - - if ((error = tsleep((caddr_t)q, PWAIT | PCATCH, "svr4_wait", 0)) != 0) - return (error); - goto loop; -} - -static void -bsd_statfs_to_svr4_statvfs(bfs, sfs) - const struct statfs *bfs; - struct svr4_statvfs *sfs; -{ - bzero(sfs, sizeof(*sfs)); - sfs->f_bsize = bfs->f_iosize; /* XXX */ - sfs->f_frsize = bfs->f_bsize; - sfs->f_blocks = bfs->f_blocks; - sfs->f_bfree = bfs->f_bfree; - sfs->f_bavail = bfs->f_bavail; - sfs->f_files = bfs->f_files; - sfs->f_ffree = bfs->f_ffree; - sfs->f_favail = bfs->f_ffree; - sfs->f_fsid = bfs->f_fsid.val[0]; - bcopy(bfs->f_fstypename, sfs->f_basetype, sizeof(sfs->f_basetype)); - if (bfs->f_flags & MNT_RDONLY) - sfs->f_flag |= SVR4_ST_RDONLY; - if (bfs->f_flags & MNT_NOSUID) - sfs->f_flag |= SVR4_ST_NOSUID; - sfs->f_namemax = MAXNAMLEN; - bcopy(bfs->f_fstypename, sfs->f_fstr, - MIN(sizeof(bfs->f_fstypename), sizeof(sfs->f_fstr))); -} - - -static void -bsd_statfs_to_svr4_statvfs64(bfs, sfs) - const struct statfs *bfs; - struct svr4_statvfs64 *sfs; -{ - bzero(sfs, sizeof(*sfs)); - sfs->f_bsize = bfs->f_iosize; /* XXX */ - sfs->f_frsize = bfs->f_bsize; - sfs->f_blocks = bfs->f_blocks; - sfs->f_bfree = bfs->f_bfree; - sfs->f_bavail = bfs->f_bavail; - sfs->f_files = bfs->f_files; - sfs->f_ffree = bfs->f_ffree; - sfs->f_favail = bfs->f_ffree; - sfs->f_fsid = bfs->f_fsid.val[0]; - bcopy(bfs->f_fstypename, sfs->f_basetype, sizeof(sfs->f_basetype)); - if (bfs->f_flags & MNT_RDONLY) - sfs->f_flag |= SVR4_ST_RDONLY; - if (bfs->f_flags & MNT_NOSUID) - sfs->f_flag |= SVR4_ST_NOSUID; - sfs->f_namemax = MAXNAMLEN; - bcopy(bfs->f_fstypename, sfs->f_fstr, - MIN(sizeof(bfs->f_fstypename), sizeof(sfs->f_fstr))); -} - - -int -svr4_sys_statvfs(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_statvfs_args *uap = v; - struct sys_statfs_args fs_args; - caddr_t sg = stackgap_init(p->p_emul); - struct statfs *fs = stackgap_alloc(&sg, sizeof(struct statfs)); - struct statfs bfs; - struct svr4_statvfs sfs; - int error; - - SVR4_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path)); - SCARG(&fs_args, path) = SCARG(uap, path); - SCARG(&fs_args, buf) = fs; - - if ((error = sys_statfs(p, &fs_args, retval)) != 0) - return error; - - if ((error = copyin(fs, &bfs, sizeof(bfs))) != 0) - return error; - - bsd_statfs_to_svr4_statvfs(&bfs, &sfs); - - return copyout(&sfs, SCARG(uap, fs), sizeof(sfs)); -} - - -int -svr4_sys_fstatvfs(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_fstatvfs_args *uap = v; - struct sys_fstatfs_args fs_args; - caddr_t sg = stackgap_init(p->p_emul); - struct statfs *fs = stackgap_alloc(&sg, sizeof(struct statfs)); - struct statfs bfs; - struct svr4_statvfs sfs; - int error; - - SCARG(&fs_args, fd) = SCARG(uap, fd); - SCARG(&fs_args, buf) = fs; - - if ((error = sys_fstatfs(p, &fs_args, retval)) != 0) - return error; - - if ((error = copyin(fs, &bfs, sizeof(bfs))) != 0) - return error; - - bsd_statfs_to_svr4_statvfs(&bfs, &sfs); - - return copyout(&sfs, SCARG(uap, fs), sizeof(sfs)); -} - - -int -svr4_sys_fstatvfs64(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_fstatvfs64_args *uap = v; - struct sys_fstatfs_args fs_args; - caddr_t sg = stackgap_init(p->p_emul); - struct statfs *fs = stackgap_alloc(&sg, sizeof(struct statfs)); - struct statfs bfs; - struct svr4_statvfs64 sfs; - int error; - - SCARG(&fs_args, fd) = SCARG(uap, fd); - SCARG(&fs_args, buf) = fs; - - if ((error = sys_fstatfs(p, &fs_args, retval)) != 0) - return error; - - if ((error = copyin(fs, &bfs, sizeof(bfs))) != 0) - return error; - - bsd_statfs_to_svr4_statvfs64(&bfs, &sfs); - - return copyout(&sfs, SCARG(uap, fs), sizeof(sfs)); -} - - -int -svr4_sys_alarm(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_alarm_args *uap = v; - int error; - struct itimerval *ntp, *otp, tp; - struct sys_setitimer_args sa; - caddr_t sg = stackgap_init(p->p_emul); - - ntp = stackgap_alloc(&sg, sizeof(struct itimerval)); - otp = stackgap_alloc(&sg, sizeof(struct itimerval)); - - timerclear(&tp.it_interval); - tp.it_value.tv_sec = SCARG(uap, sec); - tp.it_value.tv_usec = 0; - - if ((error = copyout(&tp, ntp, sizeof(tp))) != 0) - return error; - - SCARG(&sa, which) = ITIMER_REAL; - SCARG(&sa, itv) = ntp; - SCARG(&sa, oitv) = otp; - - if ((error = sys_setitimer(p, &sa, retval)) != 0) - return error; - - if ((error = copyin(otp, &tp, sizeof(tp))) != 0) - return error; - - if (tp.it_value.tv_usec) - tp.it_value.tv_sec++; - - *retval = (register_t) tp.it_value.tv_sec; - - return 0; -} - - -int -svr4_sys_gettimeofday(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_gettimeofday_args *uap = v; - - if (SCARG(uap, tp)) { - struct timeval atv; - - microtime(&atv); - return copyout(&atv, SCARG(uap, tp), sizeof (atv)); - } - - return 0; -} - -int -svr4_sys_facl(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_facl_args *uap = v; - - *retval = 0; - - switch (SCARG(uap, cmd)) { - case SVR4_SYS_SETACL: - /* We don't support acls on any filesystem */ - return ENOSYS; - - case SVR4_SYS_GETACL: - return copyout(retval, &SCARG(uap, num), - sizeof(SCARG(uap, num))); - - case SVR4_SYS_GETACLCNT: - return 0; - - default: - return EINVAL; - } -} - -int -svr4_sys_acl(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - return svr4_sys_facl(p, v, retval); /* XXX: for now the same */ -} - -int -svr4_sys_auditsys(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - /* - * XXX: Big brother is *not* watching. - */ - return 0; -} - -int -svr4_sys_memcntl(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_memcntl_args *uap = v; - struct sys_mprotect_args ap; - - SCARG(&ap, addr) = SCARG(uap, addr); - SCARG(&ap, len) = SCARG(uap, len); - SCARG(&ap, prot) = SCARG(uap, attr); - - /* XXX: no locking, invalidating, or syncing supported */ - return sys_mprotect(p, &ap, retval); -} - -int -svr4_sys_nice(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_nice_args *uap = v; - struct sys_setpriority_args ap; - int error; - - SCARG(&ap, which) = PRIO_PROCESS; - SCARG(&ap, who) = 0; - SCARG(&ap, prio) = SCARG(uap, prio); - - if ((error = sys_setpriority(p, &ap, retval)) != 0) - return error; - - if ((error = sys_getpriority(p, &ap, retval)) != 0) - return error; - - return 0; -} - -/* ARGSUSED */ -int -svr4_sys_setegid(p, v, retval) - struct proc *p; - void *v; - register_t *retval; -{ - struct sys_setegid_args /* { - syscallarg(gid_t) egid; - } */ *uap = v; - -#if defined(COMPAT_LINUX) && defined(__i386__) - if (SCARG(uap, egid) > 60000) { - /* - * One great fuckup deserves another. The Linux people - * made this their personality system call. But we can't - * tell if a binary is SVR4 or Linux until they do that - * system call, in some cases. So when we get it, and the - * value is out of some magical range, switch to Linux - * emulation and pray. - */ - extern struct emul emul_linux_elf; - - p->p_emul = &emul_linux_elf; - p->p_os = OOS_LINUX; -#ifdef KTRACE - if (KTRPOINT(p, KTR_EMUL)) - ktremul(p, p->p_emul->e_name); -#endif - return (0); - } -#else - (void)uap; -#endif - return (sys_setegid(p, v, retval)); -} - -int -svr4_sys_rdebug(p, v, retval) - struct proc *p; - void *v; - register_t *retval; -{ -#ifdef COMPAT_SVR4_NCR - return (ENXIO); -#else - return (p->p_os == OOS_NCR ? ENXIO : sys_nosys(p, v, retval)); -#endif -} diff --git a/sys/compat/svr4/svr4_net.c b/sys/compat/svr4/svr4_net.c deleted file mode 100644 index 5a7e45cf2db..00000000000 --- a/sys/compat/svr4/svr4_net.c +++ /dev/null @@ -1,229 +0,0 @@ -/* $OpenBSD: svr4_net.c,v 1.17 2005/11/21 18:16:38 millert Exp $ */ -/* $NetBSD: svr4_net.c,v 1.12 1996/09/07 12:40:51 mycroft Exp $ */ - -/* - * Copyright (c) 1994 Christos Zoulas - * All rights reserved. - * - * Redistribution ast use in source ast binary forms, with or without - * modification, are permitted provided that the following costitions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of costitions ast the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of costitions ast the following disclaimer in the - * documentation ast/or other materials provided with the distribution. - * 3. The name of the author may not be used to estorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * Emulate /dev/{udp,tcp,...} - */ - -#include <sys/param.h> -#include <sys/kernel.h> -#include <sys/systm.h> -#include <sys/buf.h> -#include <sys/malloc.h> -#include <sys/ioctl.h> -#include <sys/tty.h> -#include <sys/file.h> -#include <sys/filedesc.h> -#include <sys/selinfo.h> -#include <sys/socket.h> -#include <sys/socketvar.h> -#include <sys/protosw.h> -#include <sys/domain.h> -#include <net/if.h> -#include <netinet/in.h> -#include <sys/proc.h> -#include <sys/vnode.h> -#include <sys/device.h> -#include <sys/conf.h> - - -#include <compat/svr4/svr4_types.h> -#include <compat/svr4/svr4_util.h> -#include <compat/svr4/svr4_signal.h> -#include <compat/svr4/svr4_syscallargs.h> -#include <compat/svr4/svr4_ioctl.h> -#include <compat/svr4/svr4_stropts.h> -#include <compat/svr4/svr4_socket.h> - -/* - * Device minor numbers - */ -enum { - dev_arp = 26, - dev_icmp = 27, - dev_ip = 28, - dev_tcp = 35, - dev_udp = 36, - dev_rawip = 37, - dev_unix_dgram = 38, - dev_unix_stream = 39, - dev_unix_ord_stream = 40 -}; - -int svr4_netattach(int); - -static int svr4_soo_close(struct file *fp, struct proc *p); - -static struct fileops svr4_netops = { - soo_read, soo_write, soo_ioctl, soo_poll, soo_kqfilter, - soo_stat, svr4_soo_close -}; - - -/* - * Used by new config, but we don't need it. - */ -int -svr4_netattach(n) - int n; -{ - return 0; -} - - -int -svr4_netopen(dev, flag, mode, p) - dev_t dev; - int flag; - int mode; - struct proc *p; -{ - int type, protocol; - int fd; - struct file *fp; - struct socket *so; - int error; - int family; - - DPRINTF(("netopen(")); - - if (p->p_dupfd >= 0) - return ENODEV; - - switch (minor(dev)) { - case dev_udp: - family = AF_INET; - type = SOCK_DGRAM; - protocol = IPPROTO_UDP; - DPRINTF(("udp, ")); - break; - - case dev_tcp: - family = AF_INET; - type = SOCK_STREAM; - protocol = IPPROTO_TCP; - DPRINTF(("tcp, ")); - break; - - case dev_ip: - case dev_rawip: - family = AF_INET; - type = SOCK_RAW; - protocol = IPPROTO_IP; - DPRINTF(("ip, ")); - break; - - case dev_icmp: - family = AF_INET; - type = SOCK_RAW; - protocol = IPPROTO_ICMP; - DPRINTF(("icmp, ")); - break; - - case dev_unix_dgram: - family = AF_UNIX; - type = SOCK_DGRAM; - protocol = 0; - DPRINTF(("unix-dgram, ")); - break; - - case dev_unix_stream: - case dev_unix_ord_stream: - family = AF_UNIX; - type = SOCK_STREAM; - protocol = 0; - DPRINTF(("unix-stream, ")); - break; - - default: - DPRINTF(("%d);\n", minor(dev))); - return EOPNOTSUPP; - } - - if ((error = falloc(p, &fp, &fd)) != 0) - return (error); - - if ((error = socreate(family, &so, type, protocol)) != 0) { - DPRINTF(("socreate error %d\n", error)); - fdremove(p->p_fd, fd); - closef(fp, p); - return error; - } - - fp->f_flag = FREAD|FWRITE; - fp->f_type = DTYPE_SOCKET; - fp->f_ops = &svr4_netops; - - fp->f_data = (caddr_t)so; - (void) svr4_stream_get(fp); - - DPRINTF(("ok);\n")); - - p->p_dupfd = fd; - FILE_SET_MATURE(fp); - return ENXIO; -} - -static int -svr4_soo_close(fp, p) - struct file *fp; - struct proc *p; -{ - struct socket *so = (struct socket *) fp->f_data; - svr4_delete_socket(p, fp); - free(so->so_internal, M_NETADDR); - return soo_close(fp, p); -} - -struct svr4_strm * -svr4_stream_get(fp) - struct file *fp; -{ - struct socket *so; - struct svr4_strm *st; - - if (fp == NULL || fp->f_type != DTYPE_SOCKET) - return NULL; - - so = (struct socket *) fp->f_data; - - if (so->so_internal) - return so->so_internal; - - /* Allocate a new one. */ - fp->f_ops = &svr4_netops; - st = malloc(sizeof(struct svr4_strm), M_NETADDR, M_WAITOK); - st->s_family = so->so_proto->pr_domain->dom_family; - st->s_cmd = ~0; - st->s_afd = -1; - so->so_internal = st; - - return st; -} diff --git a/sys/compat/svr4/svr4_siginfo.h b/sys/compat/svr4/svr4_siginfo.h deleted file mode 100644 index 1852beea845..00000000000 --- a/sys/compat/svr4/svr4_siginfo.h +++ /dev/null @@ -1,111 +0,0 @@ -/* $OpenBSD: svr4_siginfo.h,v 1.3 1997/01/27 01:16:52 deraadt Exp $ */ -/* $NetBSD: svr4_siginfo.h,v 1.2 1995/07/04 19:47:05 christos Exp $ */ - -/* - * Copyright (c) 1994 Christos Zoulas - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _SVR4_SIGINFO_H_ -#define _SVR4_SIGINFO_H_ - -#define SVR4_ILL_ILLOPC 1 -#define SVR4_ILL_ILLOPN 2 -#define SVR4_ILL_ILLADR 3 -#define SVR4_ILL_ILLTRP 4 -#define SVR4_ILL_PRVOPC 5 -#define SVR4_ILL_PRVREG 6 -#define SVR4_ILL_COPROC 7 -#define SVR4_ILL_BADSTK 8 - -#define SVR4_FPE_INTDIV 1 -#define SVR4_FPE_INTOVF 2 -#define SVR4_FPE_FLTDIV 3 -#define SVR4_FPE_FLTOVF 4 -#define SVR4_FPE_FLTUND 5 -#define SVR4_FPE_FLTRES 6 -#define SVR4_FPE_FLTINV 7 -#define SVR4_FPE_FLTSUB 8 - -#define SVR4_SEGV_MAPERR 1 -#define SVR4_SEGV_ACCERR 2 - -#define SVR4_BUS_ADRALN 1 -#define SVR4_BUS_ADRERR 2 -#define SVR4_BUS_OBJERR 3 - -#define SVR4_TRAP_BRKPT 1 -#define SVR4_TRAP_TRACE 2 - -#define SVR4_POLL_IN 1 -#define SVR4_POLL_OUT 2 -#define SVR4_POLL_MSG 3 -#define SVR4_POLL_ERR 4 -#define SVR4_POLL_PRI 5 - -#define SVR4_CLD_EXITED 1 -#define SVR4_CLD_KILLED 2 -#define SVR4_CLD_DUMPED 3 -#define SVR4_CLD_TRAPPED 4 -#define SVR4_CLD_STOPPED 5 -#define SVR4_CLD_CONTINUED 6 - -#define SVR4_EMT_TAGOVF 1 - -typedef union svr4_siginfo { - char si_pad[128]; /* Total size; for future expansion */ - struct { - int _signo; - int _code; - int _errno; - union { - struct { - svr4_pid_t _pid; - svr4_clock_t _utime; - int _status; - svr4_clock_t _stime; - } _child; - - struct { - caddr_t _addr; - int _trap; - } _fault; - } _reason; - } _info; -} svr4_siginfo_t; - -#define svr4_si_signo _info._signo -#define svr4_si_code _info._code -#define svr4_si_errno _info._errno - -#define svr4_si_pid _info._reason._child._pid -#define svr4_si_stime _info._reason._child._stime -#define svr4_si_status _info._reason._child._status -#define svr4_si_utime _info._reason._child._utime - -#define svr4_si_addr _info._reason._fault._addr -#define svr4_si_trap _info._reason._fault._trap - -#endif /* !_SVR4_SIGINFO_H_ */ diff --git a/sys/compat/svr4/svr4_signal.c b/sys/compat/svr4/svr4_signal.c deleted file mode 100644 index b66f912912e..00000000000 --- a/sys/compat/svr4/svr4_signal.c +++ /dev/null @@ -1,680 +0,0 @@ -/* $OpenBSD: svr4_signal.c,v 1.14 2011/04/18 21:44:56 guenther Exp $ */ -/* $NetBSD: svr4_signal.c,v 1.24 1996/12/06 03:21:53 christos Exp $ */ - -/* - * Copyright (c) 1994 Christos Zoulas - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/namei.h> -#include <sys/proc.h> -#include <sys/filedesc.h> -#include <sys/ioctl.h> -#include <sys/mount.h> -#include <sys/kernel.h> -#include <sys/signal.h> -#include <sys/signalvar.h> -#include <sys/malloc.h> - -#include <sys/syscallargs.h> - -#include <compat/svr4/svr4_types.h> -#include <compat/svr4/svr4_signal.h> -#include <compat/svr4/svr4_syscallargs.h> -#include <compat/svr4/svr4_util.h> -#include <compat/svr4/svr4_ucontext.h> - -#define sigemptyset(s) bzero((s), sizeof(*(s))) -#define sigismember(s, n) (*(s) & sigmask(n)) -#define sigaddset(s, n) (*(s) |= sigmask(n)) - -#define svr4_sigmask(n) (1 << (((n) - 1) & (32 - 1))) -#define svr4_sigword(n) (((n) - 1) >> 5) -#define svr4_sigemptyset(s) bzero((s), sizeof(*(s))) -#define svr4_sigismember(s, n) ((s)->bits[svr4_sigword(n)] & svr4_sigmask(n)) -#define svr4_sigaddset(s, n) ((s)->bits[svr4_sigword(n)] |= svr4_sigmask(n)) - -static __inline void svr4_sigfillset(svr4_sigset_t *); -void svr4_to_bsd_sigaction(const struct svr4_sigaction *, - struct sigaction *); -void bsd_to_svr4_sigaction(const struct sigaction *, - struct svr4_sigaction *); - -static __inline void -svr4_sigfillset(s) - svr4_sigset_t *s; -{ - int i; - - svr4_sigemptyset(s); - for (i = 1; i < SVR4_NSIG; i++) - svr4_sigaddset(s, i); -} - -int bsd_to_svr4_sig[NSIG] = { - 0, - SVR4_SIGHUP, - SVR4_SIGINT, - SVR4_SIGQUIT, - SVR4_SIGILL, - SVR4_SIGTRAP, - SVR4_SIGABRT, - SVR4_SIGEMT, - SVR4_SIGFPE, - SVR4_SIGKILL, - SVR4_SIGBUS, - SVR4_SIGSEGV, - SVR4_SIGSYS, - SVR4_SIGPIPE, - SVR4_SIGALRM, - SVR4_SIGTERM, - SVR4_SIGURG, - SVR4_SIGSTOP, - SVR4_SIGTSTP, - SVR4_SIGCONT, - SVR4_SIGCHLD, - SVR4_SIGTTIN, - SVR4_SIGTTOU, - SVR4_SIGIO, - SVR4_SIGXCPU, - SVR4_SIGXFSZ, - SVR4_SIGVTALRM, - SVR4_SIGPROF, - SVR4_SIGWINCH, - 0, - SVR4_SIGUSR1, - SVR4_SIGUSR2, - 0 -}; - -int svr4_to_bsd_sig[] = { - 0, - SIGHUP, - SIGINT, - SIGQUIT, - SIGILL, - SIGTRAP, - SIGABRT, - SIGEMT, - SIGFPE, - SIGKILL, - SIGBUS, - SIGSEGV, - SIGSYS, - SIGPIPE, - SIGALRM, - SIGTERM, - SIGUSR1, - SIGUSR2, - SIGCHLD, - 0, - SIGWINCH, - SIGURG, - SIGIO, - SIGSTOP, - SIGTSTP, - SIGCONT, - SIGTTIN, - SIGTTOU, - SIGVTALRM, - SIGPROF, - SIGXCPU, - SIGXFSZ, -}; - -void -svr4_to_bsd_sigset(sss, bss) - const svr4_sigset_t *sss; - sigset_t *bss; -{ - int i, newsig; - - sigemptyset(bss); - for (i = 1; i < SVR4_NSIG; i++) { - if (svr4_sigismember(sss, i)) { - newsig = svr4_to_bsd_sig[i]; - if (newsig) - sigaddset(bss, newsig); - } - } -} - - -void -bsd_to_svr4_sigset(bss, sss) - const sigset_t *bss; - svr4_sigset_t *sss; -{ - int i, newsig; - - svr4_sigemptyset(sss); - for (i = 1; i < NSIG; i++) { - if (sigismember(bss, i)) { - newsig = bsd_to_svr4_sig[i]; - if (newsig) - svr4_sigaddset(sss, newsig); - } - } -} - -/* - * XXX: Only a subset of the flags is currently implemented. - */ -void -svr4_to_bsd_sigaction(ssa, bsa) - const struct svr4_sigaction *ssa; - struct sigaction *bsa; -{ - - bsa->sa_handler = (sig_t) ssa->sa__handler; - svr4_to_bsd_sigset(&ssa->sa_mask, &bsa->sa_mask); - bsa->sa_flags = 0; - if ((ssa->sa_flags & SVR4_SA_ONSTACK) != 0) - bsa->sa_flags |= SA_ONSTACK; - if ((ssa->sa_flags & SVR4_SA_RESTART) != 0) - bsa->sa_flags |= SA_RESTART; - if ((ssa->sa_flags & SVR4_SA_RESETHAND) != 0) - bsa->sa_flags |= SA_RESETHAND; - if ((ssa->sa_flags & SVR4_SA_NOCLDSTOP) != 0) - bsa->sa_flags |= SA_NOCLDSTOP; - if ((ssa->sa_flags & SVR4_SA_NOCLDWAIT) != 0) - bsa->sa_flags |= SA_NOCLDWAIT; - if ((ssa->sa_flags & SVR4_SA_NODEFER) != 0) - bsa->sa_flags |= SA_NODEFER; - if ((ssa->sa_flags & SVR4_SA_SIGINFO) != 0) - bsa->sa_flags |= SA_SIGINFO; -} - -void -bsd_to_svr4_sigaction(bsa, ssa) - const struct sigaction *bsa; - struct svr4_sigaction *ssa; -{ - - ssa->sa__handler = (svr4_sig_t) bsa->sa_handler; - bsd_to_svr4_sigset(&bsa->sa_mask, &ssa->sa_mask); - ssa->sa_flags = 0; - if ((bsa->sa_flags & SA_ONSTACK) != 0) - ssa->sa_flags |= SVR4_SA_ONSTACK; - if ((bsa->sa_flags & SA_RESETHAND) != 0) - ssa->sa_flags |= SVR4_SA_RESETHAND; - if ((bsa->sa_flags & SA_RESTART) != 0) - ssa->sa_flags |= SVR4_SA_RESTART; - if ((bsa->sa_flags & SA_NODEFER) != 0) - ssa->sa_flags |= SVR4_SA_NODEFER; - if ((bsa->sa_flags & SA_NOCLDSTOP) != 0) - ssa->sa_flags |= SVR4_SA_NOCLDSTOP; - if ((bsa->sa_flags & SA_NOCLDWAIT) != 0) - ssa->sa_flags |= SVR4_SA_NOCLDWAIT; - if ((bsa->sa_flags & SA_SIGINFO) != 0) - ssa->sa_flags |= SVR4_SA_SIGINFO; -} - -void -svr4_to_bsd_sigaltstack(sss, bss) - const struct svr4_sigaltstack *sss; - struct sigaltstack *bss; -{ - - bss->ss_sp = sss->ss_sp; - bss->ss_size = sss->ss_size; - bss->ss_flags = 0; - - if ((sss->ss_flags & SVR4_SS_DISABLE) != 0) - bss->ss_flags |= SS_DISABLE; - if ((sss->ss_flags & SVR4_SS_ONSTACK) != 0) - bss->ss_flags |= SS_ONSTACK; -} - -void -bsd_to_svr4_sigaltstack(bss, sss) - const struct sigaltstack *bss; - struct svr4_sigaltstack *sss; -{ - - sss->ss_sp = bss->ss_sp; - sss->ss_size = bss->ss_size; - sss->ss_flags = 0; - - if ((bss->ss_flags & SS_DISABLE) != 0) - sss->ss_flags |= SVR4_SS_DISABLE; - if ((bss->ss_flags & SS_ONSTACK) != 0) - sss->ss_flags |= SVR4_SS_ONSTACK; -} - -int -svr4_sys_sigaction(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_sigaction_args /* { - syscallarg(int) signum; - syscallarg(struct svr4_sigaction *) nsa; - syscallarg(struct svr4_sigaction *) osa; - } */ *uap = v; - struct svr4_sigaction *nssa, *ossa, tmpssa; - struct sigaction *nbsa, *obsa, tmpbsa; - struct sys_sigaction_args sa; - caddr_t sg; - int error; - - if (SCARG(uap, signum) < 0 || SCARG(uap, signum) >= SVR4_NSIG) - return (EINVAL); - - sg = stackgap_init(p->p_emul); - nssa = SCARG(uap, nsa); - ossa = SCARG(uap, osa); - - if (ossa != NULL) - obsa = stackgap_alloc(&sg, sizeof(struct sigaction)); - else - obsa = NULL; - - if (nssa != NULL) { - nbsa = stackgap_alloc(&sg, sizeof(struct sigaction)); - if ((error = copyin(nssa, &tmpssa, sizeof(tmpssa))) != 0) - return error; - svr4_to_bsd_sigaction(&tmpssa, &tmpbsa); - if ((error = copyout(&tmpbsa, nbsa, sizeof(tmpbsa))) != 0) - return error; - } else - nbsa = NULL; - - SCARG(&sa, signum) = svr4_to_bsd_sig[SCARG(uap, signum)]; - SCARG(&sa, nsa) = nbsa; - SCARG(&sa, osa) = obsa; - - if ((error = sys_sigaction(p, &sa, retval)) != 0) - return error; - - if (ossa != NULL) { - if ((error = copyin(obsa, &tmpbsa, sizeof(tmpbsa))) != 0) - return error; - bsd_to_svr4_sigaction(&tmpbsa, &tmpssa); - if ((error = copyout(&tmpssa, ossa, sizeof(tmpssa))) != 0) - return error; - } - - return 0; -} - -int -svr4_sys_sigaltstack(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_sigaltstack_args /* { - syscallarg(struct svr4_sigaltstack *) nss; - syscallarg(struct svr4_sigaltstack *) oss; - } */ *uap = v; - struct svr4_sigaltstack *nsss, *osss, tmpsss; - struct sigaltstack *nbss, *obss, tmpbss; - struct sys_sigaltstack_args sa; - caddr_t sg; - int error; - - sg = stackgap_init(p->p_emul); - nsss = SCARG(uap, nss); - osss = SCARG(uap, oss); - - if (osss != NULL) - obss = stackgap_alloc(&sg, sizeof(struct sigaltstack)); - else - obss = NULL; - - if (nsss != NULL) { - nbss = stackgap_alloc(&sg, sizeof(struct sigaltstack)); - if ((error = copyin(nsss, &tmpsss, sizeof(tmpsss))) != 0) - return error; - svr4_to_bsd_sigaltstack(&tmpsss, &tmpbss); - if ((error = copyout(&tmpbss, nbss, sizeof(tmpbss))) != 0) - return error; - } else - nbss = NULL; - - SCARG(&sa, nss) = nbss; - SCARG(&sa, oss) = obss; - - if ((error = sys_sigaltstack(p, &sa, retval)) != 0) - return error; - - if (obss != NULL) { - if ((error = copyin(obss, &tmpbss, sizeof(tmpbss))) != 0) - return error; - bsd_to_svr4_sigaltstack(&tmpbss, &tmpsss); - if ((error = copyout(&tmpsss, osss, sizeof(tmpsss))) != 0) - return error; - } - - return 0; -} - -/* - * Stolen from the ibcs2 one - */ -int -svr4_sys_signal(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_signal_args /* { - syscallarg(int) signum; - syscallarg(svr4_sig_t) handler; - } */ *uap = v; - int signum, error; - caddr_t sg = stackgap_init(p->p_emul); - - signum = SVR4_SIGNO(SCARG(uap, signum)); - if (signum < 0 || signum >= SVR4_NSIG) { - if (SVR4_SIGCALL(SCARG(uap, signum)) == SVR4_SIGNAL_MASK || - SVR4_SIGCALL(SCARG(uap, signum)) == SVR4_SIGDEFER_MASK) - *retval = (int)SVR4_SIG_ERR; - return EINVAL; - } - signum = svr4_to_bsd_sig[signum]; - - switch (SVR4_SIGCALL(SCARG(uap, signum))) { - case SVR4_SIGDEFER_MASK: - /* - * sigset is identical to signal() except - * that SIG_HOLD is allowed as - * an action. - */ - if (SCARG(uap, handler) == SVR4_SIG_HOLD) { - struct sys_sigprocmask_args sa; - - SCARG(&sa, how) = SIG_BLOCK; - SCARG(&sa, mask) = sigmask(signum); - return sys_sigprocmask(p, &sa, retval); - } - /* FALLTHROUGH */ - - case SVR4_SIGNAL_MASK: - { - struct sys_sigaction_args sa_args; - struct sigaction *nbsa, *obsa, sa; - - nbsa = stackgap_alloc(&sg, sizeof(struct sigaction)); - obsa = stackgap_alloc(&sg, sizeof(struct sigaction)); - SCARG(&sa_args, signum) = signum; - SCARG(&sa_args, nsa) = nbsa; - SCARG(&sa_args, osa) = obsa; - - sa.sa_handler = (sig_t) SCARG(uap, handler); - sigemptyset(&sa.sa_mask); - sa.sa_flags = 0; -#if 0 - if (signum != SIGALRM) - sa.sa_flags = SA_RESTART; -#endif - if ((error = copyout(&sa, nbsa, sizeof(sa))) != 0) - return error; - if ((error = sys_sigaction(p, &sa_args, retval)) != 0) { - DPRINTF(("signal: sigaction failed: %d\n", - error)); - *retval = (int)SVR4_SIG_ERR; - return error; - } - if ((error = copyin(obsa, &sa, sizeof(sa))) != 0) - return error; - *retval = (int)sa.sa_handler; - return 0; - } - - case SVR4_SIGHOLD_MASK: - { - struct sys_sigprocmask_args sa; - - SCARG(&sa, how) = SIG_BLOCK; - SCARG(&sa, mask) = sigmask(signum); - return sys_sigprocmask(p, &sa, retval); - } - - case SVR4_SIGRELSE_MASK: - { - struct sys_sigprocmask_args sa; - - SCARG(&sa, how) = SIG_UNBLOCK; - SCARG(&sa, mask) = sigmask(signum); - return sys_sigprocmask(p, &sa, retval); - } - - case SVR4_SIGIGNORE_MASK: - { - struct sys_sigaction_args sa_args; - struct sigaction *bsa, sa; - - bsa = stackgap_alloc(&sg, sizeof(struct sigaction)); - SCARG(&sa_args, signum) = signum; - SCARG(&sa_args, nsa) = bsa; - SCARG(&sa_args, osa) = NULL; - - sa.sa_handler = SIG_IGN; - sigemptyset(&sa.sa_mask); - sa.sa_flags = 0; - if ((error = copyout(&sa, bsa, sizeof(sa))) != 0) - return error; - if ((error = sys_sigaction(p, &sa_args, retval)) != 0) { - DPRINTF(("sigignore: sigaction failed\n")); - return error; - } - return 0; - } - - case SVR4_SIGPAUSE_MASK: - { - struct sys_sigsuspend_args sa; - - SCARG(&sa, mask) = p->p_sigmask & ~sigmask(signum); - return sys_sigsuspend(p, &sa, retval); - } - - default: - return ENOSYS; - } -} - -int -svr4_sys_sigprocmask(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_sigprocmask_args /* { - syscallarg(int) how; - syscallarg(svr4_sigset_t *) set; - syscallarg(svr4_sigset_t *) oset; - } */ *uap = v; - svr4_sigset_t sss; - sigset_t bss; - int error = 0; - int s; - - if (SCARG(uap, oset) != NULL) { - /* Fix the return value first if needed */ - bsd_to_svr4_sigset(&p->p_sigmask, &sss); - if ((error = copyout(&sss, SCARG(uap, oset), sizeof(sss))) != 0) - return error; - } - - if (SCARG(uap, set) == NULL) - /* Just examine */ - return 0; - - if ((error = copyin(SCARG(uap, set), &sss, sizeof(sss))) != 0) - return error; - - svr4_to_bsd_sigset(&sss, &bss); - - s = splhigh(); - - switch (SCARG(uap, how)) { - case SVR4_SIG_BLOCK: - p->p_sigmask |= bss & ~sigcantmask; - break; - - case SVR4_SIG_UNBLOCK: - p->p_sigmask &= ~bss; - break; - - case SVR4_SIG_SETMASK: - p->p_sigmask = bss & ~sigcantmask; - break; - - default: - error = EINVAL; - break; - } - - splx(s); - - return error; -} - -int -svr4_sys_sigpending(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_sigpending_args /* { - syscallarg(int) what; - syscallarg(svr4_sigset_t *) mask; - } */ *uap = v; - sigset_t bss; - svr4_sigset_t sss; - - switch (SCARG(uap, what)) { - case 1: /* sigpending */ - if (SCARG(uap, mask) == NULL) - return 0; - bss = p->p_siglist & p->p_sigmask; - bsd_to_svr4_sigset(&bss, &sss); - break; - - case 2: /* sigfillset */ - svr4_sigfillset(&sss); - break; - - default: - return EINVAL; - } - - return copyout(&sss, SCARG(uap, mask), sizeof(sss)); -} - -int -svr4_sys_sigsuspend(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_sigsuspend_args /* { - syscallarg(svr4_sigset_t *) ss; - } */ *uap = v; - svr4_sigset_t sss; - sigset_t bss; - struct sys_sigsuspend_args sa; - int error; - - if ((error = copyin(SCARG(uap, ss), &sss, sizeof(sss))) != 0) - return error; - - svr4_to_bsd_sigset(&sss, &bss); - - SCARG(&sa, mask) = bss; - return sys_sigsuspend(p, &sa, retval); -} - -int -svr4_sys_kill(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_kill_args /* { - syscallarg(int) pid; - syscallarg(int) signum; - } */ *uap = v; - struct sys_kill_args ka; - - if (SCARG(uap, signum) < 0 || SCARG(uap, signum) >= SVR4_NSIG) - return (EINVAL); - SCARG(&ka, pid) = SCARG(uap, pid); - SCARG(&ka, signum) = svr4_to_bsd_sig[SCARG(uap, signum)]; - return sys_kill(p, &ka, retval); -} - -int -svr4_sys_context(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_context_args /* { - syscallarg(int) func; - syscallarg(struct svr4_ucontext *) uc; - } */ *uap = v; - struct svr4_ucontext uc; - int error; - *retval = 0; - - switch (SCARG(uap, func)) { - case 0: - DPRINTF(("getcontext(%p)\n", SCARG(uap, uc))); - svr4_getcontext(p, &uc, p->p_sigmask, - p->p_sigacts->ps_sigstk.ss_flags & SS_ONSTACK); - return copyout(&uc, SCARG(uap, uc), sizeof(uc)); - - case 1: - DPRINTF(("setcontext(%p)\n", SCARG(uap, uc))); - if ((error = copyin(SCARG(uap, uc), &uc, sizeof(uc))) != 0) - return error; - return svr4_setcontext(p, &uc); - - default: - DPRINTF(("context(%d, %p)\n", SCARG(uap, func), - SCARG(uap, uc))); - return ENOSYS; - } - return 0; -} - -int -svr4_sys_pause(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct sys_sigsuspend_args bsa; - - SCARG(&bsa, mask) = p->p_sigmask; - return sys_sigsuspend(p, &bsa, retval); -} diff --git a/sys/compat/svr4/svr4_signal.h b/sys/compat/svr4/svr4_signal.h deleted file mode 100644 index 411138ce897..00000000000 --- a/sys/compat/svr4/svr4_signal.h +++ /dev/null @@ -1,129 +0,0 @@ -/* $OpenBSD: svr4_signal.h,v 1.5 2002/03/14 01:26:51 millert Exp $ */ -/* $NetBSD: svr4_signal.h,v 1.14 1995/10/14 20:24:41 christos Exp $ */ - -/* - * Copyright (c) 1994 Christos Zoulas - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _SVR4_SIGNAL_H_ -#define _SVR4_SIGNAL_H_ - -#include <compat/svr4/svr4_siginfo.h> - -#define SVR4_SIGHUP 1 -#define SVR4_SIGINT 2 -#define SVR4_SIGQUIT 3 -#define SVR4_SIGILL 4 -#define SVR4_SIGTRAP 5 -#define SVR4_SIGIOT 6 -#define SVR4_SIGABRT 6 -#define SVR4_SIGEMT 7 -#define SVR4_SIGFPE 8 -#define SVR4_SIGKILL 9 -#define SVR4_SIGBUS 10 -#define SVR4_SIGSEGV 11 -#define SVR4_SIGSYS 12 -#define SVR4_SIGPIPE 13 -#define SVR4_SIGALRM 14 -#define SVR4_SIGTERM 15 -#define SVR4_SIGUSR1 16 -#define SVR4_SIGUSR2 17 -#define SVR4_SIGCLD 18 -#define SVR4_SIGCHLD 18 -#define SVR4_SIGPWR 19 -#define SVR4_SIGWINCH 20 -#define SVR4_SIGURG 21 -#define SVR4_SIGPOLL 22 -#define SVR4_SIGIO 22 -#define SVR4_SIGSTOP 23 -#define SVR4_SIGTSTP 24 -#define SVR4_SIGCONT 25 -#define SVR4_SIGTTIN 26 -#define SVR4_SIGTTOU 27 -#define SVR4_SIGVTALRM 28 -#define SVR4_SIGPROF 29 -#define SVR4_SIGXCPU 30 -#define SVR4_SIGXFSZ 31 -#define SVR4_NSIG 32 - -#define SVR4_SIGNO_MASK 0x00FF -#define SVR4_SIGNAL_MASK 0x0000 -#define SVR4_SIGDEFER_MASK 0x0100 -#define SVR4_SIGHOLD_MASK 0x0200 -#define SVR4_SIGRELSE_MASK 0x0400 -#define SVR4_SIGIGNORE_MASK 0x0800 -#define SVR4_SIGPAUSE_MASK 0x1000 - -typedef void (*svr4_sig_t)(int, svr4_siginfo_t *, void *); -#define SVR4_SIG_DFL (svr4_sig_t) 0 -#define SVR4_SIG_ERR (svr4_sig_t) -1 -#define SVR4_SIG_IGN (svr4_sig_t) 1 -#define SVR4_SIG_HOLD (svr4_sig_t) 2 - -#define SVR4_SIGNO(a) ((a) & SVR4_SIGNO_MASK) -#define SVR4_SIGCALL(a) ((a) & ~SVR4_SIGNO_MASK) - -#define SVR4_SIG_BLOCK 1 -#define SVR4_SIG_UNBLOCK 2 -#define SVR4_SIG_SETMASK 3 - -typedef struct { - u_long bits[4]; -} svr4_sigset_t; - -struct svr4_sigaction { - int sa_flags; - svr4_sig_t sa__handler; - svr4_sigset_t sa_mask; - int sa_reserved[2]; -}; - -struct svr4_sigaltstack { - char *ss_sp; - int ss_size; - int ss_flags; -}; - -/* sa_flags */ -#define SVR4_SA_ONSTACK 0x00000001 -#define SVR4_SA_RESETHAND 0x00000002 -#define SVR4_SA_RESTART 0x00000004 -#define SVR4_SA_SIGINFO 0x00000008 -#define SVR4_SA_NODEFER 0x00000010 -#define SVR4_SA_NOCLDWAIT 0x00010000 /* No zombies */ -#define SVR4_SA_NOCLDSTOP 0x00020000 /* No jcl */ - -/* ss_flags */ -#define SVR4_SS_ONSTACK 0x00000001 -#define SVR4_SS_DISABLE 0x00000002 - -extern int bsd_to_svr4_sig[]; -void bsd_to_svr4_sigaltstack(const struct sigaltstack *, struct svr4_sigaltstack *); -void bsd_to_svr4_sigset(const sigset_t *, svr4_sigset_t *); -void svr4_to_bsd_sigaltstack(const struct svr4_sigaltstack *, struct sigaltstack *); -void svr4_to_bsd_sigset(const svr4_sigset_t *, sigset_t *); - -#endif /* !_SVR4_SIGNAL_H_ */ diff --git a/sys/compat/svr4/svr4_socket.c b/sys/compat/svr4/svr4_socket.c deleted file mode 100644 index fab78137b58..00000000000 --- a/sys/compat/svr4/svr4_socket.c +++ /dev/null @@ -1,207 +0,0 @@ -/* $OpenBSD: svr4_socket.c,v 1.5 2006/03/05 21:48:56 miod Exp $ */ -/* $NetBSD: svr4_socket.c,v 1.4 1997/07/21 23:02:37 christos Exp $ */ - -/* - * Copyright (c) 1996 Christos Zoulas. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Christos Zoulas. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * In SVR4 unix domain sockets are referenced sometimes - * (in putmsg(2) for example) as a [device, inode] pair instead of a pathname. - * Since there is no iname() routine in the kernel, and we need access to - * a mapping from inode to pathname, we keep our own table. This is a simple - * linked list that contains the pathname, the [device, inode] pair, the - * file corresponding to that socket and the process. When the - * socket gets closed we remove the item from the list. The list gets loaded - * every time a stat(2) call finds a socket. - */ - -#include <sys/param.h> -#include <sys/kernel.h> -#include <sys/systm.h> -#include <sys/queue.h> -#include <sys/mbuf.h> -#include <sys/file.h> -#include <sys/mount.h> -#include <sys/socket.h> -#include <sys/socketvar.h> -#include <sys/syscallargs.h> -#include <sys/un.h> -#include <sys/stat.h> - -#include <compat/svr4/svr4_types.h> -#include <compat/svr4/svr4_util.h> -#include <compat/svr4/svr4_socket.h> -#include <compat/svr4/svr4_signal.h> -#include <compat/svr4/svr4_sockmod.h> -#include <compat/svr4/svr4_syscallargs.h> - -struct svr4_sockcache_entry { - struct proc *p; /* Process for the socket */ - void *cookie; /* Internal cookie used for matching */ - struct sockaddr_un sock;/* Pathname for the socket */ - dev_t dev; /* Device where the socket lives on */ - ino_t ino; /* Inode where the socket lives on */ - TAILQ_ENTRY(svr4_sockcache_entry) entries; -}; - -static TAILQ_HEAD(svr4_sockcache_head, svr4_sockcache_entry) svr4_head; -static int initialized = 0; - -struct sockaddr_un * -svr4_find_socket(p, fp, dev, ino) - struct proc *p; - struct file *fp; - dev_t dev; - ino_t ino; -{ - struct svr4_sockcache_entry *e; - void *cookie = ((struct socket *) fp->f_data)->so_internal; - - if (!initialized) { - DPRINTF(("svr4_find_socket: uninitialized [%p,%d,%d]\n", - p, dev, ino)); - TAILQ_INIT(&svr4_head); - initialized = 1; - return NULL; - } - - - DPRINTF(("svr4_find_socket: [%p,%d,%d]: ", p, dev, ino)); - TAILQ_FOREACH(e, &svr4_head, entries) - if (e->p == p && e->dev == dev && e->ino == ino) { -#ifdef DIAGNOSTIC - if (e->cookie != NULL && e->cookie != cookie) - panic("svr4 socket cookie mismatch"); -#endif - e->cookie = cookie; - DPRINTF(("%s\n", e->sock.sun_path)); - return &e->sock; - } - - DPRINTF(("not found\n")); - return NULL; -} - - -void -svr4_delete_socket(p, fp) - struct proc *p; - struct file *fp; -{ - struct svr4_sockcache_entry *e; - void *cookie = ((struct socket *) fp->f_data)->so_internal; - - if (!initialized) { - TAILQ_INIT(&svr4_head); - initialized = 1; - return; - } - - TAILQ_FOREACH(e, &svr4_head, entries) - if (e->p == p && e->cookie == cookie) { - TAILQ_REMOVE(&svr4_head, e, entries); - DPRINTF(("svr4_delete_socket: %s [%p,%d,%d]\n", - e->sock.sun_path, p, e->dev, e->ino)); - free(e, M_TEMP); - return; - } -} - - -int -svr4_add_socket(p, path, st) - struct proc *p; - const char *path; - struct stat *st; -{ - struct svr4_sockcache_entry *e; - size_t len; - int error; - - if (!initialized) { - TAILQ_INIT(&svr4_head); - initialized = 1; - } - - e = malloc(sizeof(*e), M_TEMP, M_WAITOK); - e->cookie = NULL; - e->dev = st->st_dev; - e->ino = st->st_ino; - e->p = p; - - if ((error = copyinstr(path, e->sock.sun_path, - sizeof(e->sock.sun_path), &len)) != 0) { - DPRINTF(("svr4_add_socket: copyinstr failed %d\n", error)); - free(e, M_TEMP); - return error; - } - - e->sock.sun_family = AF_UNIX; - e->sock.sun_len = len; - - TAILQ_INSERT_HEAD(&svr4_head, e, entries); - DPRINTF(("svr4_add_socket: %s [%p,%d,%d]\n", e->sock.sun_path, - p, e->dev, e->ino)); - return 0; -} - - -int -svr4_sys_socket(p, v, retval) - struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_socket_args *uap = v; - - switch (SCARG(uap, type)) { - case SVR4_SOCK_DGRAM: - SCARG(uap, type) = SOCK_DGRAM; - break; - - case SVR4_SOCK_STREAM: - SCARG(uap, type) = SOCK_STREAM; - break; - - case SVR4_SOCK_RAW: - SCARG(uap, type) = SOCK_RAW; - break; - - case SVR4_SOCK_RDM: - SCARG(uap, type) = SOCK_RDM; - break; - - case SVR4_SOCK_SEQPACKET: - SCARG(uap, type) = SOCK_SEQPACKET; - break; - default: - return EINVAL; - } - return sys_socket(p, uap, retval); -} diff --git a/sys/compat/svr4/svr4_socket.h b/sys/compat/svr4/svr4_socket.h deleted file mode 100644 index 1360ac172b4..00000000000 --- a/sys/compat/svr4/svr4_socket.h +++ /dev/null @@ -1,45 +0,0 @@ -/* $OpenBSD: svr4_socket.h,v 1.2 2002/03/14 01:26:51 millert Exp $ */ -/* $NetBSD: svr4_socket.h,v 1.1 1996/04/11 12:43:31 christos Exp $ */ - -/* - * Copyright (c) 1996 Christos Zoulas. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Christos Zoulas. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _SVR4_SOCKET_H_ -#define _SVR4_SOCKET_H_ - -struct sockaddr_un; -struct proc; -struct file; - -struct sockaddr_un *svr4_find_socket(struct proc *, struct file *, - dev_t, ino_t); -void svr4_delete_socket(struct proc *, struct file *); -int svr4_add_socket(struct proc *, const char *, struct stat *); - -#endif /* _SVR4_SOCKET_H_ */ diff --git a/sys/compat/svr4/svr4_sockio.c b/sys/compat/svr4/svr4_sockio.c deleted file mode 100644 index f814c312d6e..00000000000 --- a/sys/compat/svr4/svr4_sockio.c +++ /dev/null @@ -1,173 +0,0 @@ -/* $OpenBSD: svr4_sockio.c,v 1.10 2006/03/05 21:48:56 miod Exp $ */ -/* $NetBSD: svr4_sockio.c,v 1.10 1996/05/03 17:09:15 christos Exp $ */ - -/* - * Copyright (c) 1995 Christos Zoulas - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/param.h> -#include <sys/proc.h> -#include <sys/systm.h> -#include <sys/file.h> -#include <sys/filedesc.h> -#include <sys/ioctl.h> -#include <sys/termios.h> -#include <sys/tty.h> -#include <sys/socket.h> -#include <sys/mount.h> -#include <net/if.h> -#include <sys/malloc.h> - -#include <sys/syscallargs.h> - -#include <compat/svr4/svr4_types.h> -#include <compat/svr4/svr4_util.h> -#include <compat/svr4/svr4_signal.h> -#include <compat/svr4/svr4_syscallargs.h> -#include <compat/svr4/svr4_stropts.h> -#include <compat/svr4/svr4_ioctl.h> -#include <compat/svr4/svr4_sockio.h> - -static int bsd_to_svr4_flags(int); - -#define bsd_to_svr4_flag(a) \ - if (bf & __CONCAT(I,a)) sf |= __CONCAT(SVR4_I,a) - -static int -bsd_to_svr4_flags(bf) - int bf; -{ - int sf = 0; - bsd_to_svr4_flag(FF_UP); - bsd_to_svr4_flag(FF_BROADCAST); - bsd_to_svr4_flag(FF_DEBUG); - bsd_to_svr4_flag(FF_LOOPBACK); - bsd_to_svr4_flag(FF_POINTOPOINT); - bsd_to_svr4_flag(FF_NOTRAILERS); - bsd_to_svr4_flag(FF_RUNNING); - bsd_to_svr4_flag(FF_NOARP); - bsd_to_svr4_flag(FF_PROMISC); - bsd_to_svr4_flag(FF_ALLMULTI); - bsd_to_svr4_flag(FF_MULTICAST); - return sf; -} - -int -svr4_sock_ioctl(fp, p, retval, fd, cmd, data) - struct file *fp; - struct proc *p; - register_t *retval; - int fd; - u_long cmd; - caddr_t data; -{ - int error; - int (*ctl)(struct file *, u_long, caddr_t, struct proc *) = - fp->f_ops->fo_ioctl; - - *retval = 0; - - switch (cmd) { - case SVR4_SIOCGIFNUM: - { - struct ifnet *ifp; - struct ifaddr *ifa; - int ifnum = 0; - - /* - * This does not return the number of physical - * interfaces (if_index), but the number of interfaces - * + addresses like ifconf() does, because this number - * is used by code that will call SVR4_SIOCGIFCONF to - * find the space needed for SVR4_SIOCGIFCONF. So we - * count the number of ifreq entries that the next - * SVR4_SIOCGIFCONF will return. Maybe a more correct - * fix is to make SVR4_SIOCGIFCONF return only one - * entry per physical interface? - */ - - TAILQ_FOREACH(ifp, &ifnet, if_list) - if (TAILQ_EMPTY(&ifp->if_addrlist)) - ifnum++; - else - TAILQ_FOREACH(ifa, &ifp->if_addrlist, - ifa_list) - ifnum++; - - - DPRINTF(("SIOCGIFNUM %d\n", ifnum)); - return copyout(&ifnum, data, sizeof(ifnum)); - } - - case SVR4_SIOCGIFFLAGS: - { - struct ifreq br; - struct svr4_ifreq sr; - - if ((error = copyin(data, &sr, sizeof(sr))) != 0) - return error; - - (void) strlcpy(br.ifr_name, sr.svr4_ifr_name, - sizeof(br.ifr_name)); - - if ((error = (*ctl)(fp, SIOCGIFFLAGS, - (caddr_t) &br, p)) != 0) { - DPRINTF(("SIOCGIFFLAGS %s: error %d\n", - sr.svr4_ifr_name, error)); - return error; - } - - sr.svr4_ifr_flags = bsd_to_svr4_flags(br.ifr_flags); - DPRINTF(("SIOCGIFFLAGS %s = %x\n", - sr.svr4_ifr_name, sr.svr4_ifr_flags)); - return copyout(&sr, data, sizeof(sr)); - } - - case SVR4_SIOCGIFCONF: - { - struct svr4_ifconf sc; - - if ((error = copyin(data, &sc, sizeof(sc))) != 0) - return error; - - DPRINTF(("ifreq %d svr4_ifreq %d ifc_len %d\n", - sizeof(struct ifreq), sizeof(struct svr4_ifreq), - sc.svr4_ifc_len)); - - if ((error = (*ctl)(fp, OSIOCGIFCONF, - (caddr_t) &sc, p)) != 0) - return error; - - DPRINTF(("SIOCGIFCONF\n")); - return 0; - } - - - default: - DPRINTF(("Unknown svr4 sockio %lx\n", cmd)); - return 0; /* ENOSYS really */ - } -} diff --git a/sys/compat/svr4/svr4_sockio.h b/sys/compat/svr4/svr4_sockio.h deleted file mode 100644 index d83999a4c4f..00000000000 --- a/sys/compat/svr4/svr4_sockio.h +++ /dev/null @@ -1,93 +0,0 @@ -/* $OpenBSD: svr4_sockio.h,v 1.2 1996/08/02 20:35:41 niklas Exp $ */ -/* $NetBSD: svr4_sockio.h,v 1.2 1995/07/04 23:00:13 christos Exp $ */ - -/* - * Copyright (c) 1995 Christos Zoulas - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _SVR4_SOCKIO_H_ -#define _SVR4_SOCKIO_H_ - -#define SVR4_IFF_UP 0x0001 -#define SVR4_IFF_BROADCAST 0x0002 -#define SVR4_IFF_DEBUG 0x0004 -#define SVR4_IFF_LOOPBACK 0x0008 -#define SVR4_IFF_POINTOPOINT 0x0010 -#define SVR4_IFF_NOTRAILERS 0x0020 -#define SVR4_IFF_RUNNING 0x0040 -#define SVR4_IFF_NOARP 0x0080 -#define SVR4_IFF_PROMISC 0x0100 -#define SVR4_IFF_ALLMULTI 0x0200 -#define SVR4_IFF_INTELLIGENT 0x0400 -#define SVR4_IFF_MULTICAST 0x0800 -#define SVR4_IFF_MULTI_BCAST 0x1000 -#define SVR4_IFF_UNNUMBERED 0x2000 -#define SVR4_IFF_PRIVATE 0x8000 - -struct svr4_ifreq { -#define SVR4_IFNAMSIZ 16 - char svr4_ifr_name[SVR4_IFNAMSIZ]; - union { - struct osockaddr ifru_addr; - struct osockaddr ifru_dstaddr; - struct osockaddr ifru_broadaddr; - short ifru_flags; - int ifru_metric; - char ifru_data; - char ifru_enaddr[6]; - int if_muxid[2]; - - } ifr_ifru; - -#define svr4_ifr_addr ifr_ifru.ifru_addr -#define svr4_ifr_dstaddr ifr_ifru.ifru_dstaddr -#define svr4_ifr_broadaddr ifr_ifru.ifru_broadaddr -#define svr4_ifr_flags ifr_ifru.ifru_flags -#define svr4_ifr_metric ifr_ifru.ifru_metric -#define svr4_ifr_data ifr_ifru.ifru_data -#define svr4_ifr_enaddr ifr_ifru.ifru_enaddr -#define svr4_ifr_muxid ifr_ifru.ifru_muxid - -}; - -struct svr4_ifconf { - int svr4_ifc_len; - union { - caddr_t ifcu_buf; - struct svr4_ifreq *ifcu_req; - } ifc_ifcu; - -#define svr4_ifc_buf ifc_ifcu.ifcu_buf -#define svr4_ifc_req ifc_ifcu.ifcu_req -}; - -#define SVR4_SIOC ('i' << 8) - -#define SVR4_SIOCGIFFLAGS SVR4_IOWR('i', 17, struct svr4_ifreq) -#define SVR4_SIOCGIFCONF SVR4_IOWR('i', 20, struct svr4_ifconf) -#define SVR4_SIOCGIFNUM SVR4_IOR('i', 87, int) - -#endif /* !_SVR4_SOCKIO_H_ */ diff --git a/sys/compat/svr4/svr4_sockmod.h b/sys/compat/svr4/svr4_sockmod.h deleted file mode 100644 index 4c722dbc9ba..00000000000 --- a/sys/compat/svr4/svr4_sockmod.h +++ /dev/null @@ -1,83 +0,0 @@ -/* $OpenBSD: svr4_sockmod.h,v 1.4 1997/08/29 19:56:38 kstailey Exp $ */ -/* $NetBSD: svr4_sockmod.h,v 1.5 1997/07/21 23:02:38 christos Exp $ */ - -/* - * Copyright (c) 1994 Christos Zoulas - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _SVR4_SOCKMOD_H_ -#define _SVR4_SOCKMOD_H_ - -#define SVR4_SIMOD ('I' << 8) - -#define SVR4_SI_OGETUDATA (SVR4_SIMOD|101) -#define SVR4_SI_SHUTDOWN (SVR4_SIMOD|102) -#define SVR4_SI_LISTEN (SVR4_SIMOD|103) -#define SVR4_SI_SETMYNAME (SVR4_SIMOD|104) -#define SVR4_SI_SETPEERNAME (SVR4_SIMOD|105) -#define SVR4_SI_GETINTRANSIT (SVR4_SIMOD|106) -#define SVR4_SI_TCL_LINK (SVR4_SIMOD|107) -#define SVR4_SI_TCL_UNLINK (SVR4_SIMOD|108) -#define SVR4_SI_SOCKPARAMS (SVR4_SIMOD|109) -#define SVR4_SI_GETUDATA (SVR4_SIMOD|110) - - -#define SVR4_SOCK_DGRAM 1 -#define SVR4_SOCK_STREAM 2 -#define SVR4_SOCK_STREAM_ORD 3 -#define SVR4_SOCK_RAW 4 -#define SVR4_SOCK_RDM 5 -#define SVR4_SOCK_SEQPACKET 6 - -struct svr4_si_sockparms { - int family; - int type; - int protocol; -}; - -struct svr4_si_oudata { - int tidusize; - int addrsize; - int optsize; - int etsdusize; - int servtype; - int so_state; - int so_options; - int tsdusize; -}; - -struct svr4_si_udata { - int tidusize; - int addrsize; - int optsize; - int etsdusize; - int servtype; - int so_state; - int so_options; - int tsdusize; - struct svr4_si_sockparms sockparms; -}; -#endif /* !_SVR4_SOCKMOD_H_ */ diff --git a/sys/compat/svr4/svr4_stat.c b/sys/compat/svr4/svr4_stat.c deleted file mode 100644 index 01ca3dca93c..00000000000 --- a/sys/compat/svr4/svr4_stat.c +++ /dev/null @@ -1,835 +0,0 @@ -/* $OpenBSD: svr4_stat.c,v 1.28 2009/01/29 22:08:45 guenther Exp $ */ -/* $NetBSD: svr4_stat.c,v 1.21 1996/04/22 01:16:07 christos Exp $ */ - -/* - * Copyright (c) 1994 Christos Zoulas - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/namei.h> -#include <sys/proc.h> -#include <sys/file.h> -#include <sys/stat.h> -#include <sys/filedesc.h> -#include <sys/ioctl.h> -#include <sys/kernel.h> -#include <sys/mount.h> -#include <sys/malloc.h> -#include <sys/unistd.h> - -#include <sys/time.h> -#include <sys/ucred.h> -#include <uvm/uvm_extern.h> -#include <sys/sysctl.h> - -#include <sys/syscallargs.h> - -#include <compat/svr4/svr4_types.h> -#include <compat/svr4/svr4_signal.h> -#include <compat/svr4/svr4_syscallargs.h> -#include <compat/svr4/svr4_util.h> -#include <compat/svr4/svr4_stat.h> -#include <compat/svr4/svr4_ustat.h> -#include <compat/svr4/svr4_fuser.h> -#include <compat/svr4/svr4_utsname.h> -#include <compat/svr4/svr4_systeminfo.h> -#include <compat/svr4/svr4_time.h> -#include <compat/svr4/svr4_socket.h> - -#ifdef __sparc__ -/* - * Solaris-2.4 on the sparc has the old stat call using the new - * stat data structure... - */ -# define SVR4_NO_OSTAT -#endif - -static void bsd_to_svr4_xstat(struct stat *, struct svr4_xstat *); -static void bsd_to_svr4_stat64(struct stat *, struct svr4_stat64 *); -int svr4_ustat(struct proc *, void *, register_t *); -static int svr4_to_bsd_pathconf(int); - -/* - * SVR4 uses named pipes as named sockets, so we tell programs - * that sockets are named pipes with mode 0 - */ -#define BSD_TO_SVR4_MODE(mode) (S_ISSOCK(mode) ? S_IFIFO : (mode)) - - -#ifndef SVR4_NO_OSTAT -static void bsd_to_svr4_stat(struct stat *, struct svr4_stat *); - -static void -bsd_to_svr4_stat(st, st4) - struct stat *st; - struct svr4_stat *st4; -{ - bzero(st4, sizeof(*st4)); - st4->st_dev = bsd_to_svr4_odev_t(st->st_dev); - st4->st_ino = st->st_ino; - st4->st_mode = BSD_TO_SVR4_MODE(st->st_mode); - st4->st_nlink = st->st_nlink; - st4->st_uid = st->st_uid; - st4->st_gid = st->st_gid; - st4->st_rdev = bsd_to_svr4_odev_t(st->st_rdev); - st4->st_size = st->st_size; - st4->st_atim = st->st_atime; - st4->st_mtim = st->st_mtime; - st4->st_ctim = st->st_ctime; -} -#endif - - -static void -bsd_to_svr4_xstat(st, st4) - struct stat *st; - struct svr4_xstat *st4; -{ - bzero(st4, sizeof(*st4)); - st4->st_dev = bsd_to_svr4_dev_t(st->st_dev); - st4->st_ino = st->st_ino; - st4->st_mode = BSD_TO_SVR4_MODE(st->st_mode); - st4->st_nlink = st->st_nlink; - st4->st_uid = st->st_uid; - st4->st_gid = st->st_gid; - st4->st_rdev = bsd_to_svr4_dev_t(st->st_rdev); - st4->st_size = st->st_size; - st4->st_atim = st->st_atim; - st4->st_mtim = st->st_mtim; - st4->st_ctim = st->st_ctim; - st4->st_blksize = st->st_blksize; - st4->st_blocks = st->st_blocks; - strlcpy(st4->st_fstype, "unknown", sizeof st4->st_fstype); -} - -static void -bsd_to_svr4_stat64(st, st4) - struct stat *st; - struct svr4_stat64 *st4; -{ - bzero(st4, sizeof(*st4)); - st4->st_dev = bsd_to_svr4_dev_t(st->st_dev); - st4->st_ino = st->st_ino; - st4->st_mode = BSD_TO_SVR4_MODE(st->st_mode); - st4->st_nlink = st->st_nlink; - st4->st_uid = st->st_uid; - st4->st_gid = st->st_gid; - st4->st_rdev = bsd_to_svr4_dev_t(st->st_rdev); - st4->st_size = st->st_size; - st4->st_atim = st->st_atim; - st4->st_mtim = st->st_mtim; - st4->st_ctim = st->st_ctim; - st4->st_blksize = st->st_blksize; - st4->st_blocks = st->st_blocks; - strlcpy(st4->st_fstype, "unknown", sizeof st4->st_fstype); -} - - -int -svr4_sys_stat(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_stat_args *uap = v; -#ifdef SVR4_NO_OSTAT - struct svr4_sys_xstat_args cup; - - SCARG(&cup, two) = 2; - SCARG(&cup, path) = SCARG(uap, path); - SCARG(&cup, ub) = (struct svr4_xstat *) SCARG(uap, ub); - return svr4_sys_xstat(p, &cup, retval); -#else - struct stat st; - struct svr4_stat svr4_st; - struct sys_stat_args cup; - int error; - - caddr_t sg = stackgap_init(p->p_emul); - SCARG(&cup, ub) = stackgap_alloc(&sg, sizeof(struct stat)); - SVR4_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path)); - - SCARG(&cup, path) = SCARG(uap, path); - - - if ((error = sys_stat(p, &cup, retval)) != 0) - return error; - - if ((error = copyin(SCARG(&cup, ub), &st, sizeof st)) != 0) - return error; - - bsd_to_svr4_stat(&st, &svr4_st); - - if (S_ISSOCK(st.st_mode)) - (void) svr4_add_socket(p, SCARG(uap, path), &st); - - if ((error = copyout(&svr4_st, SCARG(uap, ub), sizeof svr4_st)) != 0) - return error; - - return 0; -#endif -} - -int -svr4_sys_lstat(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_lstat_args *uap = v; -#ifdef SVR4_NO_OSTAT - struct svr4_sys_lxstat_args cup; - - SCARG(&cup, two) = 2; - SCARG(&cup, path) = SCARG(uap, path); - SCARG(&cup, ub) = (struct svr4_xstat *) SCARG(uap, ub); - return svr4_sys_lxstat(p, &cup, retval); -#else - struct stat st; - struct svr4_stat svr4_st; - struct sys_lstat_args cup; - int error; - - caddr_t sg = stackgap_init(p->p_emul); - SCARG(&cup, ub) = stackgap_alloc(&sg, sizeof(struct stat)); - SVR4_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path)); - - SCARG(&cup, path) = SCARG(uap, path); - - if ((error = sys_lstat(p, &cup, retval)) != 0) - return error; - - if ((error = copyin(SCARG(&cup, ub), &st, sizeof st)) != 0) - return error; - - bsd_to_svr4_stat(&st, &svr4_st); - - if (S_ISSOCK(st.st_mode)) - (void) svr4_add_socket(p, SCARG(uap, path), &st); - - if ((error = copyout(&svr4_st, SCARG(uap, ub), sizeof svr4_st)) != 0) - return error; - - return 0; -#endif -} - -int -svr4_sys_fstat(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_fstat_args *uap = v; -#ifdef SVR4_NO_OSTAT - struct svr4_sys_fxstat_args cup; - - SCARG(&cup, two) = 2; - SCARG(&cup, fd) = SCARG(uap, fd); - SCARG(&cup, sb) = (struct svr4_xstat *) SCARG(uap, sb); - return svr4_sys_fxstat(p, &cup, retval); -#else - struct stat st; - struct svr4_stat svr4_st; - struct sys_fstat_args cup; - int error; - - caddr_t sg = stackgap_init(p->p_emul); - - SCARG(&cup, fd) = SCARG(uap, fd); - SCARG(&cup, sb) = stackgap_alloc(&sg, sizeof(struct stat)); - - if ((error = sys_fstat(p, &cup, retval)) != 0) - return error; - - if ((error = copyin(SCARG(&cup, sb), &st, sizeof st)) != 0) - return error; - - bsd_to_svr4_stat(&st, &svr4_st); - - if ((error = copyout(&svr4_st, SCARG(uap, sb), sizeof svr4_st)) != 0) - return error; - - return 0; -#endif -} - - -int -svr4_sys_xstat(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_xstat_args *uap = v; - struct stat st; - struct svr4_xstat svr4_st; - struct sys_stat_args cup; - int error; - - caddr_t sg = stackgap_init(p->p_emul); - SCARG(&cup, ub) = stackgap_alloc(&sg, sizeof(struct stat)); - SVR4_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path)); - - SCARG(&cup, path) = SCARG(uap, path); - - if ((error = sys_stat(p, &cup, retval)) != 0) - return error; - - if ((error = copyin(SCARG(&cup, ub), &st, sizeof st)) != 0) - return error; - - bsd_to_svr4_xstat(&st, &svr4_st); - - if (S_ISSOCK(st.st_mode)) - (void) svr4_add_socket(p, SCARG(uap, path), &st); - - if ((error = copyout(&svr4_st, SCARG(uap, ub), sizeof svr4_st)) != 0) - return error; - - return 0; -} - -int -svr4_sys_lxstat(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_lxstat_args *uap = v; - struct stat st; - struct svr4_xstat svr4_st; - struct sys_lstat_args cup; - int error; - - caddr_t sg = stackgap_init(p->p_emul); - SCARG(&cup, ub) = stackgap_alloc(&sg, sizeof(struct stat)); - SVR4_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path)); - - SCARG(&cup, path) = SCARG(uap, path); - - if ((error = sys_lstat(p, &cup, retval)) != 0) - return error; - - if ((error = copyin(SCARG(&cup, ub), &st, sizeof st)) != 0) - return error; - - bsd_to_svr4_xstat(&st, &svr4_st); - - if (S_ISSOCK(st.st_mode)) - (void) svr4_add_socket(p, SCARG(uap, path), &st); - - if ((error = copyout(&svr4_st, SCARG(uap, ub), sizeof svr4_st)) != 0) - return error; - - return 0; -} - -int -svr4_sys_fxstat(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_fxstat_args *uap = v; - struct stat st; - struct svr4_xstat svr4_st; - struct sys_fstat_args cup; - int error; - - caddr_t sg = stackgap_init(p->p_emul); - - SCARG(&cup, fd) = SCARG(uap, fd); - SCARG(&cup, sb) = stackgap_alloc(&sg, sizeof(struct stat)); - - if ((error = sys_fstat(p, &cup, retval)) != 0) - return error; - - if ((error = copyin(SCARG(&cup, sb), &st, sizeof st)) != 0) - return error; - - bsd_to_svr4_xstat(&st, &svr4_st); - - if ((error = copyout(&svr4_st, SCARG(uap, sb), sizeof svr4_st)) != 0) - return error; - - return 0; -} - - -int -svr4_sys_stat64(p, v, retval) - struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_stat64_args *uap = v; - struct stat st; - struct svr4_stat64 svr4_st; - struct sys_stat_args cup; - int error; - - caddr_t sg = stackgap_init(p->p_emul); - - SCARG(&cup, path) = SCARG(uap, path); - SCARG(&cup, ub) = stackgap_alloc(&sg, sizeof(struct stat)); - - if ((error = sys_stat(p, &cup, retval)) != 0) - return error; - - if ((error = copyin(SCARG(&cup, ub), &st, sizeof st)) != 0) - return error; - - bsd_to_svr4_stat64(&st, &svr4_st); - - if (S_ISSOCK(st.st_mode)) - (void) svr4_add_socket(p, SCARG(uap, path), &st); - - if ((error = copyout(&svr4_st, SCARG(uap, sb), sizeof svr4_st)) != 0) - return error; - - return 0; -} - - -int -svr4_sys_lstat64(p, v, retval) - struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_lstat64_args *uap = v; - struct stat st; - struct svr4_stat64 svr4_st; - struct sys_lstat_args cup; - int error; - - caddr_t sg = stackgap_init(p->p_emul); - - SCARG(&cup, path) = SCARG(uap, path); - SCARG(&cup, ub) = stackgap_alloc(&sg, sizeof(struct stat)); - - if ((error = sys_lstat(p, &cup, retval)) != 0) - return error; - - if ((error = copyin(SCARG(&cup, ub), &st, sizeof st)) != 0) - return error; - - bsd_to_svr4_stat64(&st, &svr4_st); - - if (S_ISSOCK(st.st_mode)) - (void) svr4_add_socket(p, SCARG(uap, path), &st); - - if ((error = copyout(&svr4_st, SCARG(uap, sb), sizeof svr4_st)) != 0) - return error; - - return 0; -} - - -int -svr4_sys_fstat64(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_fstat64_args *uap = v; - struct stat st; - struct svr4_stat64 svr4_st; - struct sys_fstat_args cup; - int error; - - caddr_t sg = stackgap_init(p->p_emul); - - SCARG(&cup, fd) = SCARG(uap, fd); - SCARG(&cup, sb) = stackgap_alloc(&sg, sizeof(struct stat)); - - if ((error = sys_fstat(p, &cup, retval)) != 0) - return error; - - if ((error = copyin(SCARG(&cup, sb), &st, sizeof st)) != 0) - return error; - - bsd_to_svr4_stat64(&st, &svr4_st); - - if ((error = copyout(&svr4_st, SCARG(uap, sb), sizeof svr4_st)) != 0) - return error; - - return 0; -} - - -struct svr4_ustat_args { - syscallarg(svr4_dev_t) dev; - syscallarg(struct svr4_ustat *) name; -}; - -int -svr4_ustat(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_ustat_args /* { - syscallarg(svr4_dev_t) dev; - syscallarg(struct svr4_ustat *) name; - } */ *uap = v; - struct svr4_ustat us; - int error; - - bzero(&us, sizeof us); - - /* - * XXX: should set f_tfree and f_tinode at least - * How do we translate dev -> fstat? (and then to svr4_ustat) - */ - if ((error = copyout(&us, SCARG(uap, name), sizeof us)) != 0) - return (error); - - return 0; -} - - - -int -svr4_sys_uname(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_uname_args *uap = v; - struct svr4_utsname *sut; - extern char hostname[], machine[]; - const char *cp; - char *dp, *ep; - int error; - - sut = malloc(sizeof(*sut), M_TEMP, M_WAITOK); - bzero(sut, sizeof(*sut)); - strlcpy(sut->sysname, ostype, sizeof(sut->sysname)); - strlcpy(sut->nodename, hostname, sizeof(sut->nodename)); - strlcpy(sut->release, osrelease, sizeof(sut->release)); - - dp = sut->version; - ep = &sut->version[sizeof(sut->version) - 1]; - for (cp = version; *cp && *cp != '('; cp++) - ; - for (cp++; *cp && *cp != ')' && dp < ep; cp++) - *dp++ = *cp; - for (; *cp && *cp != '#'; cp++) - ; - for (; *cp && *cp != ':' && dp < ep; cp++) - *dp++ = *cp; - *dp = '\0'; - - strlcpy(sut->machine, machine, sizeof(sut->machine)); - - error = copyout(sut, SCARG(uap, name), sizeof(struct svr4_utsname)); - free(sut, M_TEMP); - return (error); -} - -int -svr4_sys_systeminfo(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_systeminfo_args *uap = v; - const char *str; - int name; - int error; - long len; - extern char hostname[], machine[], domainname[]; -#ifdef __sparc__ - extern char *cpu_class; -#endif - - u_int rlen = SCARG(uap, len); - - switch (SCARG(uap, what)) { - case SVR4_SI_SYSNAME: - str = ostype; - break; - - case SVR4_SI_HOSTNAME: - str = hostname; - break; - - case SVR4_SI_RELEASE: - str = osrelease; - break; - - case SVR4_SI_VERSION: - str = version; - break; - - case SVR4_SI_MACHINE: - str = machine; - break; - - case SVR4_SI_ARCHITECTURE: - str = machine; - break; - - case SVR4_SI_HW_SERIAL: - str = "0"; - break; - - case SVR4_SI_HW_PROVIDER: - str = ostype; - break; - - case SVR4_SI_SRPC_DOMAIN: - str = domainname; - break; - - case SVR4_SI_PLATFORM: -#ifdef __sparc__ - str = cpu_class; -#else - str = machine; -#endif - break; - - case SVR4_SI_KERB_REALM: - str = "unsupported"; - break; - - case SVR4_SI_SET_HOSTNAME: - if ((error = suser(p, 0)) != 0) - return error; - name = KERN_HOSTNAME; - return kern_sysctl(&name, 1, 0, 0, SCARG(uap, buf), rlen, p); - - case SVR4_SI_SET_SRPC_DOMAIN: - if ((error = suser(p, 0)) != 0) - return error; - name = KERN_DOMAINNAME; - return kern_sysctl(&name, 1, 0, 0, SCARG(uap, buf), rlen, p); - - case SVR4_SI_SET_KERB_REALM: - return 0; - - default: - DPRINTF(("Bad systeminfo command %d\n", SCARG(uap, what))); - return ENOSYS; - } - - /* on success, sysinfo() returns byte count including \0 */ - /* result is not diminished if user buffer was too small */ - len = strlen(str) + 1; - *retval = len; - - /* nothing to copy if user buffer is empty */ - if (rlen == 0) - return 0; - - if (len > rlen) { - char nul = 0; - - /* if str overruns buffer, put NUL in last place */ - len = rlen - 1; - if (copyout(&nul, SCARG(uap, buf), sizeof(char)) != 0) - return EFAULT; - } - - return copyout(str, SCARG(uap, buf), len); -} - - -int -svr4_sys_utssys(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_utssys_args *uap = v; - - switch (SCARG(uap, sel)) { - case 0: /* uname(2) */ - { - struct svr4_sys_uname_args ua; - SCARG(&ua, name) = SCARG(uap, a1); - return svr4_sys_uname(p, &ua, retval); - } - - case 2: /* ustat(2) */ - { - struct svr4_ustat_args ua; - SCARG(&ua, dev) = (svr4_dev_t) SCARG(uap, a2); - SCARG(&ua, name) = SCARG(uap, a1); - return svr4_ustat(p, &ua, retval); - } - - case 3: /* fusers(2) */ - return ENOSYS; - - default: - return ENOSYS; - } - return ENOSYS; -} - - -int -svr4_sys_utime(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_utime_args *uap = v; - struct svr4_utimbuf ub; - struct timeval tbuf[2]; - struct sys_utimes_args ap; - int error; - caddr_t sg = stackgap_init(p->p_emul); - - SCARG(&ap, tptr) = stackgap_alloc(&sg, sizeof(tbuf)); - SVR4_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path)); - SCARG(&ap, path) = SCARG(uap, path); - if (SCARG(uap, ubuf) != NULL) { - if ((error = copyin(SCARG(uap, ubuf), &ub, sizeof(ub))) != 0) - return error; - tbuf[0].tv_sec = ub.actime; - tbuf[0].tv_usec = 0; - tbuf[1].tv_sec = ub.modtime; - tbuf[1].tv_usec = 0; - error = copyout(tbuf, (struct timeval *)SCARG(&ap, tptr), sizeof(tbuf)); - if (error) - return error; - } - else - SCARG(&ap, tptr) = NULL; - return sys_utimes(p, &ap, retval); -} - - -int -svr4_sys_utimes(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_utimes_args *uap = v; - caddr_t sg = stackgap_init(p->p_emul); - SVR4_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path)); - return sys_utimes(p, uap, retval); -} - - -static int -svr4_to_bsd_pathconf(name) - int name; -{ - switch (name) { - case SVR4_PC_LINK_MAX: - return _PC_LINK_MAX; - - case SVR4_PC_MAX_CANON: - return _PC_MAX_CANON; - - case SVR4_PC_MAX_INPUT: - return _PC_MAX_INPUT; - - case SVR4_PC_NAME_MAX: - return _PC_NAME_MAX; - - case SVR4_PC_PATH_MAX: - return _PC_PATH_MAX; - - case SVR4_PC_PIPE_BUF: - return _PC_PIPE_BUF; - - case SVR4_PC_NO_TRUNC: - return _PC_NO_TRUNC; - - case SVR4_PC_VDISABLE: - return _PC_VDISABLE; - - case SVR4_PC_CHOWN_RESTRICTED: - return _PC_CHOWN_RESTRICTED; - - case SVR4_PC_ASYNC_IO: - case SVR4_PC_PRIO_IO: - case SVR4_PC_SYNC_IO: - /* Not supported */ - return 0; - - default: - /* Invalid */ - return -1; - } -} - - -int -svr4_sys_pathconf(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_pathconf_args *uap = v; - caddr_t sg = stackgap_init(p->p_emul); - - SVR4_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path)); - - SCARG(uap, name) = svr4_to_bsd_pathconf(SCARG(uap, name)); - - switch (SCARG(uap, name)) { - case -1: - *retval = -1; - return EINVAL; - case 0: - *retval = 0; - return 0; - default: - return sys_pathconf(p, uap, retval); - } -} - -int -svr4_sys_fpathconf(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_fpathconf_args *uap = v; - - SCARG(uap, name) = svr4_to_bsd_pathconf(SCARG(uap, name)); - - switch (SCARG(uap, name)) { - case -1: - *retval = -1; - return EINVAL; - case 0: - *retval = 0; - return 0; - default: - return sys_fpathconf(p, uap, retval); - } -} diff --git a/sys/compat/svr4/svr4_stat.h b/sys/compat/svr4/svr4_stat.h deleted file mode 100644 index 58695297c3d..00000000000 --- a/sys/compat/svr4/svr4_stat.h +++ /dev/null @@ -1,106 +0,0 @@ -/* $OpenBSD: svr4_stat.h,v 1.3 1999/10/07 16:14:28 brad Exp $ */ -/* $NetBSD: svr4_stat.h,v 1.4 1996/02/10 17:12:38 christos Exp $ */ - -/* - * Copyright (c) 1994 Christos Zoulas - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _SVR4_STAT_H_ -#define _SVR4_STAT_H_ - -#include <compat/svr4/svr4_types.h> -#include <sys/stat.h> - -struct svr4_stat { - svr4_o_dev_t st_dev; - svr4_o_ino_t st_ino; - svr4_o_mode_t st_mode; - svr4_o_nlink_t st_nlink; - svr4_o_uid_t st_uid; - svr4_o_gid_t st_gid; - svr4_o_dev_t st_rdev; - svr4_off_t st_size; - svr4_time_t st_atim; - svr4_time_t st_mtim; - svr4_time_t st_ctim; -}; - -struct svr4_xstat { - svr4_dev_t st_dev; - long st_pad1[3]; - svr4_ino_t st_ino; - svr4_mode_t st_mode; - svr4_nlink_t st_nlink; - svr4_uid_t st_uid; - svr4_gid_t st_gid; - svr4_dev_t st_rdev; - long st_pad2[2]; - svr4_off_t st_size; - long st_pad3; - svr4_timestruc_t st_atim; - svr4_timestruc_t st_mtim; - svr4_timestruc_t st_ctim; - long st_blksize; - svr4_blkcnt_t st_blocks; - char st_fstype[16]; - long st_pad4[8]; -}; - -struct svr4_stat64 { - svr4_dev_t st_dev; - long st_pad1[3]; - svr4_ino64_t st_ino; - svr4_mode_t st_mode; - svr4_nlink_t st_nlink; - svr4_uid_t st_uid; - svr4_gid_t st_gid; - svr4_dev_t st_rdev; - long st_pad2[2]; - svr4_off64_t st_size; - svr4_timestruc_t st_atim; - svr4_timestruc_t st_mtim; - svr4_timestruc_t st_ctim; - long st_blksize; - svr4_blkcnt64_t st_blocks; - char st_fstype[16]; - long st_pad4[8]; -}; - -#define SVR4_PC_LINK_MAX 1 -#define SVR4_PC_MAX_CANON 2 -#define SVR4_PC_MAX_INPUT 3 -#define SVR4_PC_NAME_MAX 4 -#define SVR4_PC_PATH_MAX 5 -#define SVR4_PC_PIPE_BUF 6 -#define SVR4_PC_NO_TRUNC 7 -#define SVR4_PC_VDISABLE 8 -#define SVR4_PC_CHOWN_RESTRICTED 9 -#define SVR4_PC_ASYNC_IO 10 -#define SVR4_PC_PRIO_IO 11 -#define SVR4_PC_SYNC_IO 12 -#define SVR4_PC_FILESIZEBITS 67 - -#endif /* !_SVR4_STAT_H_ */ diff --git a/sys/compat/svr4/svr4_statvfs.h b/sys/compat/svr4/svr4_statvfs.h deleted file mode 100644 index 8e1e89deb60..00000000000 --- a/sys/compat/svr4/svr4_statvfs.h +++ /dev/null @@ -1,74 +0,0 @@ -/* $OpenBSD: svr4_statvfs.h,v 1.4 2008/06/26 05:42:14 ray Exp $ */ -/* $NetBSD: svr4_statvfs.h,v 1.3 1998/09/04 19:54:40 christos Exp $ */ - -/*- - * Copyright (c) 1994 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Christos Zoulas. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _SVR4_STATVFS_H_ -#define _SVR4_STATVFS_H_ - -typedef struct svr4_statvfs { - u_long f_bsize; - u_long f_frsize; - svr4_fsblkcnt_t f_blocks; - svr4_fsblkcnt_t f_bfree; - svr4_fsblkcnt_t f_bavail; - svr4_fsblkcnt_t f_files; - svr4_fsblkcnt_t f_ffree; - svr4_fsblkcnt_t f_favail; - u_long f_fsid; - char f_basetype[16]; - u_long f_flag; - u_long f_namemax; - char f_fstr[32]; - u_long f_filler[16]; -} svr4_statvfs_t; - -typedef struct svr4_statvfs64 { - u_long f_bsize; - u_long f_frsize; - svr4_fsblkcnt64_t f_blocks; - svr4_fsblkcnt64_t f_bfree; - svr4_fsblkcnt64_t f_bavail; - svr4_fsblkcnt64_t f_files; - svr4_fsblkcnt64_t f_ffree; - svr4_fsblkcnt64_t f_favail; - u_long f_fsid; - char f_basetype[16]; - u_long f_flag; - u_long f_namemax; - char f_fstr[32]; - u_long f_filler[16]; -} svr4_statvfs64_t; - -#define SVR4_ST_RDONLY 0x01 -#define SVR4_ST_NOSUID 0x02 -#define SVR4_ST_NOTRUNC 0x04 - -#endif /* !_SVR4_STATVFS_H_ */ diff --git a/sys/compat/svr4/svr4_stream.c b/sys/compat/svr4/svr4_stream.c deleted file mode 100644 index e636098820f..00000000000 --- a/sys/compat/svr4/svr4_stream.c +++ /dev/null @@ -1,1890 +0,0 @@ -/* $OpenBSD: svr4_stream.c,v 1.19 2005/11/21 18:16:38 millert Exp $ */ -/* $NetBSD: svr4_stream.c,v 1.19 1996/12/22 23:00:03 fvdl Exp $ */ - -/* - * Copyright (c) 1994, 1996 Christos Zoulas. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Christos Zoulas. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * Pretend that we have streams... - * Yes, this is gross. - * - * ToDo: The state machine for getmsg needs re-thinking - */ - -#include <sys/param.h> -#include <sys/kernel.h> -#include <sys/systm.h> -#include <sys/buf.h> -#include <sys/malloc.h> -#include <sys/ioctl.h> -#include <sys/tty.h> -#include <sys/file.h> -#include <sys/filedesc.h> -#include <sys/selinfo.h> -#include <sys/socket.h> -#include <sys/socketvar.h> -#include <sys/un.h> -#include <net/if.h> -#include <netinet/in.h> -#include <sys/mount.h> -#include <sys/proc.h> -#include <sys/vnode.h> -#include <sys/device.h> -#include <sys/stat.h> - -#include <sys/syscallargs.h> - -#include <compat/svr4/svr4_types.h> -#include <compat/svr4/svr4_util.h> -#include <compat/svr4/svr4_signal.h> -#include <compat/svr4/svr4_syscallargs.h> -#include <compat/svr4/svr4_stropts.h> -#include <compat/svr4/svr4_timod.h> -#include <compat/svr4/svr4_sockmod.h> -#include <compat/svr4/svr4_ioctl.h> -#include <compat/svr4/svr4_socket.h> - -/* Utils */ -static int clean_pipe(struct proc *, const char *); -static void getparm(struct file *, struct svr4_si_sockparms *); - -/* Address Conversions */ -static void sockaddr_to_netaddr_in(struct svr4_strmcmd *, - const struct sockaddr_in *); -static void sockaddr_to_netaddr_un(struct svr4_strmcmd *, - const struct sockaddr_un *); -static void netaddr_to_sockaddr_in(struct sockaddr_in *, - const struct svr4_strmcmd *); -static void netaddr_to_sockaddr_un(struct sockaddr_un *, - const struct svr4_strmcmd *); - -/* stream ioctls */ -static int i_nread(struct file *, struct proc *, register_t *, int, - u_long, caddr_t); -static int i_fdinsert(struct file *, struct proc *, register_t *, int, - u_long, caddr_t); -static int i_str(struct file *, struct proc *, register_t *, int, - u_long, caddr_t); -static int _i_bind_rsvd(struct file *, struct proc *, register_t *, int, - u_long, caddr_t); -static int _i_rele_rsvd(struct file *, struct proc *, register_t *, int, - u_long, caddr_t); - -/* i_str sockmod calls */ -static int sockmod(struct file *, int, struct svr4_strioctl *, - struct proc *); -static int si_listen(struct file *, int, struct svr4_strioctl *, - struct proc *); -static int si_ogetudata(struct file *, int, struct svr4_strioctl *, - struct proc *); -static int si_sockparams(struct file *, int, struct svr4_strioctl *, - struct proc *); -static int si_shutdown(struct file *, int, struct svr4_strioctl *, - struct proc *); -static int si_getudata(struct file *, int, struct svr4_strioctl *, - struct proc *); - -/* i_str timod calls */ -static int timod(struct file *, int, struct svr4_strioctl *, - struct proc *); -static int ti_getinfo(struct file *, int, struct svr4_strioctl *, - struct proc *); -static int ti_bind(struct file *, int, struct svr4_strioctl *, - struct proc *); - -#ifdef DEBUG_SVR4 -static void bufprint(u_char *, size_t); -static int show_ioc(const char *, struct svr4_strioctl *); -static int show_strbuf(struct svr4_strbuf *); -static void show_msg(const char *, int, struct svr4_strbuf *, - struct svr4_strbuf *, int); - -static void -bufprint(buf, len) - u_char *buf; - size_t len; -{ - size_t i; - - uprintf("\n\t"); - for (i = 0; i < len; i++) { - uprintf("%x ", buf[i]); - if (i && (i % 16) == 0) - uprintf("\n\t"); - } -} - -static int -show_ioc(str, ioc) - const char *str; - struct svr4_strioctl *ioc; -{ - u_char *ptr; - int error; - int len; - - len = ioc->len; - if (len > 1024) - len = 1024; - - if (len <= 0) - return 0; - - ptr = (u_char *) malloc(len, M_TEMP, M_WAITOK); - uprintf("%s cmd = %ld, timeout = %d, len = %d, buf = %p { ", - str, ioc->cmd, ioc->timeout, ioc->len, ioc->buf); - - if ((error = copyin(ioc->buf, ptr, len)) != 0) { - free((char *) ptr, M_TEMP); - return error; - } - - bufprint(ptr, len); - - uprintf("}\n"); - - free((char *) ptr, M_TEMP); - return 0; -} - - -static int -show_strbuf(str) - struct svr4_strbuf *str; -{ - int error; - u_char *ptr = NULL; - int maxlen = str->maxlen; - int len = str->len; - - if (maxlen > 8192) - maxlen = 8192; - - if (maxlen < 0) - maxlen = 0; - - if (len >= maxlen) - len = maxlen; - - if (len > 0) { - ptr = (u_char *)malloc(len, M_TEMP, M_WAITOK); - - if ((error = copyin(str->buf, ptr, len)) != 0) { - free((char *) ptr, M_TEMP); - return error; - } - } - - uprintf(", { %d, %d, %p=[ ", str->maxlen, str->len, str->buf); - - if (ptr) - bufprint(ptr, len); - - uprintf("]}"); - - if (ptr) - free((char *) ptr, M_TEMP); - - return 0; -} - - -static void -show_msg(str, fd, ctl, dat, flags) - const char *str; - int fd; - struct svr4_strbuf *ctl; - struct svr4_strbuf *dat; - int flags; -{ - struct svr4_strbuf buf; - int error; - - uprintf("%s(%d", str, fd); - if (ctl != NULL) { - if ((error = copyin(ctl, &buf, sizeof(buf))) != 0) - return; - show_strbuf(&buf); - } - else - uprintf(", NULL"); - - if (dat != NULL) { - if ((error = copyin(dat, &buf, sizeof(buf))) != 0) - return; - show_strbuf(&buf); - } - else - uprintf(", NULL"); - - uprintf(", %x);\n", flags); -} -#endif /* DEBUG_SVR4 */ - -/* - * We are faced with an interesting situation. On svr4 unix sockets - * are really pipes. But we really have sockets, and we might as - * well use them. At the point where svr4 calls TI_BIND, it has - * already created a named pipe for the socket using mknod(2). - * We need to create a socket with the same name when we bind, - * so we need to remove the pipe before, otherwise we'll get address - * already in use. So we *carefully* remove the pipe, to avoid - * using this as a random file removal tool. We use system calls - * to avoid code duplication. - */ -static int -clean_pipe(p, path) - struct proc *p; - const char *path; -{ - struct sys_lstat_args la; - struct sys_unlink_args ua; - register_t retval; - struct stat st; - int error; - caddr_t sg = stackgap_init(p->p_emul); - size_t l = strlen(path) + 1; - - SCARG(&la, path) = stackgap_alloc(&sg, l); - SCARG(&la, ub) = stackgap_alloc(&sg, sizeof(struct stat)); - - if ((error = copyout((char *) path, (char *) SCARG(&la, path), l)) != 0) - return error; - - if ((error = sys_lstat(p, &la, &retval)) != 0) - return 0; - - if ((error = copyin(SCARG(&la, ub), &st, sizeof(st))) != 0) - return 0; - - /* - * Make sure we are dealing with a mode 0 named pipe. - */ - if ((st.st_mode & S_IFMT) != S_IFIFO) - return 0; - - if ((st.st_mode & ALLPERMS) != 0) - return 0; - - SCARG(&ua, path) = SCARG(&la, path); - - if ((error = sys_unlink(p, &ua, &retval)) != 0) { - DPRINTF(("clean_pipe: unlink failed %d\n", error)); - return error; - } - - return 0; -} - - -static void -sockaddr_to_netaddr_in(sc, sain) - struct svr4_strmcmd *sc; - const struct sockaddr_in *sain; -{ - struct svr4_netaddr_in *na; - na = SVR4_ADDROF(sc); - - na->family = sain->sin_family; - na->port = sain->sin_port; - na->addr = sain->sin_addr.s_addr; - DPRINTF(("sockaddr_in -> netaddr %d %d %lx\n", na->family, na->port, - na->addr)); -} - - -static void -sockaddr_to_netaddr_un(sc, saun) - struct svr4_strmcmd *sc; - const struct sockaddr_un *saun; -{ - struct svr4_netaddr_un *na; - char *dst, *edst = ((char *) sc) + sc->offs + sizeof(na->family) + 1 - - sizeof(*sc); - const char *src; - - na = SVR4_ADDROF(sc); - na->family = saun->sun_family; - for (src = saun->sun_path, dst = na->path; (*dst++ = *src++) != '\0'; ) - if (dst == edst) - break; - DPRINTF(("sockaddr_un -> netaddr %d %s\n", na->family, na->path)); -} - - -static void -netaddr_to_sockaddr_in(sain, sc) - struct sockaddr_in *sain; - const struct svr4_strmcmd *sc; -{ - const struct svr4_netaddr_in *na; - - - na = SVR4_ADDROF(sc); - bzero(sain, sizeof(*sain)); - sain->sin_len = sizeof(*sain); - sain->sin_family = na->family; - sain->sin_port = na->port; - sain->sin_addr.s_addr = na->addr; - DPRINTF(("netaddr -> sockaddr_in %d %d %x\n", sain->sin_family, - sain->sin_port, sain->sin_addr.s_addr)); -} - - -static void -netaddr_to_sockaddr_un(saun, sc) - struct sockaddr_un *saun; - const struct svr4_strmcmd *sc; -{ - const struct svr4_netaddr_un *na; - char *dst, *edst = &saun->sun_path[sizeof(saun->sun_path) - 1]; - const char *src; - - na = SVR4_ADDROF(sc); - bzero(saun, sizeof(*saun)); - saun->sun_family = na->family; - for (src = na->path, dst = saun->sun_path; (*dst++ = *src++) != '\0'; ) - if (dst == edst) - break; - saun->sun_len = dst - saun->sun_path; - DPRINTF(("netaddr -> sockaddr_un %d %s\n", saun->sun_family, - saun->sun_path)); -} - - -static void -getparm(fp, pa) - struct file *fp; - struct svr4_si_sockparms *pa; -{ - struct svr4_strm *st = svr4_stream_get(fp); - struct socket *so = (struct socket *) fp->f_data; - - if (st == NULL) - return; - - pa->family = st->s_family; - - switch (so->so_type) { - case SOCK_DGRAM: - pa->type = SVR4_SOCK_DGRAM; - pa->protocol = IPPROTO_UDP; - return; - - case SOCK_STREAM: - pa->type = SVR4_SOCK_STREAM; - pa->protocol = IPPROTO_IP; - return; - - case SOCK_RAW: - pa->type = SVR4_SOCK_RAW; - pa->protocol = IPPROTO_RAW; - return; - - default: - pa->type = 0; - pa->protocol = 0; - return; - } -} - - -static int -si_ogetudata(fp, fd, ioc, p) - struct file *fp; - int fd; - struct svr4_strioctl *ioc; - struct proc *p; -{ - int error; - struct svr4_si_oudata ud; - struct svr4_si_sockparms pa; - - if (ioc->len != sizeof(ud) && ioc->len != sizeof(ud) - sizeof(int)) { - DPRINTF(("SI_OGETUDATA: Wrong size %d != %d\n", - sizeof(ud), ioc->len)); - return EINVAL; - } - - if ((error = copyin(ioc->buf, &ud, sizeof(ud))) != 0) - return error; - - getparm(fp, &pa); - - switch (pa.family) { - case AF_INET: - ud.tidusize = 16384; - ud.addrsize = sizeof(struct sockaddr_in); - if (pa.type == SVR4_SOCK_STREAM) - ud.etsdusize = 1; - else - ud.etsdusize = 0; - break; - - case AF_UNIX: - ud.tidusize = 65536; - ud.addrsize = 128; - ud.etsdusize = 128; - break; - - default: - DPRINTF(("SI_OGETUDATA: Unsupported address family %d\n", - pa.family)); - return ENOSYS; - } - - /* I have no idea what these should be! */ - ud.optsize = 128; - ud.tsdusize = 128; - ud.servtype = pa.type; - - /* XXX: Fixme */ - ud.so_state = 0; - ud.so_options = 0; - return copyout(&ud, ioc->buf, ioc->len); -} - - -static int -si_sockparams(fp, fd, ioc, p) - struct file *fp; - int fd; - struct svr4_strioctl *ioc; - struct proc *p; -{ - struct svr4_si_sockparms pa; - - getparm(fp, &pa); - return copyout(&pa, ioc->buf, sizeof(pa)); -} - - -static int -si_listen(fp, fd, ioc, p) - struct file *fp; - int fd; - struct svr4_strioctl *ioc; - struct proc *p; -{ - int error; - struct svr4_strm *st = svr4_stream_get(fp); - register_t retval; - struct svr4_strmcmd lst; - struct sys_listen_args la; - - if (st == NULL) - return EINVAL; - - if (ioc->len > sizeof(lst)) - return EINVAL; - - if ((error = copyin(ioc->buf, &lst, ioc->len)) != 0) - return error; - - if (lst.cmd != SVR4_TI_BIND_REQUEST) { - DPRINTF(("si_listen: bad request %ld\n", lst.cmd)); - return EINVAL; - } - - /* - * We are making assumptions again... - */ - SCARG(&la, s) = fd; - DPRINTF(("SI_LISTEN: fileno %d backlog = %d\n", fd, 5)); - SCARG(&la, backlog) = 5; - - if ((error = sys_listen(p, &la, &retval)) != 0) { - DPRINTF(("SI_LISTEN: listen failed %d\n", error)); - return error; - } - - st->s_cmd = SVR4_TI__ACCEPT_WAIT; - lst.cmd = SVR4_TI_BIND_REPLY; - - switch (st->s_family) { - case AF_INET: - /* XXX: Fill the length here */ - break; - - case AF_UNIX: - lst.len = 140; - lst.pad[28] = 0x00000000; /* magic again */ - lst.pad[29] = 0x00000800; /* magic again */ - lst.pad[30] = 0x80001400; /* magic again */ - break; - - default: - DPRINTF(("SI_LISTEN: Unsupported address family %d\n", - st->s_family)); - return ENOSYS; - } - - - if ((error = copyout(&lst, ioc->buf, ioc->len)) != 0) - return error; - - return 0; -} - - -static int -si_getudata(fp, fd, ioc, p) - struct file *fp; - int fd; - struct svr4_strioctl *ioc; - struct proc *p; -{ - int error; - struct svr4_si_udata ud; - - if (sizeof(ud) != ioc->len) { - DPRINTF(("SI_GETUDATA: Wrong size %d != %d\n", - sizeof(ud), ioc->len)); - return EINVAL; - } - - if ((error = copyin(ioc->buf, &ud, sizeof(ud))) != 0) - return error; - - getparm(fp, &ud.sockparms); - - switch (ud.sockparms.family) { - case AF_INET: - ud.tidusize = 16384; - ud.tsdusize = 16384; - ud.addrsize = sizeof(struct sockaddr_in); - if (ud.sockparms.type == SVR4_SOCK_STREAM) - ud.etsdusize = 1; - else - ud.etsdusize = 0; - ud.optsize = 0; - break; - - case AF_UNIX: - ud.tidusize = 65536; - ud.tsdusize = 128; - ud.addrsize = 128; - ud.etsdusize = 128; - ud.optsize = 128; - break; - - default: - DPRINTF(("SI_GETUDATA: Unsupported address family %d\n", - ud.sockparms.family)); - return ENOSYS; - } - - ud.servtype = ud.sockparms.type; - - /* XXX: Fixme */ - ud.so_state = 0; - ud.so_options = 0; - return copyout(&ud, ioc->buf, sizeof(ud)); -} - - -static int -si_shutdown(fp, fd, ioc, p) - struct file *fp; - int fd; - struct svr4_strioctl *ioc; - struct proc *p; -{ - int error; - struct sys_shutdown_args ap; - register_t retval; - - if (ioc->len != sizeof(SCARG(&ap, how))) { - DPRINTF(("SI_SHUTDOWN: Wrong size %d != %d\n", - sizeof(SCARG(&ap, how)), ioc->len)); - return EINVAL; - } - - if ((error = copyin(ioc->buf, &SCARG(&ap, how), ioc->len)) != 0) - return error; - - SCARG(&ap, s) = fd; - - return sys_shutdown(p, &ap, &retval); -} - -static int -sockmod(fp, fd, ioc, p) - struct file *fp; - int fd; - struct svr4_strioctl *ioc; - struct proc *p; -{ - switch (ioc->cmd) { - case SVR4_SI_OGETUDATA: - DPRINTF(("SI_OGETUDATA\n")); - return si_ogetudata(fp, fd, ioc, p); - - case SVR4_SI_SHUTDOWN: - DPRINTF(("SI_SHUTDOWN\n")); - return si_shutdown(fp, fd, ioc, p); - - case SVR4_SI_LISTEN: - DPRINTF(("SI_LISTEN\n")); - return si_listen(fp, fd, ioc, p); - - case SVR4_SI_SETMYNAME: - DPRINTF(("SI_SETMYNAME\n")); - return 0; - - case SVR4_SI_SETPEERNAME: - DPRINTF(("SI_SETPEERNAME\n")); - return 0; - - case SVR4_SI_GETINTRANSIT: - DPRINTF(("SI_GETINTRANSIT\n")); - return 0; - - case SVR4_SI_TCL_LINK: - DPRINTF(("SI_TCL_LINK\n")); - return 0; - - case SVR4_SI_TCL_UNLINK: - DPRINTF(("SI_TCL_UNLINK\n")); - return 0; - - case SVR4_SI_SOCKPARAMS: - DPRINTF(("SI_SOCKPARAMS\n")); - return si_sockparams(fp, fd, ioc, p); - - case SVR4_SI_GETUDATA: - DPRINTF(("SI_GETUDATA\n")); - return si_getudata(fp, fd, ioc, p); - - default: - DPRINTF(("Unknown sockmod ioctl %lx\n", ioc->cmd)); - return 0; - - } -} - - -static int -ti_getinfo(fp, fd, ioc, p) - struct file *fp; - int fd; - struct svr4_strioctl *ioc; - struct proc *p; -{ - int error; - struct svr4_infocmd info; - - bzero(&info, sizeof(info)); - - if (ioc->len > sizeof(info)) - return EINVAL; - - if ((error = copyin(ioc->buf, &info, ioc->len)) != 0) - return error; - - if (info.cmd != SVR4_TI_INFO_REQUEST) - return EINVAL; - - info.cmd = SVR4_TI_INFO_REPLY; - info.tsdu = 0; - info.etsdu = 1; - info.cdata = -2; - info.ddata = -2; - info.addr = 16; - info.opt = -1; - info.tidu = 16384; - info.serv = 2; - info.current = 0; - info.provider = 2; - - ioc->len = sizeof(info); - if ((error = copyout(&info, ioc->buf, ioc->len)) != 0) - return error; - - return 0; -} - - -static int -ti_bind(fp, fd, ioc, p) - struct file *fp; - int fd; - struct svr4_strioctl *ioc; - struct proc *p; -{ - int error; - struct svr4_strm *st = svr4_stream_get(fp); - struct sockaddr_in sain; - struct sockaddr_un saun; - register_t retval; - caddr_t sg; - void *skp, *sup = NULL; - int sasize; - struct svr4_strmcmd bnd; - struct sys_bind_args ba; - - if (st == NULL) { - DPRINTF(("ti_bind: bad file descriptor\n")); - return EINVAL; - } - - if (ioc->len > sizeof(bnd)) - return EINVAL; - - if ((error = copyin(ioc->buf, &bnd, ioc->len)) != 0) - return error; - - if (bnd.cmd != SVR4_TI_BIND_REQUEST) { - DPRINTF(("ti_bind: bad request %ld\n", bnd.cmd)); - return EINVAL; - } - - switch (st->s_family) { - case AF_INET: - skp = &sain; - sasize = sizeof(sain); - - if (bnd.offs == 0) - goto reply; - - netaddr_to_sockaddr_in(&sain, &bnd); - - DPRINTF(("TI_BIND: fam %d, port %d, addr %x\n", - sain.sin_family, sain.sin_port, - sain.sin_addr.s_addr)); - break; - - case AF_UNIX: - skp = &saun; - sasize = sizeof(saun); - if (bnd.offs == 0) - goto reply; - - netaddr_to_sockaddr_un(&saun, &bnd); - - if (saun.sun_path[0] == '\0') - goto reply; - - DPRINTF(("TI_BIND: fam %d, path %s\n", - saun.sun_family, saun.sun_path)); - - if ((error = clean_pipe(p, saun.sun_path)) != 0) - return error; - - bnd.pad[28] = 0x00001000; /* magic again */ - break; - - default: - DPRINTF(("TI_BIND: Unsupported address family %d\n", - st->s_family)); - return ENOSYS; - } - - sg = stackgap_init(p->p_emul); - sup = stackgap_alloc(&sg, sasize); - - if ((error = copyout(skp, sup, sasize)) != 0) - return error; - - SCARG(&ba, s) = fd; - DPRINTF(("TI_BIND: fileno %d\n", fd)); - SCARG(&ba, name) = (void *)sup; - SCARG(&ba, namelen) = sasize; - - if ((error = sys_bind(p, &ba, &retval)) != 0) { - DPRINTF(("TI_BIND: bind failed %d\n", error)); - return error; - } - -reply: - if (sup == NULL) { - bzero(&bnd, sizeof(bnd)); - bnd.len = sasize + 4; - bnd.offs = 0x10; /* XXX */ - } - - bnd.cmd = SVR4_TI_BIND_REPLY; - - if ((error = copyout(&bnd, ioc->buf, ioc->len)) != 0) - return error; - - return 0; -} - - -static int -timod(fp, fd, ioc, p) - struct file *fp; - int fd; - struct svr4_strioctl *ioc; - struct proc *p; -{ - switch (ioc->cmd) { - case SVR4_TI_GETINFO: - DPRINTF(("TI_GETINFO\n")); - return ti_getinfo(fp, fd, ioc, p); - - case SVR4_TI_OPTMGMT: - DPRINTF(("TI_OPTMGMT\n")); - return 0; - - case SVR4_TI_BIND: - DPRINTF(("TI_BIND\n")); - return ti_bind(fp, fd, ioc, p); - - case SVR4_TI_UNBIND: - DPRINTF(("TI_UNBIND\n")); - return 0; - - default: - DPRINTF(("Unknown timod ioctl %lx\n", ioc->cmd)); - return 0; - } -} - - -int -svr4_stream_ti_ioctl(fp, p, retval, fd, cmd, dat) - struct file *fp; - struct proc *p; - register_t *retval; - int fd; - u_long cmd; - caddr_t dat; -{ - struct svr4_strbuf skb, *sub = (struct svr4_strbuf *) dat; - struct svr4_strm *st = svr4_stream_get(fp); - int error; - void *skp, *sup; - struct sockaddr_in sain; - struct sockaddr_un saun; - struct svr4_strmcmd sc; - socklen_t sasize, samax; - caddr_t sg; - int *lenp; - - if (st == NULL) - return EINVAL; - - sc.offs = 0x10; - - switch (st->s_family) { - case AF_INET: - skp = &sain; - samax = sizeof(sain); - break; - - case AF_UNIX: - skp = &saun; - samax = sizeof(saun); - break; - - default: - DPRINTF(("ti_ioctl: Unsupported address family %d\n", - st->s_family)); - return ENOSYS; - } - - sg = stackgap_init(p->p_emul); - sup = stackgap_alloc(&sg, samax); - lenp = stackgap_alloc(&sg, sizeof(*lenp)); - - if ((error = copyout(&samax, lenp, sizeof(*lenp))) != 0) { - DPRINTF(("ti_ioctl: error copying out lenp\n")); - return error; - } - - switch (cmd) { - case SVR4_TI_GETMYNAME: - DPRINTF(("TI_GETMYNAME\n")); - { - struct sys_getsockname_args ap; - SCARG(&ap, fdes) = fd; - SCARG(&ap, asa) = sup; - SCARG(&ap, alen) = lenp; - if ((error = sys_getsockname(p, &ap, retval)) != 0) { - DPRINTF(("ti_ioctl: getsockname error\n")); - return error; - } - } - break; - - case SVR4_TI_GETPEERNAME: - DPRINTF(("TI_GETPEERNAME\n")); - { - struct sys_getpeername_args ap; - SCARG(&ap, fdes) = fd; - SCARG(&ap, asa) = sup; - SCARG(&ap, alen) = lenp; - if ((error = sys_getpeername(p, &ap, retval)) != 0) { - DPRINTF(("ti_ioctl: getpeername error\n")); - return error; - } - } - break; - - case SVR4_TI_SETMYNAME: - DPRINTF(("TI_SETMYNAME\n")); - return 0; - - case SVR4_TI_SETPEERNAME: - DPRINTF(("TI_SETPEERNAME\n")); - return 0; - default: - DPRINTF(("ti_ioctl: Unknown ioctl %lx\n", cmd)); - return ENOSYS; - } - - if ((error = copyin(sup, skp, samax)) != 0) { - DPRINTF(("ti_ioctl: error copying in socket data\n")); - return error; - } - - if ((error = copyin(lenp, &sasize, sizeof(*lenp))) != 0) { - DPRINTF(("ti_ioctl: error copying in socket size\n")); - return error; - } - - if (sasize < 0 || sasize > samax) { - DPRINTF(("ti_ioctl: invalid socklen on stack\n")); - error = EINVAL; - return error; - } - - if ((error = copyin(sub, &skb, sizeof(skb))) != 0) { - DPRINTF(("ti_ioctl: error copying in strbuf\n")); - return error; - } - - switch (st->s_family) { - case AF_INET: - sockaddr_to_netaddr_in(&sc, &sain); - skb.len = sasize; - break; - - case AF_UNIX: - sockaddr_to_netaddr_un(&sc, &saun); - skb.len = sasize + 4; - break; - - default: - return ENOSYS; - } - - if ((error = copyout(SVR4_ADDROF(&sc), skb.buf, sasize)) != 0) { - DPRINTF(("ti_ioctl: error copying out socket data\n")); - return error; - } - - if ((error = copyout(&skb, sub, sizeof(skb))) != 0) { - DPRINTF(("ti_ioctl: error copying out strbuf\n")); - return error; - } - - return error; -} - -static int -i_nread(fp, p, retval, fd, cmd, dat) - struct file *fp; - struct proc *p; - register_t *retval; - int fd; - u_long cmd; - caddr_t dat; -{ - int error; - int nread = 0; - - /* - * We are supposed to return the message length in nread, and the - * number of messages in retval. We don't have the notion of number - * of stream messages, so we just find out if we have any bytes waiting - * for us, and if we do, then we assume that we have at least one - * message waiting for us. - */ - if ((error = (*fp->f_ops->fo_ioctl)(fp, FIONREAD, - (caddr_t) &nread, p)) != 0) - return error; - - if (nread != 0) - *retval = 1; - else - *retval = 0; - - return copyout(&nread, dat, sizeof(nread)); -} - -static int -i_fdinsert(fp, p, retval, fd, cmd, dat) - struct file *fp; - struct proc *p; - register_t *retval; - int fd; - u_long cmd; - caddr_t dat; -{ - /* - * Major hack again here. We assume that we are using this to - * implement accept(2). If that is the case, we have already - * called accept, and we have stored the file descriptor in - * afd. We find the file descriptor that the code wants to use - * in fd insert, and then we dup2() our accepted file descriptor - * to it. - */ - int error; - struct svr4_strm *st = svr4_stream_get(fp); - struct svr4_strfdinsert fdi; - struct sys_dup2_args d2p; - struct sys_close_args clp; - - if (st == NULL) { - DPRINTF(("fdinsert: bad file type\n")); - return EINVAL; - } - - if (st->s_afd == -1) { - DPRINTF(("fdinsert: accept fd not found\n")); - return ENOENT; - } - - if ((error = copyin(dat, &fdi, sizeof(fdi))) != 0) { - DPRINTF(("fdinsert: copyin failed %d\n", error)); - return error; - } - - SCARG(&d2p, from) = st->s_afd; - SCARG(&d2p, to) = fdi.fd; - - if ((error = sys_dup2(p, &d2p, retval)) != 0) { - DPRINTF(("fdinsert: dup2(%d, %d) failed %d\n", - st->s_afd, fdi.fd, error)); - return error; - } - - SCARG(&clp, fd) = st->s_afd; - - if ((error = sys_close(p, &clp, retval)) != 0) { - DPRINTF(("fdinsert: close(%d) failed %d\n", - st->s_afd, error)); - return error; - } - - st->s_afd = -1; - - *retval = 0; - return 0; -} - - -static int -_i_bind_rsvd(fp, p, retval, fd, cmd, dat) - struct file *fp; - struct proc *p; - register_t *retval; - int fd; - u_long cmd; - caddr_t dat; -{ - struct sys_mknod_args ap; - - /* - * This is a supposed to be a kernel and library only ioctl. - * It gets called before ti_bind, when we have a unix - * socket, to physically create the socket transport and - * ``reserve'' it. I don't know how this get reserved inside - * the kernel, but we are going to create it nevertheless. - */ - SCARG(&ap, path) = dat; - SCARG(&ap, mode) = S_IFIFO; - - return sys_mkfifo(p, &ap, retval); -} - -static int -_i_rele_rsvd(fp, p, retval, fd, cmd, dat) - struct file *fp; - struct proc *p; - register_t *retval; - int fd; - u_long cmd; - caddr_t dat; -{ - struct sys_unlink_args ap; - - /* - * This is a supposed to be a kernel and library only ioctl. - * I guess it is supposed to release the socket. - */ - SCARG(&ap, path) = dat; - - return sys_unlink(p, &ap, retval); -} - -static int -i_str(fp, p, retval, fd, cmd, dat) - struct file *fp; - struct proc *p; - register_t *retval; - int fd; - u_long cmd; - caddr_t dat; -{ - int error; - struct svr4_strioctl ioc; - - if ((error = copyin(dat, &ioc, sizeof(ioc))) != 0) - return error; - -#ifdef DEBUG_SVR4 - if ((error = show_ioc(">", &ioc)) != 0) - return error; -#endif /* DEBUG_SVR4 */ - - switch (ioc.cmd & 0xff00) { - case SVR4_SIMOD: - if ((error = sockmod(fp, fd, &ioc, p)) != 0) - return error; - break; - - case SVR4_TIMOD: - if ((error = timod(fp, fd, &ioc, p)) != 0) - return error; - break; - - default: - DPRINTF(("Unimplemented module %c %ld\n", - (char) (cmd >> 8), cmd & 0xff)); - return 0; - } - -#ifdef DEBUG_SVR4 - if ((error = show_ioc("<", &ioc)) != 0) - return error; -#endif /* DEBUG_SVR4 */ - return copyout(&ioc, dat, sizeof(ioc)); -} - - -int -svr4_stream_ioctl(fp, p, retval, fd, cmd, dat) - struct file *fp; - struct proc *p; - register_t *retval; - int fd; - u_long cmd; - caddr_t dat; -{ - *retval = 0; - - /* - * All the following stuff assumes "sockmod" is pushed... - */ - switch (cmd) { - case SVR4_I_NREAD: - DPRINTF(("I_NREAD\n")); - return i_nread(fp, p, retval, fd, cmd, dat); - - case SVR4_I_PUSH: - DPRINTF(("I_PUSH\n")); - return 0; - - case SVR4_I_POP: - DPRINTF(("I_POP\n")); - return 0; - - case SVR4_I_LOOK: - DPRINTF(("I_LOOK\n")); - return 0; - - case SVR4_I_FLUSH: - DPRINTF(("I_FLUSH\n")); - return 0; - - case SVR4_I_SRDOPT: - DPRINTF(("I_SRDOPT\n")); - return 0; - - case SVR4_I_GRDOPT: - DPRINTF(("I_GRDOPT\n")); - return 0; - - case SVR4_I_STR: - DPRINTF(("I_STR\n")); - return i_str(fp, p, retval, fd, cmd, dat); - - case SVR4_I_SETSIG: - DPRINTF(("I_SETSIG\n")); - /* - * This is the best we can do for now; we cannot generate - * signals only for specific events so the signal mask gets - * ignored. - * - * We alse have to fix the O_ASYNC fcntl bit, so the - * process will get SIGPOLLs. */ - { - struct sys_fcntl_args fa; - int error; - register_t oflags, flags; - - /* get old status flags */ - SCARG(&fa, fd) = fd; - SCARG(&fa, cmd) = F_GETFL; - if ((error = sys_fcntl(p, &fa, &oflags)) != 0) - return error; - - /* update the flags */ - if ((long) dat != 0) - flags = oflags | O_ASYNC; - else - flags = oflags & ~O_ASYNC; - - /* set the new flags, if changed */ - if (flags != oflags) { - SCARG(&fa, cmd) = F_SETFL; - SCARG(&fa, arg) = (void *) flags; - if ((error = sys_fcntl(p, &fa, &flags)) != 0) - return error; - } - - /* set up SIGIO receiver if needed */ - if ((long) dat != 0) { - SCARG(&fa, cmd) = F_SETOWN; - SCARG(&fa, arg) = (void *) p->p_pid; - return sys_fcntl(p, &fa, retval); - } - } - - case SVR4_I_GETSIG: - DPRINTF(("I_GETSIG\n")); - return EINVAL; - - case SVR4_I_FIND: - DPRINTF(("I_FIND\n")); - /* - * Here we are not pushing modules really, we just - * pretend all are present - */ - *retval = 1; - return 0; - - case SVR4_I_LINK: - DPRINTF(("I_LINK\n")); - return 0; - - case SVR4_I_UNLINK: - DPRINTF(("I_UNLINK\n")); - return 0; - - case SVR4_I_ERECVFD: - DPRINTF(("I_ERECVFD\n")); - return 0; - - case SVR4_I_PEEK: - DPRINTF(("I_PEEK\n")); - return 0; - - case SVR4_I_FDINSERT: - DPRINTF(("I_FDINSERT\n")); - return i_fdinsert(fp, p, retval, fd, cmd, dat); - - case SVR4_I_SENDFD: - DPRINTF(("I_SENDFD\n")); - return 0; - - case SVR4_I_RECVFD: - DPRINTF(("I_RECVFD\n")); - return 0; - - case SVR4_I_SWROPT: - DPRINTF(("I_SWROPT\n")); - return 0; - - case SVR4_I_GWROPT: - DPRINTF(("I_GWROPT\n")); - return 0; - - case SVR4_I_LIST: - DPRINTF(("I_LIST\n")); - return 0; - - case SVR4_I_PLINK: - DPRINTF(("I_PLINK\n")); - return 0; - - case SVR4_I_PUNLINK: - DPRINTF(("I_PUNLINK\n")); - return 0; - - case SVR4_I_SETEV: - DPRINTF(("I_SETEV\n")); - return 0; - - case SVR4_I_GETEV: - DPRINTF(("I_GETEV\n")); - return 0; - - case SVR4_I_STREV: - DPRINTF(("I_STREV\n")); - return 0; - - case SVR4_I_UNSTREV: - DPRINTF(("I_UNSTREV\n")); - return 0; - - case SVR4_I_FLUSHBAND: - DPRINTF(("I_FLUSHBAND\n")); - return 0; - - case SVR4_I_CKBAND: - DPRINTF(("I_CKBAND\n")); - return 0; - - case SVR4_I_GETBAND: - DPRINTF(("I_GETBANK\n")); - return 0; - - case SVR4_I_ATMARK: - DPRINTF(("I_ATMARK\n")); - return 0; - - case SVR4_I_SETCLTIME: - DPRINTF(("I_SETCLTIME\n")); - return 0; - - case SVR4_I_GETCLTIME: - DPRINTF(("I_GETCLTIME\n")); - return 0; - - case SVR4_I_CANPUT: - DPRINTF(("I_CANPUT\n")); - return 0; - - case SVR4__I_BIND_RSVD: - DPRINTF(("_I_BIND_RSVD\n")); - return _i_bind_rsvd(fp, p, retval, fd, cmd, dat); - - case SVR4__I_RELE_RSVD: - DPRINTF(("_I_RELE_RSVD\n")); - return _i_rele_rsvd(fp, p, retval, fd, cmd, dat); - - default: - DPRINTF(("unimpl cmd = %lx\n", cmd)); - break; - } - - return 0; -} - - - - -int -svr4_sys_putmsg(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_putmsg_args *uap = v; - struct filedesc *fdp = p->p_fd; - struct file *fp; - struct svr4_strbuf dat, ctl; - struct svr4_strmcmd sc; - struct sockaddr_in sain; - struct sockaddr_un saun; - void *skp, *sup; - int sasize; - struct svr4_strm *st; - int error; - caddr_t sg; - -#ifdef DEBUG_SVR4 - show_msg(">putmsg", SCARG(uap, fd), SCARG(uap, ctl), - SCARG(uap, dat), SCARG(uap, flags)); -#endif /* DEBUG_SVR4 */ - - if ((fp = fd_getfile(fdp, SCARG(uap, fd))) == NULL) - return EBADF; - FREF(fp); - - if (SCARG(uap, ctl) != NULL) { - if ((error = copyin(SCARG(uap, ctl), &ctl, sizeof(ctl))) != 0) - goto out; - } - else - ctl.len = -1; - - if (SCARG(uap, dat) != NULL) { - if ((error = copyin(SCARG(uap, dat), &dat, sizeof(dat))) != 0) - goto out; - } - else - dat.len = -1; - - /* - * Only for sockets for now. - */ - if ((st = svr4_stream_get(fp)) == NULL) { - DPRINTF(("putmsg: bad file type\n")); - error = EINVAL; - goto out; - } - - if (ctl.len > sizeof(sc)) { - DPRINTF(("putmsg: Bad control size %d != %d\n", ctl.len, - sizeof(struct svr4_strmcmd))); - error = EINVAL; - goto out; - } - - if ((error = copyin(ctl.buf, &sc, ctl.len)) != 0) - goto out; - - switch (st->s_family) { - case AF_INET: - if (sc.len != sizeof(sain)) { - DPRINTF(("putmsg: Invalid inet length %ld\n", sc.len)); - error = ENOSYS; - goto out; - } - netaddr_to_sockaddr_in(&sain, &sc); - skp = &sain; - sasize = sizeof(sain); - error = sain.sin_family != st->s_family; - break; - - case AF_UNIX: - if (ctl.len == 8) { - /* We are doing an accept; succeed */ - DPRINTF(("putmsg: Do nothing\n")); - *retval = 0; - error = 0; - goto out; - } else { - /* Maybe we've been given a device/inode pair */ - dev_t *dev = SVR4_ADDROF(&sc); - ino_t *ino = (ino_t *) &dev[1]; - skp = svr4_find_socket(p, fp, *dev, *ino); - if (skp == NULL) { - skp = &saun; - /* I guess we have it by name */ - netaddr_to_sockaddr_un(skp, &sc); - } - sasize = sizeof(saun); - } - break; - - default: - DPRINTF(("putmsg: Unsupported address family %d\n", - st->s_family)); - error = ENOSYS; - goto out; - } - - sg = stackgap_init(p->p_emul); - sup = stackgap_alloc(&sg, sasize); - - if ((error = copyout(skp, sup, sasize)) != 0) - goto out; - - switch (st->s_cmd = sc.cmd) { - case SVR4_TI_CONNECT_REQUEST: /* connect */ - { - struct sys_connect_args co; - - SCARG(&co, s) = SCARG(uap, fd); - SCARG(&co, name) = (void *)sup; - SCARG(&co, namelen) = (int)sasize; - error = sys_connect(p, &co, retval); - goto out; - } - - case SVR4_TI_SENDTO_REQUEST: /* sendto */ - { - struct msghdr msg; - struct iovec aiov; - - msg.msg_name = (caddr_t) sup; - msg.msg_namelen = sasize; - msg.msg_iov = &aiov; - msg.msg_iovlen = 1; - msg.msg_control = 0; - msg.msg_flags = 0; - aiov.iov_base = dat.buf; - aiov.iov_len = dat.len; - error = sendit(p, SCARG(uap, fd), &msg, - SCARG(uap, flags), retval); - - *retval = 0; - goto out; - } - - default: - DPRINTF(("putmsg: Unimplemented command %lx\n", sc.cmd)); - error = ENOSYS; - goto out; - } - -out: - FRELE(fp); - return (error); -} - - -int -svr4_sys_getmsg(p, v, retval) - register struct proc *p; - void *v; - register_t *retval; -{ - struct svr4_sys_getmsg_args *uap = v; - struct filedesc *fdp = p->p_fd; - struct file *fp; - struct sys_getpeername_args ga; - struct sys_accept_args aa; - struct svr4_strbuf dat, ctl; - struct svr4_strmcmd sc; - int error; - struct msghdr msg; - struct iovec aiov; - struct sockaddr_in sain; - struct sockaddr_un saun; - void *skp, *sup; - int sasize; - struct svr4_strm *st; - int *flen; - int fl; - caddr_t sg; - - bzero(&sc, sizeof(sc)); - -#ifdef DEBUG_SVR4 - show_msg(">getmsg", SCARG(uap, fd), SCARG(uap, ctl), - SCARG(uap, dat), 0); -#endif /* DEBUG_SVR4 */ - - if ((fp = fd_getfile(fdp, SCARG(uap, fd))) == NULL) - return EBADF; - FREF(fp); - - if (SCARG(uap, ctl) != NULL) { - if ((error = copyin(SCARG(uap, ctl), &ctl, sizeof(ctl))) != 0) - goto out; - } - else { - ctl.len = -1; - ctl.maxlen = 0; - } - - if (SCARG(uap, dat) != NULL) { - if ((error = copyin(SCARG(uap, dat), &dat, sizeof(dat))) != 0) - goto out; - } - else { - dat.len = -1; - dat.maxlen = 0; - } - - /* - * Only for sockets for now. - */ - if ((st = svr4_stream_get(fp)) == NULL) { - DPRINTF(("getmsg: bad file type\n")); - error = EINVAL; - goto out; - } - - if (ctl.maxlen == -1 || dat.maxlen == -1) { - DPRINTF(("getmsg: Cannot handle -1 maxlen (yet)\n")); - error = ENOSYS; - goto out; - } - - switch (st->s_family) { - case AF_INET: - skp = &sain; - sasize = sizeof(sain); - break; - - case AF_UNIX: - skp = &saun; - sasize = sizeof(saun); - break; - - default: - DPRINTF(("getmsg: Unsupported address family %d\n", - st->s_family)); - error = ENOSYS; - goto out; - } - - sg = stackgap_init(p->p_emul); - sup = stackgap_alloc(&sg, sasize); - flen = (int *) stackgap_alloc(&sg, sizeof(*flen)); - - fl = sasize; - if ((error = copyout(&fl, flen, sizeof(fl))) != 0) - goto out; - - switch (st->s_cmd) { - case SVR4_TI_CONNECT_REQUEST: - DPRINTF(("getmsg: TI_CONNECT_REQUEST\n")); - /* - * We do the connect in one step, so the putmsg should - * have gotten the error. - */ - sc.cmd = SVR4_TI_OK_REPLY; - sc.len = 0; - - ctl.len = 8; - dat.len = -1; - fl = 1; - st->s_cmd = sc.cmd; - break; - - case SVR4_TI_OK_REPLY: - DPRINTF(("getmsg: TI_OK_REPLY\n")); - - /* - * We are immediately after a connect reply, so we send - * a connect verification. - */ - SCARG(&ga, fdes) = SCARG(uap, fd); - SCARG(&ga, asa) = (void *)sup; - SCARG(&ga, alen) = flen; - - if ((error = sys_getpeername(p, &ga, retval)) != 0) { - DPRINTF(("getmsg: getpeername failed %d\n", error)); - goto out; - } - - if ((error = copyin(sup, skp, sasize)) != 0) - goto out; - - sc.cmd = SVR4_TI_CONNECT_REPLY; - sc.pad[0] = 0x4; - sc.offs = 0x18; - sc.pad[1] = 0x14; - sc.pad[2] = 0x04000402; - - switch (st->s_family) { - case AF_INET: - sc.len = sasize; - sockaddr_to_netaddr_in(&sc, &sain); - break; - - case AF_UNIX: - sc.len = sasize + 4; - sockaddr_to_netaddr_un(&sc, &saun); - break; - - default: - error = ENOSYS; - goto out; - } - - ctl.len = 40; - dat.len = -1; - fl = 0; - st->s_cmd = sc.cmd; - break; - - case SVR4_TI__ACCEPT_OK: - DPRINTF(("getmsg: TI__ACCEPT_OK\n")); - /* - * We do the connect in one step, so the putmsg should - * have gotten the error. - */ - sc.cmd = SVR4_TI_OK_REPLY; - sc.len = 1; - - ctl.len = 8; - dat.len = -1; - fl = 1; - st->s_cmd = SVR4_TI__ACCEPT_WAIT; - break; - - case SVR4_TI__ACCEPT_WAIT: - DPRINTF(("getmsg: TI__ACCEPT_WAIT\n")); - /* - * We are after a listen, so we try to accept... - */ - SCARG(&aa, s) = SCARG(uap, fd); - SCARG(&aa, name) = (void *)sup; - SCARG(&aa, anamelen) = flen; - - if ((error = sys_accept(p, &aa, retval)) != 0) { - DPRINTF(("getmsg: accept failed %d\n", error)); - goto out; - } - - st->s_afd = *retval; - - DPRINTF(("getmsg: Accept fd = %d\n", st->s_afd)); - - if ((error = copyin(sup, skp, sasize)) != 0) - goto out; - - sc.cmd = SVR4_TI_ACCEPT_REPLY; - sc.len = sasize; - sc.offs = 0x18; - sc.pad[0] = 0x0; - sc.pad[1] = 0x28; - sc.pad[2] = 0x3; - - switch (st->s_family) { - case AF_INET: - sc.pad[1] = 0x28; - sockaddr_to_netaddr_in(&sc, &sain); - ctl.len = 40; - sc.len = sasize; - break; - - case AF_UNIX: - sc.pad[1] = 0x00010000; - sc.pad[2] = 0xf6bcdaa0; /* I don't know what that is */ - sc.pad[3] = 0x00010000; - ctl.len = 134; - sc.len = sasize + 4; - break; - - default: - error = ENOSYS; - goto out; - } - - ctl.len = 40; - dat.len = -1; - fl = 0; - st->s_cmd = SVR4_TI__ACCEPT_OK; - break; - - case SVR4_TI_SENDTO_REQUEST: - DPRINTF(("getmsg: TI_SENDTO_REQUEST\n")); - if (ctl.maxlen > 36 && ctl.len < 36) - ctl.len = 36; - - if (ctl.len > sizeof(sc)) - ctl.len = sizeof(sc); - - if ((error = copyin(ctl.buf, &sc, ctl.len)) != 0) - goto out; - - switch (st->s_family) { - case AF_INET: - sockaddr_to_netaddr_in(&sc, &sain); - break; - - case AF_UNIX: - sockaddr_to_netaddr_un(&sc, &saun); - break; - - default: - error = ENOSYS; - goto out; - } - - msg.msg_name = (caddr_t) sup; - msg.msg_namelen = sasize; - msg.msg_iov = &aiov; - msg.msg_iovlen = 1; - msg.msg_control = 0; - aiov.iov_base = dat.buf; - aiov.iov_len = dat.maxlen; - msg.msg_flags = 0; - - error = recvit(p, SCARG(uap, fd), &msg, (caddr_t) flen, retval); - - if (error) { - DPRINTF(("getmsg: recvit failed %d\n", error)); - goto out; - } - - if ((error = copyin(msg.msg_name, skp, sasize)) != 0) - goto out; - - sc.cmd = SVR4_TI_RECVFROM_REPLY; - - switch (st->s_family) { - case AF_INET: - sc.len = sasize; - sockaddr_to_netaddr_in(&sc, &sain); - break; - - case AF_UNIX: - sc.len = sasize + 4; - sockaddr_to_netaddr_un(&sc, &saun); - break; - - default: - error = ENOSYS; - goto out; - } - - dat.len = *retval; - fl = 0; - st->s_cmd = sc.cmd; - break; - - default: - st->s_cmd = sc.cmd; - DPRINTF(("getmsg: Unknown state %x\n", st->s_cmd)); - error = EINVAL; - goto out; - } - - if (SCARG(uap, ctl)) { - if (ctl.len != -1) - if ((error = copyout(&sc, ctl.buf, ctl.len)) != 0) - goto out; - - if ((error = copyout(&ctl, SCARG(uap, ctl), sizeof(ctl))) != 0) - goto out; - } - - if (SCARG(uap, dat)) { - if ((error = copyout(&dat, SCARG(uap, dat), sizeof(dat))) != 0) - goto out; - } - - if (SCARG(uap, flags)) { /* XXX: Need translation */ - if ((error = copyout(&fl, SCARG(uap, flags), sizeof(fl))) != 0) - goto out; - } - - *retval = 0; - -#ifdef DEBUG_SVR4 - show_msg("<getmsg", SCARG(uap, fd), SCARG(uap, ctl), - SCARG(uap, dat), fl); -#endif /* DEBUG_SVR4 */ -out: - FRELE(fp); - return error; -} diff --git a/sys/compat/svr4/svr4_stropts.h b/sys/compat/svr4/svr4_stropts.h deleted file mode 100644 index 929bb20e8d8..00000000000 --- a/sys/compat/svr4/svr4_stropts.h +++ /dev/null @@ -1,152 +0,0 @@ -/* $OpenBSD: svr4_stropts.h,v 1.5 2002/03/14 01:26:51 millert Exp $ */ -/* $NetBSD: svr4_stropts.h,v 1.9 1996/10/28 08:46:38 fvdl Exp $ */ - -/* - * Copyright (c) 1994 Christos Zoulas - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _SVR4_STROPTS_H_ -#define _SVR4_STROPTS_H_ - - -struct svr4_strbuf { - int maxlen; - int len; - char *buf; -}; - -#define SVR4_STR ('S' << 8) -#define SVR4_I_NREAD (SVR4_STR| 1) -#define SVR4_I_PUSH (SVR4_STR| 2) -#define SVR4_I_POP (SVR4_STR| 3) -#define SVR4_I_LOOK (SVR4_STR| 4) -#define SVR4_I_FLUSH (SVR4_STR| 5) -#define SVR4_I_SRDOPT (SVR4_STR| 6) -#define SVR4_I_GRDOPT (SVR4_STR| 7) -#define SVR4_I_STR (SVR4_STR| 8) -#define SVR4_I_SETSIG (SVR4_STR| 9) -#define SVR4_I_GETSIG (SVR4_STR|10) -#define SVR4_I_FIND (SVR4_STR|11) -#define SVR4_I_LINK (SVR4_STR|12) -#define SVR4_I_UNLINK (SVR4_STR|13) -#define SVR4_I_ERECVFD (SVR4_STR|14) -#define SVR4_I_PEEK (SVR4_STR|15) -#define SVR4_I_FDINSERT (SVR4_STR|16) -#define SVR4_I_SENDFD (SVR4_STR|17) -#define SVR4_I_RECVFD (SVR4_STR|18) -#define SVR4_I_SWROPT (SVR4_STR|19) -#define SVR4_I_GWROPT (SVR4_STR|20) -#define SVR4_I_LIST (SVR4_STR|21) -#define SVR4_I_PLINK (SVR4_STR|22) -#define SVR4_I_PUNLINK (SVR4_STR|23) -#define SVR4_I_SETEV (SVR4_STR|24) -#define SVR4_I_GETEV (SVR4_STR|25) -#define SVR4_I_STREV (SVR4_STR|26) -#define SVR4_I_UNSTREV (SVR4_STR|27) -#define SVR4_I_FLUSHBAND (SVR4_STR|28) -#define SVR4_I_CKBAND (SVR4_STR|29) -#define SVR4_I_GETBAND (SVR4_STR|30) -#define SVR4_I_ATMARK (SVR4_STR|31) -#define SVR4_I_SETCLTIME (SVR4_STR|32) -#define SVR4_I_GETCLTIME (SVR4_STR|33) -#define SVR4_I_CANPUT (SVR4_STR|34) - -/* - * The following two ioctls are OS specific and - * undocumented. - */ -#define SVR4__I_BIND_RSVD (SVR4_STR|242) -#define SVR4__I_RELE_RSVD (SVR4_STR|243) - -/* Struct passed for SVR4_I_STR */ -struct svr4_strioctl { - u_long cmd; - int timeout; - int len; - char *buf; -}; - - -/* - * Our internal state for the stream - * For now we keep almost nothing... In the future we can keep more - * streams state. - */ -struct svr4_strm { - int s_family; /* socket family */ - int s_cmd; /* last getmsg reply or putmsg request */ - int s_afd; /* last accepted fd; [for fd_insert] */ -}; - -/* - * The following structures are determined empirically. - */ -struct svr4_strmcmd { - long cmd; /* command ? */ - long len; /* Address len */ - long offs; /* Address offset */ - long pad[61]; -}; - -struct svr4_infocmd { - long cmd; - long tsdu; - long etsdu; - long cdata; - long ddata; - long addr; - long opt; - long tidu; - long serv; - long current; - long provider; -}; - -struct svr4_strfdinsert { - struct svr4_strbuf ctl; - struct svr4_strbuf data; - long flags; - int fd; - int offset; -}; - -struct svr4_netaddr_in { - u_short family; - u_short port; - u_long addr; -}; - -struct svr4_netaddr_un { - u_short family; - char path[1]; -}; - -#define SVR4_ADDROF(sc) (void *) (((char *) (sc)) + (sc)->offs) -#define SVR4_C_ADDROF(sc) (const void *) (((const char *) (sc)) + (sc)->offs) - -struct svr4_strm *svr4_stream_get(struct file *fp); - -#endif /* !_SVR4_STROPTS */ diff --git a/sys/compat/svr4/svr4_syscall.h b/sys/compat/svr4/svr4_syscall.h deleted file mode 100644 index b3246d23912..00000000000 --- a/sys/compat/svr4/svr4_syscall.h +++ /dev/null @@ -1,451 +0,0 @@ -/* $OpenBSD: svr4_syscall.h,v 1.35 2007/11/27 18:05:59 art Exp $ */ - -/* - * System call numbers. - * - * DO NOT EDIT-- this file is automatically generated. - * created from OpenBSD: syscalls.master,v 1.33 2003/01/30 03:29:49 millert Exp - */ - -/* syscall: "syscall" ret: "int" args: */ -#define SVR4_SYS_syscall 0 - -/* syscall: "exit" ret: "int" args: "int" */ -#define SVR4_SYS_exit 1 - -/* syscall: "fork" ret: "int" args: */ -#define SVR4_SYS_fork 2 - -/* syscall: "read" ret: "int" args: "int" "char *" "u_int" */ -#define SVR4_SYS_read 3 - -/* syscall: "write" ret: "int" args: "int" "char *" "u_int" */ -#define SVR4_SYS_write 4 - -/* syscall: "open" ret: "int" args: "char *" "int" "int" */ -#define SVR4_SYS_open 5 - -/* syscall: "close" ret: "int" args: "int" */ -#define SVR4_SYS_close 6 - -/* syscall: "wait" ret: "int" args: "int *" */ -#define SVR4_SYS_wait 7 - -/* syscall: "creat" ret: "int" args: "char *" "int" */ -#define SVR4_SYS_creat 8 - -/* syscall: "link" ret: "int" args: "char *" "char *" */ -#define SVR4_SYS_link 9 - -/* syscall: "unlink" ret: "int" args: "char *" */ -#define SVR4_SYS_unlink 10 - -/* syscall: "execv" ret: "int" args: "char *" "char **" */ -#define SVR4_SYS_execv 11 - -/* syscall: "chdir" ret: "int" args: "char *" */ -#define SVR4_SYS_chdir 12 - -/* syscall: "time" ret: "int" args: "svr4_time_t *" */ -#define SVR4_SYS_time 13 - -/* syscall: "mknod" ret: "int" args: "char *" "int" "int" */ -#define SVR4_SYS_mknod 14 - -/* syscall: "chmod" ret: "int" args: "char *" "int" */ -#define SVR4_SYS_chmod 15 - -/* syscall: "chown" ret: "int" args: "char *" "int" "int" */ -#define SVR4_SYS_chown 16 - -/* syscall: "break" ret: "int" args: "caddr_t" */ -#define SVR4_SYS_break 17 - -/* syscall: "stat" ret: "int" args: "char *" "struct svr4_stat *" */ -#define SVR4_SYS_stat 18 - -/* syscall: "lseek" ret: "long" args: "int" "long" "int" */ -#define SVR4_SYS_lseek 19 - -/* syscall: "getpid" ret: "pid_t" args: */ -#define SVR4_SYS_getpid 20 - -/* syscall: "setuid" ret: "int" args: "uid_t" */ -#define SVR4_SYS_setuid 23 - -/* syscall: "getuid" ret: "uid_t" args: */ -#define SVR4_SYS_getuid 24 - -/* syscall: "alarm" ret: "int" args: "unsigned" */ -#define SVR4_SYS_alarm 27 - -/* syscall: "fstat" ret: "int" args: "int" "struct svr4_stat *" */ -#define SVR4_SYS_fstat 28 - -/* syscall: "pause" ret: "int" args: */ -#define SVR4_SYS_pause 29 - -/* syscall: "utime" ret: "int" args: "char *" "struct svr4_utimbuf *" */ -#define SVR4_SYS_utime 30 - -/* syscall: "access" ret: "int" args: "char *" "int" */ -#define SVR4_SYS_access 33 - -/* syscall: "nice" ret: "int" args: "int" */ -#define SVR4_SYS_nice 34 - -/* syscall: "sync" ret: "int" args: */ -#define SVR4_SYS_sync 36 - -/* syscall: "kill" ret: "int" args: "int" "int" */ -#define SVR4_SYS_kill 37 - -/* syscall: "pgrpsys" ret: "int" args: "int" "int" "int" */ -#define SVR4_SYS_pgrpsys 39 - -/* syscall: "dup" ret: "int" args: "u_int" */ -#define SVR4_SYS_dup 41 - -/* syscall: "opipe" ret: "int" args: */ -#define SVR4_SYS_opipe 42 - -/* syscall: "times" ret: "int" args: "struct tms *" */ -#define SVR4_SYS_times 43 - -/* syscall: "setgid" ret: "int" args: "gid_t" */ -#define SVR4_SYS_setgid 46 - -/* syscall: "getgid" ret: "gid_t" args: */ -#define SVR4_SYS_getgid 47 - -/* syscall: "signal" ret: "int" args: "int" "svr4_sig_t" */ -#define SVR4_SYS_signal 48 - -/* syscall: "msgsys" ret: "int" args: "int" "int" "int" "int" "int" */ -#define SVR4_SYS_msgsys 49 - -/* syscall: "sysarch" ret: "int" args: "int" "void *" */ -#define SVR4_SYS_sysarch 50 - -/* syscall: "shmsys" ret: "int" args: "int" "int" "int" "int" */ -#define SVR4_SYS_shmsys 52 - -/* syscall: "semsys" ret: "int" args: "int" "int" "int" "int" "int" */ -#define SVR4_SYS_semsys 53 - -/* syscall: "ioctl" ret: "int" args: "int" "u_long" "caddr_t" */ -#define SVR4_SYS_ioctl 54 - -/* syscall: "utssys" ret: "int" args: "void *" "void *" "int" "void *" */ -#define SVR4_SYS_utssys 57 - -/* syscall: "fsync" ret: "int" args: "int" */ -#define SVR4_SYS_fsync 58 - -/* syscall: "execve" ret: "int" args: "char *" "char **" "char **" */ -#define SVR4_SYS_execve 59 - -/* syscall: "umask" ret: "int" args: "int" */ -#define SVR4_SYS_umask 60 - -/* syscall: "chroot" ret: "int" args: "char *" */ -#define SVR4_SYS_chroot 61 - -/* syscall: "fcntl" ret: "int" args: "int" "int" "char *" */ -#define SVR4_SYS_fcntl 62 - -/* syscall: "ulimit" ret: "long" args: "int" "long" */ -#define SVR4_SYS_ulimit 63 - - /* 70 is obsolete advfs */ - /* 71 is obsolete unadvfs */ - /* 72 is obsolete rmount */ - /* 73 is obsolete rumount */ - /* 74 is obsolete rfstart */ - /* 75 is obsolete sigret */ -/* syscall: "rdebug" ret: "int" args: */ -#define SVR4_SYS_rdebug 76 - - /* 77 is obsolete rfstop */ -/* syscall: "rmdir" ret: "int" args: "char *" */ -#define SVR4_SYS_rmdir 79 - -/* syscall: "mkdir" ret: "int" args: "char *" "int" */ -#define SVR4_SYS_mkdir 80 - -/* syscall: "getdents" ret: "int" args: "int" "char *" "int" */ -#define SVR4_SYS_getdents 81 - - /* 82 is obsolete libattach */ - /* 83 is obsolete libdetach */ -/* syscall: "getmsg" ret: "int" args: "int" "struct svr4_strbuf *" "struct svr4_strbuf *" "int *" */ -#define SVR4_SYS_getmsg 85 - -/* syscall: "putmsg" ret: "int" args: "int" "struct svr4_strbuf *" "struct svr4_strbuf *" "int" */ -#define SVR4_SYS_putmsg 86 - -/* syscall: "poll" ret: "int" args: "struct pollfd *" "u_long" "int" */ -#define SVR4_SYS_poll 87 - -/* syscall: "lstat" ret: "int" args: "char *" "struct svr4_stat *" */ -#define SVR4_SYS_lstat 88 - -/* syscall: "symlink" ret: "int" args: "char *" "char *" */ -#define SVR4_SYS_symlink 89 - -/* syscall: "readlink" ret: "int" args: "char *" "char *" "int" */ -#define SVR4_SYS_readlink 90 - -/* syscall: "getgroups" ret: "int" args: "u_int" "gid_t *" */ -#define SVR4_SYS_getgroups 91 - -/* syscall: "setgroups" ret: "int" args: "u_int" "gid_t *" */ -#define SVR4_SYS_setgroups 92 - -/* syscall: "fchmod" ret: "int" args: "int" "int" */ -#define SVR4_SYS_fchmod 93 - -/* syscall: "fchown" ret: "int" args: "int" "int" "int" */ -#define SVR4_SYS_fchown 94 - -/* syscall: "sigprocmask" ret: "int" args: "int" "svr4_sigset_t *" "svr4_sigset_t *" */ -#define SVR4_SYS_sigprocmask 95 - -/* syscall: "sigsuspend" ret: "int" args: "svr4_sigset_t *" */ -#define SVR4_SYS_sigsuspend 96 - -/* syscall: "sigaltstack" ret: "int" args: "struct svr4_sigaltstack *" "struct svr4_sigaltstack *" */ -#define SVR4_SYS_sigaltstack 97 - -/* syscall: "sigaction" ret: "int" args: "int" "struct svr4_sigaction *" "struct svr4_sigaction *" */ -#define SVR4_SYS_sigaction 98 - -/* syscall: "sigpending" ret: "int" args: "int" "svr4_sigset_t *" */ -#define SVR4_SYS_sigpending 99 - -/* syscall: "context" ret: "int" args: "int" "struct svr4_ucontext *" */ -#define SVR4_SYS_context 100 - -/* syscall: "statvfs" ret: "int" args: "char *" "struct svr4_statvfs *" */ -#define SVR4_SYS_statvfs 103 - -/* syscall: "fstatvfs" ret: "int" args: "int" "struct svr4_statvfs *" */ -#define SVR4_SYS_fstatvfs 104 - -/* syscall: "waitsys" ret: "int" args: "int" "int" "union svr4_siginfo *" "int" */ -#define SVR4_SYS_waitsys 107 - -/* syscall: "hrtsys" ret: "int" args: "int" "int" "int" "void *" "void *" */ -#define SVR4_SYS_hrtsys 109 - -/* syscall: "pathconf" ret: "int" args: "char *" "int" */ -#define SVR4_SYS_pathconf 113 - -/* syscall: "mincore" ret: "int" args: "caddr_t" "int" "char *" */ -#define SVR4_SYS_mincore 114 - -/* syscall: "mmap" ret: "int" args: "svr4_caddr_t" "svr4_size_t" "int" "int" "int" "svr4_off_t" */ -#define SVR4_SYS_mmap 115 - -/* syscall: "mprotect" ret: "int" args: "caddr_t" "int" "int" */ -#define SVR4_SYS_mprotect 116 - -/* syscall: "munmap" ret: "int" args: "caddr_t" "int" */ -#define SVR4_SYS_munmap 117 - -/* syscall: "fpathconf" ret: "int" args: "int" "int" */ -#define SVR4_SYS_fpathconf 118 - -/* syscall: "vfork" ret: "int" args: */ -#define SVR4_SYS_vfork 119 - -/* syscall: "fchdir" ret: "int" args: "int" */ -#define SVR4_SYS_fchdir 120 - -/* syscall: "readv" ret: "int" args: "int" "struct iovec *" "u_int" */ -#define SVR4_SYS_readv 121 - -/* syscall: "writev" ret: "int" args: "int" "struct iovec *" "u_int" */ -#define SVR4_SYS_writev 122 - -/* syscall: "xstat" ret: "int" args: "int" "char *" "struct svr4_xstat *" */ -#define SVR4_SYS_xstat 123 - -/* syscall: "lxstat" ret: "int" args: "int" "char *" "struct svr4_xstat *" */ -#define SVR4_SYS_lxstat 124 - -/* syscall: "fxstat" ret: "int" args: "int" "int" "struct svr4_xstat *" */ -#define SVR4_SYS_fxstat 125 - -/* syscall: "xmknod" ret: "int" args: "int" "char *" "svr4_mode_t" "svr4_dev_t" */ -#define SVR4_SYS_xmknod 126 - -/* syscall: "setrlimit" ret: "int" args: "int" "struct ogetrlimit *" */ -#define SVR4_SYS_setrlimit 128 - -/* syscall: "getrlimit" ret: "int" args: "int" "struct ogetrlimit *" */ -#define SVR4_SYS_getrlimit 129 - -/* syscall: "lchown" ret: "int" args: "char *" "int" "int" */ -#define SVR4_SYS_lchown 130 - -/* syscall: "memcntl" ret: "int" args: "svr4_caddr_t" "svr4_size_t" "int" "svr4_caddr_t" "int" "int" */ -#define SVR4_SYS_memcntl 131 - -/* syscall: "rename" ret: "int" args: "char *" "char *" */ -#define SVR4_SYS_rename 134 - -/* syscall: "uname" ret: "int" args: "struct svr4_utsname *" "int" */ -#define SVR4_SYS_uname 135 - -/* syscall: "setegid" ret: "int" args: "gid_t" */ -#define SVR4_SYS_setegid 136 - -/* syscall: "sysconfig" ret: "int" args: "int" */ -#define SVR4_SYS_sysconfig 137 - -/* syscall: "adjtime" ret: "int" args: "struct timeval *" "struct timeval *" */ -#define SVR4_SYS_adjtime 138 - -/* syscall: "systeminfo" ret: "long" args: "int" "char *" "long" */ -#define SVR4_SYS_systeminfo 139 - -/* syscall: "seteuid" ret: "int" args: "uid_t" */ -#define SVR4_SYS_seteuid 141 - -/* syscall: "fchroot" ret: "int" args: "int" */ -#define SVR4_SYS_fchroot 153 - -/* syscall: "utimes" ret: "int" args: "char *" "struct timeval *" */ -#define SVR4_SYS_utimes 154 - -/* syscall: "vhangup" ret: "int" args: */ -#define SVR4_SYS_vhangup 155 - -/* syscall: "gettimeofday" ret: "int" args: "struct timeval *" */ -#define SVR4_SYS_gettimeofday 156 - -/* syscall: "getitimer" ret: "int" args: "u_int" "struct itimerval *" */ -#define SVR4_SYS_getitimer 157 - -/* syscall: "setitimer" ret: "int" args: "u_int" "struct itimerval *" "struct itimerval *" */ -#define SVR4_SYS_setitimer 158 - -/* syscall: "pread" ret: "ssize_t" args: "int" "void *" "size_t" "svr4_off_t" */ -#define SVR4_SYS_pread 173 - -/* syscall: "pwrite" ret: "ssize_t" args: "int" "const void *" "size_t" "svr4_off_t" */ -#define SVR4_SYS_pwrite 174 - -/* syscall: "llseek" ret: "svr4_off64_t" args: "int" "long" "long" "int" */ -#define SVR4_SYS_llseek 175 - -/* syscall: "acl" ret: "int" args: "char *" "int" "int" "struct svr4_aclent *" */ -#define SVR4_SYS_acl 185 - -/* syscall: "auditsys" ret: "int" args: "int" "int" "int" "int" "int" "int" */ -#define SVR4_SYS_auditsys 186 - -/* syscall: "clock_gettime" ret: "int" args: "clockid_t" "struct timespec *" */ -#define SVR4_SYS_clock_gettime 191 - -/* syscall: "clock_settime" ret: "int" args: "clockid_t" "const struct timespec *" */ -#define SVR4_SYS_clock_settime 192 - -/* syscall: "clock_getres" ret: "int" args: "clockid_t" "struct timespec *" */ -#define SVR4_SYS_clock_getres 193 - -/* syscall: "nanosleep" ret: "int" args: "const struct timespec *" "struct timespec *" */ -#define SVR4_SYS_nanosleep 199 - -/* syscall: "facl" ret: "int" args: "int" "int" "int" "struct svr4_aclent *" */ -#define SVR4_SYS_facl 200 - -/* syscall: "setreuid" ret: "int" args: "uid_t" "uid_t" */ -#define SVR4_SYS_setreuid 202 - -/* syscall: "setregid" ret: "int" args: "gid_t" "gid_t" */ -#define SVR4_SYS_setregid 203 - -/* syscall: "getdents64" ret: "int" args: "int" "struct svr4_dirent64 *" "int" */ -#define SVR4_SYS_getdents64 213 - -/* syscall: "mmap64" ret: "int" args: "svr4_caddr_t" "svr4_size_t" "int" "int" "int" "svr4_off64_t" */ -#define SVR4_SYS_mmap64 214 - -/* syscall: "stat64" ret: "int" args: "const char *" "struct svr4_stat64 *" */ -#define SVR4_SYS_stat64 215 - -/* syscall: "lstat64" ret: "int" args: "const char *" "struct svr4_stat64 *" */ -#define SVR4_SYS_lstat64 216 - -/* syscall: "fstat64" ret: "int" args: "int" "struct svr4_stat64 *" */ -#define SVR4_SYS_fstat64 217 - -/* syscall: "fstatvfs64" ret: "int" args: "int" "struct svr4_statvfs64 *" */ -#define SVR4_SYS_fstatvfs64 219 - -/* syscall: "pread64" ret: "ssize_t" args: "int" "void *" "size_t" "svr4_off64_t" */ -#define SVR4_SYS_pread64 222 - -/* syscall: "pwrite64" ret: "ssize_t" args: "int" "const void *" "size_t" "svr4_off64_t" */ -#define SVR4_SYS_pwrite64 223 - -/* syscall: "creat64" ret: "int" args: "char *" "int" */ -#define SVR4_SYS_creat64 224 - -/* syscall: "open64" ret: "int" args: "char *" "int" "int" */ -#define SVR4_SYS_open64 225 - -/* syscall: "socket" ret: "int" args: "int" "int" "int" */ -#define SVR4_SYS_socket 230 - -/* syscall: "socketpair" ret: "int" args: "int" "int" "int" "int *" */ -#define SVR4_SYS_socketpair 231 - -/* syscall: "bind" ret: "int" args: "int" "const struct sockaddr *" "int" */ -#define SVR4_SYS_bind 232 - -/* syscall: "listen" ret: "int" args: "int" "int" */ -#define SVR4_SYS_listen 233 - -/* syscall: "accept" ret: "int" args: "int" "struct sockaddr *" "int *" */ -#define SVR4_SYS_accept 234 - -/* syscall: "connect" ret: "int" args: "int" "const struct sockaddr *" "int" */ -#define SVR4_SYS_connect 235 - -/* syscall: "shutdown" ret: "int" args: "int" "int" */ -#define SVR4_SYS_shutdown 236 - -/* syscall: "recv" ret: "int" args: "int" "caddr_t" "int" "int" */ -#define SVR4_SYS_recv 237 - -/* syscall: "recvfrom" ret: "ssize_t" args: "int" "void *" "size_t" "int" "struct sockaddr *" "int *" */ -#define SVR4_SYS_recvfrom 238 - -/* syscall: "recvmsg" ret: "ssize_t" args: "int" "struct msghdr *" "int" */ -#define SVR4_SYS_recvmsg 239 - -/* syscall: "send" ret: "int" args: "int" "caddr_t" "int" "int" */ -#define SVR4_SYS_send 240 - -/* syscall: "sendmsg" ret: "ssize_t" args: "int" "const struct msghdr *" "int" */ -#define SVR4_SYS_sendmsg 241 - -/* syscall: "sendto" ret: "ssize_t" args: "int" "const void *" "size_t" "int" "const struct sockaddr *" "int" */ -#define SVR4_SYS_sendto 242 - -/* syscall: "getpeername" ret: "int" args: "int" "struct sockaddr *" "int *" */ -#define SVR4_SYS_getpeername 243 - -/* syscall: "getsockname" ret: "int" args: "int" "struct sockaddr *" "int *" */ -#define SVR4_SYS_getsockname 244 - -/* syscall: "getsockopt" ret: "int" args: "int" "int" "int" "void *" "int *" */ -#define SVR4_SYS_getsockopt 245 - -/* syscall: "setsockopt" ret: "int" args: "int" "int" "int" "const void *" "int" */ -#define SVR4_SYS_setsockopt 246 - -#define SVR4_SYS_MAXSYSCALL 250 diff --git a/sys/compat/svr4/svr4_syscallargs.h b/sys/compat/svr4/svr4_syscallargs.h deleted file mode 100644 index 567b9783d10..00000000000 --- a/sys/compat/svr4/svr4_syscallargs.h +++ /dev/null @@ -1,608 +0,0 @@ -/* $OpenBSD: svr4_syscallargs.h,v 1.36 2007/11/27 18:05:59 art Exp $ */ - -/* - * System call argument lists. - * - * DO NOT EDIT-- this file is automatically generated. - * created from OpenBSD: syscalls.master,v 1.33 2003/01/30 03:29:49 millert Exp - */ - -#ifdef syscallarg -#undef syscallarg -#endif - -#define syscallarg(x) \ - union { \ - register_t pad; \ - struct { x datum; } le; \ - struct { \ - int8_t pad[ (sizeof (register_t) < sizeof (x)) \ - ? 0 \ - : sizeof (register_t) - sizeof (x)]; \ - x datum; \ - } be; \ - } - -struct svr4_sys_open_args { - syscallarg(char *) path; - syscallarg(int) flags; - syscallarg(int) mode; -}; - -struct svr4_sys_wait_args { - syscallarg(int *) status; -}; - -struct svr4_sys_creat_args { - syscallarg(char *) path; - syscallarg(int) mode; -}; - -struct svr4_sys_execv_args { - syscallarg(char *) path; - syscallarg(char **) argp; -}; - -struct svr4_sys_time_args { - syscallarg(svr4_time_t *) t; -}; - -struct svr4_sys_mknod_args { - syscallarg(char *) path; - syscallarg(int) mode; - syscallarg(int) dev; -}; - -struct svr4_sys_break_args { - syscallarg(caddr_t) nsize; -}; - -struct svr4_sys_stat_args { - syscallarg(char *) path; - syscallarg(struct svr4_stat *) ub; -}; - -struct svr4_sys_alarm_args { - syscallarg(unsigned) sec; -}; - -struct svr4_sys_fstat_args { - syscallarg(int) fd; - syscallarg(struct svr4_stat *) sb; -}; - -struct svr4_sys_utime_args { - syscallarg(char *) path; - syscallarg(struct svr4_utimbuf *) ubuf; -}; - -struct svr4_sys_access_args { - syscallarg(char *) path; - syscallarg(int) flags; -}; - -struct svr4_sys_nice_args { - syscallarg(int) prio; -}; - -struct svr4_sys_kill_args { - syscallarg(int) pid; - syscallarg(int) signum; -}; - -struct svr4_sys_pgrpsys_args { - syscallarg(int) cmd; - syscallarg(int) pid; - syscallarg(int) pgid; -}; - -struct svr4_sys_times_args { - syscallarg(struct tms *) tp; -}; - -struct svr4_sys_signal_args { - syscallarg(int) signum; - syscallarg(svr4_sig_t) handler; -}; - -struct svr4_sys_msgsys_args { - syscallarg(int) what; - syscallarg(int) a2; - syscallarg(int) a3; - syscallarg(int) a4; - syscallarg(int) a5; -}; - -struct svr4_sys_sysarch_args { - syscallarg(int) op; - syscallarg(void *) a1; -}; - -struct svr4_sys_shmsys_args { - syscallarg(int) what; - syscallarg(int) a2; - syscallarg(int) a3; - syscallarg(int) a4; -}; - -struct svr4_sys_semsys_args { - syscallarg(int) what; - syscallarg(int) a2; - syscallarg(int) a3; - syscallarg(int) a4; - syscallarg(int) a5; -}; - -struct svr4_sys_ioctl_args { - syscallarg(int) fd; - syscallarg(u_long) com; - syscallarg(caddr_t) data; -}; - -struct svr4_sys_utssys_args { - syscallarg(void *) a1; - syscallarg(void *) a2; - syscallarg(int) sel; - syscallarg(void *) a3; -}; - -struct svr4_sys_execve_args { - syscallarg(char *) path; - syscallarg(char **) argp; - syscallarg(char **) envp; -}; - -struct svr4_sys_fcntl_args { - syscallarg(int) fd; - syscallarg(int) cmd; - syscallarg(char *) arg; -}; - -struct svr4_sys_ulimit_args { - syscallarg(int) cmd; - syscallarg(long) newlimit; -}; - -struct svr4_sys_getdents_args { - syscallarg(int) fd; - syscallarg(char *) buf; - syscallarg(int) nbytes; -}; - -struct svr4_sys_getmsg_args { - syscallarg(int) fd; - syscallarg(struct svr4_strbuf *) ctl; - syscallarg(struct svr4_strbuf *) dat; - syscallarg(int *) flags; -}; - -struct svr4_sys_putmsg_args { - syscallarg(int) fd; - syscallarg(struct svr4_strbuf *) ctl; - syscallarg(struct svr4_strbuf *) dat; - syscallarg(int) flags; -}; - -struct svr4_sys_lstat_args { - syscallarg(char *) path; - syscallarg(struct svr4_stat *) ub; -}; - -struct svr4_sys_sigprocmask_args { - syscallarg(int) how; - syscallarg(svr4_sigset_t *) set; - syscallarg(svr4_sigset_t *) oset; -}; - -struct svr4_sys_sigsuspend_args { - syscallarg(svr4_sigset_t *) ss; -}; - -struct svr4_sys_sigaltstack_args { - syscallarg(struct svr4_sigaltstack *) nss; - syscallarg(struct svr4_sigaltstack *) oss; -}; - -struct svr4_sys_sigaction_args { - syscallarg(int) signum; - syscallarg(struct svr4_sigaction *) nsa; - syscallarg(struct svr4_sigaction *) osa; -}; - -struct svr4_sys_sigpending_args { - syscallarg(int) what; - syscallarg(svr4_sigset_t *) mask; -}; - -struct svr4_sys_context_args { - syscallarg(int) func; - syscallarg(struct svr4_ucontext *) uc; -}; - -struct svr4_sys_statvfs_args { - syscallarg(char *) path; - syscallarg(struct svr4_statvfs *) fs; -}; - -struct svr4_sys_fstatvfs_args { - syscallarg(int) fd; - syscallarg(struct svr4_statvfs *) fs; -}; - -struct svr4_sys_waitsys_args { - syscallarg(int) grp; - syscallarg(int) id; - syscallarg(union svr4_siginfo *) info; - syscallarg(int) options; -}; - -struct svr4_sys_hrtsys_args { - syscallarg(int) cmd; - syscallarg(int) fun; - syscallarg(int) sub; - syscallarg(void *) rv1; - syscallarg(void *) rv2; -}; - -struct svr4_sys_pathconf_args { - syscallarg(char *) path; - syscallarg(int) name; -}; - -struct svr4_sys_mmap_args { - syscallarg(svr4_caddr_t) addr; - syscallarg(svr4_size_t) len; - syscallarg(int) prot; - syscallarg(int) flags; - syscallarg(int) fd; - syscallarg(svr4_off_t) pos; -}; - -struct svr4_sys_fpathconf_args { - syscallarg(int) fd; - syscallarg(int) name; -}; - -struct svr4_sys_xstat_args { - syscallarg(int) two; - syscallarg(char *) path; - syscallarg(struct svr4_xstat *) ub; -}; - -struct svr4_sys_lxstat_args { - syscallarg(int) two; - syscallarg(char *) path; - syscallarg(struct svr4_xstat *) ub; -}; - -struct svr4_sys_fxstat_args { - syscallarg(int) two; - syscallarg(int) fd; - syscallarg(struct svr4_xstat *) sb; -}; - -struct svr4_sys_xmknod_args { - syscallarg(int) two; - syscallarg(char *) path; - syscallarg(svr4_mode_t) mode; - syscallarg(svr4_dev_t) dev; -}; - -struct svr4_sys_setrlimit_args { - syscallarg(int) which; - syscallarg(struct ogetrlimit *) rlp; -}; - -struct svr4_sys_getrlimit_args { - syscallarg(int) which; - syscallarg(struct ogetrlimit *) rlp; -}; - -struct svr4_sys_memcntl_args { - syscallarg(svr4_caddr_t) addr; - syscallarg(svr4_size_t) len; - syscallarg(int) cmd; - syscallarg(svr4_caddr_t) arg; - syscallarg(int) attr; - syscallarg(int) mask; -}; - -struct svr4_sys_uname_args { - syscallarg(struct svr4_utsname *) name; - syscallarg(int) dummy; -}; - -struct svr4_sys_setegid_args { - syscallarg(gid_t) egid; -}; - -struct svr4_sys_sysconfig_args { - syscallarg(int) name; -}; - -struct svr4_sys_systeminfo_args { - syscallarg(int) what; - syscallarg(char *) buf; - syscallarg(long) len; -}; - -struct svr4_sys_fchroot_args { - syscallarg(int) fd; -}; - -struct svr4_sys_utimes_args { - syscallarg(char *) path; - syscallarg(struct timeval *) tptr; -}; - -struct svr4_sys_gettimeofday_args { - syscallarg(struct timeval *) tp; -}; - -struct svr4_sys_pread_args { - syscallarg(int) fd; - syscallarg(void *) buf; - syscallarg(size_t) nbyte; - syscallarg(svr4_off_t) off; -}; - -struct svr4_sys_pwrite_args { - syscallarg(int) fd; - syscallarg(const void *) buf; - syscallarg(size_t) nbyte; - syscallarg(svr4_off_t) off; -}; - -struct svr4_sys_llseek_args { - syscallarg(int) fd; - syscallarg(long) offset1; - syscallarg(long) offset2; - syscallarg(int) whence; -}; - -struct svr4_sys_acl_args { - syscallarg(char *) path; - syscallarg(int) cmd; - syscallarg(int) num; - syscallarg(struct svr4_aclent *) buf; -}; - -struct svr4_sys_auditsys_args { - syscallarg(int) code; - syscallarg(int) a1; - syscallarg(int) a2; - syscallarg(int) a3; - syscallarg(int) a4; - syscallarg(int) a5; -}; - -struct svr4_sys_facl_args { - syscallarg(int) fd; - syscallarg(int) cmd; - syscallarg(int) num; - syscallarg(struct svr4_aclent *) buf; -}; - -struct svr4_sys_getdents64_args { - syscallarg(int) fd; - syscallarg(struct svr4_dirent64 *) dp; - syscallarg(int) nbytes; -}; - -struct svr4_sys_mmap64_args { - syscallarg(svr4_caddr_t) addr; - syscallarg(svr4_size_t) len; - syscallarg(int) prot; - syscallarg(int) flags; - syscallarg(int) fd; - syscallarg(svr4_off64_t) pos; -}; - -struct svr4_sys_stat64_args { - syscallarg(const char *) path; - syscallarg(struct svr4_stat64 *) sb; -}; - -struct svr4_sys_lstat64_args { - syscallarg(const char *) path; - syscallarg(struct svr4_stat64 *) sb; -}; - -struct svr4_sys_fstat64_args { - syscallarg(int) fd; - syscallarg(struct svr4_stat64 *) sb; -}; - -struct svr4_sys_fstatvfs64_args { - syscallarg(int) fd; - syscallarg(struct svr4_statvfs64 *) fs; -}; - -struct svr4_sys_pread64_args { - syscallarg(int) fd; - syscallarg(void *) buf; - syscallarg(size_t) nbyte; - syscallarg(svr4_off64_t) off; -}; - -struct svr4_sys_pwrite64_args { - syscallarg(int) fd; - syscallarg(const void *) buf; - syscallarg(size_t) nbyte; - syscallarg(svr4_off64_t) off; -}; - -struct svr4_sys_creat64_args { - syscallarg(char *) path; - syscallarg(int) mode; -}; - -struct svr4_sys_open64_args { - syscallarg(char *) path; - syscallarg(int) flags; - syscallarg(int) mode; -}; - -struct svr4_sys_socket_args { - syscallarg(int) domain; - syscallarg(int) type; - syscallarg(int) protocol; -}; - -/* - * System call prototypes. - */ - -int sys_nosys(struct proc *, void *, register_t *); -int sys_exit(struct proc *, void *, register_t *); -int sys_fork(struct proc *, void *, register_t *); -int sys_read(struct proc *, void *, register_t *); -int sys_write(struct proc *, void *, register_t *); -int svr4_sys_open(struct proc *, void *, register_t *); -int sys_close(struct proc *, void *, register_t *); -int svr4_sys_wait(struct proc *, void *, register_t *); -int svr4_sys_creat(struct proc *, void *, register_t *); -int sys_link(struct proc *, void *, register_t *); -int sys_unlink(struct proc *, void *, register_t *); -int svr4_sys_execv(struct proc *, void *, register_t *); -int sys_chdir(struct proc *, void *, register_t *); -int svr4_sys_time(struct proc *, void *, register_t *); -int svr4_sys_mknod(struct proc *, void *, register_t *); -int sys_chmod(struct proc *, void *, register_t *); -int sys_chown(struct proc *, void *, register_t *); -int svr4_sys_break(struct proc *, void *, register_t *); -int svr4_sys_stat(struct proc *, void *, register_t *); -int compat_43_sys_lseek(struct proc *, void *, register_t *); -int sys_getpid(struct proc *, void *, register_t *); -int sys_setuid(struct proc *, void *, register_t *); -int sys_getuid(struct proc *, void *, register_t *); -int svr4_sys_alarm(struct proc *, void *, register_t *); -int svr4_sys_fstat(struct proc *, void *, register_t *); -int svr4_sys_pause(struct proc *, void *, register_t *); -int svr4_sys_utime(struct proc *, void *, register_t *); -int svr4_sys_access(struct proc *, void *, register_t *); -int svr4_sys_nice(struct proc *, void *, register_t *); -int sys_sync(struct proc *, void *, register_t *); -int svr4_sys_kill(struct proc *, void *, register_t *); -int svr4_sys_pgrpsys(struct proc *, void *, register_t *); -int sys_dup(struct proc *, void *, register_t *); -int sys_opipe(struct proc *, void *, register_t *); -int svr4_sys_times(struct proc *, void *, register_t *); -int sys_setgid(struct proc *, void *, register_t *); -int sys_getgid(struct proc *, void *, register_t *); -int svr4_sys_signal(struct proc *, void *, register_t *); -#ifdef SYSVMSG -int svr4_sys_msgsys(struct proc *, void *, register_t *); -#else -#endif -int svr4_sys_sysarch(struct proc *, void *, register_t *); -#ifdef SYSVSHM -int svr4_sys_shmsys(struct proc *, void *, register_t *); -#else -#endif -#ifdef SYSVSEM -int svr4_sys_semsys(struct proc *, void *, register_t *); -#else -#endif -int svr4_sys_ioctl(struct proc *, void *, register_t *); -int svr4_sys_utssys(struct proc *, void *, register_t *); -int sys_fsync(struct proc *, void *, register_t *); -int svr4_sys_execve(struct proc *, void *, register_t *); -int sys_umask(struct proc *, void *, register_t *); -int sys_chroot(struct proc *, void *, register_t *); -int svr4_sys_fcntl(struct proc *, void *, register_t *); -int svr4_sys_ulimit(struct proc *, void *, register_t *); -int svr4_sys_rdebug(struct proc *, void *, register_t *); -int sys_rmdir(struct proc *, void *, register_t *); -int sys_mkdir(struct proc *, void *, register_t *); -int svr4_sys_getdents(struct proc *, void *, register_t *); -int svr4_sys_getmsg(struct proc *, void *, register_t *); -int svr4_sys_putmsg(struct proc *, void *, register_t *); -int sys_poll(struct proc *, void *, register_t *); -int svr4_sys_lstat(struct proc *, void *, register_t *); -int sys_symlink(struct proc *, void *, register_t *); -int sys_readlink(struct proc *, void *, register_t *); -int sys_getgroups(struct proc *, void *, register_t *); -int sys_setgroups(struct proc *, void *, register_t *); -int sys_fchmod(struct proc *, void *, register_t *); -int sys_fchown(struct proc *, void *, register_t *); -int svr4_sys_sigprocmask(struct proc *, void *, register_t *); -int svr4_sys_sigsuspend(struct proc *, void *, register_t *); -int svr4_sys_sigaltstack(struct proc *, void *, register_t *); -int svr4_sys_sigaction(struct proc *, void *, register_t *); -int svr4_sys_sigpending(struct proc *, void *, register_t *); -int svr4_sys_context(struct proc *, void *, register_t *); -int svr4_sys_statvfs(struct proc *, void *, register_t *); -int svr4_sys_fstatvfs(struct proc *, void *, register_t *); -int svr4_sys_waitsys(struct proc *, void *, register_t *); -int svr4_sys_hrtsys(struct proc *, void *, register_t *); -int svr4_sys_pathconf(struct proc *, void *, register_t *); -int sys_mincore(struct proc *, void *, register_t *); -int svr4_sys_mmap(struct proc *, void *, register_t *); -int sys_mprotect(struct proc *, void *, register_t *); -int sys_munmap(struct proc *, void *, register_t *); -int svr4_sys_fpathconf(struct proc *, void *, register_t *); -int sys_vfork(struct proc *, void *, register_t *); -int sys_fchdir(struct proc *, void *, register_t *); -int sys_readv(struct proc *, void *, register_t *); -int sys_writev(struct proc *, void *, register_t *); -int svr4_sys_xstat(struct proc *, void *, register_t *); -int svr4_sys_lxstat(struct proc *, void *, register_t *); -int svr4_sys_fxstat(struct proc *, void *, register_t *); -int svr4_sys_xmknod(struct proc *, void *, register_t *); -int svr4_sys_setrlimit(struct proc *, void *, register_t *); -int svr4_sys_getrlimit(struct proc *, void *, register_t *); -int sys_lchown(struct proc *, void *, register_t *); -int svr4_sys_memcntl(struct proc *, void *, register_t *); -int sys_rename(struct proc *, void *, register_t *); -int svr4_sys_uname(struct proc *, void *, register_t *); -int svr4_sys_setegid(struct proc *, void *, register_t *); -int svr4_sys_sysconfig(struct proc *, void *, register_t *); -int sys_adjtime(struct proc *, void *, register_t *); -int svr4_sys_systeminfo(struct proc *, void *, register_t *); -int sys_seteuid(struct proc *, void *, register_t *); -int svr4_sys_fchroot(struct proc *, void *, register_t *); -int svr4_sys_utimes(struct proc *, void *, register_t *); -int svr4_sys_vhangup(struct proc *, void *, register_t *); -int svr4_sys_gettimeofday(struct proc *, void *, register_t *); -int sys_getitimer(struct proc *, void *, register_t *); -int sys_setitimer(struct proc *, void *, register_t *); -int svr4_sys_pread(struct proc *, void *, register_t *); -int svr4_sys_pwrite(struct proc *, void *, register_t *); -int svr4_sys_llseek(struct proc *, void *, register_t *); -int svr4_sys_acl(struct proc *, void *, register_t *); -int svr4_sys_auditsys(struct proc *, void *, register_t *); -int sys_clock_gettime(struct proc *, void *, register_t *); -int sys_clock_settime(struct proc *, void *, register_t *); -int sys_clock_getres(struct proc *, void *, register_t *); -int sys_nanosleep(struct proc *, void *, register_t *); -int svr4_sys_facl(struct proc *, void *, register_t *); -int sys_setreuid(struct proc *, void *, register_t *); -int sys_setregid(struct proc *, void *, register_t *); -int svr4_sys_getdents64(struct proc *, void *, register_t *); -int svr4_sys_mmap64(struct proc *, void *, register_t *); -int svr4_sys_stat64(struct proc *, void *, register_t *); -int svr4_sys_lstat64(struct proc *, void *, register_t *); -int svr4_sys_fstat64(struct proc *, void *, register_t *); -int svr4_sys_fstatvfs64(struct proc *, void *, register_t *); -int svr4_sys_pread64(struct proc *, void *, register_t *); -int svr4_sys_pwrite64(struct proc *, void *, register_t *); -int svr4_sys_creat64(struct proc *, void *, register_t *); -int svr4_sys_open64(struct proc *, void *, register_t *); -int svr4_sys_socket(struct proc *, void *, register_t *); -int sys_socketpair(struct proc *, void *, register_t *); -int sys_bind(struct proc *, void *, register_t *); -int sys_listen(struct proc *, void *, register_t *); -int compat_43_sys_accept(struct proc *, void *, register_t *); -int sys_connect(struct proc *, void *, register_t *); -int sys_shutdown(struct proc *, void *, register_t *); -int compat_43_sys_recv(struct proc *, void *, register_t *); -int compat_43_sys_recvfrom(struct proc *, void *, register_t *); -int compat_43_sys_recvmsg(struct proc *, void *, register_t *); -int compat_43_sys_send(struct proc *, void *, register_t *); -int compat_43_sys_sendmsg(struct proc *, void *, register_t *); -int sys_sendto(struct proc *, void *, register_t *); -int compat_43_sys_getpeername(struct proc *, void *, register_t *); -int compat_43_sys_getsockname(struct proc *, void *, register_t *); -int sys_getsockopt(struct proc *, void *, register_t *); -int sys_setsockopt(struct proc *, void *, register_t *); diff --git a/sys/compat/svr4/svr4_syscalls.c b/sys/compat/svr4/svr4_syscalls.c deleted file mode 100644 index 4078143af14..00000000000 --- a/sys/compat/svr4/svr4_syscalls.c +++ /dev/null @@ -1,273 +0,0 @@ -/* $OpenBSD: svr4_syscalls.c,v 1.35 2007/11/27 18:05:59 art Exp $ */ - -/* - * System call names. - * - * DO NOT EDIT-- this file is automatically generated. - * created from OpenBSD: syscalls.master,v 1.33 2003/01/30 03:29:49 millert Exp - */ - -char *svr4_syscallnames[] = { - "syscall", /* 0 = syscall */ - "exit", /* 1 = exit */ - "fork", /* 2 = fork */ - "read", /* 3 = read */ - "write", /* 4 = write */ - "open", /* 5 = open */ - "close", /* 6 = close */ - "wait", /* 7 = wait */ - "creat", /* 8 = creat */ - "link", /* 9 = link */ - "unlink", /* 10 = unlink */ - "execv", /* 11 = execv */ - "chdir", /* 12 = chdir */ - "time", /* 13 = time */ - "mknod", /* 14 = mknod */ - "chmod", /* 15 = chmod */ - "chown", /* 16 = chown */ - "break", /* 17 = break */ - "stat", /* 18 = stat */ - "lseek", /* 19 = lseek */ - "getpid", /* 20 = getpid */ - "#21 (unimplemented old_mount)", /* 21 = unimplemented old_mount */ - "#22 (unimplemented System V umount)", /* 22 = unimplemented System V umount */ - "setuid", /* 23 = setuid */ - "getuid", /* 24 = getuid */ - "#25 (unimplemented stime)", /* 25 = unimplemented stime */ - "#26 (unimplemented ptrace)", /* 26 = unimplemented ptrace */ - "alarm", /* 27 = alarm */ - "fstat", /* 28 = fstat */ - "pause", /* 29 = pause */ - "utime", /* 30 = utime */ - "#31 (unimplemented was stty)", /* 31 = unimplemented was stty */ - "#32 (unimplemented was gtty)", /* 32 = unimplemented was gtty */ - "access", /* 33 = access */ - "nice", /* 34 = nice */ - "#35 (unimplemented statfs)", /* 35 = unimplemented statfs */ - "sync", /* 36 = sync */ - "kill", /* 37 = kill */ - "#38 (unimplemented fstatfs)", /* 38 = unimplemented fstatfs */ - "pgrpsys", /* 39 = pgrpsys */ - "#40 (unimplemented xenix)", /* 40 = unimplemented xenix */ - "dup", /* 41 = dup */ - "opipe", /* 42 = opipe */ - "times", /* 43 = times */ - "#44 (unimplemented profil)", /* 44 = unimplemented profil */ - "#45 (unimplemented plock)", /* 45 = unimplemented plock */ - "setgid", /* 46 = setgid */ - "getgid", /* 47 = getgid */ - "signal", /* 48 = signal */ -#ifdef SYSVMSG - "msgsys", /* 49 = msgsys */ -#else - "#49 (unimplemented msgsys)", /* 49 = unimplemented msgsys */ -#endif - "sysarch", /* 50 = sysarch */ - "#51 (unimplemented acct)", /* 51 = unimplemented acct */ -#ifdef SYSVSHM - "shmsys", /* 52 = shmsys */ -#else - "#52 (unimplemented shmsys)", /* 52 = unimplemented shmsys */ -#endif -#ifdef SYSVSEM - "semsys", /* 53 = semsys */ -#else - "#53 (unimplemented semsys)", /* 53 = unimplemented semsys */ -#endif - "ioctl", /* 54 = ioctl */ - "#55 (unimplemented uadmin)", /* 55 = unimplemented uadmin */ - "#56 (unimplemented exch)", /* 56 = unimplemented exch */ - "utssys", /* 57 = utssys */ - "fsync", /* 58 = fsync */ - "execve", /* 59 = execve */ - "umask", /* 60 = umask */ - "chroot", /* 61 = chroot */ - "fcntl", /* 62 = fcntl */ - "ulimit", /* 63 = ulimit */ - "#64 (unimplemented reserved for unix/pc)", /* 64 = unimplemented reserved for unix/pc */ - "#65 (unimplemented reserved for unix/pc)", /* 65 = unimplemented reserved for unix/pc */ - "#66 (unimplemented reserved for unix/pc)", /* 66 = unimplemented reserved for unix/pc */ - "#67 (unimplemented reserved for unix/pc)", /* 67 = unimplemented reserved for unix/pc */ - "#68 (unimplemented reserved for unix/pc)", /* 68 = unimplemented reserved for unix/pc */ - "#69 (unimplemented reserved for unix/pc)", /* 69 = unimplemented reserved for unix/pc */ - "#70 (obsolete advfs)", /* 70 = obsolete advfs */ - "#71 (obsolete unadvfs)", /* 71 = obsolete unadvfs */ - "#72 (obsolete rmount)", /* 72 = obsolete rmount */ - "#73 (obsolete rumount)", /* 73 = obsolete rumount */ - "#74 (obsolete rfstart)", /* 74 = obsolete rfstart */ - "#75 (obsolete sigret)", /* 75 = obsolete sigret */ - "rdebug", /* 76 = rdebug */ - "#77 (obsolete rfstop)", /* 77 = obsolete rfstop */ - "#78 (unimplemented rfsys)", /* 78 = unimplemented rfsys */ - "rmdir", /* 79 = rmdir */ - "mkdir", /* 80 = mkdir */ - "getdents", /* 81 = getdents */ - "#82 (obsolete libattach)", /* 82 = obsolete libattach */ - "#83 (obsolete libdetach)", /* 83 = obsolete libdetach */ - "#84 (unimplemented sysfs)", /* 84 = unimplemented sysfs */ - "getmsg", /* 85 = getmsg */ - "putmsg", /* 86 = putmsg */ - "poll", /* 87 = poll */ - "lstat", /* 88 = lstat */ - "symlink", /* 89 = symlink */ - "readlink", /* 90 = readlink */ - "getgroups", /* 91 = getgroups */ - "setgroups", /* 92 = setgroups */ - "fchmod", /* 93 = fchmod */ - "fchown", /* 94 = fchown */ - "sigprocmask", /* 95 = sigprocmask */ - "sigsuspend", /* 96 = sigsuspend */ - "sigaltstack", /* 97 = sigaltstack */ - "sigaction", /* 98 = sigaction */ - "sigpending", /* 99 = sigpending */ - "context", /* 100 = context */ - "#101 (unimplemented evsys)", /* 101 = unimplemented evsys */ - "#102 (unimplemented evtrapret)", /* 102 = unimplemented evtrapret */ - "statvfs", /* 103 = statvfs */ - "fstatvfs", /* 104 = fstatvfs */ - "#105 (unimplemented)", /* 105 = unimplemented */ - "#106 (unimplemented nfssvc)", /* 106 = unimplemented nfssvc */ - "waitsys", /* 107 = waitsys */ - "#108 (unimplemented sigsendsys)", /* 108 = unimplemented sigsendsys */ - "hrtsys", /* 109 = hrtsys */ - "#110 (unimplemented acancel)", /* 110 = unimplemented acancel */ - "#111 (unimplemented async)", /* 111 = unimplemented async */ - "#112 (unimplemented priocntlsys)", /* 112 = unimplemented priocntlsys */ - "pathconf", /* 113 = pathconf */ - "mincore", /* 114 = mincore */ - "mmap", /* 115 = mmap */ - "mprotect", /* 116 = mprotect */ - "munmap", /* 117 = munmap */ - "fpathconf", /* 118 = fpathconf */ - "vfork", /* 119 = vfork */ - "fchdir", /* 120 = fchdir */ - "readv", /* 121 = readv */ - "writev", /* 122 = writev */ - "xstat", /* 123 = xstat */ - "lxstat", /* 124 = lxstat */ - "fxstat", /* 125 = fxstat */ - "xmknod", /* 126 = xmknod */ - "#127 (unimplemented clocal)", /* 127 = unimplemented clocal */ - "setrlimit", /* 128 = setrlimit */ - "getrlimit", /* 129 = getrlimit */ - "lchown", /* 130 = lchown */ - "memcntl", /* 131 = memcntl */ - "#132 (unimplemented getpmsg)", /* 132 = unimplemented getpmsg */ - "#133 (unimplemented putpmsg)", /* 133 = unimplemented putpmsg */ - "rename", /* 134 = rename */ - "uname", /* 135 = uname */ - "setegid", /* 136 = setegid */ - "sysconfig", /* 137 = sysconfig */ - "adjtime", /* 138 = adjtime */ - "systeminfo", /* 139 = systeminfo */ - "#140 (unimplemented)", /* 140 = unimplemented */ - "seteuid", /* 141 = seteuid */ - "#142 (unimplemented vtrace)", /* 142 = unimplemented vtrace */ - "#143 (unimplemented fork1)", /* 143 = unimplemented fork1 */ - "#144 (unimplemented sigtimedwait)", /* 144 = unimplemented sigtimedwait */ - "#145 (unimplemented lwp_info)", /* 145 = unimplemented lwp_info */ - "#146 (unimplemented yield)", /* 146 = unimplemented yield */ - "#147 (unimplemented lwp_sema_wait)", /* 147 = unimplemented lwp_sema_wait */ - "#148 (unimplemented lwp_sema_post)", /* 148 = unimplemented lwp_sema_post */ - "#149 (unimplemented lwp_sema_trywait)", /* 149 = unimplemented lwp_sema_trywait */ - "#150 (unimplemented)", /* 150 = unimplemented */ - "#151 (unimplemented)", /* 151 = unimplemented */ - "#152 (unimplemented modctl)", /* 152 = unimplemented modctl */ - "fchroot", /* 153 = fchroot */ - "utimes", /* 154 = utimes */ - "vhangup", /* 155 = vhangup */ - "gettimeofday", /* 156 = gettimeofday */ - "getitimer", /* 157 = getitimer */ - "setitimer", /* 158 = setitimer */ - "#159 (unimplemented lwp_create)", /* 159 = unimplemented lwp_create */ - "#160 (unimplemented lwp_exit)", /* 160 = unimplemented lwp_exit */ - "#161 (unimplemented lwp_suspend)", /* 161 = unimplemented lwp_suspend */ - "#162 (unimplemented lwp_continue)", /* 162 = unimplemented lwp_continue */ - "#163 (unimplemented lwp_kill)", /* 163 = unimplemented lwp_kill */ - "#164 (unimplemented lwp_self)", /* 164 = unimplemented lwp_self */ - "#165 (unimplemented lwp_getprivate)", /* 165 = unimplemented lwp_getprivate */ - "#166 (unimplemented lwp_setprivate)", /* 166 = unimplemented lwp_setprivate */ - "#167 (unimplemented lwp_wait)", /* 167 = unimplemented lwp_wait */ - "#168 (unimplemented lwp_mutex_unlock)", /* 168 = unimplemented lwp_mutex_unlock */ - "#169 (unimplemented lwp_mutex_lock)", /* 169 = unimplemented lwp_mutex_lock */ - "#170 (unimplemented lwp_cond_wait)", /* 170 = unimplemented lwp_cond_wait */ - "#171 (unimplemented lwp_cond_signal)", /* 171 = unimplemented lwp_cond_signal */ - "#172 (unimplemented lwp_cond_broadcast)", /* 172 = unimplemented lwp_cond_broadcast */ - "pread", /* 173 = pread */ - "pwrite", /* 174 = pwrite */ - "llseek", /* 175 = llseek */ - "#176 (unimplemented inst_sync)", /* 176 = unimplemented inst_sync */ - "#177 (unimplemented)", /* 177 = unimplemented */ - "#178 (unimplemented kaio)", /* 178 = unimplemented kaio */ - "#179 (unimplemented)", /* 179 = unimplemented */ - "#180 (unimplemented)", /* 180 = unimplemented */ - "#181 (unimplemented)", /* 181 = unimplemented */ - "#182 (unimplemented)", /* 182 = unimplemented */ - "#183 (unimplemented)", /* 183 = unimplemented */ - "#184 (unimplemented tsolsys)", /* 184 = unimplemented tsolsys */ - "acl", /* 185 = acl */ - "auditsys", /* 186 = auditsys */ - "#187 (unimplemented processor_bind)", /* 187 = unimplemented processor_bind */ - "#188 (unimplemented processor_info)", /* 188 = unimplemented processor_info */ - "#189 (unimplemented p_online)", /* 189 = unimplemented p_online */ - "#190 (unimplemented sigqueue)", /* 190 = unimplemented sigqueue */ - "clock_gettime", /* 191 = clock_gettime */ - "clock_settime", /* 192 = clock_settime */ - "clock_getres", /* 193 = clock_getres */ - "#194 (unimplemented timer_create)", /* 194 = unimplemented timer_create */ - "#195 (unimplemented timer_delete)", /* 195 = unimplemented timer_delete */ - "#196 (unimplemented timer_settime)", /* 196 = unimplemented timer_settime */ - "#197 (unimplemented timer_gettime)", /* 197 = unimplemented timer_gettime */ - "#198 (unimplemented timer_getoverrun)", /* 198 = unimplemented timer_getoverrun */ - "nanosleep", /* 199 = nanosleep */ - "facl", /* 200 = facl */ - "#201 (unimplemented door)", /* 201 = unimplemented door */ - "setreuid", /* 202 = setreuid */ - "setregid", /* 203 = setregid */ - "#204 (unimplemented install_utrap)", /* 204 = unimplemented install_utrap */ - "#205 (unimplemented signotify)", /* 205 = unimplemented signotify */ - "#206 (unimplemented schedctl)", /* 206 = unimplemented schedctl */ - "#207 (unimplemented pset)", /* 207 = unimplemented pset */ - "#208 (unimplemented)", /* 208 = unimplemented */ - "#209 (unimplemented resolvepath)", /* 209 = unimplemented resolvepath */ - "#210 (unimplemented signotifywait)", /* 210 = unimplemented signotifywait */ - "#211 (unimplemented lwp_sigredirect)", /* 211 = unimplemented lwp_sigredirect */ - "#212 (unimplemented lwp_alarm)", /* 212 = unimplemented lwp_alarm */ - "getdents64", /* 213 = getdents64 */ - "mmap64", /* 214 = mmap64 */ - "stat64", /* 215 = stat64 */ - "lstat64", /* 216 = lstat64 */ - "fstat64", /* 217 = fstat64 */ - "#218 (unimplemented statvfs64)", /* 218 = unimplemented statvfs64 */ - "fstatvfs64", /* 219 = fstatvfs64 */ - "#220 (unimplemented setrlimit64)", /* 220 = unimplemented setrlimit64 */ - "#221 (unimplemented getrlimit64)", /* 221 = unimplemented getrlimit64 */ - "pread64", /* 222 = pread64 */ - "pwrite64", /* 223 = pwrite64 */ - "creat64", /* 224 = creat64 */ - "open64", /* 225 = open64 */ - "#226 (unimplemented rpcsys)", /* 226 = unimplemented rpcsys */ - "#227 (unimplemented)", /* 227 = unimplemented */ - "#228 (unimplemented)", /* 228 = unimplemented */ - "#229 (unimplemented)", /* 229 = unimplemented */ - "socket", /* 230 = socket */ - "socketpair", /* 231 = socketpair */ - "bind", /* 232 = bind */ - "listen", /* 233 = listen */ - "accept", /* 234 = accept */ - "connect", /* 235 = connect */ - "shutdown", /* 236 = shutdown */ - "recv", /* 237 = recv */ - "recvfrom", /* 238 = recvfrom */ - "recvmsg", /* 239 = recvmsg */ - "send", /* 240 = send */ - "sendmsg", /* 241 = sendmsg */ - "sendto", /* 242 = sendto */ - "getpeername", /* 243 = getpeername */ - "getsockname", /* 244 = getsockname */ - "getsockopt", /* 245 = getsockopt */ - "setsockopt", /* 246 = setsockopt */ - "#247 (unimplemented sockconfig)", /* 247 = unimplemented sockconfig */ - "#248 (unimplemented ntp_gettime)", /* 248 = unimplemented ntp_gettime */ - "#249 (unimplemented ntp_adjtime)", /* 249 = unimplemented ntp_adjtime */ -}; diff --git a/sys/compat/svr4/svr4_sysconfig.h b/sys/compat/svr4/svr4_sysconfig.h deleted file mode 100644 index b9906940301..00000000000 --- a/sys/compat/svr4/svr4_sysconfig.h +++ /dev/null @@ -1,62 +0,0 @@ -/* $OpenBSD: svr4_sysconfig.h,v 1.2 1996/08/02 20:35:44 niklas Exp $ */ -/* $NetBSD: svr4_sysconfig.h,v 1.1 1995/07/02 06:16:10 christos Exp $ */ - -/* - * Copyright (c) 1995 Christos Zoulas - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _SVR4_SYSCONFIG_H_ -#define _SVR4_SYSCONFIG_H_ - -#define SVR4_CONFIG_UNUSED 0x01 -#define SVR4_CONFIG_NGROUPS 0x02 -#define SVR4_CONFIG_CHILD_MAX 0x03 -#define SVR4_CONFIG_OPEN_FILES 0x04 -#define SVR4_CONFIG_POSIX_VER 0x05 -#define SVR4_CONFIG_PAGESIZE 0x06 -#define SVR4_CONFIG_CLK_TCK 0x07 -#define SVR4_CONFIG_XOPEN_VER 0x08 -#define SVR4_CONFIG_UNUSED_9 0x09 -#define SVR4_CONFIG_PROF_TCK 0x0a -#define SVR4_CONFIG_NPROC_CONF 0x0b -#define SVR4_CONFIG_NPROC_ONLN 0x0c -#define SVR4_CONFIG_AIO_LISTIO_MAX 0x0e -#define SVR4_CONFIG_AIO_MAX 0x0f -#define SVR4_CONFIG_AIO_PRIO_DELTA_MAX 0x10 -#define SVR4_CONFIG_DELAYTIMER_MAX 0x11 -#define SVR4_CONFIG_MQ_OPEN_MAX 0x12 -#define SVR4_CONFIG_MQ_PRIO_MAX 0x13 -#define SVR4_CONFIG_RTSIG_MAX 0x14 -#define SVR4_CONFIG_SEM_NSEMS_MAX 0x15 -#define SVR4_CONFIG_SEM_VALUE_MAX 0x16 -#define SVR4_CONFIG_SIGQUEUE_MAX 0x17 -#define SVR4_CONFIG_SIGRT_MIN 0x18 -#define SVR4_CONFIG_SIGRT_MAX 0x19 -#define SVR4_CONFIG_TIMER_MAX 0x20 -#define SVR4_CONFIG_PHYS_PAGES 0x21 -#define SVR4_CONFIG_AVPHYS_PAGES 0x22 - -#endif /* !_SVR4_SYSCONFIG_H_ */ diff --git a/sys/compat/svr4/svr4_sysent.c b/sys/compat/svr4/svr4_sysent.c deleted file mode 100644 index 418b02f8519..00000000000 --- a/sys/compat/svr4/svr4_sysent.c +++ /dev/null @@ -1,542 +0,0 @@ -/* $OpenBSD: svr4_sysent.c,v 1.35 2007/11/27 18:05:59 art Exp $ */ - -/* - * System call switch table. - * - * DO NOT EDIT-- this file is automatically generated. - * created from OpenBSD: syscalls.master,v 1.33 2003/01/30 03:29:49 millert Exp - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/signal.h> -#include <sys/mount.h> -#include <sys/syscallargs.h> -#include <compat/svr4/svr4_types.h> -#include <compat/svr4/svr4_time.h> -#include <compat/svr4/svr4_signal.h> -#include <compat/svr4/svr4_ucontext.h> -#include <compat/svr4/svr4_syscallargs.h> -#include <compat/svr4/svr4_statvfs.h> -#include <compat/svr4/svr4_acl.h> - -#define s(type) sizeof(type) - -struct sysent svr4_sysent[] = { - { 0, 0, 0, - sys_nosys }, /* 0 = syscall */ - { 1, s(struct sys_exit_args), 0, - sys_exit }, /* 1 = exit */ - { 0, 0, 0, - sys_fork }, /* 2 = fork */ - { 3, s(struct sys_read_args), 0, - sys_read }, /* 3 = read */ - { 3, s(struct sys_write_args), 0, - sys_write }, /* 4 = write */ - { 3, s(struct svr4_sys_open_args), 0, - svr4_sys_open }, /* 5 = open */ - { 1, s(struct sys_close_args), 0, - sys_close }, /* 6 = close */ - { 1, s(struct svr4_sys_wait_args), 0, - svr4_sys_wait }, /* 7 = wait */ - { 2, s(struct svr4_sys_creat_args), 0, - svr4_sys_creat }, /* 8 = creat */ - { 2, s(struct sys_link_args), 0, - sys_link }, /* 9 = link */ - { 1, s(struct sys_unlink_args), 0, - sys_unlink }, /* 10 = unlink */ - { 2, s(struct svr4_sys_execv_args), 0, - svr4_sys_execv }, /* 11 = execv */ - { 1, s(struct sys_chdir_args), 0, - sys_chdir }, /* 12 = chdir */ - { 1, s(struct svr4_sys_time_args), 0, - svr4_sys_time }, /* 13 = time */ - { 3, s(struct svr4_sys_mknod_args), 0, - svr4_sys_mknod }, /* 14 = mknod */ - { 2, s(struct sys_chmod_args), 0, - sys_chmod }, /* 15 = chmod */ - { 3, s(struct sys_chown_args), 0, - sys_chown }, /* 16 = chown */ - { 1, s(struct svr4_sys_break_args), 0, - svr4_sys_break }, /* 17 = break */ - { 2, s(struct svr4_sys_stat_args), 0, - svr4_sys_stat }, /* 18 = stat */ - { 3, s(struct compat_43_sys_lseek_args), 0, - compat_43_sys_lseek }, /* 19 = lseek */ - { 0, 0, 0, - sys_getpid }, /* 20 = getpid */ - { 0, 0, 0, - sys_nosys }, /* 21 = unimplemented old_mount */ - { 0, 0, 0, - sys_nosys }, /* 22 = unimplemented System V umount */ - { 1, s(struct sys_setuid_args), 0, - sys_setuid }, /* 23 = setuid */ - { 0, 0, 0, - sys_getuid }, /* 24 = getuid */ - { 0, 0, 0, - sys_nosys }, /* 25 = unimplemented stime */ - { 0, 0, 0, - sys_nosys }, /* 26 = unimplemented ptrace */ - { 1, s(struct svr4_sys_alarm_args), 0, - svr4_sys_alarm }, /* 27 = alarm */ - { 2, s(struct svr4_sys_fstat_args), 0, - svr4_sys_fstat }, /* 28 = fstat */ - { 0, 0, 0, - svr4_sys_pause }, /* 29 = pause */ - { 2, s(struct svr4_sys_utime_args), 0, - svr4_sys_utime }, /* 30 = utime */ - { 0, 0, 0, - sys_nosys }, /* 31 = unimplemented was stty */ - { 0, 0, 0, - sys_nosys }, /* 32 = unimplemented was gtty */ - { 2, s(struct svr4_sys_access_args), 0, - svr4_sys_access }, /* 33 = access */ - { 1, s(struct svr4_sys_nice_args), 0, - svr4_sys_nice }, /* 34 = nice */ - { 0, 0, 0, - sys_nosys }, /* 35 = unimplemented statfs */ - { 0, 0, 0, - sys_sync }, /* 36 = sync */ - { 2, s(struct svr4_sys_kill_args), 0, - svr4_sys_kill }, /* 37 = kill */ - { 0, 0, 0, - sys_nosys }, /* 38 = unimplemented fstatfs */ - { 3, s(struct svr4_sys_pgrpsys_args), 0, - svr4_sys_pgrpsys }, /* 39 = pgrpsys */ - { 0, 0, 0, - sys_nosys }, /* 40 = unimplemented xenix */ - { 1, s(struct sys_dup_args), 0, - sys_dup }, /* 41 = dup */ - { 0, 0, 0, - sys_opipe }, /* 42 = opipe */ - { 1, s(struct svr4_sys_times_args), 0, - svr4_sys_times }, /* 43 = times */ - { 0, 0, 0, - sys_nosys }, /* 44 = unimplemented profil */ - { 0, 0, 0, - sys_nosys }, /* 45 = unimplemented plock */ - { 1, s(struct sys_setgid_args), 0, - sys_setgid }, /* 46 = setgid */ - { 0, 0, 0, - sys_getgid }, /* 47 = getgid */ - { 2, s(struct svr4_sys_signal_args), 0, - svr4_sys_signal }, /* 48 = signal */ -#ifdef SYSVMSG - { 5, s(struct svr4_sys_msgsys_args), 0, - svr4_sys_msgsys }, /* 49 = msgsys */ -#else - { 0, 0, 0, - sys_nosys }, /* 49 = unimplemented msgsys */ -#endif - { 2, s(struct svr4_sys_sysarch_args), 0, - svr4_sys_sysarch }, /* 50 = sysarch */ - { 0, 0, 0, - sys_nosys }, /* 51 = unimplemented acct */ -#ifdef SYSVSHM - { 4, s(struct svr4_sys_shmsys_args), 0, - svr4_sys_shmsys }, /* 52 = shmsys */ -#else - { 0, 0, 0, - sys_nosys }, /* 52 = unimplemented shmsys */ -#endif -#ifdef SYSVSEM - { 5, s(struct svr4_sys_semsys_args), 0, - svr4_sys_semsys }, /* 53 = semsys */ -#else - { 0, 0, 0, - sys_nosys }, /* 53 = unimplemented semsys */ -#endif - { 3, s(struct svr4_sys_ioctl_args), 0, - svr4_sys_ioctl }, /* 54 = ioctl */ - { 0, 0, 0, - sys_nosys }, /* 55 = unimplemented uadmin */ - { 0, 0, 0, - sys_nosys }, /* 56 = unimplemented exch */ - { 4, s(struct svr4_sys_utssys_args), 0, - svr4_sys_utssys }, /* 57 = utssys */ - { 1, s(struct sys_fsync_args), 0, - sys_fsync }, /* 58 = fsync */ - { 3, s(struct svr4_sys_execve_args), 0, - svr4_sys_execve }, /* 59 = execve */ - { 1, s(struct sys_umask_args), 0, - sys_umask }, /* 60 = umask */ - { 1, s(struct sys_chroot_args), 0, - sys_chroot }, /* 61 = chroot */ - { 3, s(struct svr4_sys_fcntl_args), 0, - svr4_sys_fcntl }, /* 62 = fcntl */ - { 2, s(struct svr4_sys_ulimit_args), 0, - svr4_sys_ulimit }, /* 63 = ulimit */ - { 0, 0, 0, - sys_nosys }, /* 64 = unimplemented reserved for unix/pc */ - { 0, 0, 0, - sys_nosys }, /* 65 = unimplemented reserved for unix/pc */ - { 0, 0, 0, - sys_nosys }, /* 66 = unimplemented reserved for unix/pc */ - { 0, 0, 0, - sys_nosys }, /* 67 = unimplemented reserved for unix/pc */ - { 0, 0, 0, - sys_nosys }, /* 68 = unimplemented reserved for unix/pc */ - { 0, 0, 0, - sys_nosys }, /* 69 = unimplemented reserved for unix/pc */ - { 0, 0, 0, - sys_nosys }, /* 70 = obsolete advfs */ - { 0, 0, 0, - sys_nosys }, /* 71 = obsolete unadvfs */ - { 0, 0, 0, - sys_nosys }, /* 72 = obsolete rmount */ - { 0, 0, 0, - sys_nosys }, /* 73 = obsolete rumount */ - { 0, 0, 0, - sys_nosys }, /* 74 = obsolete rfstart */ - { 0, 0, 0, - sys_nosys }, /* 75 = obsolete sigret */ - { 0, 0, 0, - svr4_sys_rdebug }, /* 76 = rdebug */ - { 0, 0, 0, - sys_nosys }, /* 77 = obsolete rfstop */ - { 0, 0, 0, - sys_nosys }, /* 78 = unimplemented rfsys */ - { 1, s(struct sys_rmdir_args), 0, - sys_rmdir }, /* 79 = rmdir */ - { 2, s(struct sys_mkdir_args), 0, - sys_mkdir }, /* 80 = mkdir */ - { 3, s(struct svr4_sys_getdents_args), 0, - svr4_sys_getdents }, /* 81 = getdents */ - { 0, 0, 0, - sys_nosys }, /* 82 = obsolete libattach */ - { 0, 0, 0, - sys_nosys }, /* 83 = obsolete libdetach */ - { 0, 0, 0, - sys_nosys }, /* 84 = unimplemented sysfs */ - { 4, s(struct svr4_sys_getmsg_args), 0, - svr4_sys_getmsg }, /* 85 = getmsg */ - { 4, s(struct svr4_sys_putmsg_args), 0, - svr4_sys_putmsg }, /* 86 = putmsg */ - { 3, s(struct sys_poll_args), 0, - sys_poll }, /* 87 = poll */ - { 2, s(struct svr4_sys_lstat_args), 0, - svr4_sys_lstat }, /* 88 = lstat */ - { 2, s(struct sys_symlink_args), 0, - sys_symlink }, /* 89 = symlink */ - { 3, s(struct sys_readlink_args), 0, - sys_readlink }, /* 90 = readlink */ - { 2, s(struct sys_getgroups_args), 0, - sys_getgroups }, /* 91 = getgroups */ - { 2, s(struct sys_setgroups_args), 0, - sys_setgroups }, /* 92 = setgroups */ - { 2, s(struct sys_fchmod_args), 0, - sys_fchmod }, /* 93 = fchmod */ - { 3, s(struct sys_fchown_args), 0, - sys_fchown }, /* 94 = fchown */ - { 3, s(struct svr4_sys_sigprocmask_args), 0, - svr4_sys_sigprocmask }, /* 95 = sigprocmask */ - { 1, s(struct svr4_sys_sigsuspend_args), 0, - svr4_sys_sigsuspend }, /* 96 = sigsuspend */ - { 2, s(struct svr4_sys_sigaltstack_args), 0, - svr4_sys_sigaltstack }, /* 97 = sigaltstack */ - { 3, s(struct svr4_sys_sigaction_args), 0, - svr4_sys_sigaction }, /* 98 = sigaction */ - { 2, s(struct svr4_sys_sigpending_args), 0, - svr4_sys_sigpending }, /* 99 = sigpending */ - { 2, s(struct svr4_sys_context_args), 0, - svr4_sys_context }, /* 100 = context */ - { 0, 0, 0, - sys_nosys }, /* 101 = unimplemented evsys */ - { 0, 0, 0, - sys_nosys }, /* 102 = unimplemented evtrapret */ - { 2, s(struct svr4_sys_statvfs_args), 0, - svr4_sys_statvfs }, /* 103 = statvfs */ - { 2, s(struct svr4_sys_fstatvfs_args), 0, - svr4_sys_fstatvfs }, /* 104 = fstatvfs */ - { 0, 0, 0, - sys_nosys }, /* 105 = unimplemented */ - { 0, 0, 0, - sys_nosys }, /* 106 = unimplemented nfssvc */ - { 4, s(struct svr4_sys_waitsys_args), 0, - svr4_sys_waitsys }, /* 107 = waitsys */ - { 0, 0, 0, - sys_nosys }, /* 108 = unimplemented sigsendsys */ - { 5, s(struct svr4_sys_hrtsys_args), 0, - svr4_sys_hrtsys }, /* 109 = hrtsys */ - { 0, 0, 0, - sys_nosys }, /* 110 = unimplemented acancel */ - { 0, 0, 0, - sys_nosys }, /* 111 = unimplemented async */ - { 0, 0, 0, - sys_nosys }, /* 112 = unimplemented priocntlsys */ - { 2, s(struct svr4_sys_pathconf_args), 0, - svr4_sys_pathconf }, /* 113 = pathconf */ - { 3, s(struct sys_mincore_args), 0, - sys_mincore }, /* 114 = mincore */ - { 6, s(struct svr4_sys_mmap_args), 0, - svr4_sys_mmap }, /* 115 = mmap */ - { 3, s(struct sys_mprotect_args), 0, - sys_mprotect }, /* 116 = mprotect */ - { 2, s(struct sys_munmap_args), 0, - sys_munmap }, /* 117 = munmap */ - { 2, s(struct svr4_sys_fpathconf_args), 0, - svr4_sys_fpathconf }, /* 118 = fpathconf */ - { 0, 0, 0, - sys_vfork }, /* 119 = vfork */ - { 1, s(struct sys_fchdir_args), 0, - sys_fchdir }, /* 120 = fchdir */ - { 3, s(struct sys_readv_args), 0, - sys_readv }, /* 121 = readv */ - { 3, s(struct sys_writev_args), 0, - sys_writev }, /* 122 = writev */ - { 3, s(struct svr4_sys_xstat_args), 0, - svr4_sys_xstat }, /* 123 = xstat */ - { 3, s(struct svr4_sys_lxstat_args), 0, - svr4_sys_lxstat }, /* 124 = lxstat */ - { 3, s(struct svr4_sys_fxstat_args), 0, - svr4_sys_fxstat }, /* 125 = fxstat */ - { 4, s(struct svr4_sys_xmknod_args), 0, - svr4_sys_xmknod }, /* 126 = xmknod */ - { 0, 0, 0, - sys_nosys }, /* 127 = unimplemented clocal */ - { 2, s(struct svr4_sys_setrlimit_args), 0, - svr4_sys_setrlimit }, /* 128 = setrlimit */ - { 2, s(struct svr4_sys_getrlimit_args), 0, - svr4_sys_getrlimit }, /* 129 = getrlimit */ - { 3, s(struct sys_lchown_args), 0, - sys_lchown }, /* 130 = lchown */ - { 6, s(struct svr4_sys_memcntl_args), 0, - svr4_sys_memcntl }, /* 131 = memcntl */ - { 0, 0, 0, - sys_nosys }, /* 132 = unimplemented getpmsg */ - { 0, 0, 0, - sys_nosys }, /* 133 = unimplemented putpmsg */ - { 2, s(struct sys_rename_args), 0, - sys_rename }, /* 134 = rename */ - { 2, s(struct svr4_sys_uname_args), 0, - svr4_sys_uname }, /* 135 = uname */ - { 1, s(struct svr4_sys_setegid_args), 0, - svr4_sys_setegid }, /* 136 = setegid */ - { 1, s(struct svr4_sys_sysconfig_args), 0, - svr4_sys_sysconfig }, /* 137 = sysconfig */ - { 2, s(struct sys_adjtime_args), 0, - sys_adjtime }, /* 138 = adjtime */ - { 3, s(struct svr4_sys_systeminfo_args), 0, - svr4_sys_systeminfo }, /* 139 = systeminfo */ - { 0, 0, 0, - sys_nosys }, /* 140 = unimplemented */ - { 1, s(struct sys_seteuid_args), 0, - sys_seteuid }, /* 141 = seteuid */ - { 0, 0, 0, - sys_nosys }, /* 142 = unimplemented vtrace */ - { 0, 0, 0, - sys_nosys }, /* 143 = unimplemented fork1 */ - { 0, 0, 0, - sys_nosys }, /* 144 = unimplemented sigtimedwait */ - { 0, 0, 0, - sys_nosys }, /* 145 = unimplemented lwp_info */ - { 0, 0, 0, - sys_nosys }, /* 146 = unimplemented yield */ - { 0, 0, 0, - sys_nosys }, /* 147 = unimplemented lwp_sema_wait */ - { 0, 0, 0, - sys_nosys }, /* 148 = unimplemented lwp_sema_post */ - { 0, 0, 0, - sys_nosys }, /* 149 = unimplemented lwp_sema_trywait */ - { 0, 0, 0, - sys_nosys }, /* 150 = unimplemented */ - { 0, 0, 0, - sys_nosys }, /* 151 = unimplemented */ - { 0, 0, 0, - sys_nosys }, /* 152 = unimplemented modctl */ - { 1, s(struct svr4_sys_fchroot_args), 0, - svr4_sys_fchroot }, /* 153 = fchroot */ - { 2, s(struct svr4_sys_utimes_args), 0, - svr4_sys_utimes }, /* 154 = utimes */ - { 0, 0, 0, - svr4_sys_vhangup }, /* 155 = vhangup */ - { 1, s(struct svr4_sys_gettimeofday_args), 0, - svr4_sys_gettimeofday }, /* 156 = gettimeofday */ - { 2, s(struct sys_getitimer_args), 0, - sys_getitimer }, /* 157 = getitimer */ - { 3, s(struct sys_setitimer_args), 0, - sys_setitimer }, /* 158 = setitimer */ - { 0, 0, 0, - sys_nosys }, /* 159 = unimplemented lwp_create */ - { 0, 0, 0, - sys_nosys }, /* 160 = unimplemented lwp_exit */ - { 0, 0, 0, - sys_nosys }, /* 161 = unimplemented lwp_suspend */ - { 0, 0, 0, - sys_nosys }, /* 162 = unimplemented lwp_continue */ - { 0, 0, 0, - sys_nosys }, /* 163 = unimplemented lwp_kill */ - { 0, 0, 0, - sys_nosys }, /* 164 = unimplemented lwp_self */ - { 0, 0, 0, - sys_nosys }, /* 165 = unimplemented lwp_getprivate */ - { 0, 0, 0, - sys_nosys }, /* 166 = unimplemented lwp_setprivate */ - { 0, 0, 0, - sys_nosys }, /* 167 = unimplemented lwp_wait */ - { 0, 0, 0, - sys_nosys }, /* 168 = unimplemented lwp_mutex_unlock */ - { 0, 0, 0, - sys_nosys }, /* 169 = unimplemented lwp_mutex_lock */ - { 0, 0, 0, - sys_nosys }, /* 170 = unimplemented lwp_cond_wait */ - { 0, 0, 0, - sys_nosys }, /* 171 = unimplemented lwp_cond_signal */ - { 0, 0, 0, - sys_nosys }, /* 172 = unimplemented lwp_cond_broadcast */ - { 4, s(struct svr4_sys_pread_args), 0, - svr4_sys_pread }, /* 173 = pread */ - { 4, s(struct svr4_sys_pwrite_args), 0, - svr4_sys_pwrite }, /* 174 = pwrite */ - { 4, s(struct svr4_sys_llseek_args), 0, - svr4_sys_llseek }, /* 175 = llseek */ - { 0, 0, 0, - sys_nosys }, /* 176 = unimplemented inst_sync */ - { 0, 0, 0, - sys_nosys }, /* 177 = unimplemented */ - { 0, 0, 0, - sys_nosys }, /* 178 = unimplemented kaio */ - { 0, 0, 0, - sys_nosys }, /* 179 = unimplemented */ - { 0, 0, 0, - sys_nosys }, /* 180 = unimplemented */ - { 0, 0, 0, - sys_nosys }, /* 181 = unimplemented */ - { 0, 0, 0, - sys_nosys }, /* 182 = unimplemented */ - { 0, 0, 0, - sys_nosys }, /* 183 = unimplemented */ - { 0, 0, 0, - sys_nosys }, /* 184 = unimplemented tsolsys */ - { 4, s(struct svr4_sys_acl_args), 0, - svr4_sys_acl }, /* 185 = acl */ - { 6, s(struct svr4_sys_auditsys_args), 0, - svr4_sys_auditsys }, /* 186 = auditsys */ - { 0, 0, 0, - sys_nosys }, /* 187 = unimplemented processor_bind */ - { 0, 0, 0, - sys_nosys }, /* 188 = unimplemented processor_info */ - { 0, 0, 0, - sys_nosys }, /* 189 = unimplemented p_online */ - { 0, 0, 0, - sys_nosys }, /* 190 = unimplemented sigqueue */ - { 2, s(struct sys_clock_gettime_args), 0, - sys_clock_gettime }, /* 191 = clock_gettime */ - { 2, s(struct sys_clock_settime_args), 0, - sys_clock_settime }, /* 192 = clock_settime */ - { 2, s(struct sys_clock_getres_args), 0, - sys_clock_getres }, /* 193 = clock_getres */ - { 0, 0, 0, - sys_nosys }, /* 194 = unimplemented timer_create */ - { 0, 0, 0, - sys_nosys }, /* 195 = unimplemented timer_delete */ - { 0, 0, 0, - sys_nosys }, /* 196 = unimplemented timer_settime */ - { 0, 0, 0, - sys_nosys }, /* 197 = unimplemented timer_gettime */ - { 0, 0, 0, - sys_nosys }, /* 198 = unimplemented timer_getoverrun */ - { 2, s(struct sys_nanosleep_args), 0, - sys_nanosleep }, /* 199 = nanosleep */ - { 4, s(struct svr4_sys_facl_args), 0, - svr4_sys_facl }, /* 200 = facl */ - { 0, 0, 0, - sys_nosys }, /* 201 = unimplemented door */ - { 2, s(struct sys_setreuid_args), 0, - sys_setreuid }, /* 202 = setreuid */ - { 2, s(struct sys_setregid_args), 0, - sys_setregid }, /* 203 = setregid */ - { 0, 0, 0, - sys_nosys }, /* 204 = unimplemented install_utrap */ - { 0, 0, 0, - sys_nosys }, /* 205 = unimplemented signotify */ - { 0, 0, 0, - sys_nosys }, /* 206 = unimplemented schedctl */ - { 0, 0, 0, - sys_nosys }, /* 207 = unimplemented pset */ - { 0, 0, 0, - sys_nosys }, /* 208 = unimplemented */ - { 0, 0, 0, - sys_nosys }, /* 209 = unimplemented resolvepath */ - { 0, 0, 0, - sys_nosys }, /* 210 = unimplemented signotifywait */ - { 0, 0, 0, - sys_nosys }, /* 211 = unimplemented lwp_sigredirect */ - { 0, 0, 0, - sys_nosys }, /* 212 = unimplemented lwp_alarm */ - { 3, s(struct svr4_sys_getdents64_args), 0, - svr4_sys_getdents64 }, /* 213 = getdents64 */ - { 6, s(struct svr4_sys_mmap64_args), 0, - svr4_sys_mmap64 }, /* 214 = mmap64 */ - { 2, s(struct svr4_sys_stat64_args), 0, - svr4_sys_stat64 }, /* 215 = stat64 */ - { 2, s(struct svr4_sys_lstat64_args), 0, - svr4_sys_lstat64 }, /* 216 = lstat64 */ - { 2, s(struct svr4_sys_fstat64_args), 0, - svr4_sys_fstat64 }, /* 217 = fstat64 */ - { 0, 0, 0, - sys_nosys }, /* 218 = unimplemented statvfs64 */ - { 2, s(struct svr4_sys_fstatvfs64_args), 0, - svr4_sys_fstatvfs64 }, /* 219 = fstatvfs64 */ - { 0, 0, 0, - sys_nosys }, /* 220 = unimplemented setrlimit64 */ - { 0, 0, 0, - sys_nosys }, /* 221 = unimplemented getrlimit64 */ - { 4, s(struct svr4_sys_pread64_args), 0, - svr4_sys_pread64 }, /* 222 = pread64 */ - { 4, s(struct svr4_sys_pwrite64_args), 0, - svr4_sys_pwrite64 }, /* 223 = pwrite64 */ - { 2, s(struct svr4_sys_creat64_args), 0, - svr4_sys_creat64 }, /* 224 = creat64 */ - { 3, s(struct svr4_sys_open64_args), 0, - svr4_sys_open64 }, /* 225 = open64 */ - { 0, 0, 0, - sys_nosys }, /* 226 = unimplemented rpcsys */ - { 0, 0, 0, - sys_nosys }, /* 227 = unimplemented */ - { 0, 0, 0, - sys_nosys }, /* 228 = unimplemented */ - { 0, 0, 0, - sys_nosys }, /* 229 = unimplemented */ - { 3, s(struct svr4_sys_socket_args), 0, - svr4_sys_socket }, /* 230 = socket */ - { 4, s(struct sys_socketpair_args), 0, - sys_socketpair }, /* 231 = socketpair */ - { 3, s(struct sys_bind_args), 0, - sys_bind }, /* 232 = bind */ - { 2, s(struct sys_listen_args), 0, - sys_listen }, /* 233 = listen */ - { 3, s(struct compat_43_sys_accept_args), 0, - compat_43_sys_accept }, /* 234 = accept */ - { 3, s(struct sys_connect_args), 0, - sys_connect }, /* 235 = connect */ - { 2, s(struct sys_shutdown_args), 0, - sys_shutdown }, /* 236 = shutdown */ - { 4, s(struct compat_43_sys_recv_args), 0, - compat_43_sys_recv }, /* 237 = recv */ - { 6, s(struct compat_43_sys_recvfrom_args), 0, - compat_43_sys_recvfrom }, /* 238 = recvfrom */ - { 3, s(struct compat_43_sys_recvmsg_args), 0, - compat_43_sys_recvmsg }, /* 239 = recvmsg */ - { 4, s(struct compat_43_sys_send_args), 0, - compat_43_sys_send }, /* 240 = send */ - { 3, s(struct compat_43_sys_sendmsg_args), 0, - compat_43_sys_sendmsg }, /* 241 = sendmsg */ - { 6, s(struct sys_sendto_args), 0, - sys_sendto }, /* 242 = sendto */ - { 3, s(struct compat_43_sys_getpeername_args), 0, - compat_43_sys_getpeername }, /* 243 = getpeername */ - { 3, s(struct compat_43_sys_getsockname_args), 0, - compat_43_sys_getsockname }, /* 244 = getsockname */ - { 5, s(struct sys_getsockopt_args), 0, - sys_getsockopt }, /* 245 = getsockopt */ - { 5, s(struct sys_setsockopt_args), 0, - sys_setsockopt }, /* 246 = setsockopt */ - { 0, 0, 0, - sys_nosys }, /* 247 = unimplemented sockconfig */ - { 0, 0, 0, - sys_nosys }, /* 248 = unimplemented ntp_gettime */ - { 0, 0, 0, - sys_nosys }, /* 249 = unimplemented ntp_adjtime */ -}; - diff --git a/sys/compat/svr4/svr4_systeminfo.h b/sys/compat/svr4/svr4_systeminfo.h deleted file mode 100644 index 0d817e39acf..00000000000 --- a/sys/compat/svr4/svr4_systeminfo.h +++ /dev/null @@ -1,49 +0,0 @@ -/* $OpenBSD: svr4_systeminfo.h,v 1.3 1996/08/02 20:35:45 niklas Exp $ */ -/* $NetBSD: svr4_systeminfo.h,v 1.3 1996/04/22 01:16:04 christos Exp $ */ - -/* - * Copyright (c) 1994 Christos Zoulas - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _SVR4_SYSTEMINFO_H_ -#define _SVR4_SYSTEMINFO_H_ - -#define SVR4_SI_SYSNAME 1 -#define SVR4_SI_HOSTNAME 2 -#define SVR4_SI_RELEASE 3 -#define SVR4_SI_VERSION 4 -#define SVR4_SI_MACHINE 5 -#define SVR4_SI_ARCHITECTURE 6 -#define SVR4_SI_HW_SERIAL 7 -#define SVR4_SI_HW_PROVIDER 8 -#define SVR4_SI_SRPC_DOMAIN 9 -#define SVR4_SI_SET_HOSTNAME 258 -#define SVR4_SI_SET_SRPC_DOMAIN 265 -#define SVR4_SI_SET_KERB_REALM 266 -#define SVR4_SI_KERB_REALM 267 -#define SVR4_SI_PLATFORM 513 - -#endif /* !_SVR4_SYSTEMINFO_H_ */ diff --git a/sys/compat/svr4/svr4_termios.c b/sys/compat/svr4/svr4_termios.c deleted file mode 100644 index f31a61826bb..00000000000 --- a/sys/compat/svr4/svr4_termios.c +++ /dev/null @@ -1,642 +0,0 @@ -/* $OpenBSD: svr4_termios.c,v 1.12 2002/03/14 01:26:51 millert Exp $ */ -/* $NetBSD: svr4_termios.c,v 1.9 1996/04/11 12:53:48 christos Exp $ */ - -/* - * Copyright (c) 1994 Christos Zoulas - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/param.h> -#include <sys/proc.h> -#include <sys/systm.h> -#include <sys/file.h> -#include <sys/filedesc.h> -#include <sys/ioctl.h> -#include <sys/termios.h> -#include <sys/tty.h> -#include <sys/socket.h> -#include <sys/mount.h> -#include <net/if.h> -#include <sys/malloc.h> - -#include <sys/syscallargs.h> - -#include <compat/svr4/svr4_types.h> -#include <compat/svr4/svr4_util.h> -#include <compat/svr4/svr4_signal.h> -#include <compat/svr4/svr4_ioctl.h> -#include <compat/svr4/svr4_syscallargs.h> -#include <compat/svr4/svr4_stropts.h> -#include <compat/svr4/svr4_termios.h> - -#define SVR4_OXTABS SVR4_XTABS /* XXX */ - -#ifndef __CONCAT3 -# if __STDC__ -# define __CONCAT3(a,b,c) a ## b ## c -# else -# define __CONCAT3(a,b,c) a/**/b/**/c -# endif -#endif - -u_long bsd_to_svr4_speed(u_long, u_long); -u_long svr4_to_bsd_speed(u_long, u_long); -void svr4_to_bsd_termios(const struct svr4_termios *, struct termios *, - int); -void bsd_to_svr4_termios(const struct termios *, struct svr4_termios *); -void svr4_termio_to_termios(const struct svr4_termio *, - struct svr4_termios *); -void svr4_termios_to_termio(const struct svr4_termios *, - struct svr4_termio *); -#ifdef DEBUG_SVR4 -void print_svr4_termios(const struct svr4_termios *); -void print_bsd_termios(const struct termios *); -#endif /* DEBUG_SVR4 */ - -#define undefined_char(a,b) /**/ -#define undefined_flag1(f,a,b) /**/ -#define undefined_flag2(f,a,b,c1,t1,c2,t2) /**/ -#define undefined_flag4(f,a,b,c1,t1,c2,t2,c3,t3,c4,t4) /**/ - -#define svr4_to_bsd_char(a,b) \ - if (new || __CONCAT3(SVR4_,a,b) < SVR4_NCC) { \ - if (st->c_cc[__CONCAT3(SVR4_,a,b)] == SVR4_POSIX_VDISABLE) \ - bt->c_cc[__CONCAT(a,b)] = _POSIX_VDISABLE; \ - else \ - bt->c_cc[__CONCAT(a,b)] = \ - st->c_cc[__CONCAT3(SVR4_,a,b)]; \ - } - -#define svr4_to_bsd_flag1(f,a,b) \ - if (new || __CONCAT3(SVR4_,a,b) < 0200000) { \ - if (st->f & __CONCAT3(SVR4_,a,b)) \ - bt->f |= __CONCAT(a,b); \ - else \ - bt->f &= ~__CONCAT(a,b); \ - } - -#define svr4_to_bsd_flag2(f,a,b,c1,t1,c2,t2) \ - if (new || __CONCAT3(SVR4_,a,b) < 0200000) { \ - bt->f &= ~__CONCAT(a,b); \ - switch (st->f & __CONCAT3(SVR4_,a,b)) { \ - case __CONCAT3(SVR4_,c1,t1): bt->f |= __CONCAT(c1,t1); break; \ - case __CONCAT3(SVR4_,c2,t2): bt->f |= __CONCAT(c2,t2); break; \ - } \ - } - -#define svr4_to_bsd_flag4(f,a,b,c1,t1,c2,t2,c3,t3,c4,t4) \ - if (new || __CONCAT3(SVR4_,a,b) < 0200000) { \ - bt->f &= ~__CONCAT(a,b); \ - switch (st->f & __CONCAT3(SVR4_,a,b)) { \ - case __CONCAT3(SVR4_,c1,t1): bt->f |= __CONCAT(c1,t1); break; \ - case __CONCAT3(SVR4_,c2,t2): bt->f |= __CONCAT(c2,t2); break; \ - case __CONCAT3(SVR4_,c3,t3): bt->f |= __CONCAT(c3,t3); break; \ - case __CONCAT3(SVR4_,c4,t4): bt->f |= __CONCAT(c4,t4); break; \ - } \ - } - - -#define bsd_to_svr4_char(a,b) \ - if (bt->c_cc[__CONCAT(a,b)] == _POSIX_VDISABLE) \ - st->c_cc[__CONCAT3(SVR4_,a,b)] = SVR4_POSIX_VDISABLE; \ - else \ - st->c_cc[__CONCAT3(SVR4_,a,b)] = bt->c_cc[__CONCAT(a,b)] - -#define bsd_to_svr4_flag1(f,a,b) \ - if (bt->f & __CONCAT(a,b)) \ - st->f |= __CONCAT3(SVR4_,a,b); \ - else \ - st->f &= ~__CONCAT3(SVR4_,a,b) - -#define bsd_to_svr4_flag2(f,a,b,c1,t1,c2,t2) \ - st->f &= ~__CONCAT3(SVR4_,a,b); \ - switch (bt->f & __CONCAT(a,b)) { \ - case __CONCAT(c1,t1): st->f |= __CONCAT3(SVR4_,c1,t1); break; \ - case __CONCAT(c2,t2): st->f |= __CONCAT3(SVR4_,c2,t2); break; \ - } - -#define bsd_to_svr4_flag4(f,a,b,c1,t1,c2,t2,c3,t3,c4,t4) \ - st->f &= ~__CONCAT3(SVR4_,a,b); \ - switch (bt->f & __CONCAT(a,b)) { \ - case __CONCAT(c1,t1): st->f |= __CONCAT3(SVR4_,c1,t1); break; \ - case __CONCAT(c2,t2): st->f |= __CONCAT3(SVR4_,c2,t2); break; \ - case __CONCAT(c3,t3): st->f |= __CONCAT3(SVR4_,c3,t3); break; \ - case __CONCAT(c4,t4): st->f |= __CONCAT3(SVR4_,c4,t4); break; \ - } - -#ifdef DEBUG_SVR4 -void -print_svr4_termios(st) - const struct svr4_termios *st; -{ - int i; - uprintf("SVR4\niflag=%lo oflag=%lo cflag=%lo lflag=%lo\n", - st->c_iflag, st->c_oflag, st->c_cflag, st->c_lflag); - uprintf("cc: "); - for (i = 0; i < SVR4_NCCS; i++) - uprintf("%o ", st->c_cc[i]); - uprintf("\n"); -} - -void -print_bsd_termios(bt) - const struct termios *bt; -{ - int i; - uprintf( - "BSD\niflag=%x oflag=%x cflag=%x lflag=%x ispeed=%d osped=%d\n", - bt->c_iflag, bt->c_oflag, bt->c_cflag, bt->c_lflag, bt->c_ispeed, - bt->c_ospeed); - uprintf("cc: "); - for (i = 0; i < NCCS; i++) - uprintf("%o ", bt->c_cc[i]); - uprintf("\n"); -} -#endif /* DEBUG_SVR4 */ - -u_long -bsd_to_svr4_speed(sp, mask) - u_long sp; - u_long mask; -{ - switch (sp) { -#undef getval -#define getval(a,b) case __CONCAT(a,b): sp = __CONCAT3(SVR4_,a,b); break - getval(B,0); - getval(B,50); - getval(B,75); - getval(B,110); - getval(B,134); - getval(B,150); - getval(B,200); - getval(B,300); - getval(B,600); - getval(B,1200); - getval(B,1800); - getval(B,2400); - getval(B,4800); - getval(B,9600); - getval(B,19200); - getval(B,38400); -#if 0 - /* XXX These don't fit in CBAUD */ - getval(B,57600); - getval(B,115200); -#endif - default: sp = SVR4_B9600; /* XXX */ - } - - while ((mask & 1) == 0) { - mask >>= 1; - sp <<= 1; - } - - return (sp); -} - -u_long -svr4_to_bsd_speed(sp, mask) - u_long sp; - u_long mask; -{ - while ((mask & 1) == 0) { - mask >>= 1; - sp >>= 1; - } - - switch (sp & mask) { -#undef getval -#define getval(a,b) case __CONCAT3(SVR4_,a,b): return (__CONCAT(a,b)) - getval(B,0); - getval(B,50); - getval(B,75); - getval(B,110); - getval(B,134); - getval(B,150); - getval(B,200); - getval(B,300); - getval(B,600); - getval(B,1200); - getval(B,1800); - getval(B,2400); - getval(B,4800); - getval(B,9600); - getval(B,19200); - getval(B,38400); -#if 0 - /* XXX These don't fit in CBAUD */ - getval(B,57600); - getval(B,115200); -#endif - default: return (B9600); /* XXX */ - } -} - -void -svr4_to_bsd_termios(st, bt, new) - const struct svr4_termios *st; - struct termios *bt; - int new; -{ - /* control characters */ - svr4_to_bsd_char(V,INTR); - svr4_to_bsd_char(V,QUIT); - svr4_to_bsd_char(V,ERASE); - svr4_to_bsd_char(V,KILL); - if (st->c_lflag & ICANON) { - svr4_to_bsd_char(V,EOF); - svr4_to_bsd_char(V,EOL); - } else { - /* - * These are not chars so _POSIX_DISABLE values should not be - * special cased. - */ - bt->c_cc[VMIN] = st->c_cc[SVR4_VMIN]; - bt->c_cc[VTIME] = st->c_cc[SVR4_VTIME]; - } - svr4_to_bsd_char(V,EOF); - svr4_to_bsd_char(V,EOL); - svr4_to_bsd_char(V,EOL2); - undefined_char(V,SWTCH); - svr4_to_bsd_char(V,START); - svr4_to_bsd_char(V,STOP); - svr4_to_bsd_char(V,SUSP); - svr4_to_bsd_char(V,DSUSP); - svr4_to_bsd_char(V,REPRINT); - svr4_to_bsd_char(V,DISCARD); - svr4_to_bsd_char(V,WERASE); - svr4_to_bsd_char(V,LNEXT); - - /* Input modes */ - svr4_to_bsd_flag1(c_iflag,I,GNBRK); - svr4_to_bsd_flag1(c_iflag,B,RKINT); - svr4_to_bsd_flag1(c_iflag,I,GNPAR); - svr4_to_bsd_flag1(c_iflag,P,ARMRK); - svr4_to_bsd_flag1(c_iflag,I,NPCK); - svr4_to_bsd_flag1(c_iflag,I,STRIP); - svr4_to_bsd_flag1(c_iflag,I,NLCR); - svr4_to_bsd_flag1(c_iflag,I,GNCR); - svr4_to_bsd_flag1(c_iflag,I,CRNL); - undefined_flag1(c_iflag,I,UCLC); - svr4_to_bsd_flag1(c_iflag,I,XON); - svr4_to_bsd_flag1(c_iflag,I,XANY); - svr4_to_bsd_flag1(c_iflag,I,XOFF); - svr4_to_bsd_flag1(c_iflag,I,MAXBEL); - undefined_flag1(c_iflag,D,OSMODE); - - /* Output modes */ - svr4_to_bsd_flag1(c_oflag,O,POST); - undefined_flag1(c_oflag,O,LCUC); - svr4_to_bsd_flag1(c_oflag,O,NLCR); - undefined_flag1(c_oflag,O,CRNL); - undefined_flag1(c_oflag,O,NOCR); - undefined_flag1(c_oflag,O,NLRET); - undefined_flag1(c_oflag,O,FILL); - undefined_flag1(c_oflag,O,FDEL); - undefined_flag2(c_oflag,N,LDLY,N,L0,N,L1); - undefined_flag4(c_oflag,C,RDLY,C,R0,C,R1,C,R2,C,R3); - undefined_flag4(c_oflag,T,ABDLY,T,AB0,T,AB1,T,AB2,T,AB3); - /* - * XXX Note, we cannot use svr4_to_bsd_flag1 here because the SVR4 - * field is a two bit value where identity is important, i.e. any bit - * set in that field is *not* enough. Someday we might to wish to - * support the other values of this bitfield, but not now... - */ - if ((st->c_oflag & SVR4_XTABS) == SVR4_XTABS) - bt->c_oflag |= OXTABS; - else - bt->c_oflag &= ~OXTABS; - undefined_flag2(c_oflag,B,SDLY,B,S0,B,S1); - undefined_flag2(c_oflag,V,TDLY,V,T0,V,T1); - undefined_flag2(c_oflag,F,FDLY,F,F0,F,F1); - undefined_flag1(c_oflag,P,AGEOUT); - undefined_flag1(c_oflag,W,RAP); - - /* Control modes */ - bt->c_ospeed = svr4_to_bsd_speed(st->c_cflag, SVR4_CBAUD); - svr4_to_bsd_flag4(c_cflag,C,SIZE,C,S5,C,S6,C,S7,C,S8) - svr4_to_bsd_flag1(c_cflag,C,STOPB); - svr4_to_bsd_flag1(c_cflag,C,READ); - svr4_to_bsd_flag1(c_cflag,P,ARENB); - svr4_to_bsd_flag1(c_cflag,P,ARODD); - svr4_to_bsd_flag1(c_cflag,H,UPCL); - svr4_to_bsd_flag1(c_cflag,C,LOCAL); - undefined_flag1(c_cflag,R,CV1EN); - undefined_flag1(c_cflag,X,MT1EN); - undefined_flag1(c_cflag,L,OBLK); - undefined_flag1(c_cflag,X,CLUDE); - bt->c_ispeed = svr4_to_bsd_speed(st->c_cflag, SVR4_CIBAUD); - undefined_flag1(c_cflag,P,AREXT); - - /* line discipline modes */ - svr4_to_bsd_flag1(c_lflag,I,SIG); - svr4_to_bsd_flag1(c_lflag,I,CANON); - undefined_flag1(c_lflag,X,CASE); - svr4_to_bsd_flag1(c_lflag,E,CHO); - svr4_to_bsd_flag1(c_lflag,E,CHOE); - svr4_to_bsd_flag1(c_lflag,E,CHOK); - svr4_to_bsd_flag1(c_lflag,E,CHONL); - svr4_to_bsd_flag1(c_lflag,N,OFLSH); - svr4_to_bsd_flag1(c_lflag,T,OSTOP); - svr4_to_bsd_flag1(c_lflag,E,CHOCTL); - svr4_to_bsd_flag1(c_lflag,E,CHOPRT); - svr4_to_bsd_flag1(c_lflag,E,CHOKE); - undefined_flag1(c_lflag,D,EFECHO); - svr4_to_bsd_flag1(c_lflag,F,LUSHO); - svr4_to_bsd_flag1(c_lflag,P,ENDIN); - svr4_to_bsd_flag1(c_lflag,I,EXTEN); -} - -void -bsd_to_svr4_termios(bt, st) - const struct termios *bt; - struct svr4_termios *st; -{ - /* control characters */ - bsd_to_svr4_char(V,INTR); - bsd_to_svr4_char(V,QUIT); - bsd_to_svr4_char(V,ERASE); - bsd_to_svr4_char(V,KILL); - if (bt->c_lflag & ICANON) { - bsd_to_svr4_char(V,EOF); - bsd_to_svr4_char(V,EOL); - } else { - /* - * These are not chars so _POSIX_DISABLE values should not be - * special cased. - */ - st->c_cc[SVR4_VMIN] = bt->c_cc[VMIN]; - st->c_cc[SVR4_VTIME] = bt->c_cc[VTIME]; - } - bsd_to_svr4_char(V,EOL2); - undefined_char(V,SWTCH); - bsd_to_svr4_char(V,START); - bsd_to_svr4_char(V,STOP); - bsd_to_svr4_char(V,SUSP); - bsd_to_svr4_char(V,DSUSP); - bsd_to_svr4_char(V,REPRINT); - bsd_to_svr4_char(V,DISCARD); - bsd_to_svr4_char(V,WERASE); - bsd_to_svr4_char(V,LNEXT); - - /* Input modes */ - bsd_to_svr4_flag1(c_iflag,I,GNBRK); - bsd_to_svr4_flag1(c_iflag,B,RKINT); - bsd_to_svr4_flag1(c_iflag,I,GNPAR); - bsd_to_svr4_flag1(c_iflag,P,ARMRK); - bsd_to_svr4_flag1(c_iflag,I,NPCK); - bsd_to_svr4_flag1(c_iflag,I,STRIP); - bsd_to_svr4_flag1(c_iflag,I,NLCR); - bsd_to_svr4_flag1(c_iflag,I,GNCR); - bsd_to_svr4_flag1(c_iflag,I,CRNL); - undefined_flag1(c_iflag,I,UCLC); - bsd_to_svr4_flag1(c_iflag,I,XON); - bsd_to_svr4_flag1(c_iflag,I,XANY); - bsd_to_svr4_flag1(c_iflag,I,XOFF); - bsd_to_svr4_flag1(c_iflag,I,MAXBEL); - undefined_flag1(c_iflag,D,OSMODE); - - /* Output modes */ - bsd_to_svr4_flag1(c_oflag,O,POST); - undefined_flag1(c_oflag,O,LCUC); - bsd_to_svr4_flag1(c_oflag,O,NLCR); - undefined_flag1(c_oflag,O,CRNL); - undefined_flag1(c_oflag,O,NOCR); - undefined_flag1(c_oflag,O,NLRET); - undefined_flag1(c_oflag,O,FILL); - undefined_flag1(c_oflag,O,FDEL); - undefined_flag2(c_oflag,N,LDLY,N,L0,N,L1); - undefined_flag4(c_oflag,C,RDLY,C,R0,C,R1,C,R2,C,R3); - undefined_flag4(c_oflag,T,ABDLY,T,AB0,T,AB1,T,AB2,T,AB3); - /* - * XXX This isn't what it seem to be, a one bit flag... It's actually - * a two bit value in SVR4 with composite semantics, where we only - * support one of them. Be careful if you change this... - */ - bsd_to_svr4_flag1(c_oflag,OX,TABS); - undefined_flag2(c_oflag,B,SDLY,B,S0,B,S1); - undefined_flag2(c_oflag,V,TDLY,V,T0,V,T1); - undefined_flag2(c_oflag,F,FDLY,F,F0,F,F1); - undefined_flag1(c_oflag,P,AGEOUT); - undefined_flag1(c_oflag,W,RAP); - - /* Control modes */ - st->c_cflag &= ~SVR4_CBAUD; - st->c_cflag |= bsd_to_svr4_speed(bt->c_ospeed, SVR4_CBAUD); - bsd_to_svr4_flag4(c_cflag,C,SIZE,C,S5,C,S6,C,S7,C,S8) - bsd_to_svr4_flag1(c_cflag,C,STOPB); - bsd_to_svr4_flag1(c_cflag,C,READ); - bsd_to_svr4_flag1(c_cflag,P,ARENB); - bsd_to_svr4_flag1(c_cflag,P,ARODD); - bsd_to_svr4_flag1(c_cflag,H,UPCL); - bsd_to_svr4_flag1(c_cflag,C,LOCAL); - undefined_flag1(c_cflag,R,CV1EN); - undefined_flag1(c_cflag,X,MT1EN); - undefined_flag1(c_cflag,L,OBLK); - undefined_flag1(c_cflag,X,CLUDE); - st->c_cflag &= ~SVR4_CIBAUD; - st->c_cflag |= bsd_to_svr4_speed(bt->c_ispeed, SVR4_CIBAUD); - - undefined_flag1(c_oflag,P,AREXT); - - /* line discipline modes */ - bsd_to_svr4_flag1(c_lflag,I,SIG); - bsd_to_svr4_flag1(c_lflag,I,CANON); - undefined_flag1(c_lflag,X,CASE); - bsd_to_svr4_flag1(c_lflag,E,CHO); - bsd_to_svr4_flag1(c_lflag,E,CHOE); - bsd_to_svr4_flag1(c_lflag,E,CHOK); - bsd_to_svr4_flag1(c_lflag,E,CHONL); - bsd_to_svr4_flag1(c_lflag,N,OFLSH); - bsd_to_svr4_flag1(c_lflag,T,OSTOP); - bsd_to_svr4_flag1(c_lflag,E,CHOCTL); - bsd_to_svr4_flag1(c_lflag,E,CHOPRT); - bsd_to_svr4_flag1(c_lflag,E,CHOKE); - undefined_flag1(c_lflag,D,EFECHO); - bsd_to_svr4_flag1(c_lflag,F,LUSHO); - bsd_to_svr4_flag1(c_lflag,P,ENDIN); - bsd_to_svr4_flag1(c_lflag,I,EXTEN); -} - -void -svr4_termio_to_termios(t, ts) - const struct svr4_termio *t; - struct svr4_termios *ts; -{ - int i; - - ts->c_iflag = (svr4_tcflag_t)t->c_iflag; - ts->c_oflag = (svr4_tcflag_t)t->c_oflag; - ts->c_cflag = (svr4_tcflag_t)t->c_cflag & ~SVR4_CIBAUD; - /* XXX because SVR4_CIBAUD == SVR4_CBAUD << 16 we can do: */ - ts->c_cflag |= (ts->c_cflag & SVR4_CBAUD) << 16; - ts->c_lflag = (svr4_tcflag_t)t->c_lflag; - - for (i = 0; i < SVR4_NCC; i++) - ts->c_cc[i] = (svr4_cc_t)t->c_cc[i]; -} - -void -svr4_termios_to_termio(ts, t) - const struct svr4_termios *ts; - struct svr4_termio *t; -{ - int i; - - t->c_iflag = (u_short)ts->c_iflag; - t->c_oflag = (u_short)ts->c_oflag; - t->c_cflag = (u_short)ts->c_cflag; - t->c_lflag = (u_short)ts->c_lflag; - t->c_line = 0; /* XXX */ - - for (i = 0; i < SVR4_NCC; i++) - t->c_cc[i] = (u_char)ts->c_cc[i]; -} - -int -svr4_term_ioctl(fp, p, retval, fd, cmd, data) - struct file *fp; - struct proc *p; - register_t *retval; - int fd; - u_long cmd; - caddr_t data; -{ - struct termios bt; - struct svr4_termios st; - struct svr4_termio t; - int error, new; - int (*ctl)(struct file *, u_long, caddr_t, struct proc *) = - fp->f_ops->fo_ioctl; - - *retval = 0; - - switch (cmd) { - case SVR4_TCGETA: - case SVR4_TCGETS: - if ((error = (*ctl)(fp, TIOCGETA, (caddr_t)&bt, p)) != 0) - return (error); - - bzero(&st,sizeof(st)); - bsd_to_svr4_termios(&bt, &st); - - DPRINTF(("ioctl(TCGET%c);\n", cmd == SVR4_TCGETA ? 'A' : 'S')); -#ifdef DEBUG_SVR4 - print_bsd_termios(&bt); - print_svr4_termios(&st); -#endif /* DEBUG_SVR4 */ - - if (cmd == SVR4_TCGETA) { - svr4_termios_to_termio(&st, &t); - return (copyout(&t, data, sizeof(t))); - } - else { - return (copyout(&st, data, sizeof(st))); - } - - case SVR4_TCSETA: - case SVR4_TCSETS: - case SVR4_TCSETAW: - case SVR4_TCSETSW: - case SVR4_TCSETAF: - case SVR4_TCSETSF: - /* get full BSD termios so we don't lose information */ - if ((error = (*ctl)(fp, TIOCGETA, (caddr_t) &bt, p)) != 0) - return (error); - - switch (cmd) { - case SVR4_TCSETS: - case SVR4_TCSETSW: - case SVR4_TCSETSF: - if ((error = copyin(data, &st, sizeof(st))) != 0) - return (error); - new = 1; - break; - - case SVR4_TCSETA: - case SVR4_TCSETAW: - case SVR4_TCSETAF: - if ((error = copyin(data, &t, sizeof(t))) != 0) - return (error); - - bsd_to_svr4_termios(&bt, &st); - svr4_termio_to_termios(&t, &st); - new = 0; - break; - - default: - return (EINVAL); - } - - svr4_to_bsd_termios(&st, &bt, new); - - switch (cmd) { - case SVR4_TCSETA: - case SVR4_TCSETS: - DPRINTF(("ioctl(TCSET[A|S]);\n")); - cmd = TIOCSETA; - break; - case SVR4_TCSETAW: - case SVR4_TCSETSW: - DPRINTF(("ioctl(TCSET[A|S]W);\n")); - cmd = TIOCSETAW; - break; - case SVR4_TCSETAF: - case SVR4_TCSETSF: - DPRINTF(("ioctl(TCSET[A|S]F);\n")); - cmd = TIOCSETAF; - break; - } - -#ifdef DEBUG_SVR4 - print_bsd_termios(&bt); - print_svr4_termios(&st); -#endif /* DEBUG_SVR4 */ - - return ((*ctl)(fp, cmd, (caddr_t) &bt, p)); - - case SVR4_TIOCGWINSZ: - { - struct svr4_winsize ws; - - error = (*ctl)(fp, TIOCGWINSZ, (caddr_t)&ws, p); - if (error) - return (error); - return (copyout(&ws, data, sizeof(ws))); - } - - case SVR4_TIOCSWINSZ: - { - struct svr4_winsize ws; - - if ((error = copyin(data, &ws, sizeof(ws))) != 0) - return (error); - return ((*ctl)(fp, TIOCSWINSZ, (caddr_t) &ws, p)); - } - - default: - return (svr4_stream_ti_ioctl(fp, p, retval, fd, cmd, data)); - } -} diff --git a/sys/compat/svr4/svr4_termios.h b/sys/compat/svr4/svr4_termios.h deleted file mode 100644 index ca1e0c7318e..00000000000 --- a/sys/compat/svr4/svr4_termios.h +++ /dev/null @@ -1,228 +0,0 @@ -/* $OpenBSD: svr4_termios.h,v 1.4 1998/02/10 15:01:43 niklas Exp $ */ -/* $NetBSD: svr4_termios.h,v 1.2 1994/11/18 02:54:21 christos Exp $ */ - -/* - * Copyright (c) 1994 Christos Zoulas - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _SVR4_TERMIOS_H_ -#define _SVR4_TERMIOS_H_ - -#define SVR4_POSIX_VDISABLE 0 -#define SVR4_NCC 8 -#define SVR4_NCCS 19 - -typedef u_long svr4_tcflag_t; -typedef u_char svr4_cc_t; -typedef u_long svr4_speed_t; - -struct svr4_termios { - svr4_tcflag_t c_iflag; - svr4_tcflag_t c_oflag; - svr4_tcflag_t c_cflag; - svr4_tcflag_t c_lflag; - svr4_cc_t c_cc[SVR4_NCCS]; -}; - -struct svr4_termio { - u_short c_iflag; - u_short c_oflag; - u_short c_cflag; - u_short c_lflag; - char c_line; - u_char c_cc[SVR4_NCC]; -}; - -/* control characters */ -#define SVR4_VINTR 0 -#define SVR4_VQUIT 1 -#define SVR4_VERASE 2 -#define SVR4_VKILL 3 -#define SVR4_VEOF 4 -#define SVR4_VEOL 5 -#define SVR4_VEOL2 6 -#define SVR4_VMIN 4 -#define SVR4_VTIME 5 -#define SVR4_VSWTCH 7 -#define SVR4_VSTART 8 -#define SVR4_VSTOP 9 -#define SVR4_VSUSP 10 -#define SVR4_VDSUSP 11 -#define SVR4_VREPRINT 12 -#define SVR4_VDISCARD 13 -#define SVR4_VWERASE 14 -#define SVR4_VLNEXT 15 - -/* Input modes */ -#define SVR4_IGNBRK 00000001 -#define SVR4_BRKINT 00000002 -#define SVR4_IGNPAR 00000004 -#define SVR4_PARMRK 00000010 -#define SVR4_INPCK 00000020 -#define SVR4_ISTRIP 00000040 -#define SVR4_INLCR 00000100 -#define SVR4_IGNCR 00000200 -#define SVR4_ICRNL 00000400 -#define SVR4_IUCLC 00001000 -#define SVR4_IXON 00002000 -#define SVR4_IXANY 00004000 -#define SVR4_IXOFF 00010000 -#define SVR4_IMAXBEL 00020000 -#define SVR4_DOSMODE 00100000 - -/* Output modes */ -#define SVR4_OPOST 00000001 -#define SVR4_OLCUC 00000002 -#define SVR4_ONLCR 00000004 -#define SVR4_OCRNL 00000010 -#define SVR4_ONOCR 00000020 -#define SVR4_ONLRET 00000040 -#define SVR4_OFILL 00000100 -#define SVR4_OFDEL 00000200 -#define SVR4_NLDLY 00000400 -#define SVR4_NL0 00000000 -#define SVR4_NL1 00000400 -#define SVR4_CRDLY 00003000 -#define SVR4_CR0 00000000 -#define SVR4_CR1 00001000 -#define SVR4_CR2 00002000 -#define SVR4_CR3 00003000 -#define SVR4_TABDLY 00014000 -#define SVR4_TAB0 00000000 -#define SVR4_TAB1 00004000 -#define SVR4_TAB2 00010000 -#define SVR4_TAB3 00014000 -#define SVR4_XTABS 00014000 -#define SVR4_BSDLY 00020000 -#define SVR4_BS0 00000000 -#define SVR4_BS1 00020000 -#define SVR4_VTDLY 00040000 -#define SVR4_VT0 00000000 -#define SVR4_VT1 00040000 -#define SVR4_FFDLY 00100000 -#define SVR4_FF0 00000000 -#define SVR4_FF1 00100000 -#define SVR4_PAGEOUT 00200000 -#define SVR4_WRAP 00400000 - -/* Control modes */ -#define SVR4_CBAUD 00000017 -#define SVR4_CSIZE 00000060 -#define SVR4_CS5 00000000 -#define SVR4_CS6 00000020 -#define SVR4_CS7 00000040 -#define SVR4_CS8 00000060 -#define SVR4_CSTOPB 00000100 -#define SVR4_CREAD 00000200 -#define SVR4_PARENB 00000400 -#define SVR4_PARODD 00001000 -#define SVR4_HUPCL 00002000 -#define SVR4_CLOCAL 00004000 -#define SVR4_RCV1EN 00010000 -#define SVR4_XMT1EN 00020000 -#define SVR4_LOBLK 00040000 -#define SVR4_XCLUDE 00100000 -#define SVR4_CIBAUD 03600000 -#define SVR4_PAREXT 04000000 - -/* line discipline modes */ -#define SVR4_ISIG 00000001 -#define SVR4_ICANON 00000002 -#define SVR4_XCASE 00000004 -#define SVR4_ECHO 00000010 -#define SVR4_ECHOE 00000020 -#define SVR4_ECHOK 00000040 -#define SVR4_ECHONL 00000100 -#define SVR4_NOFLSH 00000200 -#define SVR4_TOSTOP 00000400 -#define SVR4_ECHOCTL 00001000 -#define SVR4_ECHOPRT 00002000 -#define SVR4_ECHOKE 00004000 -#define SVR4_DEFECHO 00010000 -#define SVR4_FLUSHO 00020000 -#define SVR4_PENDIN 00040000 -#define SVR4_IEXTEN 00100000 - -#define SVR4_TIOC ('T' << 8) - -#define SVR4_TCGETA (SVR4_TIOC| 1) -#define SVR4_TCSETA (SVR4_TIOC| 2) -#define SVR4_TCSETAW (SVR4_TIOC| 3) -#define SVR4_TCSETAF (SVR4_TIOC| 4) -#define SVR4_TCSBRK (SVR4_TIOC| 5) -#define SVR4_TCXONC (SVR4_TIOC| 6) -#define SVR4_TCFLSH (SVR4_TIOC| 7) -#define SVR4_TIOCKBON (SVR4_TIOC| 8) -#define SVR4_TIOCKBOF (SVR4_TIOC| 9) -#define SVR4_KBENABLED (SVR4_TIOC|10) -#define SVR4_TCGETS (SVR4_TIOC|13) -#define SVR4_TCSETS (SVR4_TIOC|14) -#define SVR4_TCSETSW (SVR4_TIOC|15) -#define SVR4_TCSETSF (SVR4_TIOC|16) -#define SVR4_TCDSET (SVR4_TIOC|32) -#define SVR4_RTS_TOG (SVR4_TIOC|33) -#define SVR4_TCGETSC (SVR4_TIOC|34) -#define SVR4_TCSETSC (SVR4_TIOC|35) -#define SVR4_TCMOUSE (SVR4_TIOC|36) -#define SVR4_TIOCGWINSZ (SVR4_TIOC|104) -#define SVR4_TIOCSWINSZ (SVR4_TIOC|103) - -struct svr4_winsize { - u_short ws_row; - u_short ws_col; - u_short ws_xpixel; - u_short ws_ypixel; -}; - - -#define SVR4_B0 0 -#define SVR4_B50 1 -#define SVR4_B75 2 -#define SVR4_B110 3 -#define SVR4_B134 4 -#define SVR4_B150 5 -#define SVR4_B200 6 -#define SVR4_B300 7 -#define SVR4_B600 8 -#define SVR4_B1200 9 -#define SVR4_B1800 10 -#define SVR4_B2400 11 -#define SVR4_B4800 12 -#define SVR4_B9600 13 -#define SVR4_B19200 14 -#define SVR4_B38400 15 -#if 0 -/* XXX How do these fit in CBAUD? */ -#define SVR4_B57600 16 -#define SVR4_B76800 17 -#define SVR4_B115200 18 -#define SVR4_B153600 19 -#define SVR4_B230400 20 -#define SVR4_B307200 21 -#define SVR4_B460800 22 -#endif - -#endif /* !_SVR4_TERMIOS_H_ */ diff --git a/sys/compat/svr4/svr4_time.h b/sys/compat/svr4/svr4_time.h deleted file mode 100644 index c836a1850f4..00000000000 --- a/sys/compat/svr4/svr4_time.h +++ /dev/null @@ -1,42 +0,0 @@ -/* $OpenBSD: svr4_time.h,v 1.3 1996/08/02 20:35:46 niklas Exp $ */ -/* $NetBSD: svr4_time.h,v 1.4 1995/12/19 07:13:23 christos Exp $ */ - -/* - * Copyright (c) 1994 Christos Zoulas - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _SVR4_TIME_H_ -#define _SVR4_TIME_H_ - -#include <compat/svr4/svr4_types.h> -#include <sys/time.h> - -struct svr4_utimbuf { - time_t actime; - time_t modtime; -}; - -#endif /* !_SVR4_TIME_H_ */ diff --git a/sys/compat/svr4/svr4_timod.h b/sys/compat/svr4/svr4_timod.h deleted file mode 100644 index 8c7c03761a1..00000000000 --- a/sys/compat/svr4/svr4_timod.h +++ /dev/null @@ -1,65 +0,0 @@ -/* $OpenBSD: svr4_timod.h,v 1.3 1997/02/13 19:45:26 niklas Exp $ */ -/* $NetBSD: svr4_timod.h,v 1.5 1996/08/30 23:06:42 christos Exp $ */ - -/* - * Copyright (c) 1994 Christos Zoulas - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _SVR4_TIMOD_H_ -#define _SVR4_TIMOD_H_ - -#define SVR4_TIMOD ('T' << 8) -#define SVR4_TI_GETINFO (SVR4_TIMOD|140) -#define SVR4_TI_OPTMGMT (SVR4_TIMOD|141) -#define SVR4_TI_BIND (SVR4_TIMOD|142) -#define SVR4_TI_UNBIND (SVR4_TIMOD|143) -#define SVR4_TI_GETMYNAME (SVR4_TIMOD|144) -#define SVR4_TI_GETPEERNAME (SVR4_TIMOD|145) -#define SVR4_TI_SETMYNAME (SVR4_TIMOD|146) -#define SVR4_TI_SETPEERNAME (SVR4_TIMOD|147) - -#define SVR4_TI_CONNECT_REQUEST 0x00 -#define SVR4_TI_INFO_REQUEST 0x05 -#define SVR4_TI_BIND_REQUEST 0x06 -#define SVR4_TI_SENDTO_REQUEST 0x08 - -#define SVR4_TI_ACCEPT_REPLY 0x0b -#define SVR4_TI_CONNECT_REPLY 0x0c -#define SVR4_TI_INFO_REPLY 0x10 -#define SVR4_TI_BIND_REPLY 0x11 -#define SVR4_TI_OK_REPLY 0x13 -#define SVR4_TI_RECVFROM_REPLY 0x14 - -#define SVR4_TI__ACCEPT_WAIT 0x10000001 -#define SVR4_TI__ACCEPT_OK 0x10000002 - -struct svr4_netbuf { - u_int maxlen; - u_int len; - char *buf; -}; - -#endif /* !_SVR4_TIMOD_H_ */ diff --git a/sys/compat/svr4/svr4_ttold.c b/sys/compat/svr4/svr4_ttold.c deleted file mode 100644 index 928771f0325..00000000000 --- a/sys/compat/svr4/svr4_ttold.c +++ /dev/null @@ -1,375 +0,0 @@ -/* $OpenBSD: svr4_ttold.c,v 1.7 2002/03/14 01:26:51 millert Exp $ */ -/* $NetBSD: svr4_ttold.c,v 1.9 1996/04/11 12:54:45 christos Exp $ */ - -/* - * Copyright (c) 1994 Christos Zoulas - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <sys/param.h> -#include <sys/proc.h> -#include <sys/systm.h> -#include <sys/file.h> -#include <sys/filedesc.h> -#include <sys/ioctl.h> -#include <sys/termios.h> -#include <sys/tty.h> -#include <sys/socket.h> -#include <sys/mount.h> -#include <net/if.h> -#include <sys/malloc.h> - -#include <sys/syscallargs.h> - -#include <compat/svr4/svr4_types.h> -#include <compat/svr4/svr4_util.h> -#include <compat/svr4/svr4_signal.h> -#include <compat/svr4/svr4_syscallargs.h> -#include <compat/svr4/svr4_stropts.h> -#include <compat/svr4/svr4_ttold.h> -#include <compat/svr4/svr4_ioctl.h> - -static void svr4_tchars_to_bsd_tchars(const struct svr4_tchars *st, - struct tchars *bt); -static void bsd_tchars_to_svr4_tchars(const struct tchars *bt, - struct svr4_tchars *st); -static void svr4_sgttyb_to_bsd_sgttyb(const struct svr4_sgttyb *ss, - struct sgttyb *bs); -static void bsd_sgttyb_to_svr4_sgttyb(const struct sgttyb *bs, - struct svr4_sgttyb *ss); -static void svr4_ltchars_to_bsd_ltchars(const struct svr4_ltchars *sl, - struct ltchars *bl); -static void bsd_ltchars_to_svr4_ltchars(const struct ltchars *bl, - struct svr4_ltchars *sl); - -#ifdef DEBUG_SVR4 -static void print_svr4_sgttyb(const char *, struct svr4_sgttyb *); -static void print_svr4_tchars(const char *, struct svr4_tchars *); -static void print_svr4_ltchars(const char *, struct svr4_ltchars *); - -static void -print_svr4_sgttyb(str, ss) - const char *str; - struct svr4_sgttyb *ss; -{ - uprintf("%s\nispeed=%o ospeed=%o ", str, ss->sg_ispeed, ss->sg_ospeed); - uprintf("erase=%o kill=%o flags=%o\n", ss->sg_erase, ss->sg_kill, - ss->sg_flags); -} - -static void -print_svr4_tchars(str, st) - const char *str; - struct svr4_tchars *st; -{ - uprintf("%s\nintrc=%o quitc=%o ", str, st->t_intrc, st->t_quitc); - uprintf("startc=%o stopc=%o eofc=%o brkc=%o\n", st->t_startc, - st->t_stopc, st->t_eofc, st->t_brkc); -} - -static void -print_svr4_ltchars(str, sl) - const char *str; - struct svr4_ltchars *sl; -{ - uprintf("%s\nsuspc=%o dsuspc=%o ", str, sl->t_suspc, sl->t_dsuspc); - uprintf("rprntc=%o flushc=%o werasc=%o lnextc=%o\n", sl->t_rprntc, - sl->t_flushc, sl->t_werasc, sl->t_lnextc); -} -#endif /* DEBUG_SVR4 */ - -static void -svr4_tchars_to_bsd_tchars(st, bt) - const struct svr4_tchars *st; - struct tchars *bt; -{ - bt->t_intrc = st->t_intrc; - bt->t_quitc = st->t_quitc; - bt->t_startc = st->t_startc; - bt->t_stopc = st->t_stopc; - bt->t_eofc = st->t_eofc; - bt->t_brkc = st->t_brkc; -} - - -static void -bsd_tchars_to_svr4_tchars(bt, st) - const struct tchars *bt; - struct svr4_tchars *st; -{ - st->t_intrc = bt->t_intrc; - st->t_quitc = bt->t_quitc; - st->t_startc = bt->t_startc; - st->t_stopc = bt->t_stopc; - st->t_eofc = bt->t_eofc; - st->t_brkc = bt->t_brkc; -} - - -static void -svr4_sgttyb_to_bsd_sgttyb(ss, bs) - const struct svr4_sgttyb *ss; - struct sgttyb *bs; -{ - bs->sg_ispeed = ss->sg_ispeed; - bs->sg_ospeed = ss->sg_ospeed; - bs->sg_erase = ss->sg_erase; - bs->sg_kill = ss->sg_kill; - bs->sg_flags = ss->sg_flags; -}; - - -static void -bsd_sgttyb_to_svr4_sgttyb(bs, ss) - const struct sgttyb *bs; - struct svr4_sgttyb *ss; -{ - ss->sg_ispeed = bs->sg_ispeed; - ss->sg_ospeed = bs->sg_ospeed; - ss->sg_erase = bs->sg_erase; - ss->sg_kill = bs->sg_kill; - ss->sg_flags = bs->sg_flags; -} - - -static void -svr4_ltchars_to_bsd_ltchars(sl, bl) - const struct svr4_ltchars *sl; - struct ltchars *bl; -{ - bl->t_suspc = sl->t_suspc; - bl->t_dsuspc = sl->t_dsuspc; - bl->t_rprntc = sl->t_rprntc; - bl->t_flushc = sl->t_flushc; - bl->t_werasc = sl->t_werasc; - bl->t_lnextc = sl->t_lnextc; -} - - -static void -bsd_ltchars_to_svr4_ltchars(bl, sl) - const struct ltchars *bl; - struct svr4_ltchars *sl; -{ - sl->t_suspc = bl->t_suspc; - sl->t_dsuspc = bl->t_dsuspc; - sl->t_rprntc = bl->t_rprntc; - sl->t_flushc = bl->t_flushc; - sl->t_werasc = bl->t_werasc; - sl->t_lnextc = bl->t_lnextc; -} - - -int -svr4_ttold_ioctl(fp, p, retval, fd, cmd, data) - struct file *fp; - struct proc *p; - register_t *retval; - int fd; - u_long cmd; - caddr_t data; -{ - int error; - int (*ctl)(struct file *, u_long, caddr_t, struct proc *) = - fp->f_ops->fo_ioctl; - - *retval = 0; - - switch (cmd) { - case SVR4_TIOCGPGRP: - { - pid_t pid; - - if ((error = (*ctl)(fp, TIOCGPGRP, - (caddr_t) &pid, p)) != 0) - return error; - - DPRINTF(("TIOCGPGRP %d\n", pid)); - - if ((error = copyout(&pid, data, sizeof(pid))) != 0) - return error; - - } - - case SVR4_TIOCSPGRP: - { - pid_t pid; - - if ((error = copyin(data, &pid, sizeof(pid))) != 0) - return error; - - DPRINTF(("TIOCSPGRP %d\n", pid)); - - return (*ctl)(fp, TIOCSPGRP, (caddr_t) &pid, p); - } - - case SVR4_TIOCGSID: - { - pid_t pid; - - if ((error = (*ctl)(fp, TIOCGSID, - (caddr_t) &pid, p)) != 0) - return error; - - DPRINTF(("TIOCGSID %d\n", pid)); - - return copyout(&pid, data, sizeof(pid)); - } - - case SVR4_TIOCGETP: - { - struct sgttyb bs; - struct svr4_sgttyb ss; - - error = (*ctl)(fp, TIOCGETP, (caddr_t) &bs, p); - if (error) - return error; - - bsd_sgttyb_to_svr4_sgttyb(&bs, &ss); -#ifdef DEBUG_SVR4 - print_svr4_sgttyb("SVR4_TIOCGETP", &ss); -#endif /* DEBUG_SVR4 */ - return copyout(&ss, data, sizeof(ss)); - } - - case SVR4_TIOCSETP: - case SVR4_TIOCSETN: - { - struct sgttyb bs; - struct svr4_sgttyb ss; - - if ((error = copyin(data, &ss, sizeof(ss))) != 0) - return error; - - svr4_sgttyb_to_bsd_sgttyb(&ss, &bs); -#ifdef DEBUG_SVR4 - print_svr4_sgttyb("SVR4_TIOCSET{P,N}", &ss); -#endif /* DEBUG_SVR4 */ - cmd = (cmd == SVR4_TIOCSETP) ? TIOCSETP : TIOCSETN; - return (*ctl)(fp, cmd, (caddr_t) &bs, p); - } - - case SVR4_TIOCGETC: - { - struct tchars bt; - struct svr4_tchars st; - - error = (*ctl)(fp, TIOCGETC, (caddr_t) &bt, p); - if (error) - return error; - - bsd_tchars_to_svr4_tchars(&bt, &st); -#ifdef DEBUG_SVR4 - print_svr4_tchars("SVR4_TIOCGETC", &st); -#endif /* DEBUG_SVR4 */ - return copyout(&st, data, sizeof(st)); - } - - case SVR4_TIOCSETC: - { - struct tchars bt; - struct svr4_tchars st; - - if ((error = copyin(data, &st, sizeof(st))) != 0) - return error; - - svr4_tchars_to_bsd_tchars(&st, &bt); -#ifdef DEBUG_SVR4 - print_svr4_tchars("SVR4_TIOCSETC", &st); -#endif /* DEBUG_SVR4 */ - return (*ctl)(fp, TIOCSETC, (caddr_t) &bt, p); - } - - case SVR4_TIOCGLTC: - { - struct ltchars bl; - struct svr4_ltchars sl; - - error = (*ctl)(fp, TIOCGLTC, (caddr_t) &bl, p); - if (error) - return error; - - bsd_ltchars_to_svr4_ltchars(&bl, &sl); -#ifdef DEBUG_SVR4 - print_svr4_ltchars("SVR4_TIOCGLTC", &sl); -#endif /* DEBUG_SVR4 */ - return copyout(&sl, data, sizeof(sl)); - } - - case SVR4_TIOCSLTC: - { - struct ltchars bl; - struct svr4_ltchars sl; - - if ((error = copyin(data, &sl, sizeof(sl))) != 0) - return error; - - svr4_ltchars_to_bsd_ltchars(&sl, &bl); -#ifdef DEBUG_SVR4 - print_svr4_ltchars("SVR4_TIOCSLTC", &sl); -#endif /* DEBUG_SVR4 */ - return (*ctl)(fp, TIOCSLTC, (caddr_t) &bl, p); - } - - case SVR4_TIOCLGET: - { - int flags; - if ((error = (*ctl)(fp, cmd, (caddr_t) &flags, p)) != - 0) - return error; - DPRINTF(("SVR4_TIOCLGET %o\n", flags)); - return copyout(&flags, data, sizeof(flags)); - } - - case SVR4_TIOCLSET: - case SVR4_TIOCLBIS: - case SVR4_TIOCLBIC: - { - int flags; - - if ((error = copyin(data, &flags, sizeof(flags))) != 0) - return error; - - switch (cmd) { - case SVR4_TIOCLSET: - cmd = TIOCLSET; - break; - case SVR4_TIOCLBIS: - cmd = TIOCLBIS; - break; - case SVR4_TIOCLBIC: - cmd = TIOCLBIC; - break; - } - - DPRINTF(("SVR4_TIOCL{SET,BIS,BIC} %o\n", flags)); - return (*ctl)(fp, cmd, (caddr_t) &flags, p); - } - - default: - DPRINTF(("Unknown svr4 ttold %lx\n", cmd)); - return 0; /* ENOSYS really */ - } -} diff --git a/sys/compat/svr4/svr4_ttold.h b/sys/compat/svr4/svr4_ttold.h deleted file mode 100644 index 2d9cf0388b4..00000000000 --- a/sys/compat/svr4/svr4_ttold.h +++ /dev/null @@ -1,122 +0,0 @@ -/* $OpenBSD: svr4_ttold.h,v 1.2 1996/08/02 20:35:46 niklas Exp $ */ -/* $NetBSD: svr4_ttold.h,v 1.2 1994/11/18 02:54:25 christos Exp $ */ - -/* - * Copyright (c) 1994 Christos Zoulas - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _SVR4_TTOLD_H_ -#define _SVR4_TTOLD_H_ - -struct svr4_tchars { - char t_intrc; - char t_quitc; - char t_startc; - char t_stopc; - char t_eofc; - char t_brkc; -}; - -struct svr4_sgttyb { - u_char sg_ispeed; - u_char sg_ospeed; - u_char sg_erase; - u_char sg_kill; - int sg_flags; -}; - -struct svr4_ltchars { - char t_suspc; - char t_dsuspc; - char t_rprntc; - char t_flushc; - char t_werasc; - char t_lnextc; -}; - -#ifndef SVR4_tIOC -#define SVR4_tIOC ('t' << 8) -#endif - -#define SVR4_TIOCGETD (SVR4_tIOC | 0) -#define SVR4_TIOCSETD (SVR4_tIOC | 1) -#define SVR4_TIOCHPCL (SVR4_tIOC | 2) -#define SVR4_TIOCGETP (SVR4_tIOC | 8) -#define SVR4_TIOCSETP (SVR4_tIOC | 9) -#define SVR4_TIOCSETN (SVR4_tIOC | 10) -#define SVR4_TIOCEXCL (SVR4_tIOC | 13) -#define SVR4_TIOCNXCL (SVR4_tIOC | 14) -#define SVR4_TIOCFLUSH (SVR4_tIOC | 16) -#define SVR4_TIOCSETC (SVR4_tIOC | 17) -#define SVR4_TIOCGETC (SVR4_tIOC | 18) -#define SVR4_TIOCGPGRP (SVR4_tIOC | 20) -#define SVR4_TIOCSPGRP (SVR4_tIOC | 21) -#define SVR4_TIOCGSID (SVR4_tIOC | 22) -#define SVR4_TIOCSTI (SVR4_tIOC | 23) -#define SVR4_TIOCSSID (SVR4_tIOC | 24) -#define SVR4_TIOCMSET (SVR4_tIOC | 26) -#define SVR4_TIOCMBIS (SVR4_tIOC | 27) -#define SVR4_TIOCMBIC (SVR4_tIOC | 28) -#define SVR4_TIOCMGET (SVR4_tIOC | 29) -#define SVR4_TIOCREMOTE (SVR4_tIOC | 30) -#define SVR4_TIOCSIGNAL (SVR4_tIOC | 31) - -#define SVR4_TIOCSTART (SVR4_tIOC | 110) -#define SVR4_TIOCSTOP (SVR4_tIOC | 111) -#define SVR4_TIOCNOTTY (SVR4_tIOC | 113) -#define SVR4_TIOCOUTQ (SVR4_tIOC | 115) -#define SVR4_TIOCGLTC (SVR4_tIOC | 116) -#define SVR4_TIOCSLTC (SVR4_tIOC | 117) -#define SVR4_TIOCCDTR (SVR4_tIOC | 120) -#define SVR4_TIOCSDTR (SVR4_tIOC | 121) -#define SVR4_TIOCCBRK (SVR4_tIOC | 122) -#define SVR4_TIOCSBRK (SVR4_tIOC | 123) -#define SVR4_TIOCLGET (SVR4_tIOC | 124) -#define SVR4_TIOCLSET (SVR4_tIOC | 125) -#define SVR4_TIOCLBIC (SVR4_tIOC | 126) -#define SVR4_TIOCLBIS (SVR4_tIOC | 127) - -#define SVR4_TIOCM_LE 0001 -#define SVR4_TIOCM_DTR 0002 -#define SVR4_TIOCM_RTS 0004 -#define SVR4_TIOCM_ST 0010 -#define SVR4_TIOCM_SR 0020 -#define SVR4_TIOCM_CTS 0040 -#define SVR4_TIOCM_CAR 0100 -#define SVR4_TIOCM_CD SVR4_TIOCM_CAR -#define SVR4_TIOCM_RNG 0200 -#define SVR4_TIOCM_RI SVR4_TIOCM_RNG -#define SVR4_TIOCM_DSR 0400 - -#define SVR4_OTTYDISC 0 -#define SVR4_NETLDISC 1 -#define SVR4_NTTYDISC 2 -#define SVR4_TABLDISC 3 -#define SVR4_NTABLDISC 4 -#define SVR4_MOUSELDISC 5 -#define SVR4_KBDLDISC 6 - -#endif /* !_SVR4_TTOLD_H_ */ diff --git a/sys/compat/svr4/svr4_types.h b/sys/compat/svr4/svr4_types.h deleted file mode 100644 index e9e2d846dcb..00000000000 --- a/sys/compat/svr4/svr4_types.h +++ /dev/null @@ -1,82 +0,0 @@ -/* $OpenBSD: svr4_types.h,v 1.7 2008/06/26 05:42:14 ray Exp $ */ -/* $NetBSD: svr4_types.h,v 1.11 1998/09/11 12:34:46 mycroft Exp $ */ - -/*- - * Copyright (c) 1994 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Christos Zoulas. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _SVR4_TYPES_H_ -#define _SVR4_TYPES_H_ - -typedef u_quad_t svr4_ino64_t; -typedef quad_t svr4_off64_t; -typedef quad_t svr4_blkcnt64_t; -typedef u_quad_t svr4_fsblkcnt64_t; - -typedef long svr4_off_t; -typedef u_long svr4_dev_t; -typedef u_long svr4_ino_t; -typedef u_long svr4_mode_t; -typedef u_long svr4_nlink_t; -typedef long svr4_uid_t; -typedef long svr4_gid_t; -typedef int32_t svr4_daddr_t; -typedef long svr4_pid_t; -typedef long svr4_time_t; -typedef long svr4_blkcnt_t; -typedef u_long svr4_fsblkcnt_t; -typedef char *svr4_caddr_t; -typedef u_int svr4_size_t; - -typedef short svr4_o_dev_t; -typedef short svr4_o_pid_t; -typedef u_short svr4_o_ino_t; -typedef u_short svr4_o_mode_t; -typedef short svr4_o_nlink_t; -typedef u_short svr4_o_uid_t; -typedef u_short svr4_o_gid_t; -typedef long svr4_clock_t; -typedef int svr4_key_t; - -typedef struct timespec svr4_timestruc_t; - -#define svr4_omajor(x) ((int32_t)((((x) & 0x7f00) >> 8))) -#define svr4_ominor(x) ((int32_t)((((x) & 0x00ff) >> 0))) -#define svr4_omakedev(x,y) ((svr4_o_dev_t)((((x) << 8) & 0x7f00) | \ - (((y) << 0) & 0x00ff))) -#define svr4_to_bsd_odev_t(d) makedev(svr4_omajor(d), svr4_ominor(d)) -#define bsd_to_svr4_odev_t(d) svr4_omakedev(major(d), minor(d)) - -#define svr4_major(x) ((int32_t)((((x) & 0xfffc0000) >> 18))) -#define svr4_minor(x) ((int32_t)((((x) & 0x0003ffff) >> 0))) -#define svr4_makedev(x,y) ((svr4_dev_t)((((x) << 18) & 0xfffc0000) | \ - (((y) << 0) & 0x0003ffff))) -#define svr4_to_bsd_dev_t(d) makedev(svr4_major(d), svr4_minor(d)) -#define bsd_to_svr4_dev_t(d) svr4_makedev(major(d), minor(d)) - -#endif /* !_SVR4_TYPES_H_ */ diff --git a/sys/compat/svr4/svr4_ucontext.h b/sys/compat/svr4/svr4_ucontext.h deleted file mode 100644 index f2b8884f615..00000000000 --- a/sys/compat/svr4/svr4_ucontext.h +++ /dev/null @@ -1,77 +0,0 @@ -/* $OpenBSD: svr4_ucontext.h,v 1.2 1996/08/02 20:35:47 niklas Exp $ */ -/* $NetBSD: svr4_ucontext.h,v 1.3 1995/08/14 01:13:29 mycroft Exp $ */ - -/* - * Copyright (c) 1994 Christos Zoulas - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _SVR4_UCONTEXT_H_ -#define _SVR4_UCONTEXT_H_ - -#include <compat/svr4/svr4_types.h> -#include <compat/svr4/svr4_signal.h> -#include <machine/svr4_machdep.h> - -/* - * Machine context - */ - -#define SVR4_UC_SIGMASK 0x01 -#define SVR4_UC_STACK 0x02 - -#define SVR4_UC_CPU 0x04 -#define SVR4_UC_FPU 0x08 -#define SVR4_UC_WEITEK 0x10 - -#define SVR4_UC_MCONTEXT (SVR4_UC_CPU|SVR4_UC_FPU|SVR4_UC_WEITEK) - -#define SVR4_UC_ALL (SVR4_UC_SIGMASK|SVR4_UC_STACK|SVR4_UC_MCONTEXT) - -typedef struct svr4_ucontext { - u_long uc_flags; - struct svr4_ucontext *uc_link; - svr4_sigset_t uc_sigmask; - struct svr4_sigaltstack uc_stack; - svr4_mcontext_t uc_mcontext; - long uc_pad[5]; -} svr4_ucontext_t; - -#define SVR4_UC_GETREGSET 0 -#define SVR4_UC_SETREGSET 1 - -/* - * Signal frame - */ -struct svr4_sigframe { - int sf_signum; - union svr4_siginfo *sf_sip; - struct svr4_ucontext *sf_ucp; - sig_t sf_handler; - struct svr4_ucontext sf_uc; - union svr4_siginfo sf_si; -}; - -#endif /* !_SVR4_UCONTEXT_H_ */ diff --git a/sys/compat/svr4/svr4_ulimit.h b/sys/compat/svr4/svr4_ulimit.h deleted file mode 100644 index 9c1ab4aad14..00000000000 --- a/sys/compat/svr4/svr4_ulimit.h +++ /dev/null @@ -1,41 +0,0 @@ -/* $OpenBSD: svr4_ulimit.h,v 1.2 1996/08/02 20:35:47 niklas Exp $ */ -/* $NetBSD: svr4_ulimit.h,v 1.2 1994/11/18 02:54:29 christos Exp $ */ - -/* - * Copyright (c) 1994 Christos Zoulas - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _SVR4_ULIMIT_H_ -#define _SVR4_ULIMIT_H_ - -#define SVR4_GFILLIM 1 -#define SVR4_SFILLIM 2 -#define SVR4_GMEMLIM 3 -#define SVR4_GDESLIM 4 -#define SVR4_GTXTOFF 64 - - -#endif /* !_SVR4_ULIMIT_H_ */ diff --git a/sys/compat/svr4/svr4_ustat.h b/sys/compat/svr4/svr4_ustat.h deleted file mode 100644 index 380723b287e..00000000000 --- a/sys/compat/svr4/svr4_ustat.h +++ /dev/null @@ -1,43 +0,0 @@ -/* $OpenBSD: svr4_ustat.h,v 1.2 1996/08/02 20:35:48 niklas Exp $ */ -/* $NetBSD: svr4_ustat.h,v 1.3 1994/10/29 00:43:30 christos Exp $ */ - -/* - * Copyright (c) 1994 Christos Zoulas - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _SVR4_USTAT_H_ -#define _SVR4_USTAT_H_ - -#include <compat/svr4/svr4_types.h> - -struct svr4_ustat { - svr4_daddr_t f_tfree; - svr4_ino_t f_tinode; - char f_fname[6]; - char f_fpack[6]; -}; - -#endif /* !_SVR4_USTAT_H_ */ diff --git a/sys/compat/svr4/svr4_util.h b/sys/compat/svr4/svr4_util.h deleted file mode 100644 index db753d99b04..00000000000 --- a/sys/compat/svr4/svr4_util.h +++ /dev/null @@ -1,50 +0,0 @@ -/* $OpenBSD: svr4_util.h,v 1.3 2000/08/23 19:31:34 fgsch Exp $ */ -/* $NetBSD: svr4_util.h,v 1.8 1996/04/11 12:41:25 christos Exp $ */ - -/* - * Copyright (c) 1994 Christos Zoulas - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _SVR4_UTIL_H_ -#define _SVR4_UTIL_H_ - -#include <compat/common/compat_util.h> - -#ifdef DEBUG_SVR4 -#define DPRINTF(a) uprintf a; -#else -#define DPRINTF(a) -#endif - -extern const char svr4_emul_path[]; - -#define SVR4_CHECK_ALT_EXIST(p, sgp, path) \ - CHECK_ALT_EXIST(p, sgp, svr4_emul_path, path) - -#define SVR4_CHECK_ALT_CREAT(p, sgp, path) \ - CHECK_ALT_CREAT(p, sgp, svr4_emul_path, path) - -#endif /* !_SVR4_UTIL_H_ */ diff --git a/sys/compat/svr4/svr4_utsname.h b/sys/compat/svr4/svr4_utsname.h deleted file mode 100644 index 26aff2868f4..00000000000 --- a/sys/compat/svr4/svr4_utsname.h +++ /dev/null @@ -1,45 +0,0 @@ -/* $OpenBSD: svr4_utsname.h,v 1.2 1996/08/02 20:35:48 niklas Exp $ */ -/* $NetBSD: svr4_utsname.h,v 1.3 1994/10/29 00:43:33 christos Exp $ */ - -/* - * Copyright (c) 1994 Christos Zoulas - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _SVR4_UTSNAME_H_ -#define _SVR4_UTSNAME_H_ - -#include <compat/svr4/svr4_types.h> -#include <sys/utsname.h> - -struct svr4_utsname { - char sysname[257]; - char nodename[257]; - char release[257]; - char version[257]; - char machine[257]; -}; - -#endif /* !_SVR4_UTSNAME_H_ */ diff --git a/sys/compat/svr4/svr4_wait.h b/sys/compat/svr4/svr4_wait.h deleted file mode 100644 index 4a46b3d8d58..00000000000 --- a/sys/compat/svr4/svr4_wait.h +++ /dev/null @@ -1,56 +0,0 @@ -/* $OpenBSD: svr4_wait.h,v 1.2 1996/08/02 20:35:49 niklas Exp $ */ -/* $NetBSD: svr4_wait.h,v 1.5 1995/03/31 03:06:50 christos Exp $ */ - -/* - * Copyright (c) 1994 Christos Zoulas - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _SVR4_WAIT_H_ -#define _SVR4_WAIT_H_ - - -#define SVR4_P_PID 0 -#define SVR4_P_PPID 1 -#define SVR4_P_PGID 2 -#define SVR4_P_SID 3 -#define SVR4_P_CID 4 -#define SVR4_P_UID 5 -#define SVR4_P_GID 6 -#define SVR4_P_ALL 7 - -#define SVR4_WEXITED 0x01 -#define SVR4_WTRAPPED 0x02 -#define SVR4_WSTOPPED 0x04 -#define SVR4_WCONTINUED 0x08 -#define SVR4_WUNDEF1 0x10 -#define SVR4_WUNDEF2 0x20 -#define SVR4_WNOHANG 0x40 -#define SVR4_WNOWAIT 0x80 - -#define SVR4_WOPTMASK (SVR4_WEXITED|SVR4_WTRAPPED|SVR4_WSTOPPED|\ - SVR4_WCONTINUED|SVR4_WNOHANG|SVR4_WNOWAIT) - -#endif /* !_SVR4_WAIT_H_ */ diff --git a/sys/compat/svr4/syscalls.conf b/sys/compat/svr4/syscalls.conf deleted file mode 100644 index 1baa75300fd..00000000000 --- a/sys/compat/svr4/syscalls.conf +++ /dev/null @@ -1,12 +0,0 @@ -# $OpenBSD: syscalls.conf,v 1.3 2001/05/16 05:02:19 millert Exp $ -# $NetBSD: syscalls.conf,v 1.3 1994/10/26 05:28:08 cgd Exp $ - -sysnames="svr4_syscalls.c" -sysnumhdr="svr4_syscall.h" -syssw="svr4_sysent.c" -sysarghdr="svr4_syscallargs.h" -libcompatopts="" - -switchname="svr4_sysent" -namesname="svr4_syscallnames" -constprefix="SVR4_SYS_" diff --git a/sys/compat/svr4/syscalls.master b/sys/compat/svr4/syscalls.master deleted file mode 100644 index ac9b4b81f0c..00000000000 --- a/sys/compat/svr4/syscalls.master +++ /dev/null @@ -1,389 +0,0 @@ - $OpenBSD: syscalls.master,v 1.33 2003/01/30 03:29:49 millert Exp $ -; $NetBSD: syscalls.master,v 1.17 1996/02/10 17:12:51 christos Exp $ - -; @(#)syscalls.master 8.1 (Berkeley) 7/19/93 - -; OpenBSD COMPAT_SVR4 system call name/number "master" file. -; (See syscalls.conf to see what it is processed into.) -; -; Fields: number type [type-dependent ...] -; number system call number, must be in order -; type one of STD, OBSOL, UNIMPL, NODEF, NOARGS, or one of -; the compatibility options defined in syscalls.conf. -; -; types: -; STD always included -; OBSOL obsolete, not included in system -; UNIMPL unimplemented, not included in system -; NODEF included, but don't define the syscall number -; NOARGS included, but don't define the syscall args structure -; -; The compat options are defined in the syscalls.conf file, and the -; compat option name is prefixed to the syscall name. Other than -; that, they're like NODEF (for 'compat' options), or STD (for -; 'libcompat' options). -; -; The type-dependent arguments are as follows: -; For STD, NODEF, NOARGS, and compat syscalls: -; { pseudo-proto } [alias] -; For other syscalls: -; [comment] -; -; #ifdef's, etc. may be included, and are copied to the output files. -; #include's are copied to the syscall switch definition file only. - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/signal.h> -#include <sys/mount.h> -#include <sys/syscallargs.h> - -#include <compat/svr4/svr4_types.h> -#include <compat/svr4/svr4_time.h> -#include <compat/svr4/svr4_signal.h> -#include <compat/svr4/svr4_ucontext.h> -#include <compat/svr4/svr4_syscallargs.h> -#include <compat/svr4/svr4_statvfs.h> -#include <compat/svr4/svr4_acl.h> - -0 NOARGS { int sys_nosys(void); } syscall -1 NOARGS { int sys_exit(int rval); } -2 NOARGS { int sys_fork(void); } -3 NOARGS { int sys_read(int fd, char *buf, u_int nbyte); } -4 NOARGS { int sys_write(int fd, char *buf, u_int nbyte); } -5 STD { int svr4_sys_open(char *path, int flags, int mode); } -6 NOARGS { int sys_close(int fd); } -7 STD { int svr4_sys_wait(int *status); } -8 STD { int svr4_sys_creat(char *path, int mode); } -9 NOARGS { int sys_link(char *path, char *link); } -10 NOARGS { int sys_unlink(char *path); } -11 STD { int svr4_sys_execv(char *path, char **argp); } -12 NOARGS { int sys_chdir(char *path); } -13 STD { int svr4_sys_time(svr4_time_t *t); } -14 STD { int svr4_sys_mknod(char *path, int mode, int dev); } -15 NOARGS { int sys_chmod(char *path, int mode); } -16 NOARGS { int sys_chown(char *path, int uid, int gid); } -17 STD { int svr4_sys_break(caddr_t nsize); } -18 STD { int svr4_sys_stat(char *path, struct svr4_stat* ub); } -19 NOARGS { long compat_43_sys_lseek(int fd, long offset, \ - int whence); } -20 NOARGS { pid_t sys_getpid(void); } -21 UNIMPL old_mount -22 UNIMPL System V umount -23 NOARGS { int sys_setuid(uid_t uid); } -24 NOARGS { uid_t sys_getuid(void); } -25 UNIMPL stime -26 UNIMPL ptrace -27 STD { int svr4_sys_alarm(unsigned sec); } -28 STD { int svr4_sys_fstat(int fd, struct svr4_stat *sb); } -29 STD { int svr4_sys_pause(void); } -30 STD { int svr4_sys_utime(char *path, \ - struct svr4_utimbuf *ubuf); } -31 UNIMPL was stty -32 UNIMPL was gtty -33 STD { int svr4_sys_access(char *path, int flags); } -34 STD { int svr4_sys_nice(int prio); } -35 UNIMPL statfs -36 NOARGS { int sys_sync(void); } -37 STD { int svr4_sys_kill(int pid, int signum); } -38 UNIMPL fstatfs -39 STD { int svr4_sys_pgrpsys(int cmd, int pid, int pgid); } -40 UNIMPL xenix -41 NOARGS { int sys_dup(u_int fd); } -42 NOARGS { int sys_opipe(void); } -43 STD { int svr4_sys_times(struct tms *tp); } -44 UNIMPL profil -45 UNIMPL plock -46 NOARGS { int sys_setgid(gid_t gid); } -47 NOARGS { gid_t sys_getgid(void); } -48 STD { int svr4_sys_signal(int signum, svr4_sig_t handler); } -#ifdef SYSVMSG -49 STD { int svr4_sys_msgsys(int what, int a2, int a3, \ - int a4, int a5); } -#else -49 UNIMPL msgsys -#endif -50 STD { int svr4_sys_sysarch(int op, void *a1); } -51 UNIMPL acct -#ifdef SYSVSHM -52 STD { int svr4_sys_shmsys(int what, int a2, int a3, \ - int a4); } -#else -52 UNIMPL shmsys -#endif -#ifdef SYSVSEM -53 STD { int svr4_sys_semsys(int what, int a2, int a3, \ - int a4, int a5); } -#else -53 UNIMPL semsys -#endif -54 STD { int svr4_sys_ioctl(int fd, u_long com, \ - caddr_t data); } -55 UNIMPL uadmin -56 UNIMPL exch -57 STD { int svr4_sys_utssys(void *a1, void *a2, int sel, \ - void *a3); } -58 NOARGS { int sys_fsync(int fd); } -59 STD { int svr4_sys_execve(char *path, char **argp, \ - char **envp); } -60 NOARGS { int sys_umask(int newmask); } -61 NOARGS { int sys_chroot(char *path); } -62 STD { int svr4_sys_fcntl(int fd, int cmd, char *arg); } -63 STD { long svr4_sys_ulimit(int cmd, long newlimit); } -64 UNIMPL reserved for unix/pc -65 UNIMPL reserved for unix/pc -66 UNIMPL reserved for unix/pc -67 UNIMPL reserved for unix/pc -68 UNIMPL reserved for unix/pc -69 UNIMPL reserved for unix/pc -70 OBSOL advfs -71 OBSOL unadvfs -72 OBSOL rmount -73 OBSOL rumount -74 OBSOL rfstart -75 OBSOL sigret -76 STD { int svr4_sys_rdebug(void); } -77 OBSOL rfstop -78 UNIMPL rfsys -79 NOARGS { int sys_rmdir(char *path); } -80 NOARGS { int sys_mkdir(char *path, int mode); } -81 STD { int svr4_sys_getdents(int fd, char *buf, \ - int nbytes); } -82 OBSOL libattach -83 OBSOL libdetach -84 UNIMPL sysfs -85 STD { int svr4_sys_getmsg(int fd, struct svr4_strbuf *ctl, \ - struct svr4_strbuf *dat, int *flags); } -86 STD { int svr4_sys_putmsg(int fd, struct svr4_strbuf *ctl, \ - struct svr4_strbuf *dat, int flags); } -87 NOARGS { int sys_poll(struct pollfd *fds, u_long nfds, \ - int timeout); } -88 STD { int svr4_sys_lstat(char *path, \ - struct svr4_stat *ub); } -89 NOARGS { int sys_symlink(char *path, char *link); } -90 NOARGS { int sys_readlink(char *path, char *buf, int count); } -91 NOARGS { int sys_getgroups(u_int gidsetsize, gid_t *gidset); } -92 NOARGS { int sys_setgroups(u_int gidsetsize, gid_t *gidset); } -93 NOARGS { int sys_fchmod(int fd, int mode); } -94 NOARGS { int sys_fchown(int fd, int uid, int gid); } -95 STD { int svr4_sys_sigprocmask(int how, \ - svr4_sigset_t *set, svr4_sigset_t *oset); } -96 STD { int svr4_sys_sigsuspend(svr4_sigset_t *ss); } -97 STD { int svr4_sys_sigaltstack( \ - struct svr4_sigaltstack *nss, \ - struct svr4_sigaltstack *oss); } -98 STD { int svr4_sys_sigaction(int signum, \ - struct svr4_sigaction *nsa, \ - struct svr4_sigaction *osa); } -99 STD { int svr4_sys_sigpending(int what, \ - svr4_sigset_t *mask); } -100 STD { int svr4_sys_context(int func, \ - struct svr4_ucontext *uc); } -101 UNIMPL evsys -102 UNIMPL evtrapret -103 STD { int svr4_sys_statvfs(char *path, \ - struct svr4_statvfs *fs); } -104 STD { int svr4_sys_fstatvfs(int fd, \ - struct svr4_statvfs *fs); } -105 UNIMPL -106 UNIMPL nfssvc -107 STD { int svr4_sys_waitsys(int grp, int id, \ - union svr4_siginfo *info, int options); } -108 UNIMPL sigsendsys -109 STD { int svr4_sys_hrtsys(int cmd, int fun, int sub, \ - void *rv1, void *rv2); } -110 UNIMPL acancel -111 UNIMPL async -112 UNIMPL priocntlsys -113 STD { int svr4_sys_pathconf(char *path, int name); } -114 NOARGS { int sys_mincore(caddr_t addr, int len, char *vec); } -115 STD { int svr4_sys_mmap(svr4_caddr_t addr, \ - svr4_size_t len, int prot, int flags, int fd, \ - svr4_off_t pos); } -116 NOARGS { int sys_mprotect(caddr_t addr, int len, int prot); } -117 NOARGS { int sys_munmap(caddr_t addr, int len); } -118 STD { int svr4_sys_fpathconf(int fd, int name); } -119 NOARGS { int sys_vfork(void); } -120 NOARGS { int sys_fchdir(int fd); } -121 NOARGS { int sys_readv(int fd, struct iovec *iovp, u_int iovcnt); } -122 NOARGS { int sys_writev(int fd, struct iovec *iovp, \ - u_int iovcnt); } -123 STD { int svr4_sys_xstat(int two, char *path, \ - struct svr4_xstat *ub); } -124 STD { int svr4_sys_lxstat(int two, char *path, \ - struct svr4_xstat *ub); } -125 STD { int svr4_sys_fxstat(int two, int fd, \ - struct svr4_xstat *sb); } -126 STD { int svr4_sys_xmknod(int two, char *path, \ - svr4_mode_t mode, svr4_dev_t dev); } -127 UNIMPL clocal -128 STD { int svr4_sys_setrlimit(int which, \ - struct ogetrlimit *rlp); } -129 STD { int svr4_sys_getrlimit(int which, \ - struct ogetrlimit *rlp); } -130 NOARGS { int sys_lchown(char *path, int uid, int gid); } -131 STD { int svr4_sys_memcntl(svr4_caddr_t addr, \ - svr4_size_t len, int cmd, svr4_caddr_t arg, \ - int attr, int mask); } -132 UNIMPL getpmsg -133 UNIMPL putpmsg -134 NOARGS { int sys_rename(char *from, char *to); } -135 STD { int svr4_sys_uname(struct svr4_utsname* name, \ - int dummy); } -136 STD { int svr4_sys_setegid(gid_t egid); } -137 STD { int svr4_sys_sysconfig(int name); } -138 NOARGS { int sys_adjtime(struct timeval *delta, \ - struct timeval *olddelta); } -139 STD { long svr4_sys_systeminfo(int what, char *buf, \ - long len); } -140 UNIMPL -141 NOARGS { int sys_seteuid(uid_t euid); } -142 UNIMPL vtrace -143 UNIMPL fork1 -144 UNIMPL sigtimedwait -145 UNIMPL lwp_info -146 UNIMPL yield -147 UNIMPL lwp_sema_wait -148 UNIMPL lwp_sema_post -149 UNIMPL lwp_sema_trywait -150 UNIMPL -151 UNIMPL -152 UNIMPL modctl -153 STD { int svr4_sys_fchroot(int fd); } -154 STD { int svr4_sys_utimes(char *path, \ - struct timeval *tptr); } -155 STD { int svr4_sys_vhangup(void); } -156 STD { int svr4_sys_gettimeofday(struct timeval *tp); } -157 NOARGS { int sys_getitimer(u_int which, \ - struct itimerval *itv); } -158 NOARGS { int sys_setitimer(u_int which, \ - struct itimerval *itv, struct itimerval *oitv); } -159 UNIMPL lwp_create -160 UNIMPL lwp_exit -161 UNIMPL lwp_suspend -162 UNIMPL lwp_continue -163 UNIMPL lwp_kill -164 UNIMPL lwp_self -165 UNIMPL lwp_getprivate -166 UNIMPL lwp_setprivate -167 UNIMPL lwp_wait -168 UNIMPL lwp_mutex_unlock -169 UNIMPL lwp_mutex_lock -170 UNIMPL lwp_cond_wait -171 UNIMPL lwp_cond_signal -172 UNIMPL lwp_cond_broadcast -173 STD { ssize_t svr4_sys_pread(int fd, void *buf, \ - size_t nbyte, svr4_off_t off); } -174 STD { ssize_t svr4_sys_pwrite(int fd, const void *buf, \ - size_t nbyte, svr4_off_t off); } -175 STD { svr4_off64_t svr4_sys_llseek(int fd, \ - long offset1, long offset2, int whence); } -176 UNIMPL inst_sync -177 UNIMPL -178 UNIMPL kaio -179 UNIMPL -180 UNIMPL -181 UNIMPL -182 UNIMPL -183 UNIMPL -184 UNIMPL tsolsys -185 STD { int svr4_sys_acl(char *path, int cmd, int num, \ - struct svr4_aclent *buf); } -186 STD { int svr4_sys_auditsys(int code, int a1, int a2, \ - int a3, int a4, int a5); } -187 UNIMPL processor_bind -188 UNIMPL processor_info -189 UNIMPL p_online -190 UNIMPL sigqueue -191 NOARGS { int sys_clock_gettime(clockid_t clock_id, \ - struct timespec *tp); } -192 NOARGS { int sys_clock_settime(clockid_t clock_id, \ - const struct timespec *tp); } -193 NOARGS { int sys_clock_getres(clockid_t clock_id, \ - struct timespec *tp); } -194 UNIMPL timer_create -195 UNIMPL timer_delete -196 UNIMPL timer_settime -197 UNIMPL timer_gettime -198 UNIMPL timer_getoverrun -199 NOARGS { int sys_nanosleep(const struct timespec *rqtp, \ - struct timespec *rmtp); } -200 STD { int svr4_sys_facl(int fd, int cmd, int num, \ - struct svr4_aclent *buf); } -201 UNIMPL door -202 NOARGS { int sys_setreuid(uid_t ruid, uid_t euid); } -203 NOARGS { int sys_setregid(gid_t rgid, gid_t egid); } -204 UNIMPL install_utrap -205 UNIMPL signotify -206 UNIMPL schedctl -207 UNIMPL pset -208 UNIMPL -209 UNIMPL resolvepath -210 UNIMPL signotifywait -211 UNIMPL lwp_sigredirect -212 UNIMPL lwp_alarm -213 STD { int svr4_sys_getdents64(int fd, \ - struct svr4_dirent64 *dp, \ - int nbytes); } -214 STD { int svr4_sys_mmap64(svr4_caddr_t addr, \ - svr4_size_t len, int prot, int flags, int fd, \ - svr4_off64_t pos); } -215 STD { int svr4_sys_stat64(const char *path, \ - struct svr4_stat64 *sb); } -216 STD { int svr4_sys_lstat64(const char *path, \ - struct svr4_stat64 *sb); } -217 STD { int svr4_sys_fstat64(int fd, \ - struct svr4_stat64 *sb); } -218 UNIMPL statvfs64 -219 STD { int svr4_sys_fstatvfs64(int fd, \ - struct svr4_statvfs64 *fs); } -220 UNIMPL setrlimit64 -221 UNIMPL getrlimit64 -222 STD { ssize_t svr4_sys_pread64(int fd, void *buf, \ - size_t nbyte, svr4_off64_t off); } -223 STD { ssize_t svr4_sys_pwrite64(int fd, const void *buf, \ - size_t nbyte, svr4_off64_t off); } -224 STD { int svr4_sys_creat64(char *path, int mode); } -225 STD { int svr4_sys_open64(char *path, int flags, \ - int mode); } -226 UNIMPL rpcsys -227 UNIMPL -228 UNIMPL -229 UNIMPL -230 STD { int svr4_sys_socket(int domain, int type, \ - int protocol); } -231 NOARGS { int sys_socketpair(int domain, int type, \ - int protocol, int *rsv); } -232 NOARGS { int sys_bind(int s, const struct sockaddr *name, \ - int namelen); } -233 NOARGS { int sys_listen(int s, int backlog); } -234 NOARGS { int compat_43_sys_accept(int s, \ - struct sockaddr *name, int *anamelen); } -235 NOARGS { int sys_connect(int s, const struct sockaddr *name, \ - int namelen); } -236 NOARGS { int sys_shutdown(int s, int how); } -237 NOARGS { int compat_43_sys_recv(int s, caddr_t buf, int len, \ - int flags); } -238 NOARGS { ssize_t compat_43_sys_recvfrom(int s, void *buf, \ - size_t len, int flags, struct sockaddr *from, \ - int *fromlenaddr); } -239 NOARGS { ssize_t compat_43_sys_recvmsg(int s, \ - struct msghdr *msg, int flags); } -240 NOARGS { int compat_43_sys_send(int s, caddr_t buf, int len, \ - int flags); } -241 NOARGS { ssize_t compat_43_sys_sendmsg(int s, \ - const struct msghdr *msg, int flags); } -242 NOARGS { ssize_t sys_sendto(int s, const void *buf, \ - size_t len, int flags, const struct sockaddr *to, \ - int tolen); } -243 NOARGS { int compat_43_sys_getpeername(int fdes, \ - struct sockaddr *asa, int *alen); } -244 NOARGS { int compat_43_sys_getsockname(int fdes, \ - struct sockaddr *asa, int *alen); } -245 NOARGS { int sys_getsockopt(int s, int level, int name, \ - void *val, int *avalsize); } -246 NOARGS { int sys_setsockopt(int s, int level, int name, \ - const void *val, int valsize); } -247 UNIMPL sockconfig -248 UNIMPL ntp_gettime -249 UNIMPL ntp_adjtime |