diff options
Diffstat (limited to 'sys/compat/hpux')
-rw-r--r-- | sys/compat/hpux/files.hpux | 14 | ||||
-rw-r--r-- | sys/compat/hpux/hpux.h | 310 | ||||
-rw-r--r-- | sys/compat/hpux/hpux_compat.c | 2164 | ||||
-rw-r--r-- | sys/compat/hpux/hpux_exec.h | 63 | ||||
-rw-r--r-- | sys/compat/hpux/hpux_net.c | 317 | ||||
-rw-r--r-- | sys/compat/hpux/hpux_sig.c | 437 | ||||
-rw-r--r-- | sys/compat/hpux/hpux_syscall.h | 151 | ||||
-rw-r--r-- | sys/compat/hpux/hpux_syscallargs.h | 475 | ||||
-rw-r--r-- | sys/compat/hpux/hpux_syscalls.c | 356 | ||||
-rw-r--r-- | sys/compat/hpux/hpux_sysent.c | 702 | ||||
-rw-r--r-- | sys/compat/hpux/hpux_termio.h | 192 | ||||
-rw-r--r-- | sys/compat/hpux/hpux_tty.c | 548 | ||||
-rw-r--r-- | sys/compat/hpux/hpux_util.h | 41 | ||||
-rw-r--r-- | sys/compat/hpux/syscalls.conf | 12 | ||||
-rw-r--r-- | sys/compat/hpux/syscalls.master | 439 |
15 files changed, 6221 insertions, 0 deletions
diff --git a/sys/compat/hpux/files.hpux b/sys/compat/hpux/files.hpux new file mode 100644 index 00000000000..a95e7509382 --- /dev/null +++ b/sys/compat/hpux/files.hpux @@ -0,0 +1,14 @@ +# $NetBSD: files.hpux,v 1.1 1995/05/10 16:45:27 christos Exp $ +# +# Config.new file description for machine-independent HPUX compat code. +# Included by ports that need it. + +# ports should define any machine-specific files they need in their +# own file lists. + +file compat/hpux/hpux_compat.c compat_hpux +file compat/hpux/hpux_net.c compat_hpux +file compat/hpux/hpux_sig.c compat_hpux +file compat/hpux/hpux_syscalls.c compat_hpux +file compat/hpux/hpux_sysent.c compat_hpux +file compat/hpux/hpux_tty.c compat_hpux diff --git a/sys/compat/hpux/hpux.h b/sys/compat/hpux/hpux.h new file mode 100644 index 00000000000..b4ec592f366 --- /dev/null +++ b/sys/compat/hpux/hpux.h @@ -0,0 +1,310 @@ +/* $NetBSD: hpux.h,v 1.8 1995/05/10 16:45:29 christos Exp $ */ + +/* + * Copyright (c) 1988 University of Utah. + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * the Systems Programming Group of the University of Utah Computer + * Science Department. + * + * 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 the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + * + * from: Utah $Hdr: hpux.h 1.33 93/08/05$ + * + * @(#)hpux.h 8.4 (Berkeley) 2/13/94 + */ + +#include <compat/hpux/hpux_exec.h> + +/* HP-UX style UTSNAME struct used by uname syscall */ + +struct hpux_utsname { + char sysname[9]; + char nodename[9]; + char release[9]; + char version[9]; + char machine[9]; + char idnumber[15]; +}; + +/* HP-UX style "old" IOCTLs */ + +struct hpux_sgttyb { + char sg_ispeed; + char sg_ospeed; + char sg_erase; + char sg_kill; + int sg_flags; /* only a short in BSD */ +}; + +#define V7_HUPCL 00001 +#define V7_XTABS 00002 +#define V7_NOAL 04000 + +#define HPUXTIOCGETP _IOR('t', 8, struct hpux_sgttyb) +#define HPUXTIOCSETP _IOW('t', 9, struct hpux_sgttyb) + +/* 6.5 job control related ioctls which need to be mapped */ + +#define HPUXTIOCSLTC _IOW('T', 23, struct ltchars) +#define HPUXTIOCGLTC _IOR('T', 24, struct ltchars) +#define HPUXTIOCLBIS _IOW('T', 25, int) +#define HPUXTIOCLBIC _IOW('T', 26, int) +#define HPUXTIOCLSET _IOW('T', 27, int) +#define HPUXTIOCLGET _IOR('T', 28, int) +# define HPUXLTOSTOP 0000001 +#define HPUXTIOCSPGRP _IOW('T', 29, int) +#define HPUXTIOCGPGRP _IOR('T', 30, int) +#define HPUXTIOCCONS _IO('t', 104) +#define HPUXTIOCSWINSZ _IOW('t', 106, struct winsize) +#define HPUXTIOCGWINSZ _IOR('t', 107, struct winsize) + +/* non-blocking IO--doesn't interfere with O_NDELAY */ +#define HPUXFIOSNBIO _IOW('f', 126, int) + +/* HP-UX stat structure */ + +#define bsdtohpuxdev(d) ((major(d) << 24) | minor(d)) + +struct hpux_stat { + long hst_dev; + u_long hst_ino; + u_short hst_mode; + short hst_nlink; + u_short hst_uid; + u_short hst_gid; + long hst_rdev; + long hst_size; + time_t hst_atime; + int hst_spare1; + time_t hst_mtime; + int hst_spare2; + time_t hst_ctime; + int hst_spare3; + long hst_blksize; + long hst_blocks; + u_int hst_remote; + long hst_netdev; + u_long hst_netino; + long hst_spare4[9]; +}; + +/* from old timeb.h */ +struct hpux_otimeb { + time_t time; + u_short millitm; + short timezone; + short dstflag; +}; + +/* ye ole stat structure */ +struct hpux_ostat { + u_short hst_dev; + u_short hst_ino; + u_short hst_mode; + short hst_nlink; + short hst_uid; + short hst_gid; + u_short hst_rdev; + int hst_size; + int hst_atime; + int hst_mtime; + int hst_ctime; +}; +/* + * Skeletal 6.X HP-UX user structure info for ptrace() mapping. + * Yes, this is as bogus as it gets... + */ + +/* 6.0/6.2 offsets */ +#define ooHU_AROFF 0x004 +#define ooHU_TSOFF 0x092 +#define ooHU_EDOFF 0x91E +#define ooHU_FPOFF 0xA66 + +/* 6.5 offsets */ +#define oHU_AROFF 0x004 +#define oHU_TSOFF 0x0B2 +#define oHU_EDOFF 0x93A +#define oHU_FPOFF 0xA86 + +/* 7.X offsets */ +#define HU_AROFF 0x004 +#define HU_TSOFF 0x0B4 +#define HU_EDOFF 0x8C8 +#define HU_FPOFF 0xA28 + +#define HU_PAD1 (HU_AROFF) +#define HU_PAD2 (HU_TSOFF-HU_AROFF-4) +#define HU_PAD3 (HU_EDOFF-HU_TSOFF-12) +#define HU_PAD4 (HU_FPOFF-HU_EDOFF-sizeof(struct hpux_exec)) + +struct hpux_user { + u_char whocares1[HU_PAD1]; /* +0x000 */ + int *hpuxu_ar0; /* +0x004 */ + u_char whocares2[HU_PAD2]; /* +0x008 */ + int hpuxu_tsize; /* +0x0B2 */ + int hpuxu_dsize; /* +0x0B6 */ + int hpuxu_ssize; /* +0x0BA */ + u_char whocares3[HU_PAD3]; /* +0x0BE */ + struct hpux_exec hpuxu_exdata; /* +0x93A */ + u_char whocares4[HU_PAD4]; /* +0x95E */ + struct hpux_fp { /* +0xA66 */ + int hpfp_save[54]; + int hpfp_ctrl[3]; + int hpfp_reg[24]; + } hpuxu_fp; + short hpuxu_dragon; /* +0xBCA */ +}; + +/* HP-UX compat file flags */ +#define HPUXNDELAY 00000004 +#define HPUXFCREAT 00000400 +#define HPUXFTRUNC 00001000 +#define HPUXFEXCL 00002000 +#define HPUXFSYNCIO 00100000 +#define HPUXNONBLOCK 00200000 +#define HPUXFREMOTE 01000000 + +/* HP-UX fcntl file locking */ +struct hpux_flock { + short hl_type; + short hl_whence; + long hl_start; + long hl_len; + long hl_pid; +}; + +#define HPUXF_GETLK 7 +#define HPUXF_SETLK 8 +#define HPUXF_SETLKW 9 + +#define HPUXF_RDLCK 1 +#define HPUXF_WRLCK 2 +#define HPUXF_UNLCK 3 + +/* HP-UX only sysV shmctl() commands */ +#define SHM_LOCK 3 /* Lock segment in core */ +#define SHM_UNLOCK 4 /* Unlock segment */ + +/* SHM stuff reflecting POSIX types */ +struct hpux_ipc_perm { + long uid; /* owner's user id */ + long gid; /* owner's group id */ + long cuid; /* creator's user id */ + long cgid; /* creator's group id */ + u_short mode; /* access modes */ + u_short seq; /* slot usage sequence number */ + long key; /* key */ +}; + +struct hpux_shmid_ds { + struct hpux_ipc_perm shm_perm; /* operation permission struct */ + int shm_segsz; /* segment size (bytes) */ + struct pte *shm_ptbl; /* ptr to associated page table */ + long shm_lpid; /* pid of last shmop */ + long shm_cpid; /* pid of creator */ + u_short shm_nattch; /* current # attached */ + u_short shm_cnattch; /* in memory # attached */ + time_t shm_atime; /* last shmat time */ + time_t shm_dtime; /* last shmdt time */ + time_t shm_ctime; /* last change time */ + /* actually longer */ +}; + +/* HP-UX rtprio values */ +#define RTPRIO_MIN 0 +#define RTPRIO_MAX 127 +#define RTPRIO_NOCHG 1000 +#define RTPRIO_RTOFF 1001 + +/* HP-UX only sigvec sv_flags values */ +#define HPUXSV_RESET 000000004 + +/* + * HP-UX returns SIGILL instead of SIGFPE for the CHK and TRAPV exceptions. + * It also returns different u_code values for certain illegal instruction + * and floating point exceptions. Here are the proper HP-UX u_code values + * (numbers from hpux 6.2 manual pages). + */ + +/* SIGILL codes */ +#define HPUX_ILL_ILLINST_TRAP 0 /* T_ILLINST+USER */ +#define HPUX_ILL_CHK_TRAP 6 /* T_CHKINST+USER */ +#define HPUX_ILL_TRAPV_TRAP 7 /* T_TRAPVINST+USER */ +#define HPUX_ILL_PRIV_TRAP 8 /* T_PRIVINST+USER */ + +/* SIGFPE codes */ +#define HPUX_FPE_INTDIV_TRAP 5 /* T_ZERODIV+USER */ + +/* HP-UX POSIX signal stuff implementation */ +typedef struct __hpux_sigset_t { long sigset[8]; } hpux_sigset_t; +struct hpux_sigaction { + void (*sa_handler)(); + hpux_sigset_t sa_mask; + int sa_flags; +}; +#define HPUXSA_ONSTACK 1 +#define HPUXSA_RESETHAND 4 +#define HPUXSA_NOCLDSTOP 8 + +#define HPUXSIG_BLOCK 0 /* block specified signal set */ +#define HPUXSIG_UNBLOCK 1 /* unblock specified signal set */ +#define HPUXSIG_SETMASK 2 /* set specified signal set */ + +/* sysconf stuff */ +#define HPUX_SYSCONF_CLKTICK 2 +#define HPUX_SYSCONF_OPENMAX 4 +#define HPUX_SYSCONF_CPUTYPE 10001 +#define HPUX_SYSCONF_CPUM020 0x20C +#define HPUX_SYSCONF_CPUM030 0x20D +#define HPUX_SYSCONF_CPUM040 0x20E +#define HPUX_SYSCONF_CPUPA10 0x20B +#define HPUX_SYSCONF_CPUPA11 0x210 + +/* mmap stuff */ +#define HPUXMAP_FIXED 0x04 +#define HPUXMAP_REPLACE 0x08 +#define HPUXMAP_ANON 0x10 + +/* rlimit stuff */ +#define HPUXRLIMIT_NOFILE 6 + +/* + * In BSD EAGAIN and EWOULDBLOCK are the same error code. + * However, for HP-UX we must split them out to seperate codes. + * The easiest way to do this was to check the return value of + * BSD routines which are known to return EAGAIN (but never + * EWOULDBLOCK) and change it to the pseudo-code OEAGAIN when + * we see it. The error translation table will them map that + * code to the HP-UX EAGAIN value. + */ +#define OEAGAIN 82 diff --git a/sys/compat/hpux/hpux_compat.c b/sys/compat/hpux/hpux_compat.c new file mode 100644 index 00000000000..bc127ad804c --- /dev/null +++ b/sys/compat/hpux/hpux_compat.c @@ -0,0 +1,2164 @@ +/* $NetBSD: hpux_compat.c,v 1.19 1995/10/07 06:26:34 mycroft Exp $ */ + +/* + * Copyright (c) 1988 University of Utah. + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * the Systems Programming Group of the University of Utah Computer + * Science Department. + * + * 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 the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + * + * from: Utah $Hdr: hpux_compat.c 1.64 93/08/05$ + * + * @(#)hpux_compat.c 8.4 (Berkeley) 2/13/94 + */ + +/* + * Various HP-UX compatibility routines + */ + +#ifndef COMPAT_43 +#define COMPAT_43 +#endif + +#include <sys/param.h> +#include <sys/systm.h> +#include <sys/signalvar.h> +#include <sys/kernel.h> +#include <sys/filedesc.h> +#include <sys/proc.h> +#include <sys/buf.h> +#include <sys/wait.h> +#include <sys/file.h> +#include <sys/namei.h> +#include <sys/vnode.h> +#include <sys/ioctl.h> +#include <sys/ptrace.h> +#include <sys/stat.h> +#include <sys/syslog.h> +#include <sys/malloc.h> +#include <sys/mount.h> +#include <sys/ipc.h> +#include <sys/user.h> +#include <sys/mman.h> + +#include <machine/cpu.h> +#include <machine/reg.h> +#include <machine/psl.h> +#include <machine/vmparam.h> + +#include <sys/syscallargs.h> + +#include <compat/hpux/hpux.h> +#include <compat/hpux/hpux_util.h> +#include <compat/hpux/hpux_termio.h> +#include <compat/hpux/hpux_syscall.h> +#include <compat/hpux/hpux_syscallargs.h> + +#ifdef DEBUG +int unimpresponse = 0; +#endif + +/* 6.0 and later style context */ +#if defined(HP380) +char hpux_040context[] = + "standalone HP-MC68040 HP-MC68881 HP-MC68020 HP-MC68010 localroot default"; +#endif +#ifdef FPCOPROC +char hpux_context[] = + "standalone HP-MC68881 HP-MC68020 HP-MC68010 localroot default"; +#else +char hpux_context[] = + "standalone HP-MC68020 HP-MC68010 localroot default"; +#endif + +#define NERR 83 +#define BERR 1000 + +/* indexed by BSD errno */ +int bsdtohpuxerrnomap[NERR] = { +/*00*/ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, +/*10*/ 10, 45, 12, 13, 14, 15, 16, 17, 18, 19, +/*20*/ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, +/*30*/ 30, 31, 32, 33, 34, 246, 245, 244, 216, 217, +/*40*/ 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, +/*50*/ 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, +/*60*/ 238, 239, 249, 248, 241, 242, 247,BERR,BERR,BERR, +/*70*/ 70, 71,BERR,BERR,BERR,BERR,BERR, 46, 251,BERR, +/*80*/ BERR,BERR, 11 +}; + +extern char sigcode[], esigcode[]; +extern struct sysent hpux_sysent[]; +extern char *hpux_syscallnames[]; + +struct emul emul_hpux = { + "hpux", + bsdtohpuxerrnomap, + sendsig, + HPUX_SYS_syscall, + HPUX_SYS_MAXSYSCALL, + hpux_sysent, + hpux_syscallnames, + 0, + copyargs, + setregs, + sigcode, + esigcode, +}; + +/* + * HP-UX fork and vfork need to map the EAGAIN return value appropriately. + */ +int +hpux_sys_fork(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + struct hpux_sys_fork_args *uap = v; + int error; + + error = sys_fork(p, (struct fork_args *) uap, retval); + if (error == EAGAIN) + error = OEAGAIN; + return (error); +} + +int +hpux_sys_vfork(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + struct hpux_sys_vfork_args *uap = v; + int error; + + error = sys_vfork(p, (struct vfork_args *) uap, retval); + if (error == EAGAIN) + error = OEAGAIN; + return (error); +} + +int +hpux_sys_execv(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + struct hpux_sys_execv_args *uap = v; + struct sys_execve_args ap; + + SCARG(&ap, path) = SCARG(uap, path); + SCARG(&ap, argp) = SCARG(uap, argp); + SCARG(&ap, envp) = NULL; + + return sys_execve(p, &ap, retval); +} + +/* + * HP-UX versions of wait and wait3 actually pass the parameters + * (status pointer, options, rusage) into the kernel rather than + * handling it in the C library stub. We also need to map any + * termination signal from BSD to HP-UX. + */ +int +hpux_sys_wait3(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + struct hpux_sys_wait3_args *uap = v; + + /* rusage pointer must be zero */ + if (SCARG(uap, rusage)) + return (EINVAL); +#if __mc68k__ + p->p_md.md_regs[PS] = PSL_ALLCC; + p->p_md.md_regs[R0] = SCARG(uap, options); + p->p_md.md_regs[R1] = SCARG(uap, rusage); +#endif + + return (hpux_sys_wait(p, uap, retval)); +} + +int +hpux_sys_wait(p, v, retval) + register struct proc *p; + void *v; + register_t *retval; +{ + register struct hpux_sys_wait_args *uap = v; + struct sys_wait4_args w4; + int error; + int sig; + size_t sz = sizeof(*SCARG(&w4, status)); + int 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; + + error = sys_wait4(p, &w4, retval); + /* + * HP-UX wait always returns EINTR when interrupted by a signal + * (well, unless its emulating a BSD process, but we don't bother...) + */ + if (error == ERESTART) + error = EINTR; + if (error) + return error; + + if ((error = copyin(SCARG(&w4, status), &status, sizeof(status))) != 0) + return error; + + sig = status & 0xFF; + if (sig == WSTOPPED) { + sig = (status >> 8) & 0xFF; + retval[1] = (bsdtohpuxsig(sig) << 8) | WSTOPPED; + } else if (sig) + retval[1] = (status & 0xFF00) | + bsdtohpuxsig(sig & 0x7F) | (sig & 0x80); + + if (SCARG(uap, status) == NULL) + return error; + else + return copyout(&retval[1], + SCARG(uap, status), sizeof(retval[1])); +} + +int +hpux_sys_waitpid(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + struct hpux_sys_waitpid_args *uap = v; + int rv, sig, xstat, error; + + SCARG(uap, rusage) = 0; + error = sys_wait4(p, uap, retval); + /* + * HP-UX wait always returns EINTR when interrupted by a signal + * (well, unless its emulating a BSD process, but we don't bother...) + */ + if (error == ERESTART) + error = EINTR; + if (error) + return (error); + + if (SCARG(uap, status)) { + /* + * Wait4 already wrote the status out to user space, + * pull it back, change the signal portion, and write + * it back out. + */ + rv = fuword((caddr_t)SCARG(uap, status)); + if (WIFSTOPPED(rv)) { + sig = WSTOPSIG(rv); + rv = W_STOPCODE(bsdtohpuxsig(sig)); + } else if (WIFSIGNALED(rv)) { + sig = WTERMSIG(rv); + xstat = WEXITSTATUS(rv); + rv = W_EXITCODE(xstat, bsdtohpuxsig(sig)) | + WCOREDUMP(rv); + } + (void)suword((caddr_t)SCARG(uap, status), rv); + } + return (error); +} + +/* + * Old creat system call. + */ +int +hpux_sys_creat(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + register struct hpux_sys_creat_args *uap = v; + struct sys_open_args oap; + + SCARG(&oap, path) = SCARG(uap, path); + SCARG(&oap, flags) = O_WRONLY | O_CREAT | O_TRUNC; + SCARG(&oap, mode) = SCARG(uap, mode); + + return sys_open(p, &oap, retval); +} + +/* + * XXX extensions to the fd_ofileflags flags. + * Hate to put this there, but they do need to be per-file. + */ +#define UF_NONBLOCK_ON 0x10 +#define UF_FNDELAY_ON 0x20 +#define UF_FIONBIO_ON 0x40 + +/* + * Must remap some bits in the mode mask. + * O_CREAT, O_TRUNC, and O_EXCL must be remapped, + * O_NONBLOCK is remapped and remembered, + * O_FNDELAY is remembered, + * O_SYNCIO is removed entirely. + */ +int +hpux_sys_open(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + register struct hpux_sys_open_args *uap = v; + int mode, error; + + mode = SCARG(uap, mode); + SCARG(uap, mode) &= + ~(HPUXNONBLOCK|HPUXFSYNCIO|HPUXFEXCL|HPUXFTRUNC|HPUXFCREAT); + if (mode & HPUXFCREAT) { + /* + * simulate the pre-NFS behavior that opening a + * file for READ+CREATE ignores the CREATE (unless + * EXCL is set in which case we will return the + * proper error). + */ + if ((mode & HPUXFEXCL) || (FFLAGS(mode) & FWRITE)) + SCARG(uap, mode) |= O_CREAT; + } + if (mode & HPUXFTRUNC) + SCARG(uap, mode) |= O_TRUNC; + if (mode & HPUXFEXCL) + SCARG(uap, mode) |= O_EXCL; + if (mode & HPUXNONBLOCK) + SCARG(uap, mode) |= O_NDELAY; + error = sys_open(p, (struct open_args *) uap, retval); + /* + * Record non-blocking mode for fcntl, read, write, etc. + */ + if (error == 0 && (SCARG(uap, mode) & O_NDELAY)) + p->p_fd->fd_ofileflags[*retval] |= + (mode & HPUXNONBLOCK) ? UF_NONBLOCK_ON : UF_FNDELAY_ON; + return (error); +} + +int +hpux_sys_fcntl(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + register struct hpux_sys_fcntl_args *uap = v; + int mode, error, flg = F_POSIX; + struct file *fp; + char *pop; + struct hpux_flock hfl; + struct flock fl; + struct vnode *vp; + + if ((unsigned)SCARG(uap, fd) >= p->p_fd->fd_nfiles || + (fp = p->p_fd->fd_ofiles[SCARG(uap, fd)]) == NULL) + return (EBADF); + pop = &p->p_fd->fd_ofileflags[SCARG(uap, fd)]; + switch (SCARG(uap, cmd)) { + case F_SETFL: + if (SCARG(uap, arg) & HPUXNONBLOCK) + *pop |= UF_NONBLOCK_ON; + else + *pop &= ~UF_NONBLOCK_ON; + if (SCARG(uap, arg) & HPUXNDELAY) + *pop |= UF_FNDELAY_ON; + else + *pop &= ~UF_FNDELAY_ON; + if (*pop & (UF_NONBLOCK_ON|UF_FNDELAY_ON|UF_FIONBIO_ON)) + SCARG(uap, arg) |= FNONBLOCK; + else + SCARG(uap, arg) &= ~FNONBLOCK; + SCARG(uap, arg) &= ~(HPUXNONBLOCK|HPUXFSYNCIO|HPUXFREMOTE); + break; + case F_GETFL: + case F_DUPFD: + case F_GETFD: + case F_SETFD: + break; + + case HPUXF_SETLKW: + flg |= F_WAIT; + /* Fall into F_SETLK */ + + case HPUXF_SETLK: + if (fp->f_type != DTYPE_VNODE) + return (EBADF); + vp = (struct vnode *)fp->f_data; + /* Copy in the lock structure */ + error = copyin((caddr_t)SCARG(uap, arg), (caddr_t)&hfl, + sizeof (hfl)); + if (error) + return (error); + fl.l_start = hfl.hl_start; + fl.l_len = hfl.hl_len; + fl.l_pid = hfl.hl_pid; + fl.l_type = hfl.hl_type; + fl.l_whence = hfl.hl_whence; + if (fl.l_whence == SEEK_CUR) + fl.l_start += fp->f_offset; + switch (fl.l_type) { + + case F_RDLCK: + if ((fp->f_flag & FREAD) == 0) + return (EBADF); + p->p_flag |= P_ADVLOCK; + return (VOP_ADVLOCK(vp, (caddr_t)p, F_SETLK, &fl, flg)); + + case F_WRLCK: + if ((fp->f_flag & FWRITE) == 0) + return (EBADF); + p->p_flag |= P_ADVLOCK; + return (VOP_ADVLOCK(vp, (caddr_t)p, F_SETLK, &fl, flg)); + + case F_UNLCK: + return (VOP_ADVLOCK(vp, (caddr_t)p, F_UNLCK, &fl, + F_POSIX)); + + default: + return (EINVAL); + } + + case F_GETLK: + if (fp->f_type != DTYPE_VNODE) + return (EBADF); + vp = (struct vnode *)fp->f_data; + /* Copy in the lock structure */ + error = copyin((caddr_t)SCARG(uap, arg), (caddr_t)&hfl, + sizeof (hfl)); + if (error) + return (error); + fl.l_start = hfl.hl_start; + fl.l_len = hfl.hl_len; + fl.l_pid = hfl.hl_pid; + fl.l_type = hfl.hl_type; + fl.l_whence = hfl.hl_whence; + if (fl.l_whence == SEEK_CUR) + fl.l_start += fp->f_offset; + if (error = VOP_ADVLOCK(vp, (caddr_t)p, F_GETLK, &fl, F_POSIX)) + return (error); + hfl.hl_start = fl.l_start; + hfl.hl_len = fl.l_len; + hfl.hl_pid = fl.l_pid; + hfl.hl_type = fl.l_type; + hfl.hl_whence = fl.l_whence; + return (copyout((caddr_t)&hfl, (caddr_t)SCARG(uap, arg), + sizeof (hfl))); + + default: + return (EINVAL); + } + error = sys_fcntl(p, uap, retval); + if (error == 0 && SCARG(uap, cmd) == F_GETFL) { + mode = *retval; + *retval &= ~(O_CREAT|O_TRUNC|O_EXCL); + if (mode & FNONBLOCK) { + if (*pop & UF_NONBLOCK_ON) + *retval |= HPUXNONBLOCK; + if ((*pop & UF_FNDELAY_ON) == 0) + *retval &= ~HPUXNDELAY; + } + if (mode & O_CREAT) + *retval |= HPUXFCREAT; + if (mode & O_TRUNC) + *retval |= HPUXFTRUNC; + if (mode & O_EXCL) + *retval |= HPUXFEXCL; + } + return (error); +} + +/* + * Read and write calls. Same as BSD except for non-blocking behavior. + * There are three types of non-blocking reads/writes in HP-UX checked + * in the following order: + * + * O_NONBLOCK: return -1 and errno == EAGAIN + * O_NDELAY: return 0 + * FIOSNBIO: return -1 and errno == EWOULDBLOCK + */ +int +hpux_sys_read(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + struct hpux_sys_read_args *uap = v; + int error; + + error = sys_read(p, (struct sys_read_args *) uap, retval); + if (error == EWOULDBLOCK) { + char *fp = &p->p_fd->fd_ofileflags[SCARG(uap, fd)]; + + if (*fp & UF_NONBLOCK_ON) { + *retval = -1; + error = OEAGAIN; + } else if (*fp & UF_FNDELAY_ON) { + *retval = 0; + error = 0; + } + } + return (error); +} + +int +hpux_sys_write(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + struct hpux_sys_write_args *uap = v; + int error; + + error = sys_write(p, (struct sys_write_args *) uap, retval); + if (error == EWOULDBLOCK) { + char *fp = &p->p_fd->fd_ofileflags[SCARG(uap, fd)]; + + if (*fp & UF_NONBLOCK_ON) { + *retval = -1; + error = OEAGAIN; + } else if (*fp & UF_FNDELAY_ON) { + *retval = 0; + error = 0; + } + } + return (error); +} + +int +hpux_sys_readv(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + struct hpux_sys_readv_args *uap = v; + int error; + + error = sys_readv(p, (struct sys_readv_args *) uap, retval); + if (error == EWOULDBLOCK) { + char *fp = &p->p_fd->fd_ofileflags[SCARG(uap, fd)]; + + if (*fp & UF_NONBLOCK_ON) { + *retval = -1; + error = OEAGAIN; + } else if (*fp & UF_FNDELAY_ON) { + *retval = 0; + error = 0; + } + } + return (error); +} + +int +hpux_sys_writev(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + struct hpux_sys_writev_args *uap = v; + int error; + + error = sys_writev(p, (struct sys_writev_args *) uap, retval); + if (error == EWOULDBLOCK) { + char *fp = &p->p_fd->fd_ofileflags[SCARG(uap, fd)]; + + if (*fp & UF_NONBLOCK_ON) { + *retval = -1; + error = OEAGAIN; + } else if (*fp & UF_FNDELAY_ON) { + *retval = 0; + error = 0; + } + } + return (error); +} + +/* + * 4.3bsd dup allows dup2 to come in on the same syscall entry + * and hence allows two arguments. HP-UX dup has only one arg. + */ +int +hpux_sys_dup(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + register struct hpux_sys_dup_args *uap = v; + register struct filedesc *fdp = p->p_fd; + struct file *fp; + int fd, error; + + if (((unsigned)SCARG(uap, fd)) >= fdp->fd_nfiles || + (fp = fdp->fd_ofiles[SCARG(uap, fd)]) == NULL) + return (EBADF); + if (error = fdalloc(p, 0, &fd)) + return (error); + fdp->fd_ofiles[fd] = fp; + fdp->fd_ofileflags[fd] = + fdp->fd_ofileflags[SCARG(uap, fd)] &~ UF_EXCLOSE; + fp->f_count++; + if (fd > fdp->fd_lastfile) + fdp->fd_lastfile = fd; + *retval = fd; + return (0); +} + +/* + * XXX: This belongs in hpux_machdep.c !! + */ +int +hpux_sys_utssys(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + register struct hpux_sys_utssys_args *uap = v; + register int i; + int error; + struct hpux_utsname ut; + extern char ostype[], hostname[], osrelease[], version[], machine[]; + + switch (SCARG(uap, request)) { + /* uname */ + case 0: + bzero(&ut, sizeof(ut)); + + strncpy(ut.sysname, ostype, sizeof(ut.sysname)); + ut.sysname[sizeof(ut.sysname) - 1] = '\0'; + + /* copy hostname (sans domain) to nodename */ + for (i = 0; i < 8 && hostname[i] != '.'; i++) + ut.nodename[i] = hostname[i]; + ut.nodename[i] = '\0'; + + strncpy(ut.release, osrelease, sizeof(ut.release)); + ut.release[sizeof(ut.release) - 1] = '\0'; + + strncpy(ut.version, version, sizeof(ut.version)); + ut.version[sizeof(ut.version) - 1] = '\0'; + + strncpy(ut.machine, "9000/3?0", sizeof(ut.machine)); + ut.machine[sizeof(ut.machine) - 1] = '\0'; + + /* fill in machine type */ +#ifdef HP_320 + switch (machineid) { + case HP_320: + ut.machine[6] = '2'; + break; + /* includes 318 and 319 */ + case HP_330: + ut.machine[6] = '3'; + break; + case HP_340: + ut.machine[6] = '4'; + break; + case HP_350: + ut.machine[6] = '5'; + break; + case HP_360: + ut.machine[6] = '6'; + break; + case HP_370: + ut.machine[6] = '7'; + break; + /* includes 345 */ + case HP_375: + ut.machine[6] = '7'; + ut.machine[7] = '5'; + break; + /* includes 425 */ + case HP_380: + ut.machine[6] = '8'; + break; + case HP_433: + ut.machine[5] = '4'; + ut.machine[6] = '3'; + ut.machine[7] = '3'; + break; + } +#endif + + error = copyout((caddr_t)&ut, + (caddr_t)SCARG(uap, uts), sizeof(ut)); + break; + + /* gethostname */ + case 5: + /* SCARG(uap, dev) is length */ + if (SCARG(uap, dev) > hostnamelen + 1) + SCARG(uap, dev) = hostnamelen + 1; + error = copyout((caddr_t)hostname, (caddr_t)SCARG(uap, uts), + SCARG(uap, dev)); + break; + + case 1: /* ?? */ + case 2: /* ustat */ + case 3: /* ?? */ + case 4: /* sethostname */ + default: + error = EINVAL; + break; + } + return (error); +} + +/* + * XXX: This belongs in hpux_machdep.c !! + */ +int +hpux_sys_sysconf(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + struct hpux_sys_sysconf_args *uap = v; + switch (SCARG(uap, name)) { + + /* clock ticks per second */ + case HPUX_SYSCONF_CLKTICK: + *retval = hz; + break; + + /* open files */ + case HPUX_SYSCONF_OPENMAX: + *retval = NOFILE; + break; + + /* architecture */ + case HPUX_SYSCONF_CPUTYPE: +#ifdef HP_320 + switch (machineid) { + case HP_320: + case HP_330: + case HP_350: + *retval = HPUX_SYSCONF_CPUM020; + break; + case HP_340: + case HP_360: + case HP_370: + case HP_375: + *retval = HPUX_SYSCONF_CPUM030; + break; + case HP_380: + case HP_433: + *retval = HPUX_SYSCONF_CPUM040; + break; + } +#else + *retval = HPUX_SYSCONF_CPUM020; +#endif + break; + default: + uprintf("HP-UX sysconf(%d) not implemented\n", + SCARG(uap, name)); + return (EINVAL); + } + return (0); +} + +int +hpux_sys_stat(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + struct hpux_sys_stat_args *uap = v; + + return (hpux_stat1(SCARG(uap, path), SCARG(uap, sb), FOLLOW, p)); +} + +int +hpux_sys_lstat(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + struct hpux_sys_lstat_args *uap = v; + + return (hpux_stat1(SCARG(uap, path), SCARG(uap, sb), NOFOLLOW, p)); +} + +int +hpux_sys_fstat(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + register struct hpux_sys_fstat_args *uap = v; + register struct filedesc *fdp = p->p_fd; + register struct file *fp; + struct stat sb; + int error; + + if (((unsigned)SCARG(uap, fd)) >= fdp->fd_nfiles || + (fp = fdp->fd_ofiles[SCARG(uap, fd)]) == NULL) + return (EBADF); + + switch (fp->f_type) { + + case DTYPE_VNODE: + error = vn_stat((struct vnode *)fp->f_data, &sb, p); + break; + + case DTYPE_SOCKET: + error = soo_stat((struct socket *)fp->f_data, &sb, p); + break; + + default: + panic("fstat"); + /*NOTREACHED*/ + } + /* is this right for sockets?? */ + if (error == 0) + error = bsdtohpuxstat(&sb, SCARG(uap, sb)); + return (error); +} + +int +hpux_sys_ulimit(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + register struct hpux_sys_ulimit_args *uap = v; + struct rlimit *limp; + int error = 0; + + limp = &p->p_rlimit[RLIMIT_FSIZE]; + switch (SCARG(uap, cmd)) { + case 2: + SCARG(uap, newlimit) *= 512; + if (SCARG(uap, newlimit) > limp->rlim_max && + (error = suser(p->p_ucred, &p->p_acflag))) + break; + limp->rlim_cur = limp->rlim_max = SCARG(uap, newlimit); + /* else fall into... */ + + case 1: + *retval = limp->rlim_max / 512; + break; + + case 3: + limp = &p->p_rlimit[RLIMIT_DATA]; + *retval = ctob(p->p_vmspace->vm_tsize) + limp->rlim_max; + break; + + default: + error = EINVAL; + break; + } + return (error); +} + +/* + * Map "real time" priorities 0 (high) thru 127 (low) into nice + * values -16 (high) thru -1 (low). + */ +int +hpux_sys_rtprio(cp, v, retval) + struct proc *cp; + void *v; + register_t *retval; +{ + register struct hpux_sys_rtprio_args *uap = v; + struct proc *p; + int nice, error; + + if (SCARG(uap, prio) < RTPRIO_MIN && SCARG(uap, prio) > RTPRIO_MAX && + SCARG(uap, prio) != RTPRIO_NOCHG && + SCARG(uap, prio) != RTPRIO_RTOFF) + return (EINVAL); + if (SCARG(uap, pid) == 0) + p = cp; + else if ((p = pfind(SCARG(uap, pid))) == 0) + return (ESRCH); + nice = p->p_nice; + if (nice < NZERO) + *retval = (nice + 16) << 3; + else + *retval = RTPRIO_RTOFF; + switch (SCARG(uap, prio)) { + + case RTPRIO_NOCHG: + return (0); + + case RTPRIO_RTOFF: + if (nice >= NZERO) + return (0); + nice = NZERO; + break; + + default: + nice = (SCARG(uap, prio) >> 3) - 16; + break; + } + error = donice(cp, p, nice); + if (error == EACCES) + error = EPERM; + return (error); +} + +/* + * XXX: This belongs in hpux_machdep.c !! + */ +int +hpux_sys_advise(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + struct hpux_sys_advise_args *uap = v; + int error = 0; + +#ifdef hp300 + switch (SCARG(uap, arg)) { + case 0: + p->p_md.md_flags |= MDP_HPUXMMAP; + break; + case 1: + ICIA(); + break; + case 2: + DCIA(); + break; + default: + error = EINVAL; + break; + } +#endif + return (error); +} + +int +hpux_sys_ptrace(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + struct hpux_sys_ptrace_args *uap = v; + int error, isps = 0; + struct proc *cp; + + switch (SCARG(uap, req)) { + /* map signal */ +#if defined(PT_STEP) || defined(PT_CONTINUE) +# ifdef PT_STEP + case PT_STEP: +# endif +# ifdef PT_CONTINUE + case PT_CONTINUE: +# endif + if (SCARG(uap, data)) { + SCARG(uap, data) = hpuxtobsdsig(SCARG(uap, data)); + if (SCARG(uap, data) == 0) + SCARG(uap, data) = NSIG; + } + break; +#endif + /* map u-area offset */ +#if defined(PT_READ_U) || defined(PT_WRITE_U) +# ifdef PT_READ_U + case PT_READ_U: +# endif +# ifdef PT_WRITE_U + case PT_WRITE_U: +# endif + /* + * Big, cheezy hack: hpuxtobsduoff is really intended + * to be called in the child context (procxmt) but we + * do it here in the parent context to avoid hacks in + * the MI sys_process.c file. This works only because + * we can access the child's md_regs pointer and it + * has the correct value (the child has already trapped + * into the kernel). + */ + if ((cp = pfind(SCARG(uap, pid))) == 0) + return (ESRCH); + SCARG(uap, addr) = + (int *)hpuxtobsduoff(SCARG(uap, addr), &isps, cp); + + /* + * Since HP-UX PS is only 16-bits in ar0, requests + * to write PS actually contain the PS in the high word + * and the high half of the PC (the following register) + * in the low word. Move the PS value to where BSD + * expects it. + */ + if (isps && SCARG(uap, req) == PT_WRITE_U) + SCARG(uap, data) >>= 16; + break; +#endif + } + + error = sys_ptrace(p, uap, retval); + /* + * Align PS as HP-UX expects it (see WRITE_U comment above). + * Note that we do not return the high part of PC like HP-UX + * would, but the HP-UX debuggers don't require it. + */ +#ifdef PT_READ_U + if (isps && error == 0 && SCARG(uap, req) == PT_READ_U) + *retval <<= 16; +#endif + return (error); +} + +#ifdef SYSVSHM +#include <sys/shm.h> + +int +hpux_sys_shmctl(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + struct hpux_sys_shmctl_args *uap = v; + + return (hpux_shmctl1(p, (struct hpux_shmctl_args *) uap, retval, 0)); +} + +int +hpux_sys_nshmctl(p, v, retval) + struct proc *p; + void *v; + register_t *retval; /* struct hpux_nshmctl_args * */ +{ + struct hpux_sys_nshmctl_args *uap = v; + + return (hpux_shmctl1(p, (struct hpux_shmctl_args *) uap, retval, 1)); +} + +/* + * Handle HP-UX specific commands. + */ +int +hpux_shmctl1(p, uap, retval, isnew) + struct proc *p; + struct hpux_sys_shmctl_args *uap; + register_t *retval; + int isnew; +{ + register struct shmid_ds *shp; + register struct ucred *cred = p->p_ucred; + struct hpux_shmid_ds sbuf; + int error; + extern struct shmid_ds *shm_find_segment_by_shmid __P((int)); + + if ((shp = shm_find_segment_by_shmid(SCARG(uap, shmid))) == NULL) + return EINVAL; + + switch (SCARG(uap, cmd)) { + case SHM_LOCK: + case SHM_UNLOCK: + /* don't really do anything, but make them think we did */ + if (cred->cr_uid && cred->cr_uid != shp->shm_perm.uid && + cred->cr_uid != shp->shm_perm.cuid) + return (EPERM); + return (0); + + case IPC_STAT: + if (!isnew) + break; + error = ipcperm(cred, &shp->shm_perm, IPC_R); + if (error == 0) { + sbuf.shm_perm.uid = shp->shm_perm.uid; + sbuf.shm_perm.gid = shp->shm_perm.gid; + sbuf.shm_perm.cuid = shp->shm_perm.cuid; + sbuf.shm_perm.cgid = shp->shm_perm.cgid; + sbuf.shm_perm.mode = shp->shm_perm.mode; + sbuf.shm_perm.seq = shp->shm_perm.seq; + sbuf.shm_perm.key = shp->shm_perm.key; + sbuf.shm_segsz = shp->shm_segsz; + sbuf.shm_ptbl = shp->shm_internal; /* XXX */ + sbuf.shm_lpid = shp->shm_lpid; + sbuf.shm_cpid = shp->shm_cpid; + sbuf.shm_nattch = shp->shm_nattch; + sbuf.shm_cnattch = shp->shm_nattch; /* XXX */ + sbuf.shm_atime = shp->shm_atime; + sbuf.shm_dtime = shp->shm_dtime; + sbuf.shm_ctime = shp->shm_ctime; + error = copyout((caddr_t)&sbuf, SCARG(uap, buf), + sizeof sbuf); + } + return (error); + + case IPC_SET: + if (!isnew) + break; + if (cred->cr_uid && cred->cr_uid != shp->shm_perm.uid && + cred->cr_uid != shp->shm_perm.cuid) { + return (EPERM); + } + error = copyin(SCARG(uap, buf), (caddr_t)&sbuf, sizeof sbuf); + if (error == 0) { + shp->shm_perm.uid = sbuf.shm_perm.uid; + shp->shm_perm.gid = sbuf.shm_perm.gid; + shp->shm_perm.mode = (shp->shm_perm.mode & ~0777) + | (sbuf.shm_perm.mode & 0777); + shp->shm_ctime = time.tv_sec; + } + return (error); + } + return (sys_shmctl(p, uap, retval)); +} +#endif + +/* + * HP-UX mmap() emulation (mainly for shared library support). + */ +int +hpux_sys_mmap(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + struct hpux_sys_mmap_args *uap = v; + struct sys_mmap_args /* { + syscallarg(caddr_t) addr; + syscallarg(size_t) len; + syscallarg(int) prot; + syscallarg(int) flags; + syscallarg(int) fd; + syscallarg(long) pad; + syscallarg(off_t) pos; + } */ nargs; + + SCARG(&nargs, addr) = SCARG(uap, addr); + SCARG(&nargs, len) = SCARG(uap, len); + SCARG(&nargs, prot) = SCARG(uap, prot); + SCARG(&nargs, flags) = SCARG(uap, flags) & + ~(HPUXMAP_FIXED|HPUXMAP_REPLACE|HPUXMAP_ANON); + if (SCARG(uap, flags) & HPUXMAP_FIXED) + SCARG(&nargs, flags) |= MAP_FIXED; + if (SCARG(uap, flags) & HPUXMAP_ANON) + SCARG(&nargs, flags) |= MAP_ANON; + SCARG(&nargs, fd) = (SCARG(&nargs, flags) & MAP_ANON) ? -1 : SCARG(uap, fd); + SCARG(&nargs, pos) = SCARG(uap, pos); + + return (sys_mmap(p, &nargs, retval)); +} + +hpux_stat1(fname, hsb, follow, p) + char *fname; + struct hpux_stat *hsb; + int follow; + struct proc *p; +{ + int error; + struct stat sb; + struct nameidata nd; + + NDINIT(&nd, LOOKUP, follow | LOCKLEAF, UIO_USERSPACE, fname, p); + if (error = namei(&nd)) + return (error); + error = vn_stat(nd.ni_vp, &sb, p); + vput(nd.ni_vp); + if (error == 0) + error = bsdtohpuxstat(&sb, hsb); + return (error); +} + +#ifdef hp300 +#include "grf.h" +#define NHIL 1 /* XXX */ +#endif + +#if NGRF > 0 +extern int grfopen __P((dev_t dev, int oflags, int devtype, struct proc *p)); +#endif + +#if NHIL > 0 +extern int hilopen __P((dev_t dev, int oflags, int devtype, struct proc *p)); +#endif + +#include <sys/conf.h> + +int +bsdtohpuxstat(sb, hsb) + struct stat *sb; + struct hpux_stat *hsb; +{ + struct hpux_stat ds; + + bzero((caddr_t)&ds, sizeof(ds)); + ds.hst_dev = (u_short)sb->st_dev; + ds.hst_ino = (u_long)sb->st_ino; + ds.hst_mode = sb->st_mode; + ds.hst_nlink = sb->st_nlink; + ds.hst_uid = (u_short)sb->st_uid; + ds.hst_gid = (u_short)sb->st_gid; + ds.hst_rdev = bsdtohpuxdev(sb->st_rdev); + + /* XXX: I don't want to talk about it... */ + if ((sb->st_mode & S_IFMT) == S_IFCHR) +#if NGRF > 0 + if (cdevsw[major(sb->st_rdev)].d_open == grfopen) + ds.hst_rdev = grfdevno(sb->st_rdev); + else +#endif +#if NHIL > 0 + if (cdevsw[major(sb->st_rdev)].d_open == hilopen) + ds.hst_rdev = hildevno(sb->st_rdev); +#endif + + if (sb->st_size < (quad_t)1 << 32) + ds.hst_size = (long)sb->st_size; + else + ds.hst_size = -2; + ds.hst_atime = sb->st_atime; + ds.hst_mtime = sb->st_mtime; + ds.hst_ctime = sb->st_ctime; + ds.hst_blksize = sb->st_blksize; + ds.hst_blocks = sb->st_blocks; + return(copyout((caddr_t)&ds, (caddr_t)hsb, sizeof(ds))); +} + +int +hpuxtobsdioctl(com) + u_long com; +{ + switch (com) { + case HPUXTIOCSLTC: + com = TIOCSLTC; break; + case HPUXTIOCGLTC: + com = TIOCGLTC; break; + case HPUXTIOCSPGRP: + com = TIOCSPGRP; break; + case HPUXTIOCGPGRP: + com = TIOCGPGRP; break; + case HPUXTIOCLBIS: + com = TIOCLBIS; break; + case HPUXTIOCLBIC: + com = TIOCLBIC; break; + case HPUXTIOCLSET: + com = TIOCLSET; break; + case HPUXTIOCLGET: + com = TIOCLGET; break; + case HPUXTIOCGWINSZ: + com = TIOCGWINSZ; break; + case HPUXTIOCSWINSZ: + com = TIOCSWINSZ; break; + } + return(com); +} + +/* + * HP-UX ioctl system call. The differences here are: + * IOC_IN also means IOC_VOID if the size portion is zero. + * no FIOCLEX/FIONCLEX/FIOASYNC/FIOGETOWN/FIOSETOWN + * the sgttyb struct is 2 bytes longer + */ +int +hpux_sys_ioctl(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + register struct hpux_sys_ioctl_args *uap = v; + register struct filedesc *fdp = p->p_fd; + register struct file *fp; + register int com, error; + register u_int size; + caddr_t memp = 0; +#define STK_PARAMS 128 + char stkbuf[STK_PARAMS]; + caddr_t dt = stkbuf; + + com = SCARG(uap, com); + +#ifdef COMPAT_HPUX_6X + /* XXX */ + if (com == HPUXTIOCGETP || com == HPUXTIOCSETP) + return (getsettty(p, SCARG(uap, fd), com, SCARG(uap, data))); +#endif + + if (((unsigned)SCARG(uap, fd)) >= fdp->fd_nfiles || + (fp = fdp->fd_ofiles[SCARG(uap, fd)]) == NULL) + return (EBADF); + if ((fp->f_flag & (FREAD|FWRITE)) == 0) + return (EBADF); + + /* + * Interpret high order word to find + * amount of data to be copied to/from the + * user's address space. + */ + size = IOCPARM_LEN(com); + if (size > IOCPARM_MAX) + return (ENOTTY); + if (size > sizeof (stkbuf)) { + memp = (caddr_t)malloc((u_long)size, M_IOCTLOPS, M_WAITOK); + dt = memp; + } + if (com&IOC_IN) { + if (size) { + error = copyin(SCARG(uap, data), dt, (u_int)size); + if (error) { + if (memp) + free(memp, M_IOCTLOPS); + return (error); + } + } else + *(caddr_t *)dt = SCARG(uap, data); + } else if ((com&IOC_OUT) && size) + /* + * Zero the buffer so the user always + * gets back something deterministic. + */ + bzero(dt, size); + else if (com&IOC_VOID) + *(caddr_t *)dt = SCARG(uap, data); + + switch (com) { + + case HPUXFIOSNBIO: + { + char *ofp = &fdp->fd_ofileflags[SCARG(uap, fd)]; + int tmp; + + if (*(int *)dt) + *ofp |= UF_FIONBIO_ON; + else + *ofp &= ~UF_FIONBIO_ON; + /* + * Only set/clear if O_NONBLOCK/FNDELAY not in effect + */ + if ((*ofp & (UF_NONBLOCK_ON|UF_FNDELAY_ON)) == 0) { + tmp = *ofp & UF_FIONBIO_ON; + error = (*fp->f_ops->fo_ioctl)(fp, FIONBIO, + (caddr_t)&tmp, p); + } + break; + } + + case HPUXTIOCCONS: + *(int *)dt = 1; + error = (*fp->f_ops->fo_ioctl)(fp, TIOCCONS, dt, p); + break; + + /* BSD-style job control ioctls */ + case HPUXTIOCLBIS: + case HPUXTIOCLBIC: + case HPUXTIOCLSET: + *(int *)dt &= HPUXLTOSTOP; + if (*(int *)dt & HPUXLTOSTOP) + *(int *)dt = LTOSTOP; + /* fall into */ + + /* simple mapping cases */ + case HPUXTIOCLGET: + case HPUXTIOCSLTC: + case HPUXTIOCGLTC: + case HPUXTIOCSPGRP: + case HPUXTIOCGPGRP: + case HPUXTIOCGWINSZ: + case HPUXTIOCSWINSZ: + error = (*fp->f_ops->fo_ioctl) + (fp, hpuxtobsdioctl(com), dt, p); + if (error == 0 && com == HPUXTIOCLGET) { + *(int *)dt &= LTOSTOP; + if (*(int *)dt & LTOSTOP) + *(int *)dt = HPUXLTOSTOP; + } + break; + + /* SYS 5 termio and POSIX termios */ + case HPUXTCGETA: + case HPUXTCSETA: + case HPUXTCSETAW: + case HPUXTCSETAF: + case HPUXTCGETATTR: + case HPUXTCSETATTR: + case HPUXTCSETATTRD: + case HPUXTCSETATTRF: + error = hpux_termio(SCARG(uap, fd), com, dt, p); + break; + + default: + error = (*fp->f_ops->fo_ioctl)(fp, com, dt, p); + break; + } + /* + * Copy any data to user, size was + * already set and checked above. + */ + if (error == 0 && (com&IOC_OUT) && size) + error = copyout(dt, SCARG(uap, data), (u_int)size); + if (memp) + free(memp, M_IOCTLOPS); + return (error); +} + +/* + * XXX: This should be in hpux_machdep.c !! + */ +/* + * Man page lies, behaviour here is based on observed behaviour. + */ +int +hpux_sys_getcontext(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + struct hpux_sys_getcontext_args *uap = v; + int error = 0; + register int len; + +#ifdef HP380 + if (machineid == HP_380) { + len = min(SCARG(uap, len), sizeof(hpux_040context)); + if (len) + error = copyout(hpux_040context, SCARG(uap, buf), len); + if (error == 0) + *retval = sizeof(hpux_040context); + return (error); + } +#endif + len = min(SCARG(uap, len), sizeof(hpux_context)); + if (len) + error = copyout(hpux_context, SCARG(uap, buf), (u_int)len); + if (error == 0) + *retval = sizeof(hpux_context); + return (error); +} + +/* + * This is the equivalent of BSD getpgrp but with more restrictions. + * Note we do not check the real uid or "saved" uid. + */ +int +hpux_sys_getpgrp2(cp, v, retval) + struct proc *cp; + void *v; + register_t *retval; +{ + register struct hpux_sys_getpgrp2_args *uap = v; + register struct proc *p; + + if (SCARG(uap, pid) == 0) + SCARG(uap, pid) = cp->p_pid; + p = pfind(SCARG(uap, pid)); + if (p == 0) + return (ESRCH); + if (cp->p_ucred->cr_uid && p->p_ucred->cr_uid != cp->p_ucred->cr_uid && + !inferior(p)) + return (EPERM); + *retval = p->p_pgid; + return (0); +} + +/* + * This is the equivalent of BSD setpgrp but with more restrictions. + * Note we do not check the real uid or "saved" uid or pgrp. + */ +int +hpux_sys_setpgrp2(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + struct hpux_sys_setpgrp2_args *uap = v; + + /* empirically determined */ + if (SCARG(uap, pgid) < 0 || SCARG(uap, pgid) >= 30000) + return (EINVAL); + return (sys_setpgid(p, uap, retval)); +} + +/* + * XXX Same as BSD setre[ug]id right now. Need to consider saved ids. + */ +int +hpux_sys_setresuid(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + struct hpux_sys_setresuid_args *uap = v; + + return (compat_43_sys_setreuid(p, uap, retval)); +} + +int +hpux_sys_setresgid(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + struct hpux_sys_setresgid_args *uap = v; + + return (compat_43_sys_setregid(p, uap, retval)); +} + +int +hpux_sys_getrlimit(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + struct hpux_sys_getrlimit_args *uap = v; + struct compat_43_sys_getrlimit_args ap; + + if (SCARG(uap, which) > HPUXRLIMIT_NOFILE) + return (EINVAL); + if (SCARG(uap, which) == HPUXRLIMIT_NOFILE) + SCARG(uap, which) = RLIMIT_NOFILE; + + SCARG(&ap, which) = SCARG(uap, which); + SCARG(&ap, rlp) = SCARG(uap, rlp); + + return (compat_43_sys_getrlimit(p, uap, retval)); +} + +int +hpux_sys_setrlimit(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + struct hpux_sys_setrlimit_args *uap = v; + struct compat_43_sys_setrlimit_args ap; + + if (SCARG(uap, which) > HPUXRLIMIT_NOFILE) + return (EINVAL); + if (SCARG(uap, which) == HPUXRLIMIT_NOFILE) + SCARG(uap, which) = RLIMIT_NOFILE; + + SCARG(&ap, which) = SCARG(uap, which); + SCARG(&ap, rlp) = SCARG(uap, rlp); + + return (compat_43_sys_setrlimit(p, uap, retval)); +} + +/* + * XXX: simple recognition hack to see if we can make grmd work. + */ +int +hpux_sys_lockf(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + struct hpux_sys_lockf_args *uap = v; + + return (0); +} + +int +hpux_sys_getaccess(p, v, retval) + register struct proc *p; + void *v; + register_t *retval; +{ + register struct hpux_sys_getaccess_args *uap = v; + int lgroups[NGROUPS]; + int error = 0; + register struct ucred *cred; + register struct vnode *vp; + struct nameidata nd; + + /* + * Build an appropriate credential structure + */ + cred = crdup(p->p_ucred); + switch (SCARG(uap, uid)) { + case 65502: /* UID_EUID */ + break; + case 65503: /* UID_RUID */ + cred->cr_uid = p->p_cred->p_ruid; + break; + case 65504: /* UID_SUID */ + error = EINVAL; + break; + default: + if (SCARG(uap, uid) > 65504) + error = EINVAL; + cred->cr_uid = SCARG(uap, uid); + break; + } + switch (SCARG(uap, ngroups)) { + case -1: /* NGROUPS_EGID */ + cred->cr_ngroups = 1; + break; + case -5: /* NGROUPS_EGID_SUPP */ + break; + case -2: /* NGROUPS_RGID */ + cred->cr_ngroups = 1; + cred->cr_gid = p->p_cred->p_rgid; + break; + case -6: /* NGROUPS_RGID_SUPP */ + cred->cr_gid = p->p_cred->p_rgid; + break; + case -3: /* NGROUPS_SGID */ + case -7: /* NGROUPS_SGID_SUPP */ + error = EINVAL; + break; + case -4: /* NGROUPS_SUPP */ + if (cred->cr_ngroups > 1) + cred->cr_gid = cred->cr_groups[1]; + else + error = EINVAL; + break; + default: + if (SCARG(uap, ngroups) > 0 && SCARG(uap, ngroups) <= NGROUPS) + error = copyin((caddr_t)SCARG(uap, gidset), + (caddr_t)&lgroups[0], + SCARG(uap, ngroups) * + sizeof(lgroups[0])); + else + error = EINVAL; + if (error == 0) { + int gid; + + for (gid = 0; gid < SCARG(uap, ngroups); gid++) + cred->cr_groups[gid] = lgroups[gid]; + cred->cr_ngroups = SCARG(uap, ngroups); + } + break; + } + /* + * Lookup file using caller's effective IDs. + */ + if (error == 0) { + NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE, + SCARG(uap, path), p); + error = namei(&nd); + } + if (error) { + crfree(cred); + return (error); + } + /* + * Use the constructed credentials for access checks. + */ + vp = nd.ni_vp; + *retval = 0; + if (VOP_ACCESS(vp, VREAD, cred, p) == 0) + *retval |= R_OK; + if (vn_writechk(vp) == 0 && VOP_ACCESS(vp, VWRITE, cred, p) == 0) + *retval |= W_OK; + /* XXX we return X_OK for root on VREG even if not */ + if (VOP_ACCESS(vp, VEXEC, cred, p) == 0) + *retval |= X_OK; + vput(vp); + crfree(cred); + return (error); +} + +/* + * XXX: This needs to be in hpux_machdep.c !! + */ +extern char kstack[]; +#define UOFF(f) ((int)&((struct user *)0)->f) +#define HPUOFF(f) ((int)&((struct hpux_user *)0)->f) + +/* simplified FP structure */ +struct bsdfp { + int save[54]; + int reg[24]; + int ctrl[3]; +}; + +/* + * Brutal hack! Map HP-UX u-area offsets into BSD k-stack offsets. + */ +hpuxtobsduoff(off, isps, p) + int *off, *isps; + struct proc *p; +{ +#ifdef hp300 + register int *ar0 = p->p_md.md_regs; + struct hpux_fp *hp; + struct bsdfp *bp; + register u_int raddr; + + *isps = 0; + + /* u_ar0 field; procxmt puts in U_ar0 */ + if ((int)off == HPUOFF(hpuxu_ar0)) + return(UOFF(U_ar0)); + +#ifdef FPCOPROC + /* FP registers from PCB */ + hp = (struct hpux_fp *)HPUOFF(hpuxu_fp); + bp = (struct bsdfp *)UOFF(u_pcb.pcb_fpregs); + if (off >= hp->hpfp_ctrl && off < &hp->hpfp_ctrl[3]) + return((int)&bp->ctrl[off - hp->hpfp_ctrl]); + if (off >= hp->hpfp_reg && off < &hp->hpfp_reg[24]) + return((int)&bp->reg[off - hp->hpfp_reg]); +#endif + + /* + * Everything else we recognize comes from the kernel stack, + * so we convert off to an absolute address (if not already) + * for simplicity. + */ + if (off < (int *)ctob(UPAGES)) + off = (int *)((u_int)off + (u_int)kstack); + + /* + * General registers. + * We know that the HP-UX registers are in the same order as ours. + * The only difference is that their PS is 2 bytes instead of a + * padded 4 like ours throwing the alignment off. + */ + if (off >= ar0 && off < &ar0[18]) { + /* + * PS: return low word and high word of PC as HP-UX would + * (e.g. &u.u_ar0[16.5]). + * + * XXX we don't do this since HP-UX adb doesn't rely on + * it and passing such an offset to procxmt will cause + * it to fail anyway. Instead, we just set the offset + * to PS and let hpux_ptrace() shift up the value returned. + */ + if (off == &ar0[PS]) { +#if 0 + raddr = (u_int) &((short *)ar0)[PS*2+1]; +#else + raddr = (u_int) &ar0[(int)(off - ar0)]; +#endif + *isps = 1; + } + /* + * PC: off will be &u.u_ar0[16.5] since HP-UX saved PS + * is only 16 bits. + */ + else if (off == (int *)&(((short *)ar0)[PS*2+1])) + raddr = (u_int) &ar0[PC]; + /* + * D0-D7, A0-A7: easy + */ + else + raddr = (u_int) &ar0[(int)(off - ar0)]; + return((int)(raddr - (u_int)kstack)); + } +#endif + /* everything else */ + return(-1); +} + +/* + * Kludge up a uarea dump so that HP-UX debuggers can find out + * what they need. IMPORTANT NOTE: we do not EVEN attempt to + * convert the entire user struct. + */ +int +hpux_dumpu(vp, cred) + struct vnode *vp; + struct ucred *cred; +{ + int error = 0; +#ifdef hp300 + struct proc *p = curproc; + struct hpux_user *faku; + struct bsdfp *bp; + short *foop; + + faku = (struct hpux_user *)malloc((u_long)ctob(1), M_TEMP, M_WAITOK); + /* + * Make sure there is no mistake about this + * being a real user structure. + */ + bzero((caddr_t)faku, ctob(1)); + /* + * Fill in the process sizes. + */ + faku->hpuxu_tsize = p->p_vmspace->vm_tsize; + faku->hpuxu_dsize = p->p_vmspace->vm_dsize; + faku->hpuxu_ssize = p->p_vmspace->vm_ssize; + /* + * Fill in the exec header for CDB. + * This was saved back in exec(). As far as I can tell CDB + * only uses this information to verify that a particular + * core file goes with a particular binary. + */ + bcopy((caddr_t)p->p_addr->u_md.md_exec, + (caddr_t)&faku->hpuxu_exdata, sizeof (struct hpux_exec)); + /* + * Adjust user's saved registers (on kernel stack) to reflect + * HP-UX order. Note that HP-UX saves the SR as 2 bytes not 4 + * so we have to move it up. + */ + faku->hpuxu_ar0 = p->p_md.md_regs; + foop = (short *) p->p_md.md_regs; + foop[32] = foop[33]; + foop[33] = foop[34]; + foop[34] = foop[35]; +#ifdef FPCOPROC + /* + * Copy 68881 registers from our PCB format to HP-UX format + */ + bp = (struct bsdfp *) &p->p_addr->u_pcb.pcb_fpregs; + bcopy((caddr_t)bp->save, (caddr_t)faku->hpuxu_fp.hpfp_save, + sizeof(bp->save)); + bcopy((caddr_t)bp->ctrl, (caddr_t)faku->hpuxu_fp.hpfp_ctrl, + sizeof(bp->ctrl)); + bcopy((caddr_t)bp->reg, (caddr_t)faku->hpuxu_fp.hpfp_reg, + sizeof(bp->reg)); +#endif + /* + * Slay the dragon + */ + faku->hpuxu_dragon = -1; + /* + * Dump this artfully constructed page in place of the + * user struct page. + */ + error = vn_rdwr(UIO_WRITE, vp, (caddr_t)faku, ctob(1), (off_t)0, + UIO_SYSSPACE, IO_NODELOCKED|IO_UNIT, cred, + (int *)NULL, p); + /* + * Dump the remaining UPAGES-1 pages normally + */ + if (!error) + error = vn_rdwr(UIO_WRITE, vp, kstack + ctob(1), + ctob(UPAGES-1), (off_t)ctob(1), UIO_SYSSPACE, + IO_NODELOCKED|IO_UNIT, cred, (int *)NULL, p); + free((caddr_t)faku, M_TEMP); +#endif + return(error); +} + +/* + * The remaining routines are essentially the same as those in kern_xxx.c + * and vfs_xxx.c as defined under "#ifdef COMPAT". We replicate them here + * to avoid COMPAT_HPUX dependencies in those files and to make sure that + * HP-UX compatibility still works even when COMPAT is not defined. + * + * These are still needed as of HP-UX 7.05. + */ +#ifdef COMPAT_HPUX_6X + +#define HPUX_HZ 50 + +#include "sys/times.h" + + +/* + * SYS V style setpgrp() + */ +int +compat_hpux_6x_sys_setpgrp(p, v, retval) + register struct proc *p; + void *v; + register_t *retval; +{ + struct compat_hpux_6x_sys_setpgrp_args *uap = v; + + if (p->p_pid != p->p_pgid) + enterpgrp(p, p->p_pid, 0); + *retval = p->p_pgid; + return (0); +} + +int +compat_hpux_6x_sys_time(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + register struct compat_hpux_6x_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; +} + +int +compat_hpux_6x_sys_stime(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + register struct compat_hpux_6x_sys_stime_args *uap = v; + struct timeval tv; + int s, error; + + tv.tv_sec = SCARG(uap, time); + tv.tv_usec = 0; + if (error = suser(p->p_ucred, &p->p_acflag)) + return (error); + + /* WHAT DO WE DO ABOUT PENDING REAL-TIME TIMEOUTS??? */ + boottime.tv_sec += tv.tv_sec - time.tv_sec; + s = splhigh(); time = tv; splx(s); + resettodr(); + return (0); +} + +int +compat_hpux_6x_sys_ftime(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + register struct compat_hpux_6x_sys_ftime_args *uap = v; + struct hpux_otimeb tb; + int s; + + s = splhigh(); + tb.time = time.tv_sec; + tb.millitm = time.tv_usec / 1000; + splx(s); + tb.timezone = tz.tz_minuteswest; + tb.dstflag = tz.tz_dsttime; + return (copyout((caddr_t)&tb, (caddr_t)SCARG(uap, tp), sizeof (tb))); +} + +int +compat_hpux_6x_sys_alarm(p, v, retval) + register struct proc *p; + void *v; + register_t *retval; +{ + register struct compat_hpux_6x_sys_alarm_args *uap = v; + int s = splhigh(); + + untimeout(realitexpire, (caddr_t)p); + timerclear(&p->p_realtimer.it_interval); + *retval = 0; + if (timerisset(&p->p_realtimer.it_value) && + timercmp(&p->p_realtimer.it_value, &time, >)) + *retval = p->p_realtimer.it_value.tv_sec - time.tv_sec; + if (SCARG(uap, deltat) == 0) { + timerclear(&p->p_realtimer.it_value); + splx(s); + return (0); + } + p->p_realtimer.it_value = time; + p->p_realtimer.it_value.tv_sec += SCARG(uap, deltat); + timeout(realitexpire, (caddr_t)p, hzto(&p->p_realtimer.it_value)); + splx(s); + return (0); +} + +int +compat_hpux_6x_sys_nice(p, v, retval) + register struct proc *p; + void *v; + register_t *retval; +{ + register struct compat_hpux_6x_sys_nice_args *uap = v; + int error; + + error = donice(p, p, (p->p_nice-NZERO)+SCARG(uap, nval)); + if (error == 0) + *retval = p->p_nice - NZERO; + return (error); +} + +int +compat_hpux_6x_sys_times(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + register struct compat_hpux_6x_sys_times_args *uap = v; + struct timeval ru, rs; + struct tms atms; + int error; + + calcru(p, &ru, &rs, NULL); + atms.tms_utime = hpux_scale(&ru); + atms.tms_stime = hpux_scale(&rs); + atms.tms_cutime = hpux_scale(&p->p_stats->p_cru.ru_utime); + atms.tms_cstime = hpux_scale(&p->p_stats->p_cru.ru_stime); + error = copyout((caddr_t)&atms, (caddr_t)SCARG(uap, tms), + sizeof (atms)); + if (error == 0) + *(time_t *)retval = hpux_scale(&time) - hpux_scale(&boottime); + return (error); +} + +/* + * Doesn't exactly do what the documentation says. + * What we really do is return 1/HPUX_HZ-th of a second since that + * is what HP-UX returns. + */ +int +hpux_scale(tvp) + register struct timeval *tvp; +{ + return (tvp->tv_sec * HPUX_HZ + tvp->tv_usec * HPUX_HZ / 1000000); +} + +/* + * Set IUPD and IACC times on file. + * Can't set ICHG. + */ +int +compat_hpux_6x_sys_utime(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + register struct compat_hpux_6x_sys_utime_args *uap = v; + register struct vnode *vp; + struct vattr vattr; + time_t tv[2]; + int error; + struct nameidata nd; + + if (SCARG(uap, tptr)) { + error = copyin((caddr_t)SCARG(uap, tptr), (caddr_t)tv, + sizeof (tv)); + if (error) + return (error); + } else + tv[0] = tv[1] = time.tv_sec; + vattr_null(&vattr); + vattr.va_atime.ts_sec = tv[0]; + vattr.va_atime.ts_nsec = 0; + vattr.va_mtime.ts_sec = tv[1]; + vattr.va_mtime.ts_nsec = 0; + NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE, + SCARG(uap, fname), p); + if (error = namei(&nd)) + return (error); + vp = nd.ni_vp; + if (vp->v_mount->mnt_flag & MNT_RDONLY) + error = EROFS; + else + error = VOP_SETATTR(vp, &vattr, nd.ni_cnd.cn_cred, p); + vput(vp); + return (error); +} + +int +compat_hpux_6x_sys_pause(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + struct compat_hpux_6x_sys_pause_args *uap = v; + + (void) tsleep(kstack, PPAUSE | PCATCH, "pause", 0); + /* always return EINTR rather than ERESTART... */ + return (EINTR); +} + +/* + * The old fstat system call. + */ +int +compat_hpux_6x_sys_fstat(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + register struct compat_hpux_6x_sys_fstat_args *uap = v; + register struct filedesc *fdp = p->p_fd; + struct file *fp; + + if (((unsigned)SCARG(uap, fd)) >= fdp->fd_nfiles || + (fp = fdp->fd_ofiles[SCARG(uap, fd)]) == NULL) + return (EBADF); + if (fp->f_type != DTYPE_VNODE) + return (EINVAL); + return (compat_hpux_6x_stat1((struct vnode *)fp->f_data, + SCARG(uap, sb), p)); +} + +/* + * Old stat system call. This version follows links. + */ +int +compat_hpux_6x_sys_stat(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + register struct compat_hpux_6x_sys_stat_args *uap = v; + int error; + struct nameidata nd; + + NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE, + SCARG(uap, path), p); + if (error = namei(&nd)) + return (error); + error = compat_hpux_6x_stat1(nd.ni_vp, SCARG(uap, sb), p); + vput(nd.ni_vp); + return (error); +} + +int +compat_hpux_6x_stat1(vp, ub, p) + struct vnode *vp; + struct hpux_ostat *ub; + struct proc *p; +{ + struct hpux_ostat ohsb; + struct stat sb; + int error; + + error = vn_stat(vp, &sb, p); + if (error) + return (error); + + ohsb.hst_dev = sb.st_dev; + ohsb.hst_ino = sb.st_ino; + ohsb.hst_mode = sb.st_mode; + ohsb.hst_nlink = sb.st_nlink; + ohsb.hst_uid = sb.st_uid; + ohsb.hst_gid = sb.st_gid; + ohsb.hst_rdev = sb.st_rdev; + if (sb.st_size < (quad_t)1 << 32) + ohsb.hst_size = sb.st_size; + else + ohsb.hst_size = -2; + ohsb.hst_atime = sb.st_atime; + ohsb.hst_mtime = sb.st_mtime; + ohsb.hst_ctime = sb.st_ctime; + return (copyout((caddr_t)&ohsb, (caddr_t)ub, sizeof(ohsb))); +} +#endif diff --git a/sys/compat/hpux/hpux_exec.h b/sys/compat/hpux/hpux_exec.h new file mode 100644 index 00000000000..3f524c2b9e0 --- /dev/null +++ b/sys/compat/hpux/hpux_exec.h @@ -0,0 +1,63 @@ +/* $NetBSD: hpux_exec.h,v 1.5 1994/10/26 02:45:16 cgd Exp $ */ + +/* + * Copyright (c) 1988 University of Utah. + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * the Systems Programming Group of the University of Utah Computer + * Science Department. + * + * 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 the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + * + * from: Utah $Hdr: hpux_exec.h 1.6 92/01/20$ + * + * @(#)hpux_exec.h 8.1 (Berkeley) 6/10/93 + */ + +/* + * HPUX a.out header format + */ +struct hpux_exec { + long ha_magic; /* magic number */ + short ha_version; /* version ID */ + short ha_pad0; /* doesn't matter */ + long ha_misc; /* misc. info */ +unsigned long ha_text; /* size of text segment */ +unsigned long ha_data; /* size of initialized data */ +unsigned long ha_bss; /* size of uninitialized data */ +unsigned long ha_pad2[5]; /* doesn't matter */ +unsigned long ha_entry; /* entry point */ +unsigned long ha_pad3[4]; /* doesn't matter */ +}; + +#define HPUXM_VALID 0x00000001 +#define HPUXM_STKWT 0x02000000 +#define HPUXM_DATAWT 0x04000000 diff --git a/sys/compat/hpux/hpux_net.c b/sys/compat/hpux/hpux_net.c new file mode 100644 index 00000000000..e23a58a80fa --- /dev/null +++ b/sys/compat/hpux/hpux_net.c @@ -0,0 +1,317 @@ +/* $NetBSD: hpux_net.c,v 1.12 1995/10/07 06:26:37 mycroft Exp $ */ + +/* + * Copyright (c) 1988 University of Utah. + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * the Systems Programming Group of the University of Utah Computer + * Science Department. + * + * 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 the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + * + * from: Utah $Hdr: hpux_net.c 1.8 93/08/02$ + * + * @(#)hpux_net.c 8.2 (Berkeley) 9/9/93 + */ + +/* + * Network related HP-UX compatibility routines + */ + +#include <sys/param.h> +#include <sys/systm.h> +#include <sys/kernel.h> +#include <sys/time.h> +#include <sys/errno.h> +#include <sys/proc.h> +#include <sys/file.h> +#include <sys/mbuf.h> +#include <sys/mount.h> +#include <sys/socket.h> +#include <sys/socketvar.h> +#include <sys/uio.h> +#include <sys/ktrace.h> +#include <sys/syscallargs.h> + +#include <compat/hpux/hpux.h> +#include <compat/hpux/hpux_syscallargs.h> +#include <compat/hpux/hpux_util.h> + + +#define syscallarg(x) union { x datum; register_t pad; } + +struct hpux_sys_setsockopt_args { + syscallarg(int) s; + syscallarg(int) level; + syscallarg(int) name; + syscallarg(caddr_t) val; + syscallarg(int) valsize; +}; + +struct hpux_sys_getsockopt_args { + syscallarg(int) s; + syscallarg(int) level; + syscallarg(int) name; + syscallarg(caddr_t) val; + syscallarg(int *) avalsize; +}; + +int hpux_sys_setsockopt __P((struct proc *, void *, register_t *)); +int hpux_sys_getsockopt __P((struct proc *, void *, register_t *)); + + +#define MINBSDIPCCODE 0x3EE +#define NUMBSDIPC 32 + +/* + * HPUX netioctl() to BSD syscall map. + * Indexed by callno - MINBSDIPCCODE + */ + +struct hpuxtobsdipc { + int (*rout)(); + int nargs; +} hpuxtobsdipc[NUMBSDIPC] = { + { sys_socket, 3 }, /* 3ee */ + { sys_listen, 2 }, /* 3ef */ + { sys_bind, 3 }, /* 3f0 */ + { compat_43_sys_accept, 3 }, /* 3f1 */ + { sys_connect, 3 }, /* 3f2 */ + { compat_43_sys_recv, 4 }, /* 3f3 */ + { compat_43_sys_send, 4 }, /* 3f4 */ + { sys_shutdown, 2 }, /* 3f5 */ + { compat_43_sys_getsockname, 3 }, /* 3f6 */ + { hpux_sys_setsockopt, 5 }, /* 3f7 */ + { sys_sendto, 6 }, /* 3f8 */ + { compat_43_sys_recvfrom, 6 }, /* 3f9 */ + { compat_43_sys_getpeername, 3 }, /* 3fa */ + { NULL, 0 }, /* 3fb */ + { NULL, 0 }, /* 3fc */ + { NULL, 0 }, /* 3fd */ + { NULL, 0 }, /* 3fe */ + { NULL, 0 }, /* 3ff */ + { NULL, 0 }, /* 400 */ + { NULL, 0 }, /* 401 */ + { NULL, 0 }, /* 402 */ + { NULL, 0 }, /* 403 */ + { NULL, 0 }, /* 404 */ + { NULL, 0 }, /* 405 */ + { NULL, 0 }, /* 406 */ + { NULL, 0 }, /* 407 */ + { NULL, 0 }, /* 408 */ + { NULL, 0 }, /* 409 */ + { NULL, 0 }, /* 40a */ + { hpux_sys_getsockopt, 5 }, /* 40b */ + { NULL, 0 }, /* 40c */ + { NULL, 0 }, /* 40d */ +}; + +/* + * Single system call entry to BSD style IPC. + * Gleened from disassembled libbsdipc.a syscall entries. + */ +int +hpux_sys_netioctl(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + struct hpux_sys_netioctl_args *uap = v; + int *args, i; + register int code; + int error; + + args = SCARG(uap, args); + code = SCARG(uap, call) - MINBSDIPCCODE; + if (code < 0 || code >= NUMBSDIPC || hpuxtobsdipc[code].rout == NULL) + return (EINVAL); + if ((i = hpuxtobsdipc[code].nargs * sizeof (int)) && + (error = copyin((caddr_t)args, (caddr_t)uap, (u_int)i))) { +#ifdef KTRACE + if (KTRPOINT(p, KTR_SYSCALL)) + ktrsyscall(p->p_tracep, code + MINBSDIPCCODE, + hpuxtobsdipc[code].nargs, + (register_t *)uap); +#endif + return (error); + } +#ifdef KTRACE + if (KTRPOINT(p, KTR_SYSCALL)) + ktrsyscall(p->p_tracep, code + MINBSDIPCCODE, + hpuxtobsdipc[code].nargs, + (register_t *)uap); +#endif + return ((*hpuxtobsdipc[code].rout)(p, uap, retval)); +} + +int +socksetsize(size, m) + int size; + struct mbuf *m; +{ + register int tmp; + + if (size < sizeof(int)) { + switch(size) { + case 1: + tmp = (int) *mtod(m, char *); + break; + case 2: + tmp = (int) *mtod(m, short *); + break; + case 3: + tmp = (((int) *mtod(m, int *)) >> 8) & 0xffffff; + break; + } + *mtod(m, int *) = tmp; + m->m_len = sizeof(int); + } else { + m->m_len = size; + } +} + +/* ARGSUSED */ +hpux_sys_setsockopt(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + struct hpux_sys_setsockopt_args *uap = v; + struct file *fp; + struct mbuf *m = NULL; + int tmp, error; + + if (error = getsock(p->p_fd, SCARG(uap, s), &fp)) + return (error); + if (SCARG(uap, valsize) > MLEN) + return (EINVAL); + if (SCARG(uap, val)) { + m = m_get(M_WAIT, MT_SOOPTS); + if (m == NULL) + return (ENOBUFS); + if (error = copyin(SCARG(uap, val), mtod(m, caddr_t), + (u_int)SCARG(uap, valsize))) { + (void) m_free(m); + return (error); + } + if (SCARG(uap, name) == SO_LINGER) { + tmp = *mtod(m, int *); + mtod(m, struct linger *)->l_onoff = 1; + mtod(m, struct linger *)->l_linger = tmp; + m->m_len = sizeof(struct linger); + } else + socksetsize(SCARG(uap, valsize), m); + } else if (SCARG(uap, name) == ~SO_LINGER) { + m = m_get(M_WAIT, MT_SOOPTS); + if (m) { + SCARG(uap, name) = SO_LINGER; + mtod(m, struct linger *)->l_onoff = 0; + m->m_len = sizeof(struct linger); + } + } + return (sosetopt((struct socket *)fp->f_data, SCARG(uap, level), + SCARG(uap, name), m)); +} + +/* ARGSUSED */ +int +hpux_sys_setsockopt2(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + register struct hpux_sys_setsockopt2_args *uap = v; + struct file *fp; + struct mbuf *m = NULL; + int error; + + if (error = getsock(p->p_fd, SCARG(uap, s), &fp)) + return (error); + if (SCARG(uap, valsize) > MLEN) + return (EINVAL); + if (SCARG(uap, val)) { + m = m_get(M_WAIT, MT_SOOPTS); + if (m == NULL) + return (ENOBUFS); + if (error = copyin(SCARG(uap, val), mtod(m, caddr_t), + (u_int)SCARG(uap, valsize))) { + (void) m_free(m); + return (error); + } + socksetsize(SCARG(uap, valsize), m); + } + return (sosetopt((struct socket *)fp->f_data, SCARG(uap, level), + SCARG(uap, name), m)); +} + +int +hpux_sys_getsockopt(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + struct hpux_sys_getsockopt_args *uap = v; + struct file *fp; + struct mbuf *m = NULL; + int valsize, error; + + if (error = getsock(p->p_fd, SCARG(uap, s), &fp)) + return (error); + if (SCARG(uap, val)) { + if (error = copyin((caddr_t)SCARG(uap, avalsize), + (caddr_t)&valsize, sizeof (valsize))) + return (error); + } else + valsize = 0; + if (error = sogetopt((struct socket *)fp->f_data, SCARG(uap, level), + SCARG(uap, name), &m)) + goto bad; + if (SCARG(uap, val) && valsize && m != NULL) { + if (SCARG(uap, name) == SO_LINGER) { + if (mtod(m, struct linger *)->l_onoff) + *mtod(m, int *) = mtod(m, struct linger *)->l_linger; + else + *mtod(m, int *) = 0; + m->m_len = sizeof(int); + } + if (valsize > m->m_len) + valsize = m->m_len; + error = copyout(mtod(m, caddr_t), SCARG(uap, val), + (u_int)valsize); + if (error == 0) + error = copyout((caddr_t)&valsize, + (caddr_t)SCARG(uap, avalsize), sizeof (valsize)); + } +bad: + if (m != NULL) + (void) m_free(m); + return (error); +} diff --git a/sys/compat/hpux/hpux_sig.c b/sys/compat/hpux/hpux_sig.c new file mode 100644 index 00000000000..8443e5ae282 --- /dev/null +++ b/sys/compat/hpux/hpux_sig.c @@ -0,0 +1,437 @@ +/* $NetBSD: hpux_sig.c,v 1.14 1995/10/07 06:26:38 mycroft Exp $ */ + +/* + * Copyright (c) 1988 University of Utah. + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * the Systems Programming Group of the University of Utah Computer + * Science Department. + * + * 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 the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + * + * from: Utah $Hdr: hpux_sig.c 1.4 92/01/20$ + * + * @(#)hpux_sig.c 8.2 (Berkeley) 9/23/93 + */ + +/* + * Signal related HPUX compatibility routines + */ + +#include <sys/param.h> +#include <sys/systm.h> +#include <sys/kernel.h> +#include <sys/proc.h> +#include <sys/signalvar.h> + +#include <compat/hpux/hpux.h> +#include <compat/hpux/hpux_syscallargs.h> + +/* indexed by HPUX signal number - 1 */ +char hpuxtobsdsigmap[NSIG] = { +/*01*/ SIGHUP, SIGINT, SIGQUIT, SIGILL, SIGTRAP, SIGIOT, SIGEMT, SIGFPE, +/*09*/ SIGKILL, SIGBUS, SIGSEGV, SIGSYS, SIGPIPE, SIGALRM, SIGTERM, SIGUSR1, +/*17*/ SIGUSR2, SIGCHLD, 0, SIGVTALRM,SIGPROF, SIGIO, SIGWINCH, SIGSTOP, +/*25*/ SIGTSTP, SIGCONT,SIGTTIN, SIGTTOU, SIGURG, 0, 0, 0 +}; + +/* indexed by BSD signal number - 1 */ +char bsdtohpuxsigmap[NSIG] = { +/*01*/ 1, 2, 3, 4, 5, 6, 7, 8, +/*09*/ 9, 10, 11, 12, 13, 14, 15, 29, +/*17*/ 24, 25, 26, 18, 27, 28, 22, 0, +/*25*/ 0, 20, 21, 23, 0, 16, 17, 0 +}; + +/* + * XXX: In addition to mapping the signal number we also have + * to see if the "old" style signal mechinism is needed. + * If so, we set the OUSIG flag. This is not really correct + * as under HP-UX "old" style handling can be set on a per + * signal basis and we are setting it for all signals in one + * swell foop. I suspect we can get away with this since I + * doubt any program of interest mixes the two semantics. + */ +int +hpux_sys_sigvec(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + register struct hpux_sys_sigvec_args *uap = v; + struct sigvec vec; + register struct sigacts *ps = p->p_sigacts; + register struct sigvec *sv; + register int sig; + int bit, error; + + sig = hpuxtobsdsig(SCARG(uap, signo)); + if (sig <= 0 || sig >= NSIG || sig == SIGKILL || sig == SIGSTOP) + return (EINVAL); + sv = &vec; + if (SCARG(uap, osv)) { + sv->sv_handler = ps->ps_sigact[sig]; + sv->sv_mask = ps->ps_catchmask[sig]; + bit = sigmask(sig); + sv->sv_flags = 0; + if ((ps->ps_sigonstack & bit) != 0) + sv->sv_flags |= SV_ONSTACK; + if ((ps->ps_sigintr & bit) != 0) + sv->sv_flags |= SV_INTERRUPT; + if ((ps->ps_sigreset & bit) != 0) + sv->sv_flags |= HPUXSV_RESET; + sv->sv_mask &= ~bit; + error = copyout((caddr_t)sv, (caddr_t)SCARG(uap, osv), + sizeof (vec)); + if (error) + return (error); + } + if (SCARG(uap, nsv)) { + error = copyin((caddr_t)SCARG(uap, nsv), (caddr_t)sv, + sizeof (vec)); + if (error) + return (error); + if (sig == SIGCONT && sv->sv_handler == SIG_IGN) + return (EINVAL); + sv->sv_flags ^= SA_RESTART; + setsigvec(p, sig, (struct sigaction *)sv); +#if 0 +/* XXX -- SOUSIG no longer exists, do something here */ + if (sv->sv_flags & HPUXSV_RESET) + p->p_flag |= SOUSIG; /* XXX */ +#endif + } + return (0); +} + +int +hpux_sys_sigblock(p, v, retval) + register struct proc *p; + void *v; + register_t *retval; +{ + struct hpux_sys_sigblock_args *uap = v; + + (void) splhigh(); + *retval = bsdtohpuxmask(p->p_sigmask); + p->p_sigmask |= hpuxtobsdmask(SCARG(uap, mask)) &~ sigcantmask; + (void) spl0(); + return (0); +} + +int +hpux_sys_sigsetmask(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + struct hpux_sys_sigsetmask_args *uap = v; + + (void) splhigh(); + *retval = bsdtohpuxmask(p->p_sigmask); + p->p_sigmask = hpuxtobsdmask(SCARG(uap, mask)) &~ sigcantmask; + (void) spl0(); + return (0); +} + +int +hpux_sys_sigpause(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + struct hpux_sys_sigpause_args *uap = v; + + SCARG(uap, mask) = hpuxtobsdmask(SCARG(uap, mask)); + return (sys_sigsuspend(p, uap, retval)); +} + +/* not totally correct, but close enuf' */ +int +hpux_sys_kill(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + struct hpux_sys_kill_args *uap = v; + + if (SCARG(uap, signo)) { + SCARG(uap, signo) = hpuxtobsdsig(SCARG(uap, signo)); + if (SCARG(uap, signo) == 0) + SCARG(uap, signo) = NSIG; + } + return (sys_kill(p, uap, retval)); +} + +/* + * The following (sigprocmask, sigpending, sigsuspend, sigaction are + * POSIX calls. Under BSD, the library routine dereferences the sigset_t + * pointers before traping. Not so under HP-UX. + */ + +/* + * Manipulate signal mask. + * Note that we receive new mask, not pointer, + * and return old mask as return value; + * the library stub does the rest. + */ +int +hpux_sys_sigprocmask(p, v, retval) + register struct proc *p; + void *v; + register_t *retval; +{ + struct hpux_sys_sigprocmask_args *uap = v; + int mask, error = 0; + hpux_sigset_t sigset; + + /* + * Copy out old mask first to ensure no errors. + * (proc sigmask should not be changed if call fails for any reason) + */ + if (SCARG(uap, oset)) { + bzero((caddr_t)&sigset, sizeof(sigset)); + sigset.sigset[0] = bsdtohpuxmask(p->p_sigmask); + if (copyout((caddr_t)&sigset, (caddr_t)SCARG(uap, oset), + sizeof(sigset))) + return (EFAULT); + } + if (SCARG(uap, set)) { + if (copyin((caddr_t)SCARG(uap, set), (caddr_t)&sigset, + sizeof(sigset))) + return (EFAULT); + mask = hpuxtobsdmask(sigset.sigset[0]); + (void) splhigh(); + switch (SCARG(uap, how)) { + case HPUXSIG_BLOCK: + p->p_sigmask |= mask &~ sigcantmask; + break; + case HPUXSIG_UNBLOCK: + p->p_sigmask &= ~mask; + break; + case HPUXSIG_SETMASK: + p->p_sigmask = mask &~ sigcantmask; + break; + default: + error = EINVAL; + break; + } + (void) spl0(); + } + return (error); +} + +int +hpux_sys_sigpending(p, v, retval) + register struct proc *p; + void *v; + register_t *retval; +{ + struct hpux_sys_sigpending_args *uap = v; + hpux_sigset_t sigset; + + sigset.sigset[0] = bsdtohpuxmask(p->p_siglist); + return (copyout((caddr_t)&sigset, (caddr_t)SCARG(uap, set), + sizeof(sigset))); +} + +int +hpux_sys_sigsuspend(p, v, retval) + register struct proc *p; + void *v; + register_t *retval; +{ + struct hpux_sys_sigsuspend_args *uap = v; + register struct sigacts *ps = p->p_sigacts; + hpux_sigset_t sigset; + int mask; + + if (copyin((caddr_t)SCARG(uap, set), (caddr_t)&sigset, sizeof(sigset))) + return (EFAULT); + mask = hpuxtobsdmask(sigset.sigset[0]); + ps->ps_oldmask = p->p_sigmask; + ps->ps_flags |= SAS_OLDMASK; + p->p_sigmask = mask &~ sigcantmask; + (void) tsleep((caddr_t)ps, PPAUSE | PCATCH, "pause", 0); + /* always return EINTR rather than ERESTART... */ + return (EINTR); +} + +int +hpux_sys_sigaction(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + register struct hpux_sys_sigaction_args *uap = v; + struct hpux_sigaction action; + register struct sigacts *ps = p->p_sigacts; + register struct hpux_sigaction *sa; + register int sig; + int bit; + + sig = hpuxtobsdsig(SCARG(uap, signo)); + if (sig <= 0 || sig >= NSIG || sig == SIGKILL || sig == SIGSTOP) + return (EINVAL); + + sa = &action; + if (SCARG(uap, osa)) { + sa->sa_handler = ps->ps_sigact[sig]; + bzero((caddr_t)&sa->sa_mask, sizeof(sa->sa_mask)); + sa->sa_mask.sigset[0] = bsdtohpuxmask(ps->ps_catchmask[sig]); + bit = sigmask(sig); + sa->sa_flags = 0; + if ((ps->ps_sigonstack & bit) != 0) + sa->sa_flags |= HPUXSA_ONSTACK; + if ((ps->ps_sigreset & bit) != 0) + sa->sa_flags |= HPUXSA_RESETHAND; + if (p->p_flag & P_NOCLDSTOP) + sa->sa_flags |= HPUXSA_NOCLDSTOP; + if (copyout((caddr_t)sa, (caddr_t)SCARG(uap, osa), + sizeof (action))) + return (EFAULT); + } + if (SCARG(uap, nsa)) { + struct sigaction act; + + if (copyin((caddr_t)SCARG(uap, nsa), (caddr_t)sa, + sizeof (action))) + return (EFAULT); + if (sig == SIGCONT && sa->sa_handler == SIG_IGN) + return (EINVAL); + /* + * Create a sigaction struct for setsigvec + */ + act.sa_handler = sa->sa_handler; + act.sa_mask = hpuxtobsdmask(sa->sa_mask.sigset[0]); + act.sa_flags == SA_RESTART; + if (sa->sa_flags & HPUXSA_ONSTACK) + act.sa_flags |= SA_ONSTACK; + if (sa->sa_flags & HPUXSA_NOCLDSTOP) + act.sa_flags |= SA_NOCLDSTOP; + setsigvec(p, sig, &act); +#if 0 +/* XXX -- SOUSIG no longer exists, do something here */ + if (sa->sa_flags & HPUXSA_RESETHAND) + p->p_flag |= SOUSIG; /* XXX */ +#endif + } + return (0); +} + +#ifdef COMPAT_HPUX_6X +int +compat_hpux_6x_sys_ssig(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + struct compat_hpux_6x_sys_ssig_args *uap = v; + register int a; + struct sigaction vec; + register struct sigaction *sa = &vec; + + a = hpuxtobsdsig(SCARG(uap, signo)); + sa->sa_handler = SCARG(uap, fun); + /* + * Kill processes trying to use job control facilities + * (this'll help us find any vestiges of the old stuff). + */ + if ((a &~ 0377) || + (sa->sa_handler != SIG_DFL && sa->sa_handler != SIG_IGN && + ((int)sa->sa_handler) & 1)) { + psignal(p, SIGSYS); + return (0); + } + if (a <= 0 || a >= NSIG || a == SIGKILL || a == SIGSTOP || + a == SIGCONT && sa->sa_handler == SIG_IGN) + return (EINVAL); + sa->sa_mask = 0; + sa->sa_flags = 0; + *retval = (int)p->p_sigacts->ps_sigact[a]; + setsigvec(p, a, sa); +#if 0 + p->p_flag |= SOUSIG; /* mark as simulating old stuff */ +#endif + return (0); +} +#endif + +/* signal numbers: convert from HPUX to BSD */ +int +hpuxtobsdsig(sig) + register int sig; +{ + if (--sig < 0 || sig >= NSIG) + return(0); + return((int)hpuxtobsdsigmap[sig]); +} + +/* signal numbers: convert from BSD to HPUX */ +int +bsdtohpuxsig(sig) + register int sig; +{ + if (--sig < 0 || sig >= NSIG) + return(0); + return((int)bsdtohpuxsigmap[sig]); +} + +/* signal masks: convert from HPUX to BSD (not pretty or fast) */ +int +hpuxtobsdmask(mask) + register int mask; +{ + register int nmask, sig, nsig; + + if (mask == 0 || mask == -1) + return(mask); + nmask = 0; + for (sig = 1; sig < NSIG; sig++) + if ((mask & sigmask(sig)) && (nsig = hpuxtobsdsig(sig))) + nmask |= sigmask(nsig); + return(nmask); +} + +int +bsdtohpuxmask(mask) + register int mask; +{ + register int nmask, sig, nsig; + + if (mask == 0 || mask == -1) + return(mask); + nmask = 0; + for (sig = 1; sig < NSIG; sig++) + if ((mask & sigmask(sig)) && (nsig = bsdtohpuxsig(sig))) + nmask |= sigmask(nsig); + return(nmask); +} diff --git a/sys/compat/hpux/hpux_syscall.h b/sys/compat/hpux/hpux_syscall.h new file mode 100644 index 00000000000..9d1924965e4 --- /dev/null +++ b/sys/compat/hpux/hpux_syscall.h @@ -0,0 +1,151 @@ +/* + * System call numbers. + * + * DO NOT EDIT-- this file is automatically generated. + * created from NetBSD: syscalls.master,v 1.8 1995/10/07 06:26:42 mycroft Exp + */ + +#define HPUX_SYS_syscall 0 +#define HPUX_SYS_exit 1 +#define HPUX_SYS_fork 2 +#define HPUX_SYS_read 3 +#define HPUX_SYS_write 4 +#define HPUX_SYS_open 5 +#define HPUX_SYS_close 6 +#define HPUX_SYS_wait 7 +#define HPUX_SYS_creat 8 +#define HPUX_SYS_link 9 +#define HPUX_SYS_unlink 10 +#define HPUX_SYS_execv 11 +#define HPUX_SYS_chdir 12 + /* 13 is compat_hpux_6x time */ +#define HPUX_SYS_mknod 14 +#define HPUX_SYS_chmod 15 +#define HPUX_SYS_chown 16 +#define HPUX_SYS_obreak 17 + /* 18 is compat_hpux_6x stat */ +#define HPUX_SYS_lseek 19 +#define HPUX_SYS_getpid 20 +#define HPUX_SYS_setuid 23 +#define HPUX_SYS_getuid 24 + /* 25 is compat_hpux_6x stime */ +#define HPUX_SYS_ptrace 26 + /* 27 is compat_hpux_6x alarm */ + /* 28 is compat_hpux_6x fstat */ + /* 29 is compat_hpux_6x pause */ + /* 30 is compat_hpux_6x utime */ + /* 31 is compat_hpux_6x stty */ + /* 32 is compat_hpux_6x gtty */ +#define HPUX_SYS_access 33 + /* 34 is compat_hpux_6x nice */ + /* 35 is compat_hpux_6x ftime */ +#define HPUX_SYS_sync 36 +#define HPUX_SYS_kill 37 +#define HPUX_SYS_stat 38 + /* 39 is compat_hpux_6x setpgrp */ +#define HPUX_SYS_lstat 40 +#define HPUX_SYS_dup 41 +#define HPUX_SYS_pipe 42 + /* 43 is compat_hpux_6x times */ +#define HPUX_SYS_profil 44 +#define HPUX_SYS_setgid 46 +#define HPUX_SYS_getgid 47 + /* 48 is compat_hpux_6x ssig */ +#define HPUX_SYS_ioctl 54 +#define HPUX_SYS_symlink 56 +#define HPUX_SYS_utssys 57 +#define HPUX_SYS_readlink 58 +#define HPUX_SYS_execve 59 +#define HPUX_SYS_umask 60 +#define HPUX_SYS_chroot 61 +#define HPUX_SYS_fcntl 62 +#define HPUX_SYS_ulimit 63 +#define HPUX_SYS_vfork 66 +#define HPUX_SYS_vread 67 +#define HPUX_SYS_vwrite 68 +#define HPUX_SYS_mmap 71 +#define HPUX_SYS_munmap 73 +#define HPUX_SYS_mprotect 74 +#define HPUX_SYS_getgroups 79 +#define HPUX_SYS_setgroups 80 +#define HPUX_SYS_getpgrp2 81 +#define HPUX_SYS_setpgrp2 82 +#define HPUX_SYS_setitimer 83 +#define HPUX_SYS_wait3 84 +#define HPUX_SYS_getitimer 86 +#define HPUX_SYS_dup2 90 +#define HPUX_SYS_fstat 92 +#define HPUX_SYS_select 93 +#define HPUX_SYS_fsync 95 +#define HPUX_SYS_sigreturn 103 +#define HPUX_SYS_sigvec 108 +#define HPUX_SYS_sigblock 109 +#define HPUX_SYS_sigsetmask 110 +#define HPUX_SYS_sigpause 111 +#define HPUX_SYS_sigstack 112 +#define HPUX_SYS_gettimeofday 116 +#define HPUX_SYS_readv 120 +#define HPUX_SYS_writev 121 +#define HPUX_SYS_settimeofday 122 +#define HPUX_SYS_fchown 123 +#define HPUX_SYS_fchmod 124 +#define HPUX_SYS_setresuid 126 +#define HPUX_SYS_setresgid 127 +#define HPUX_SYS_rename 128 +#define HPUX_SYS_truncate 129 +#define HPUX_SYS_ftruncate 130 +#define HPUX_SYS_sysconf 132 +#define HPUX_SYS_mkdir 136 +#define HPUX_SYS_rmdir 137 +#define HPUX_SYS_getrlimit 144 +#define HPUX_SYS_setrlimit 145 +#define HPUX_SYS_rtprio 152 +#define HPUX_SYS_netioctl 154 +#define HPUX_SYS_lockf 155 +#define HPUX_SYS_semget 156 +#define HPUX_SYS___semctl 157 +#define HPUX_SYS_semop 158 +#define HPUX_SYS_msgget 159 +#define HPUX_SYS_msgctl 160 +#define HPUX_SYS_msgsnd 161 +#define HPUX_SYS_msgrcv 162 +#define HPUX_SYS_shmget 163 +#define HPUX_SYS_shmctl 164 +#define HPUX_SYS_shmat 165 +#define HPUX_SYS_shmdt 166 +#define HPUX_SYS_advise 167 +#define HPUX_SYS_getcontext 174 +#define HPUX_SYS_getaccess 190 +#define HPUX_SYS_waitpid 200 +#define HPUX_SYS_pathconf 225 +#define HPUX_SYS_fpathconf 226 +#define HPUX_SYS_getdirentries 231 +#define HPUX_SYS_getdomainname 232 +#define HPUX_SYS_setdomainname 236 +#define HPUX_SYS_sigaction 239 +#define HPUX_SYS_sigprocmask 240 +#define HPUX_SYS_sigpending 241 +#define HPUX_SYS_sigsuspend 242 +#define HPUX_SYS_getdtablesize 268 +#define HPUX_SYS_fchdir 272 +#define HPUX_SYS_accept 275 +#define HPUX_SYS_bind 276 +#define HPUX_SYS_connect 277 +#define HPUX_SYS_getpeername 278 +#define HPUX_SYS_getsockname 279 +#define HPUX_SYS_getsockopt 280 +#define HPUX_SYS_listen 281 +#define HPUX_SYS_recv 282 +#define HPUX_SYS_recvfrom 283 +#define HPUX_SYS_recvmsg 284 +#define HPUX_SYS_send 285 +#define HPUX_SYS_sendmsg 286 +#define HPUX_SYS_sendto 287 +#define HPUX_SYS_setsockopt2 288 +#define HPUX_SYS_shutdown 289 +#define HPUX_SYS_socket 290 +#define HPUX_SYS_socketpair 291 +#define HPUX_SYS_nsemctl 312 +#define HPUX_SYS_nmsgctl 313 +#define HPUX_SYS_nshmctl 314 +#define HPUX_SYS_MAXSYSCALL 315 diff --git a/sys/compat/hpux/hpux_syscallargs.h b/sys/compat/hpux/hpux_syscallargs.h new file mode 100644 index 00000000000..63af42f3115 --- /dev/null +++ b/sys/compat/hpux/hpux_syscallargs.h @@ -0,0 +1,475 @@ +/* + * System call argument lists. + * + * DO NOT EDIT-- this file is automatically generated. + * created from NetBSD: syscalls.master,v 1.8 1995/10/07 06:26:42 mycroft Exp + */ + +#define syscallarg(x) union { x datum; register_t pad; } + +struct hpux_sys_read_args { + syscallarg(int) fd; + syscallarg(char *) buf; + syscallarg(u_int) nbyte; +}; + +struct hpux_sys_write_args { + syscallarg(int) fd; + syscallarg(char *) buf; + syscallarg(u_int) nbyte; +}; + +struct hpux_sys_open_args { + syscallarg(char *) path; + syscallarg(int) flags; + syscallarg(int) mode; +}; + +struct hpux_sys_wait_args { + syscallarg(int *) status; +}; + +struct hpux_sys_creat_args { + syscallarg(char *) path; + syscallarg(int) mode; +}; + +struct hpux_sys_execv_args { + syscallarg(char *) path; + syscallarg(char **) argp; +}; + +struct compat_hpux_6x_sys_time_args { + syscallarg(time_t *) t; +}; + +struct compat_hpux_6x_sys_stat_args { + syscallarg(char *) path; + syscallarg(struct hpux_ostat *) sb; +}; + +struct compat_hpux_6x_sys_stime_args { + syscallarg(int) time; +}; + +struct hpux_sys_ptrace_args { + syscallarg(int) req; + syscallarg(int) pid; + syscallarg(int *) addr; + syscallarg(int) data; +}; + +struct compat_hpux_6x_sys_alarm_args { + syscallarg(int) deltat; +}; + +struct compat_hpux_6x_sys_fstat_args { + syscallarg(int) fd; + syscallarg(struct hpux_ostat *) sb; +}; + +struct compat_hpux_6x_sys_utime_args { + syscallarg(char *) fname; + syscallarg(time_t *) tptr; +}; + +struct compat_hpux_6x_sys_stty_args { + syscallarg(int) fd; + syscallarg(caddr_t) arg; +}; + +struct compat_hpux_6x_sys_gtty_args { + syscallarg(int) fd; + syscallarg(caddr_t) arg; +}; + +struct compat_hpux_6x_sys_nice_args { + syscallarg(int) nval; +}; + +struct compat_hpux_6x_sys_ftime_args { + syscallarg(struct hpux_timeb *) tp; +}; + +struct hpux_sys_kill_args { + syscallarg(pid_t) pid; + syscallarg(int) signo; +}; + +struct hpux_sys_stat_args { + syscallarg(char *) path; + syscallarg(struct hpux_stat *) sb; +}; + +struct hpux_sys_lstat_args { + syscallarg(char *) path; + syscallarg(struct hpux_stat *) sb; +}; + +struct hpux_sys_dup_args { + syscallarg(int) fd; +}; + +struct compat_hpux_6x_sys_times_args { + syscallarg(struct tms *) tms; +}; + +struct compat_hpux_6x_sys_ssig_args { + syscallarg(int) signo; + syscallarg(sig_t) fun; +}; + +struct hpux_sys_ioctl_args { + syscallarg(int) fd; + syscallarg(int) com; + syscallarg(caddr_t) data; +}; + +struct hpux_sys_utssys_args { + syscallarg(struct hpux_utsname *) uts; + syscallarg(int) dev; + syscallarg(int) request; +}; + +struct hpux_sys_fcntl_args { + syscallarg(int) fd; + syscallarg(int) cmd; + syscallarg(int) arg; +}; + +struct hpux_sys_ulimit_args { + syscallarg(int) cmd; + syscallarg(int) newlimit; +}; + +struct hpux_sys_mmap_args { + syscallarg(caddr_t) addr; + syscallarg(size_t) len; + syscallarg(int) prot; + syscallarg(int) flags; + syscallarg(int) fd; + syscallarg(long) pos; +}; + +struct hpux_sys_getpgrp2_args { + syscallarg(pid_t) pid; +}; + +struct hpux_sys_setpgrp2_args { + syscallarg(pid_t) pid; + syscallarg(pid_t) pgid; +}; + +struct hpux_sys_wait3_args { + syscallarg(int *) status; + syscallarg(int) options; + syscallarg(int) rusage; +}; + +struct hpux_sys_fstat_args { + syscallarg(int) fd; + syscallarg(struct hpux_stat *) sb; +}; + +struct hpux_sys_sigvec_args { + syscallarg(int) signo; + syscallarg(struct sigvec *) nsv; + syscallarg(struct sigvec *) osv; +}; + +struct hpux_sys_sigblock_args { + syscallarg(int) mask; +}; + +struct hpux_sys_sigsetmask_args { + syscallarg(int) mask; +}; + +struct hpux_sys_sigpause_args { + syscallarg(int) mask; +}; + +struct hpux_sys_readv_args { + syscallarg(int) fd; + syscallarg(struct iovec *) iovp; + syscallarg(u_int) iovcnt; +}; + +struct hpux_sys_writev_args { + syscallarg(int) fd; + syscallarg(struct iovec *) iovp; + syscallarg(u_int) iovcnt; +}; + +struct hpux_sys_setresuid_args { + syscallarg(uid_t) r; + syscallarg(uid_t) e; + syscallarg(uid_t) s; +}; + +struct hpux_sys_setresgid_args { + syscallarg(gid_t) r; + syscallarg(gid_t) e; + syscallarg(gid_t) s; +}; + +struct hpux_sys_sysconf_args { + syscallarg(int) name; +}; + +struct hpux_sys_getrlimit_args { + syscallarg(u_int) which; + syscallarg(struct ogetrlimit *) rlp; +}; + +struct hpux_sys_setrlimit_args { + syscallarg(u_int) which; + syscallarg(struct ogetrlimit *) rlp; +}; + +struct hpux_sys_rtprio_args { + syscallarg(pid_t) pid; + syscallarg(int) prio; +}; + +struct hpux_sys_netioctl_args { + syscallarg(int) call; + syscallarg(int *) args; +}; + +struct hpux_sys_lockf_args { + syscallarg(int) fd; + syscallarg(int) func; + syscallarg(long) size; +}; + +struct hpux_sys_shmctl_args { + syscallarg(int) shmid; + syscallarg(int) cmd; + syscallarg(caddr_t) buf; +}; + +struct hpux_sys_advise_args { + syscallarg(int) arg; +}; + +struct hpux_sys_getcontext_args { + syscallarg(char *) buf; + syscallarg(int) len; +}; + +struct hpux_sys_getaccess_args { + syscallarg(char *) path; + syscallarg(uid_t) uid; + syscallarg(int) ngroups; + syscallarg(gid_t *) gidset; + syscallarg(void *) label; + syscallarg(void *) privs; +}; + +struct hpux_sys_waitpid_args { + syscallarg(pid_t) pid; + syscallarg(int *) status; + syscallarg(int) options; + syscallarg(struct rusage *) rusage; +}; + +struct hpux_sys_sigaction_args { + syscallarg(int) signo; + syscallarg(struct hpux_sigaction *) nsa; + syscallarg(struct hpux_sigaction *) osa; +}; + +struct hpux_sys_sigprocmask_args { + syscallarg(int) how; + syscallarg(hpux_sigset_t *) set; + syscallarg(hpux_sigset_t *) oset; +}; + +struct hpux_sys_sigpending_args { + syscallarg(hpux_sigset_t *) set; +}; + +struct hpux_sys_sigsuspend_args { + syscallarg(hpux_sigset_t *) set; +}; + +struct hpux_sys_setsockopt2_args { + syscallarg(int) s; + syscallarg(int) level; + syscallarg(int) name; + syscallarg(caddr_t) val; + syscallarg(int) valsize; +}; + +struct hpux_sys_nshmctl_args { + syscallarg(int) shmid; + syscallarg(int) cmd; + syscallarg(caddr_t) buf; +}; + +/* + * System call prototypes. + */ + +int sys_nosys __P((struct proc *, void *, register_t *)); +int sys_exit __P((struct proc *, void *, register_t *)); +int hpux_sys_fork __P((struct proc *, void *, register_t *)); +int hpux_sys_read __P((struct proc *, void *, register_t *)); +int hpux_sys_write __P((struct proc *, void *, register_t *)); +int hpux_sys_open __P((struct proc *, void *, register_t *)); +int sys_close __P((struct proc *, void *, register_t *)); +int hpux_sys_wait __P((struct proc *, void *, register_t *)); +int hpux_sys_creat __P((struct proc *, void *, register_t *)); +int sys_link __P((struct proc *, void *, register_t *)); +int sys_unlink __P((struct proc *, void *, register_t *)); +int hpux_sys_execv __P((struct proc *, void *, register_t *)); +int sys_chdir __P((struct proc *, void *, register_t *)); +int compat_hpux_6x_sys_time __P((struct proc *, void *, register_t *)); +int sys_mknod __P((struct proc *, void *, register_t *)); +int sys_chmod __P((struct proc *, void *, register_t *)); +int sys_chown __P((struct proc *, void *, register_t *)); +int sys_obreak __P((struct proc *, void *, register_t *)); +int compat_hpux_6x_sys_stat __P((struct proc *, void *, register_t *)); +int compat_43_sys_lseek __P((struct proc *, void *, register_t *)); +int sys_getpid __P((struct proc *, void *, register_t *)); +int sys_setuid __P((struct proc *, void *, register_t *)); +int sys_getuid __P((struct proc *, void *, register_t *)); +int compat_hpux_6x_sys_stime __P((struct proc *, void *, register_t *)); +int hpux_sys_ptrace __P((struct proc *, void *, register_t *)); +int compat_hpux_6x_sys_alarm __P((struct proc *, void *, register_t *)); +int compat_hpux_6x_sys_fstat __P((struct proc *, void *, register_t *)); +int compat_hpux_6x_sys_pause __P((struct proc *, void *, register_t *)); +int compat_hpux_6x_sys_utime __P((struct proc *, void *, register_t *)); +int compat_hpux_6x_sys_stty __P((struct proc *, void *, register_t *)); +int compat_hpux_6x_sys_gtty __P((struct proc *, void *, register_t *)); +int sys_access __P((struct proc *, void *, register_t *)); +int compat_hpux_6x_sys_nice __P((struct proc *, void *, register_t *)); +int compat_hpux_6x_sys_ftime __P((struct proc *, void *, register_t *)); +int sys_sync __P((struct proc *, void *, register_t *)); +int hpux_sys_kill __P((struct proc *, void *, register_t *)); +int hpux_sys_stat __P((struct proc *, void *, register_t *)); +int compat_hpux_6x_sys_setpgrp __P((struct proc *, void *, register_t *)); +int hpux_sys_lstat __P((struct proc *, void *, register_t *)); +int hpux_sys_dup __P((struct proc *, void *, register_t *)); +int sys_pipe __P((struct proc *, void *, register_t *)); +int compat_hpux_6x_sys_times __P((struct proc *, void *, register_t *)); +int sys_profil __P((struct proc *, void *, register_t *)); +int sys_setgid __P((struct proc *, void *, register_t *)); +int sys_getgid __P((struct proc *, void *, register_t *)); +int compat_hpux_6x_sys_ssig __P((struct proc *, void *, register_t *)); +int hpux_sys_ioctl __P((struct proc *, void *, register_t *)); +int sys_symlink __P((struct proc *, void *, register_t *)); +int hpux_sys_utssys __P((struct proc *, void *, register_t *)); +int sys_readlink __P((struct proc *, void *, register_t *)); +int sys_execve __P((struct proc *, void *, register_t *)); +int sys_umask __P((struct proc *, void *, register_t *)); +int sys_chroot __P((struct proc *, void *, register_t *)); +int hpux_sys_fcntl __P((struct proc *, void *, register_t *)); +int hpux_sys_ulimit __P((struct proc *, void *, register_t *)); +int hpux_sys_vfork __P((struct proc *, void *, register_t *)); +int hpux_sys_read __P((struct proc *, void *, register_t *)); +int hpux_sys_write __P((struct proc *, void *, register_t *)); +int hpux_sys_mmap __P((struct proc *, void *, register_t *)); +int sys_munmap __P((struct proc *, void *, register_t *)); +int sys_mprotect __P((struct proc *, void *, register_t *)); +int sys_getgroups __P((struct proc *, void *, register_t *)); +int sys_setgroups __P((struct proc *, void *, register_t *)); +int hpux_sys_getpgrp2 __P((struct proc *, void *, register_t *)); +int hpux_sys_setpgrp2 __P((struct proc *, void *, register_t *)); +int sys_setitimer __P((struct proc *, void *, register_t *)); +int hpux_sys_wait3 __P((struct proc *, void *, register_t *)); +int sys_getitimer __P((struct proc *, void *, register_t *)); +int sys_dup2 __P((struct proc *, void *, register_t *)); +int hpux_sys_fstat __P((struct proc *, void *, register_t *)); +int sys_select __P((struct proc *, void *, register_t *)); +int sys_fsync __P((struct proc *, void *, register_t *)); +int sys_sigreturn __P((struct proc *, void *, register_t *)); +int hpux_sys_sigvec __P((struct proc *, void *, register_t *)); +int hpux_sys_sigblock __P((struct proc *, void *, register_t *)); +int hpux_sys_sigsetmask __P((struct proc *, void *, register_t *)); +int hpux_sys_sigpause __P((struct proc *, void *, register_t *)); +int compat_43_sys_sigstack __P((struct proc *, void *, register_t *)); +int sys_gettimeofday __P((struct proc *, void *, register_t *)); +int hpux_sys_readv __P((struct proc *, void *, register_t *)); +int hpux_sys_writev __P((struct proc *, void *, register_t *)); +int sys_settimeofday __P((struct proc *, void *, register_t *)); +int sys_fchown __P((struct proc *, void *, register_t *)); +int sys_fchmod __P((struct proc *, void *, register_t *)); +int hpux_sys_setresuid __P((struct proc *, void *, register_t *)); +int hpux_sys_setresgid __P((struct proc *, void *, register_t *)); +int sys_rename __P((struct proc *, void *, register_t *)); +int compat_43_sys_truncate __P((struct proc *, void *, register_t *)); +int compat_43_sys_ftruncate __P((struct proc *, void *, register_t *)); +int hpux_sys_sysconf __P((struct proc *, void *, register_t *)); +int sys_mkdir __P((struct proc *, void *, register_t *)); +int sys_rmdir __P((struct proc *, void *, register_t *)); +int hpux_sys_getrlimit __P((struct proc *, void *, register_t *)); +int hpux_sys_setrlimit __P((struct proc *, void *, register_t *)); +int hpux_sys_rtprio __P((struct proc *, void *, register_t *)); +int hpux_sys_netioctl __P((struct proc *, void *, register_t *)); +int hpux_sys_lockf __P((struct proc *, void *, register_t *)); +#ifdef SYSVSEM +int sys_semget __P((struct proc *, void *, register_t *)); +int sys___semctl __P((struct proc *, void *, register_t *)); +int sys_semop __P((struct proc *, void *, register_t *)); +#else +#endif +#ifdef SYSVMSG +int sys_msgget __P((struct proc *, void *, register_t *)); +int sys_msgctl __P((struct proc *, void *, register_t *)); +int sys_msgsnd __P((struct proc *, void *, register_t *)); +int sys_msgrcv __P((struct proc *, void *, register_t *)); +#else +#endif +#ifdef SYSVSHM +int sys_shmget __P((struct proc *, void *, register_t *)); +int hpux_sys_shmctl __P((struct proc *, void *, register_t *)); +int sys_shmat __P((struct proc *, void *, register_t *)); +int sys_shmdt __P((struct proc *, void *, register_t *)); +#else +#endif +int hpux_sys_advise __P((struct proc *, void *, register_t *)); +int hpux_sys_getcontext __P((struct proc *, void *, register_t *)); +int hpux_sys_getaccess __P((struct proc *, void *, register_t *)); +int hpux_sys_waitpid __P((struct proc *, void *, register_t *)); +int sys_pathconf __P((struct proc *, void *, register_t *)); +int sys_fpathconf __P((struct proc *, void *, register_t *)); +int compat_43_sys_getdirentries __P((struct proc *, void *, register_t *)); +int compat_09_sys_getdomainname __P((struct proc *, void *, register_t *)); +int compat_09_sys_setdomainname __P((struct proc *, void *, register_t *)); +int hpux_sys_sigaction __P((struct proc *, void *, register_t *)); +int hpux_sys_sigprocmask __P((struct proc *, void *, register_t *)); +int hpux_sys_sigpending __P((struct proc *, void *, register_t *)); +int hpux_sys_sigsuspend __P((struct proc *, void *, register_t *)); +int compat_43_sys_getdtablesize __P((struct proc *, void *, register_t *)); +int sys_fchdir __P((struct proc *, void *, register_t *)); +int compat_43_sys_accept __P((struct proc *, void *, register_t *)); +int sys_bind __P((struct proc *, void *, register_t *)); +int sys_connect __P((struct proc *, void *, register_t *)); +int compat_43_sys_getpeername __P((struct proc *, void *, register_t *)); +int compat_43_sys_getsockname __P((struct proc *, void *, register_t *)); +int sys_getsockopt __P((struct proc *, void *, register_t *)); +int sys_listen __P((struct proc *, void *, register_t *)); +int compat_43_sys_recv __P((struct proc *, void *, register_t *)); +int compat_43_sys_recvfrom __P((struct proc *, void *, register_t *)); +int compat_43_sys_recvmsg __P((struct proc *, void *, register_t *)); +int compat_43_sys_send __P((struct proc *, void *, register_t *)); +int compat_43_sys_sendmsg __P((struct proc *, void *, register_t *)); +int sys_sendto __P((struct proc *, void *, register_t *)); +int hpux_sys_setsockopt2 __P((struct proc *, void *, register_t *)); +int sys_shutdown __P((struct proc *, void *, register_t *)); +int sys_socket __P((struct proc *, void *, register_t *)); +int sys_socketpair __P((struct proc *, void *, register_t *)); +#ifdef SYSVSEM +int sys___semctl __P((struct proc *, void *, register_t *)); +#else +#endif +#ifdef SYSVMSG +int sys_msgctl __P((struct proc *, void *, register_t *)); +#else +#endif +#ifdef SYSVSHM +int hpux_sys_nshmctl __P((struct proc *, void *, register_t *)); +#else +#endif diff --git a/sys/compat/hpux/hpux_syscalls.c b/sys/compat/hpux/hpux_syscalls.c new file mode 100644 index 00000000000..58930283148 --- /dev/null +++ b/sys/compat/hpux/hpux_syscalls.c @@ -0,0 +1,356 @@ +/* + * System call names. + * + * DO NOT EDIT-- this file is automatically generated. + * created from NetBSD: syscalls.master,v 1.8 1995/10/07 06:26:42 mycroft Exp + */ + +char *hpux_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 */ + "compat_hpux_6x_time", /* 13 = compat_hpux_6x time */ + "mknod", /* 14 = mknod */ + "chmod", /* 15 = chmod */ + "chown", /* 16 = chown */ + "obreak", /* 17 = obreak */ + "compat_hpux_6x_stat", /* 18 = compat_hpux_6x stat */ + "lseek", /* 19 = lseek */ + "getpid", /* 20 = getpid */ + "#21 (unimplemented mount)", /* 21 = unimplemented mount */ + "#22 (unimplemented umount)", /* 22 = unimplemented umount */ + "setuid", /* 23 = setuid */ + "getuid", /* 24 = getuid */ + "compat_hpux_6x_stime", /* 25 = compat_hpux_6x stime */ + "ptrace", /* 26 = ptrace */ + "compat_hpux_6x_alarm", /* 27 = compat_hpux_6x alarm */ + "compat_hpux_6x_fstat", /* 28 = compat_hpux_6x fstat */ + "compat_hpux_6x_pause", /* 29 = compat_hpux_6x pause */ + "compat_hpux_6x_utime", /* 30 = compat_hpux_6x utime */ + "compat_hpux_6x_stty", /* 31 = compat_hpux_6x stty */ + "compat_hpux_6x_gtty", /* 32 = compat_hpux_6x gtty */ + "access", /* 33 = access */ + "compat_hpux_6x_nice", /* 34 = compat_hpux_6x nice */ + "compat_hpux_6x_ftime", /* 35 = compat_hpux_6x ftime */ + "sync", /* 36 = sync */ + "kill", /* 37 = kill */ + "stat", /* 38 = stat */ + "compat_hpux_6x_setpgrp", /* 39 = compat_hpux_6x setpgrp */ + "lstat", /* 40 = lstat */ + "dup", /* 41 = dup */ + "pipe", /* 42 = pipe */ + "compat_hpux_6x_times", /* 43 = compat_hpux_6x times */ + "profil", /* 44 = profil */ + "#45 (unimplemented ki_syscall)", /* 45 = unimplemented ki_syscall */ + "setgid", /* 46 = setgid */ + "getgid", /* 47 = getgid */ + "compat_hpux_6x_ssig", /* 48 = compat_hpux_6x ssig */ + "#49 (unimplemented reserved for USG)", /* 49 = unimplemented reserved for USG */ + "#50 (unimplemented reserved for USG)", /* 50 = unimplemented reserved for USG */ + "#51 (unimplemented acct)", /* 51 = unimplemented acct */ + "#52 (unimplemented)", /* 52 = unimplemented */ + "#53 (unimplemented)", /* 53 = unimplemented */ + "ioctl", /* 54 = ioctl */ + "#55 (unimplemented reboot)", /* 55 = unimplemented reboot */ + "symlink", /* 56 = symlink */ + "utssys", /* 57 = utssys */ + "readlink", /* 58 = readlink */ + "execve", /* 59 = execve */ + "umask", /* 60 = umask */ + "chroot", /* 61 = chroot */ + "fcntl", /* 62 = fcntl */ + "ulimit", /* 63 = ulimit */ + "#64 (unimplemented)", /* 64 = unimplemented */ + "#65 (unimplemented)", /* 65 = unimplemented */ + "vfork", /* 66 = vfork */ + "vread", /* 67 = vread */ + "vwrite", /* 68 = vwrite */ + "#69 (unimplemented)", /* 69 = unimplemented */ + "#70 (unimplemented)", /* 70 = unimplemented */ + "mmap", /* 71 = mmap */ + "#72 (unimplemented)", /* 72 = unimplemented */ + "munmap", /* 73 = munmap */ + "mprotect", /* 74 = mprotect */ + "#75 (unimplemented)", /* 75 = unimplemented */ + "#76 (unimplemented)", /* 76 = unimplemented */ + "#77 (unimplemented)", /* 77 = unimplemented */ + "#78 (unimplemented)", /* 78 = unimplemented */ + "getgroups", /* 79 = getgroups */ + "setgroups", /* 80 = setgroups */ + "getpgrp2", /* 81 = getpgrp2 */ + "setpgrp2", /* 82 = setpgrp2 */ + "setitimer", /* 83 = setitimer */ + "wait3", /* 84 = wait3 */ + "#85 (unimplemented swapon)", /* 85 = unimplemented swapon */ + "getitimer", /* 86 = getitimer */ + "#87 (unimplemented)", /* 87 = unimplemented */ + "#88 (unimplemented)", /* 88 = unimplemented */ + "#89 (unimplemented)", /* 89 = unimplemented */ + "dup2", /* 90 = dup2 */ + "#91 (unimplemented)", /* 91 = unimplemented */ + "fstat", /* 92 = fstat */ + "select", /* 93 = select */ + "#94 (unimplemented)", /* 94 = unimplemented */ + "fsync", /* 95 = fsync */ + "#96 (unimplemented)", /* 96 = unimplemented */ + "#97 (unimplemented)", /* 97 = unimplemented */ + "#98 (unimplemented)", /* 98 = unimplemented */ + "#99 (unimplemented)", /* 99 = unimplemented */ + "#100 (unimplemented)", /* 100 = unimplemented */ + "#101 (unimplemented)", /* 101 = unimplemented */ + "#102 (unimplemented)", /* 102 = unimplemented */ + "sigreturn", /* 103 = sigreturn */ + "#104 (unimplemented)", /* 104 = unimplemented */ + "#105 (unimplemented)", /* 105 = unimplemented */ + "#106 (unimplemented)", /* 106 = unimplemented */ + "#107 (unimplemented)", /* 107 = unimplemented */ + "sigvec", /* 108 = sigvec */ + "sigblock", /* 109 = sigblock */ + "sigsetmask", /* 110 = sigsetmask */ + "sigpause", /* 111 = sigpause */ + "sigstack", /* 112 = sigstack */ + "#113 (unimplemented)", /* 113 = unimplemented */ + "#114 (unimplemented)", /* 114 = unimplemented */ + "#115 (unimplemented)", /* 115 = unimplemented */ + "gettimeofday", /* 116 = gettimeofday */ + "#117 (unimplemented)", /* 117 = unimplemented */ + "#118 (unimplemented)", /* 118 = unimplemented */ + "#119 (unimplemented io_stub)", /* 119 = unimplemented io_stub */ + "readv", /* 120 = readv */ + "writev", /* 121 = writev */ + "settimeofday", /* 122 = settimeofday */ + "fchown", /* 123 = fchown */ + "fchmod", /* 124 = fchmod */ + "#125 (unimplemented)", /* 125 = unimplemented */ + "setresuid", /* 126 = setresuid */ + "setresgid", /* 127 = setresgid */ + "rename", /* 128 = rename */ + "truncate", /* 129 = truncate */ + "ftruncate", /* 130 = ftruncate */ + "#131 (unimplemented)", /* 131 = unimplemented */ + "sysconf", /* 132 = sysconf */ + "#133 (unimplemented)", /* 133 = unimplemented */ + "#134 (unimplemented)", /* 134 = unimplemented */ + "#135 (unimplemented)", /* 135 = unimplemented */ + "mkdir", /* 136 = mkdir */ + "rmdir", /* 137 = rmdir */ + "#138 (unimplemented)", /* 138 = unimplemented */ + "#139 (unimplemented)", /* 139 = unimplemented */ + "#140 (unimplemented)", /* 140 = unimplemented */ + "#141 (unimplemented)", /* 141 = unimplemented */ + "#142 (unimplemented)", /* 142 = unimplemented */ + "#143 (unimplemented)", /* 143 = unimplemented */ + "getrlimit", /* 144 = getrlimit */ + "setrlimit", /* 145 = setrlimit */ + "#146 (unimplemented)", /* 146 = unimplemented */ + "#147 (unimplemented)", /* 147 = unimplemented */ + "#148 (unimplemented)", /* 148 = unimplemented */ + "#149 (unimplemented)", /* 149 = unimplemented */ + "#150 (unimplemented)", /* 150 = unimplemented */ + "#151 (unimplemented privgrp)", /* 151 = unimplemented privgrp */ + "rtprio", /* 152 = rtprio */ + "#153 (unimplemented plock)", /* 153 = unimplemented plock */ + "netioctl", /* 154 = netioctl */ + "lockf", /* 155 = lockf */ +#ifdef SYSVSEM + "semget", /* 156 = semget */ + "__semctl", /* 157 = __semctl */ + "semop", /* 158 = semop */ +#else + "#156 (unimplemented semget)", /* 156 = unimplemented semget */ + "#157 (unimplemented semctl)", /* 157 = unimplemented semctl */ + "#158 (unimplemented semop)", /* 158 = unimplemented semop */ +#endif +#ifdef SYSVMSG + "msgget", /* 159 = msgget */ + "msgctl", /* 160 = msgctl */ + "msgsnd", /* 161 = msgsnd */ + "msgrcv", /* 162 = msgrcv */ +#else + "#159 (unimplemented msgget)", /* 159 = unimplemented msgget */ + "#160 (unimplemented msgctl)", /* 160 = unimplemented msgctl */ + "#161 (unimplemented msgsnd)", /* 161 = unimplemented msgsnd */ + "#162 (unimplemented msgrcv)", /* 162 = unimplemented msgrcv */ +#endif +#ifdef SYSVSHM + "shmget", /* 163 = shmget */ + "shmctl", /* 164 = shmctl */ + "shmat", /* 165 = shmat */ + "shmdt", /* 166 = shmdt */ +#else + "#163 (unimplemented shmget)", /* 163 = unimplemented shmget */ + "#164 (unimplemented shmctl)", /* 164 = unimplemented shmctl */ + "#165 (unimplemented shmat)", /* 165 = unimplemented shmat */ + "#166 (unimplemented shmdt)", /* 166 = unimplemented shmdt */ +#endif + "advise", /* 167 = advise */ + "#168 (unimplemented nsp_init)", /* 168 = unimplemented nsp_init */ + "#169 (unimplemented cluster)", /* 169 = unimplemented cluster */ + "#170 (unimplemented mkrnod)", /* 170 = unimplemented mkrnod */ + "#171 (unimplemented)", /* 171 = unimplemented */ + "#172 (unimplemented unsp_open)", /* 172 = unimplemented unsp_open */ + "#173 (unimplemented)", /* 173 = unimplemented */ + "getcontext", /* 174 = getcontext */ + "#175 (unimplemented)", /* 175 = unimplemented */ + "#176 (unimplemented)", /* 176 = unimplemented */ + "#177 (unimplemented)", /* 177 = unimplemented */ + "#178 (unimplemented lsync)", /* 178 = unimplemented lsync */ + "#179 (unimplemented)", /* 179 = unimplemented */ + "#180 (unimplemented mysite)", /* 180 = unimplemented mysite */ + "#181 (unimplemented sitels)", /* 181 = unimplemented sitels */ + "#182 (unimplemented)", /* 182 = unimplemented */ + "#183 (unimplemented)", /* 183 = unimplemented */ + "#184 (unimplemented dskless_stats)", /* 184 = unimplemented dskless_stats */ + "#185 (unimplemented)", /* 185 = unimplemented */ + "#186 (unimplemented setacl)", /* 186 = unimplemented setacl */ + "#187 (unimplemented fsetacl)", /* 187 = unimplemented fsetacl */ + "#188 (unimplemented getacl)", /* 188 = unimplemented getacl */ + "#189 (unimplemented fgetacl)", /* 189 = unimplemented fgetacl */ + "getaccess", /* 190 = getaccess */ + "#191 (unimplemented getaudid)", /* 191 = unimplemented getaudid */ + "#192 (unimplemented setaudid)", /* 192 = unimplemented setaudid */ + "#193 (unimplemented getaudproc)", /* 193 = unimplemented getaudproc */ + "#194 (unimplemented setaudproc)", /* 194 = unimplemented setaudproc */ + "#195 (unimplemented getevent)", /* 195 = unimplemented getevent */ + "#196 (unimplemented setevent)", /* 196 = unimplemented setevent */ + "#197 (unimplemented audwrite)", /* 197 = unimplemented audwrite */ + "#198 (unimplemented audswitch)", /* 198 = unimplemented audswitch */ + "#199 (unimplemented audctl)", /* 199 = unimplemented audctl */ + "waitpid", /* 200 = waitpid */ + "#201 (unimplemented)", /* 201 = unimplemented */ + "#202 (unimplemented)", /* 202 = unimplemented */ + "#203 (unimplemented)", /* 203 = unimplemented */ + "#204 (unimplemented)", /* 204 = unimplemented */ + "#205 (unimplemented)", /* 205 = unimplemented */ + "#206 (unimplemented)", /* 206 = unimplemented */ + "#207 (unimplemented)", /* 207 = unimplemented */ + "#208 (unimplemented)", /* 208 = unimplemented */ + "#209 (unimplemented)", /* 209 = unimplemented */ + "#210 (unimplemented)", /* 210 = unimplemented */ + "#211 (unimplemented)", /* 211 = unimplemented */ + "#212 (unimplemented)", /* 212 = unimplemented */ + "#213 (unimplemented)", /* 213 = unimplemented */ + "#214 (unimplemented)", /* 214 = unimplemented */ + "#215 (unimplemented)", /* 215 = unimplemented */ + "#216 (unimplemented)", /* 216 = unimplemented */ + "#217 (unimplemented)", /* 217 = unimplemented */ + "#218 (unimplemented)", /* 218 = unimplemented */ + "#219 (unimplemented)", /* 219 = unimplemented */ + "#220 (unimplemented)", /* 220 = unimplemented */ + "#221 (unimplemented)", /* 221 = unimplemented */ + "#222 (unimplemented)", /* 222 = unimplemented */ + "#223 (unimplemented)", /* 223 = unimplemented */ + "#224 (unimplemented)", /* 224 = unimplemented */ + "pathconf", /* 225 = pathconf */ + "fpathconf", /* 226 = fpathconf */ + "#227 (unimplemented)", /* 227 = unimplemented */ + "#228 (unimplemented)", /* 228 = unimplemented */ + "#229 (unimplemented async_daemon)", /* 229 = unimplemented async_daemon */ + "#230 (unimplemented nfs_fcntl)", /* 230 = unimplemented nfs_fcntl */ + "getdirentries", /* 231 = getdirentries */ + "getdomainname", /* 232 = getdomainname */ + "#233 (unimplemented nfs_getfh)", /* 233 = unimplemented nfs_getfh */ + "#234 (unimplemented vfsmount)", /* 234 = unimplemented vfsmount */ + "#235 (unimplemented nfs_svc)", /* 235 = unimplemented nfs_svc */ + "setdomainname", /* 236 = setdomainname */ + "#237 (unimplemented statfs)", /* 237 = unimplemented statfs */ + "#238 (unimplemented fstatfs)", /* 238 = unimplemented fstatfs */ + "sigaction", /* 239 = sigaction */ + "sigprocmask", /* 240 = sigprocmask */ + "sigpending", /* 241 = sigpending */ + "sigsuspend", /* 242 = sigsuspend */ + "#243 (unimplemented fsctl)", /* 243 = unimplemented fsctl */ + "#244 (unimplemented)", /* 244 = unimplemented */ + "#245 (unimplemented pstat)", /* 245 = unimplemented pstat */ + "#246 (unimplemented)", /* 246 = unimplemented */ + "#247 (unimplemented)", /* 247 = unimplemented */ + "#248 (unimplemented)", /* 248 = unimplemented */ + "#249 (unimplemented)", /* 249 = unimplemented */ + "#250 (unimplemented)", /* 250 = unimplemented */ + "#251 (unimplemented)", /* 251 = unimplemented */ + "#252 (unimplemented)", /* 252 = unimplemented */ + "#253 (unimplemented)", /* 253 = unimplemented */ + "#254 (unimplemented)", /* 254 = unimplemented */ + "#255 (unimplemented)", /* 255 = unimplemented */ + "#256 (unimplemented)", /* 256 = unimplemented */ + "#257 (unimplemented)", /* 257 = unimplemented */ + "#258 (unimplemented)", /* 258 = unimplemented */ + "#259 (unimplemented)", /* 259 = unimplemented */ + "#260 (unimplemented)", /* 260 = unimplemented */ + "#261 (unimplemented)", /* 261 = unimplemented */ + "#262 (unimplemented)", /* 262 = unimplemented */ + "#263 (unimplemented)", /* 263 = unimplemented */ + "#264 (unimplemented)", /* 264 = unimplemented */ + "#265 (unimplemented)", /* 265 = unimplemented */ + "#266 (unimplemented)", /* 266 = unimplemented */ + "#267 (unimplemented)", /* 267 = unimplemented */ + "getdtablesize", /* 268 = getdtablesize */ + "#269 (unimplemented)", /* 269 = unimplemented */ + "#270 (unimplemented)", /* 270 = unimplemented */ + "#271 (unimplemented)", /* 271 = unimplemented */ + "fchdir", /* 272 = fchdir */ + "#273 (unimplemented)", /* 273 = unimplemented */ + "#274 (unimplemented)", /* 274 = unimplemented */ + "accept", /* 275 = accept */ + "bind", /* 276 = bind */ + "connect", /* 277 = connect */ + "getpeername", /* 278 = getpeername */ + "getsockname", /* 279 = getsockname */ + "getsockopt", /* 280 = getsockopt */ + "listen", /* 281 = listen */ + "recv", /* 282 = recv */ + "recvfrom", /* 283 = recvfrom */ + "recvmsg", /* 284 = recvmsg */ + "send", /* 285 = send */ + "sendmsg", /* 286 = sendmsg */ + "sendto", /* 287 = sendto */ + "setsockopt2", /* 288 = setsockopt2 */ + "shutdown", /* 289 = shutdown */ + "socket", /* 290 = socket */ + "socketpair", /* 291 = socketpair */ + "#292 (unimplemented)", /* 292 = unimplemented */ + "#293 (unimplemented)", /* 293 = unimplemented */ + "#294 (unimplemented)", /* 294 = unimplemented */ + "#295 (unimplemented)", /* 295 = unimplemented */ + "#296 (unimplemented)", /* 296 = unimplemented */ + "#297 (unimplemented)", /* 297 = unimplemented */ + "#298 (unimplemented)", /* 298 = unimplemented */ + "#299 (unimplemented)", /* 299 = unimplemented */ + "#300 (unimplemented)", /* 300 = unimplemented */ + "#301 (unimplemented)", /* 301 = unimplemented */ + "#302 (unimplemented)", /* 302 = unimplemented */ + "#303 (unimplemented)", /* 303 = unimplemented */ + "#304 (unimplemented)", /* 304 = unimplemented */ + "#305 (unimplemented)", /* 305 = unimplemented */ + "#306 (unimplemented)", /* 306 = unimplemented */ + "#307 (unimplemented)", /* 307 = unimplemented */ + "#308 (unimplemented)", /* 308 = unimplemented */ + "#309 (unimplemented)", /* 309 = unimplemented */ + "#310 (unimplemented)", /* 310 = unimplemented */ + "#311 (unimplemented)", /* 311 = unimplemented */ +#ifdef SYSVSEM + "nsemctl", /* 312 = nsemctl */ +#else + "#312 (unimplemented semctl)", /* 312 = unimplemented semctl */ +#endif +#ifdef SYSVMSG + "nmsgctl", /* 313 = nmsgctl */ +#else + "#313 (unimplemented msgctl)", /* 313 = unimplemented msgctl */ +#endif +#ifdef SYSVSHM + "nshmctl", /* 314 = nshmctl */ +#else + "#314 (unimplemented shmctl)", /* 314 = unimplemented shmctl */ +#endif +}; diff --git a/sys/compat/hpux/hpux_sysent.c b/sys/compat/hpux/hpux_sysent.c new file mode 100644 index 00000000000..bad0ac8abd6 --- /dev/null +++ b/sys/compat/hpux/hpux_sysent.c @@ -0,0 +1,702 @@ +/* + * System call switch table. + * + * DO NOT EDIT-- this file is automatically generated. + * created from NetBSD: syscalls.master,v 1.8 1995/10/07 06:26:42 mycroft Exp + */ + +#include <sys/param.h> +#include <sys/systm.h> +#include <sys/signal.h> +#include <sys/mount.h> +#include <sys/syscallargs.h> +#include <compat/hpux/hpux.h> +#include <compat/hpux/hpux_syscallargs.h> + +#ifdef COMPAT_HPUX_6X +#define compat_hpux_6x(func) __CONCAT(compat_hpux_6x_,func) +#else +#define compat_hpux_6x(func) sys_nosys +#endif + +#define s(type) sizeof(type) + +struct sysent hpux_sysent[] = { + { 0, 0, + sys_nosys }, /* 0 = syscall */ + { 1, s(struct sys_exit_args), + sys_exit }, /* 1 = exit */ + { 0, 0, + hpux_sys_fork }, /* 2 = fork */ + { 3, s(struct hpux_sys_read_args), + hpux_sys_read }, /* 3 = read */ + { 3, s(struct hpux_sys_write_args), + hpux_sys_write }, /* 4 = write */ + { 3, s(struct hpux_sys_open_args), + hpux_sys_open }, /* 5 = open */ + { 1, s(struct sys_close_args), + sys_close }, /* 6 = close */ + { 1, s(struct hpux_sys_wait_args), + hpux_sys_wait }, /* 7 = wait */ + { 2, s(struct hpux_sys_creat_args), + hpux_sys_creat }, /* 8 = creat */ + { 2, s(struct sys_link_args), + sys_link }, /* 9 = link */ + { 1, s(struct sys_unlink_args), + sys_unlink }, /* 10 = unlink */ + { 2, s(struct hpux_sys_execv_args), + hpux_sys_execv }, /* 11 = execv */ + { 1, s(struct sys_chdir_args), + sys_chdir }, /* 12 = chdir */ + { 1, s(struct compat_hpux_6x_sys_time_args), + compat_hpux_6x(sys_time) }, /* 13 = compat_hpux_6x time */ + { 3, s(struct sys_mknod_args), + sys_mknod }, /* 14 = mknod */ + { 2, s(struct sys_chmod_args), + sys_chmod }, /* 15 = chmod */ + { 3, s(struct sys_chown_args), + sys_chown }, /* 16 = chown */ + { 1, s(struct sys_obreak_args), + sys_obreak }, /* 17 = obreak */ + { 2, s(struct compat_hpux_6x_sys_stat_args), + compat_hpux_6x(sys_stat) }, /* 18 = compat_hpux_6x stat */ + { 3, s(struct compat_43_sys_lseek_args), + compat_43_sys_lseek }, /* 19 = lseek */ + { 0, 0, + sys_getpid }, /* 20 = getpid */ + { 0, 0, + sys_nosys }, /* 21 = unimplemented mount */ + { 0, 0, + sys_nosys }, /* 22 = unimplemented umount */ + { 1, s(struct sys_setuid_args), + sys_setuid }, /* 23 = setuid */ + { 0, 0, + sys_getuid }, /* 24 = getuid */ + { 1, s(struct compat_hpux_6x_sys_stime_args), + compat_hpux_6x(sys_stime) }, /* 25 = compat_hpux_6x stime */ + { 4, s(struct hpux_sys_ptrace_args), + hpux_sys_ptrace }, /* 26 = ptrace */ + { 1, s(struct compat_hpux_6x_sys_alarm_args), + compat_hpux_6x(sys_alarm) }, /* 27 = compat_hpux_6x alarm */ + { 2, s(struct compat_hpux_6x_sys_fstat_args), + compat_hpux_6x(sys_fstat) }, /* 28 = compat_hpux_6x fstat */ + { 0, 0, + compat_hpux_6x(sys_pause) }, /* 29 = compat_hpux_6x pause */ + { 2, s(struct compat_hpux_6x_sys_utime_args), + compat_hpux_6x(sys_utime) }, /* 30 = compat_hpux_6x utime */ + { 2, s(struct compat_hpux_6x_sys_stty_args), + compat_hpux_6x(sys_stty) }, /* 31 = compat_hpux_6x stty */ + { 2, s(struct compat_hpux_6x_sys_gtty_args), + compat_hpux_6x(sys_gtty) }, /* 32 = compat_hpux_6x gtty */ + { 2, s(struct sys_access_args), + sys_access }, /* 33 = access */ + { 1, s(struct compat_hpux_6x_sys_nice_args), + compat_hpux_6x(sys_nice) }, /* 34 = compat_hpux_6x nice */ + { 1, s(struct compat_hpux_6x_sys_ftime_args), + compat_hpux_6x(sys_ftime) }, /* 35 = compat_hpux_6x ftime */ + { 0, 0, + sys_sync }, /* 36 = sync */ + { 2, s(struct hpux_sys_kill_args), + hpux_sys_kill }, /* 37 = kill */ + { 2, s(struct hpux_sys_stat_args), + hpux_sys_stat }, /* 38 = stat */ + { 0, 0, + compat_hpux_6x(sys_setpgrp) }, /* 39 = compat_hpux_6x setpgrp */ + { 2, s(struct hpux_sys_lstat_args), + hpux_sys_lstat }, /* 40 = lstat */ + { 1, s(struct hpux_sys_dup_args), + hpux_sys_dup }, /* 41 = dup */ + { 0, 0, + sys_pipe }, /* 42 = pipe */ + { 1, s(struct compat_hpux_6x_sys_times_args), + compat_hpux_6x(sys_times) }, /* 43 = compat_hpux_6x times */ + { 4, s(struct sys_profil_args), + sys_profil }, /* 44 = profil */ + { 0, 0, + sys_nosys }, /* 45 = unimplemented ki_syscall */ + { 1, s(struct sys_setgid_args), + sys_setgid }, /* 46 = setgid */ + { 0, 0, + sys_getgid }, /* 47 = getgid */ + { 2, s(struct compat_hpux_6x_sys_ssig_args), + compat_hpux_6x(sys_ssig) }, /* 48 = compat_hpux_6x ssig */ + { 0, 0, + sys_nosys }, /* 49 = unimplemented reserved for USG */ + { 0, 0, + sys_nosys }, /* 50 = unimplemented reserved for USG */ + { 0, 0, + sys_nosys }, /* 51 = unimplemented acct */ + { 0, 0, + sys_nosys }, /* 52 = unimplemented */ + { 0, 0, + sys_nosys }, /* 53 = unimplemented */ + { 3, s(struct hpux_sys_ioctl_args), + hpux_sys_ioctl }, /* 54 = ioctl */ + { 0, 0, + sys_nosys }, /* 55 = unimplemented reboot */ + { 2, s(struct sys_symlink_args), + sys_symlink }, /* 56 = symlink */ + { 3, s(struct hpux_sys_utssys_args), + hpux_sys_utssys }, /* 57 = utssys */ + { 3, s(struct sys_readlink_args), + sys_readlink }, /* 58 = readlink */ + { 3, s(struct sys_execve_args), + sys_execve }, /* 59 = execve */ + { 1, s(struct sys_umask_args), + sys_umask }, /* 60 = umask */ + { 1, s(struct sys_chroot_args), + sys_chroot }, /* 61 = chroot */ + { 3, s(struct hpux_sys_fcntl_args), + hpux_sys_fcntl }, /* 62 = fcntl */ + { 2, s(struct hpux_sys_ulimit_args), + hpux_sys_ulimit }, /* 63 = ulimit */ + { 0, 0, + sys_nosys }, /* 64 = unimplemented */ + { 0, 0, + sys_nosys }, /* 65 = unimplemented */ + { 0, 0, + hpux_sys_vfork }, /* 66 = vfork */ + { 3, s(struct hpux_sys_read_args), + hpux_sys_read }, /* 67 = vread */ + { 3, s(struct hpux_sys_write_args), + hpux_sys_write }, /* 68 = vwrite */ + { 0, 0, + sys_nosys }, /* 69 = unimplemented */ + { 0, 0, + sys_nosys }, /* 70 = unimplemented */ + { 6, s(struct hpux_sys_mmap_args), + hpux_sys_mmap }, /* 71 = mmap */ + { 0, 0, + sys_nosys }, /* 72 = unimplemented */ + { 2, s(struct sys_munmap_args), + sys_munmap }, /* 73 = munmap */ + { 3, s(struct sys_mprotect_args), + sys_mprotect }, /* 74 = mprotect */ + { 0, 0, + sys_nosys }, /* 75 = unimplemented */ + { 0, 0, + sys_nosys }, /* 76 = unimplemented */ + { 0, 0, + sys_nosys }, /* 77 = unimplemented */ + { 0, 0, + sys_nosys }, /* 78 = unimplemented */ + { 2, s(struct sys_getgroups_args), + sys_getgroups }, /* 79 = getgroups */ + { 2, s(struct sys_setgroups_args), + sys_setgroups }, /* 80 = setgroups */ + { 1, s(struct hpux_sys_getpgrp2_args), + hpux_sys_getpgrp2 }, /* 81 = getpgrp2 */ + { 2, s(struct hpux_sys_setpgrp2_args), + hpux_sys_setpgrp2 }, /* 82 = setpgrp2 */ + { 3, s(struct sys_setitimer_args), + sys_setitimer }, /* 83 = setitimer */ + { 3, s(struct hpux_sys_wait3_args), + hpux_sys_wait3 }, /* 84 = wait3 */ + { 0, 0, + sys_nosys }, /* 85 = unimplemented swapon */ + { 2, s(struct sys_getitimer_args), + sys_getitimer }, /* 86 = getitimer */ + { 0, 0, + sys_nosys }, /* 87 = unimplemented */ + { 0, 0, + sys_nosys }, /* 88 = unimplemented */ + { 0, 0, + sys_nosys }, /* 89 = unimplemented */ + { 2, s(struct sys_dup2_args), + sys_dup2 }, /* 90 = dup2 */ + { 0, 0, + sys_nosys }, /* 91 = unimplemented */ + { 2, s(struct hpux_sys_fstat_args), + hpux_sys_fstat }, /* 92 = fstat */ + { 5, s(struct sys_select_args), + sys_select }, /* 93 = select */ + { 0, 0, + sys_nosys }, /* 94 = unimplemented */ + { 1, s(struct sys_fsync_args), + sys_fsync }, /* 95 = fsync */ + { 0, 0, + sys_nosys }, /* 96 = unimplemented */ + { 0, 0, + sys_nosys }, /* 97 = unimplemented */ + { 0, 0, + sys_nosys }, /* 98 = unimplemented */ + { 0, 0, + sys_nosys }, /* 99 = unimplemented */ + { 0, 0, + sys_nosys }, /* 100 = unimplemented */ + { 0, 0, + sys_nosys }, /* 101 = unimplemented */ + { 0, 0, + sys_nosys }, /* 102 = unimplemented */ + { 1, s(struct sys_sigreturn_args), + sys_sigreturn }, /* 103 = sigreturn */ + { 0, 0, + sys_nosys }, /* 104 = unimplemented */ + { 0, 0, + sys_nosys }, /* 105 = unimplemented */ + { 0, 0, + sys_nosys }, /* 106 = unimplemented */ + { 0, 0, + sys_nosys }, /* 107 = unimplemented */ + { 3, s(struct hpux_sys_sigvec_args), + hpux_sys_sigvec }, /* 108 = sigvec */ + { 1, s(struct hpux_sys_sigblock_args), + hpux_sys_sigblock }, /* 109 = sigblock */ + { 1, s(struct hpux_sys_sigsetmask_args), + hpux_sys_sigsetmask }, /* 110 = sigsetmask */ + { 1, s(struct hpux_sys_sigpause_args), + hpux_sys_sigpause }, /* 111 = sigpause */ + { 2, s(struct compat_43_sys_sigstack_args), + compat_43_sys_sigstack }, /* 112 = sigstack */ + { 0, 0, + sys_nosys }, /* 113 = unimplemented */ + { 0, 0, + sys_nosys }, /* 114 = unimplemented */ + { 0, 0, + sys_nosys }, /* 115 = unimplemented */ + { 1, s(struct sys_gettimeofday_args), + sys_gettimeofday }, /* 116 = gettimeofday */ + { 0, 0, + sys_nosys }, /* 117 = unimplemented */ + { 0, 0, + sys_nosys }, /* 118 = unimplemented */ + { 0, 0, + sys_nosys }, /* 119 = unimplemented io_stub */ + { 3, s(struct hpux_sys_readv_args), + hpux_sys_readv }, /* 120 = readv */ + { 3, s(struct hpux_sys_writev_args), + hpux_sys_writev }, /* 121 = writev */ + { 2, s(struct sys_settimeofday_args), + sys_settimeofday }, /* 122 = settimeofday */ + { 3, s(struct sys_fchown_args), + sys_fchown }, /* 123 = fchown */ + { 2, s(struct sys_fchmod_args), + sys_fchmod }, /* 124 = fchmod */ + { 0, 0, + sys_nosys }, /* 125 = unimplemented */ + { 3, s(struct hpux_sys_setresuid_args), + hpux_sys_setresuid }, /* 126 = setresuid */ + { 3, s(struct hpux_sys_setresgid_args), + hpux_sys_setresgid }, /* 127 = setresgid */ + { 2, s(struct sys_rename_args), + sys_rename }, /* 128 = rename */ + { 2, s(struct compat_43_sys_truncate_args), + compat_43_sys_truncate }, /* 129 = truncate */ + { 2, s(struct compat_43_sys_ftruncate_args), + compat_43_sys_ftruncate }, /* 130 = ftruncate */ + { 0, 0, + sys_nosys }, /* 131 = unimplemented */ + { 1, s(struct hpux_sys_sysconf_args), + hpux_sys_sysconf }, /* 132 = sysconf */ + { 0, 0, + sys_nosys }, /* 133 = unimplemented */ + { 0, 0, + sys_nosys }, /* 134 = unimplemented */ + { 0, 0, + sys_nosys }, /* 135 = unimplemented */ + { 2, s(struct sys_mkdir_args), + sys_mkdir }, /* 136 = mkdir */ + { 1, s(struct sys_rmdir_args), + sys_rmdir }, /* 137 = rmdir */ + { 0, 0, + sys_nosys }, /* 138 = unimplemented */ + { 0, 0, + sys_nosys }, /* 139 = unimplemented */ + { 0, 0, + sys_nosys }, /* 140 = unimplemented */ + { 0, 0, + sys_nosys }, /* 141 = unimplemented */ + { 0, 0, + sys_nosys }, /* 142 = unimplemented */ + { 0, 0, + sys_nosys }, /* 143 = unimplemented */ + { 2, s(struct hpux_sys_getrlimit_args), + hpux_sys_getrlimit }, /* 144 = getrlimit */ + { 2, s(struct hpux_sys_setrlimit_args), + hpux_sys_setrlimit }, /* 145 = setrlimit */ + { 0, 0, + sys_nosys }, /* 146 = unimplemented */ + { 0, 0, + sys_nosys }, /* 147 = unimplemented */ + { 0, 0, + sys_nosys }, /* 148 = unimplemented */ + { 0, 0, + sys_nosys }, /* 149 = unimplemented */ + { 0, 0, + sys_nosys }, /* 150 = unimplemented */ + { 0, 0, + sys_nosys }, /* 151 = unimplemented privgrp */ + { 2, s(struct hpux_sys_rtprio_args), + hpux_sys_rtprio }, /* 152 = rtprio */ + { 0, 0, + sys_nosys }, /* 153 = unimplemented plock */ + { 2, s(struct hpux_sys_netioctl_args), + hpux_sys_netioctl }, /* 154 = netioctl */ + { 3, s(struct hpux_sys_lockf_args), + hpux_sys_lockf }, /* 155 = lockf */ +#ifdef SYSVSEM + { 3, s(struct sys_semget_args), + sys_semget }, /* 156 = semget */ + { 4, s(struct sys___semctl_args), + sys___semctl }, /* 157 = __semctl */ + { 3, s(struct sys_semop_args), + sys_semop }, /* 158 = semop */ +#else + { 0, 0, + sys_nosys }, /* 156 = unimplemented semget */ + { 0, 0, + sys_nosys }, /* 157 = unimplemented semctl */ + { 0, 0, + sys_nosys }, /* 158 = unimplemented semop */ +#endif +#ifdef SYSVMSG + { 2, s(struct sys_msgget_args), + sys_msgget }, /* 159 = msgget */ + { 3, s(struct sys_msgctl_args), + sys_msgctl }, /* 160 = msgctl */ + { 4, s(struct sys_msgsnd_args), + sys_msgsnd }, /* 161 = msgsnd */ + { 5, s(struct sys_msgrcv_args), + sys_msgrcv }, /* 162 = msgrcv */ +#else + { 0, 0, + sys_nosys }, /* 159 = unimplemented msgget */ + { 0, 0, + sys_nosys }, /* 160 = unimplemented msgctl */ + { 0, 0, + sys_nosys }, /* 161 = unimplemented msgsnd */ + { 0, 0, + sys_nosys }, /* 162 = unimplemented msgrcv */ +#endif +#ifdef SYSVSHM + { 3, s(struct sys_shmget_args), + sys_shmget }, /* 163 = shmget */ + { 3, s(struct hpux_sys_shmctl_args), + hpux_sys_shmctl }, /* 164 = shmctl */ + { 3, s(struct sys_shmat_args), + sys_shmat }, /* 165 = shmat */ + { 1, s(struct sys_shmdt_args), + sys_shmdt }, /* 166 = shmdt */ +#else + { 0, 0, + sys_nosys }, /* 163 = unimplemented shmget */ + { 0, 0, + sys_nosys }, /* 164 = unimplemented shmctl */ + { 0, 0, + sys_nosys }, /* 165 = unimplemented shmat */ + { 0, 0, + sys_nosys }, /* 166 = unimplemented shmdt */ +#endif + { 1, s(struct hpux_sys_advise_args), + hpux_sys_advise }, /* 167 = advise */ + { 0, 0, + sys_nosys }, /* 168 = unimplemented nsp_init */ + { 0, 0, + sys_nosys }, /* 169 = unimplemented cluster */ + { 0, 0, + sys_nosys }, /* 170 = unimplemented mkrnod */ + { 0, 0, + sys_nosys }, /* 171 = unimplemented */ + { 0, 0, + sys_nosys }, /* 172 = unimplemented unsp_open */ + { 0, 0, + sys_nosys }, /* 173 = unimplemented */ + { 2, s(struct hpux_sys_getcontext_args), + hpux_sys_getcontext }, /* 174 = getcontext */ + { 0, 0, + sys_nosys }, /* 175 = unimplemented */ + { 0, 0, + sys_nosys }, /* 176 = unimplemented */ + { 0, 0, + sys_nosys }, /* 177 = unimplemented */ + { 0, 0, + sys_nosys }, /* 178 = unimplemented lsync */ + { 0, 0, + sys_nosys }, /* 179 = unimplemented */ + { 0, 0, + sys_nosys }, /* 180 = unimplemented mysite */ + { 0, 0, + sys_nosys }, /* 181 = unimplemented sitels */ + { 0, 0, + sys_nosys }, /* 182 = unimplemented */ + { 0, 0, + sys_nosys }, /* 183 = unimplemented */ + { 0, 0, + sys_nosys }, /* 184 = unimplemented dskless_stats */ + { 0, 0, + sys_nosys }, /* 185 = unimplemented */ + { 0, 0, + sys_nosys }, /* 186 = unimplemented setacl */ + { 0, 0, + sys_nosys }, /* 187 = unimplemented fsetacl */ + { 0, 0, + sys_nosys }, /* 188 = unimplemented getacl */ + { 0, 0, + sys_nosys }, /* 189 = unimplemented fgetacl */ + { 6, s(struct hpux_sys_getaccess_args), + hpux_sys_getaccess }, /* 190 = getaccess */ + { 0, 0, + sys_nosys }, /* 191 = unimplemented getaudid */ + { 0, 0, + sys_nosys }, /* 192 = unimplemented setaudid */ + { 0, 0, + sys_nosys }, /* 193 = unimplemented getaudproc */ + { 0, 0, + sys_nosys }, /* 194 = unimplemented setaudproc */ + { 0, 0, + sys_nosys }, /* 195 = unimplemented getevent */ + { 0, 0, + sys_nosys }, /* 196 = unimplemented setevent */ + { 0, 0, + sys_nosys }, /* 197 = unimplemented audwrite */ + { 0, 0, + sys_nosys }, /* 198 = unimplemented audswitch */ + { 0, 0, + sys_nosys }, /* 199 = unimplemented audctl */ + { 4, s(struct hpux_sys_waitpid_args), + hpux_sys_waitpid }, /* 200 = waitpid */ + { 0, 0, + sys_nosys }, /* 201 = unimplemented */ + { 0, 0, + sys_nosys }, /* 202 = unimplemented */ + { 0, 0, + sys_nosys }, /* 203 = unimplemented */ + { 0, 0, + sys_nosys }, /* 204 = unimplemented */ + { 0, 0, + sys_nosys }, /* 205 = unimplemented */ + { 0, 0, + sys_nosys }, /* 206 = unimplemented */ + { 0, 0, + sys_nosys }, /* 207 = unimplemented */ + { 0, 0, + sys_nosys }, /* 208 = unimplemented */ + { 0, 0, + sys_nosys }, /* 209 = unimplemented */ + { 0, 0, + sys_nosys }, /* 210 = unimplemented */ + { 0, 0, + sys_nosys }, /* 211 = unimplemented */ + { 0, 0, + sys_nosys }, /* 212 = unimplemented */ + { 0, 0, + sys_nosys }, /* 213 = unimplemented */ + { 0, 0, + sys_nosys }, /* 214 = unimplemented */ + { 0, 0, + sys_nosys }, /* 215 = unimplemented */ + { 0, 0, + sys_nosys }, /* 216 = unimplemented */ + { 0, 0, + sys_nosys }, /* 217 = unimplemented */ + { 0, 0, + sys_nosys }, /* 218 = unimplemented */ + { 0, 0, + sys_nosys }, /* 219 = unimplemented */ + { 0, 0, + sys_nosys }, /* 220 = unimplemented */ + { 0, 0, + sys_nosys }, /* 221 = unimplemented */ + { 0, 0, + sys_nosys }, /* 222 = unimplemented */ + { 0, 0, + sys_nosys }, /* 223 = unimplemented */ + { 0, 0, + sys_nosys }, /* 224 = unimplemented */ + { 2, s(struct sys_pathconf_args), + sys_pathconf }, /* 225 = pathconf */ + { 2, s(struct sys_fpathconf_args), + sys_fpathconf }, /* 226 = fpathconf */ + { 0, 0, + sys_nosys }, /* 227 = unimplemented */ + { 0, 0, + sys_nosys }, /* 228 = unimplemented */ + { 0, 0, + sys_nosys }, /* 229 = unimplemented async_daemon */ + { 0, 0, + sys_nosys }, /* 230 = unimplemented nfs_fcntl */ + { 4, s(struct compat_43_sys_getdirentries_args), + compat_43_sys_getdirentries }, /* 231 = getdirentries */ + { 2, s(struct compat_09_sys_getdomainname_args), + compat_09_sys_getdomainname }, /* 232 = getdomainname */ + { 0, 0, + sys_nosys }, /* 233 = unimplemented nfs_getfh */ + { 0, 0, + sys_nosys }, /* 234 = unimplemented vfsmount */ + { 0, 0, + sys_nosys }, /* 235 = unimplemented nfs_svc */ + { 2, s(struct compat_09_sys_setdomainname_args), + compat_09_sys_setdomainname }, /* 236 = setdomainname */ + { 0, 0, + sys_nosys }, /* 237 = unimplemented statfs */ + { 0, 0, + sys_nosys }, /* 238 = unimplemented fstatfs */ + { 3, s(struct hpux_sys_sigaction_args), + hpux_sys_sigaction }, /* 239 = sigaction */ + { 3, s(struct hpux_sys_sigprocmask_args), + hpux_sys_sigprocmask }, /* 240 = sigprocmask */ + { 1, s(struct hpux_sys_sigpending_args), + hpux_sys_sigpending }, /* 241 = sigpending */ + { 1, s(struct hpux_sys_sigsuspend_args), + hpux_sys_sigsuspend }, /* 242 = sigsuspend */ + { 0, 0, + sys_nosys }, /* 243 = unimplemented fsctl */ + { 0, 0, + sys_nosys }, /* 244 = unimplemented */ + { 0, 0, + sys_nosys }, /* 245 = unimplemented pstat */ + { 0, 0, + sys_nosys }, /* 246 = unimplemented */ + { 0, 0, + sys_nosys }, /* 247 = unimplemented */ + { 0, 0, + sys_nosys }, /* 248 = unimplemented */ + { 0, 0, + sys_nosys }, /* 249 = unimplemented */ + { 0, 0, + sys_nosys }, /* 250 = unimplemented */ + { 0, 0, + sys_nosys }, /* 251 = unimplemented */ + { 0, 0, + sys_nosys }, /* 252 = unimplemented */ + { 0, 0, + sys_nosys }, /* 253 = unimplemented */ + { 0, 0, + sys_nosys }, /* 254 = unimplemented */ + { 0, 0, + sys_nosys }, /* 255 = unimplemented */ + { 0, 0, + sys_nosys }, /* 256 = unimplemented */ + { 0, 0, + sys_nosys }, /* 257 = unimplemented */ + { 0, 0, + sys_nosys }, /* 258 = unimplemented */ + { 0, 0, + sys_nosys }, /* 259 = unimplemented */ + { 0, 0, + sys_nosys }, /* 260 = unimplemented */ + { 0, 0, + sys_nosys }, /* 261 = unimplemented */ + { 0, 0, + sys_nosys }, /* 262 = unimplemented */ + { 0, 0, + sys_nosys }, /* 263 = unimplemented */ + { 0, 0, + sys_nosys }, /* 264 = unimplemented */ + { 0, 0, + sys_nosys }, /* 265 = unimplemented */ + { 0, 0, + sys_nosys }, /* 266 = unimplemented */ + { 0, 0, + sys_nosys }, /* 267 = unimplemented */ + { 0, 0, + compat_43_sys_getdtablesize }, /* 268 = getdtablesize */ + { 0, 0, + sys_nosys }, /* 269 = unimplemented */ + { 0, 0, + sys_nosys }, /* 270 = unimplemented */ + { 0, 0, + sys_nosys }, /* 271 = unimplemented */ + { 1, s(struct sys_fchdir_args), + sys_fchdir }, /* 272 = fchdir */ + { 0, 0, + sys_nosys }, /* 273 = unimplemented */ + { 0, 0, + sys_nosys }, /* 274 = unimplemented */ + { 3, s(struct compat_43_sys_accept_args), + compat_43_sys_accept }, /* 275 = accept */ + { 3, s(struct sys_bind_args), + sys_bind }, /* 276 = bind */ + { 3, s(struct sys_connect_args), + sys_connect }, /* 277 = connect */ + { 3, s(struct compat_43_sys_getpeername_args), + compat_43_sys_getpeername }, /* 278 = getpeername */ + { 3, s(struct compat_43_sys_getsockname_args), + compat_43_sys_getsockname }, /* 279 = getsockname */ + { 5, s(struct sys_getsockopt_args), + sys_getsockopt }, /* 280 = getsockopt */ + { 2, s(struct sys_listen_args), + sys_listen }, /* 281 = listen */ + { 4, s(struct compat_43_sys_recv_args), + compat_43_sys_recv }, /* 282 = recv */ + { 6, s(struct compat_43_sys_recvfrom_args), + compat_43_sys_recvfrom }, /* 283 = recvfrom */ + { 3, s(struct compat_43_sys_recvmsg_args), + compat_43_sys_recvmsg }, /* 284 = recvmsg */ + { 4, s(struct compat_43_sys_send_args), + compat_43_sys_send }, /* 285 = send */ + { 3, s(struct compat_43_sys_sendmsg_args), + compat_43_sys_sendmsg }, /* 286 = sendmsg */ + { 6, s(struct sys_sendto_args), + sys_sendto }, /* 287 = sendto */ + { 5, s(struct hpux_sys_setsockopt2_args), + hpux_sys_setsockopt2 }, /* 288 = setsockopt2 */ + { 2, s(struct sys_shutdown_args), + sys_shutdown }, /* 289 = shutdown */ + { 3, s(struct sys_socket_args), + sys_socket }, /* 290 = socket */ + { 4, s(struct sys_socketpair_args), + sys_socketpair }, /* 291 = socketpair */ + { 0, 0, + sys_nosys }, /* 292 = unimplemented */ + { 0, 0, + sys_nosys }, /* 293 = unimplemented */ + { 0, 0, + sys_nosys }, /* 294 = unimplemented */ + { 0, 0, + sys_nosys }, /* 295 = unimplemented */ + { 0, 0, + sys_nosys }, /* 296 = unimplemented */ + { 0, 0, + sys_nosys }, /* 297 = unimplemented */ + { 0, 0, + sys_nosys }, /* 298 = unimplemented */ + { 0, 0, + sys_nosys }, /* 299 = unimplemented */ + { 0, 0, + sys_nosys }, /* 300 = unimplemented */ + { 0, 0, + sys_nosys }, /* 301 = unimplemented */ + { 0, 0, + sys_nosys }, /* 302 = unimplemented */ + { 0, 0, + sys_nosys }, /* 303 = unimplemented */ + { 0, 0, + sys_nosys }, /* 304 = unimplemented */ + { 0, 0, + sys_nosys }, /* 305 = unimplemented */ + { 0, 0, + sys_nosys }, /* 306 = unimplemented */ + { 0, 0, + sys_nosys }, /* 307 = unimplemented */ + { 0, 0, + sys_nosys }, /* 308 = unimplemented */ + { 0, 0, + sys_nosys }, /* 309 = unimplemented */ + { 0, 0, + sys_nosys }, /* 310 = unimplemented */ + { 0, 0, + sys_nosys }, /* 311 = unimplemented */ +#ifdef SYSVSEM + { 4, s(struct sys___semctl_args), + sys___semctl }, /* 312 = nsemctl */ +#else + { 0, 0, + sys_nosys }, /* 312 = unimplemented semctl */ +#endif +#ifdef SYSVMSG + { 3, s(struct sys_msgctl_args), + sys_msgctl }, /* 313 = nmsgctl */ +#else + { 0, 0, + sys_nosys }, /* 313 = unimplemented msgctl */ +#endif +#ifdef SYSVSHM + { 3, s(struct hpux_sys_nshmctl_args), + hpux_sys_nshmctl }, /* 314 = nshmctl */ +#else + { 0, 0, + sys_nosys }, /* 314 = unimplemented shmctl */ +#endif +}; + diff --git a/sys/compat/hpux/hpux_termio.h b/sys/compat/hpux/hpux_termio.h new file mode 100644 index 00000000000..ec446acd16e --- /dev/null +++ b/sys/compat/hpux/hpux_termio.h @@ -0,0 +1,192 @@ +/* $NetBSD: hpux_termio.h,v 1.6 1994/10/26 02:45:20 cgd Exp $ */ + +/* + * Copyright (c) 1988 University of Utah. + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * the Systems Programming Group of the University of Utah Computer + * Science Department. + * + * 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 the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + * + * from: Utah $Hdr: hpux_termio.h 1.1 90/07/09$ + * + * @(#)hpux_termio.h 8.1 (Berkeley) 6/10/93 + */ + +/* HP-UX termio stuff */ + +#define HPUXNCC 8 + +/* control characters */ +#define HPUXVINTR 0 +#define HPUXVQUIT 1 +#define HPUXVERASE 2 +#define HPUXVKILL 3 +#define HPUXVEOF 4 +#define HPUXVEOL 5 +#define HPUXVMIN 4 +#define HPUXVTIME 5 +#define HPUXVEOL2 6 +#define HPUXVSWTCH 7 + +/* input modes */ +#define TIO_IGNBRK 0x00000001 /* 0000001 */ +#define TIO_BRKINT 0x00000002 /* 0000002 */ +#define TIO_IGNPAR 0x00000004 /* 0000004 */ +#define TIO_PARMRK 0x00000008 /* 0000010 */ +#define TIO_INPCK 0x00000010 /* 0000020 */ +#define TIO_ISTRIP 0x00000020 /* 0000040 */ +#define TIO_INLCR 0x00000040 /* 0000100 */ +#define TIO_IGNCR 0x00000080 /* 0000200 */ +#define TIO_ICRNL 0x00000100 /* 0000400 */ +#define TIO_IUCLC 0x00000200 /* 0001000 */ +#define TIO_IXON 0x00000400 /* 0002000 */ +#define TIO_IXANY 0x00000800 /* 0004000 */ +#define TIO_IXOFF 0x00001000 /* 0010000 */ +#define TIO_IENQAK 0x00002000 /* 0020000 */ + +/* output modes */ +#define TIO_OPOST 0x00000001 /* 0000001 */ +#define TIO_OLCUC 0x00000002 /* 0000002 */ +#define TIO_ONLCR 0x00000004 /* 0000004 */ +#define TIO_OCRNL 0x00000008 /* 0000010 */ +#define TIO_ONOCR 0x00000010 /* 0000020 */ +#define TIO_ONLRET 0x00000020 /* 0000040 */ +#define TIO_OFILL 0x00000040 /* 0000100 */ +#define TIO_OFDEL 0x00000080 /* 0000200 */ +#define TIO_NLDLY 0x00000100 /* 0000400 */ +#define TIO_NL0 0 +#define TIO_NL1 0x00000100 /* 0000400 */ +#define TIO_CRDLY 0x00000600 /* 0003000 */ +#define TIO_CR0 0 +#define TIO_CR1 0x00000200 /* 0001000 */ +#define TIO_CR2 0x00000400 /* 0002000 */ +#define TIO_CR3 0x00000600 /* 0003000 */ +#define TIO_TABDLY 0x00001800 /* 0014000 */ +#define TIO_TAB0 0 +#define TIO_TAB1 0x00000800 /* 0004000 */ +#define TIO_TAB2 0x00001000 /* 0010000 */ +#define TIO_TAB3 0x00001800 /* 0014000 */ +#define TIO_BSDLY 0x00002000 /* 0020000 */ +#define TIO_BS0 0 +#define TIO_BS1 0x00002000 /* 0020000 */ +#define TIO_VTDLY 0x00004000 /* 0040000 */ +#define TIO_VT0 0 +#define TIO_VT1 0x00004000 /* 0040000 */ +#define TIO_FFDLY 0x00008000 /* 0100000 */ +#define TIO_FF0 0 +#define TIO_FF1 0x00008000 /* 0100000 */ + +/* control modes */ +#define TIO_CBAUD 0x0000001f /* 0000037 */ +#define TIO_B0 0 +#define TIO_B50 0x00000001 /* 0000001 */ +#define TIO_B75 0x00000002 /* 0000002 */ +#define TIO_B110 0x00000003 /* 0000003 */ +#define TIO_B134 0x00000004 /* 0000004 */ +#define TIO_B150 0x00000005 /* 0000005 */ +#define TIO_B200 0x00000006 /* 0000006 */ +#define TIO_B300 0x00000007 /* 0000007 */ +#define TIO_B600 0x00000008 /* 0000010 */ +#define TIO_B900 0x00000009 /* 0000011 */ +#define TIO_B1200 0x0000000a /* 0000012 */ +#define TIO_B1800 0x0000000b /* 0000013 */ +#define TIO_B2400 0x0000000c /* 0000014 */ +#define TIO_B3600 0x0000000d /* 0000015 */ +#define TIO_B4800 0x0000000e /* 0000016 */ +#define TIO_B7200 0x0000000f /* 0000017 */ +#define TIO_B9600 0x00000010 /* 0000020 */ +#define TIO_B19200 0x00000011 /* 0000021 */ +#define TIO_B38400 0x00000012 /* 0000022 */ +#define TIO_EXTA 0x0000001e /* 0000036 */ +#define TIO_EXTB 0x0000001f /* 0000037 */ +#define TIO_CSIZE 0x00000060 /* 0000140 */ +#define TIO_CS5 0 +#define TIO_CS6 0x00000020 /* 0000040 */ +#define TIO_CS7 0x00000040 /* 0000100 */ +#define TIO_CS8 0x00000060 /* 0000140 */ +#define TIO_CSTOPB 0x00000080 /* 0000200 */ +#define TIO_CREAD 0x00000100 /* 0000400 */ +#define TIO_PARENB 0x00000200 /* 0001000 */ +#define TIO_PARODD 0x00000400 /* 0002000 */ +#define TIO_HUPCL 0x00000800 /* 0004000 */ +#define TIO_CLOCAL 0x00001000 /* 0010000 */ +#define TIO_CRTS 0x00002000 /* 0020000 */ /* Obsolete */ + +/* line discipline 0 modes */ +#define TIO_ISIG 0x00000001 /* 0000001 */ +#define TIO_ICANON 0x00000002 /* 0000002 */ +#define TIO_XCASE 0x00000004 /* 0000004 */ +#define TIO_ECHO 0x00000008 /* 0000010 */ +#define TIO_ECHOE 0x00000010 /* 0000020 */ +#define TIO_ECHOK 0x00000020 /* 0000040 */ +#define TIO_ECHONL 0x00000040 /* 0000100 */ +#define TIO_NOFLSH 0x00000080 /* 0000200 */ + +struct hpux_termio { + u_short c_iflag; /* input modes */ + u_short c_oflag; /* output modes */ + u_short c_cflag; /* control modes */ + u_short c_lflag; /* line discipline modes */ + char c_line; /* line discipline */ + u_char c_cc[HPUXNCC]; /* control chars */ +}; + +#define HPUXTCGETA _IOR('T', 1, struct hpux_termio) +#define HPUXTCSETA _IOW('T', 2, struct hpux_termio) +#define HPUXTCSETAW _IOW('T', 3, struct hpux_termio) +#define HPUXTCSETAF _IOW('T', 4, struct hpux_termio) + +/* HP-UX termios stuff */ + +#define HPUXNCCS 16 + +/* control characters */ +#define HPUXVMINS 11 /* different than termio */ +#define HPUXVTIMES 12 /* different than termio */ +#define HPUXVSUSP 13 +#define HPUXVSTART 14 +#define HPUXVSTOP 15 + +struct hpux_termios { + u_int c_iflag; /* input modes */ + u_int c_oflag; /* output modes */ + u_int c_cflag; /* control modes */ + u_int c_lflag; /* line discipline modes */ + u_int c_reserved; /* future use */ + u_char c_cc[HPUXNCCS]; /* control chars */ +}; + +#define HPUXTCGETATTR _IOR('T', 16, struct hpux_termios) +#define HPUXTCSETATTR _IOW('T', 17, struct hpux_termios) +#define HPUXTCSETATTRD _IOW('T', 18, struct hpux_termios) +#define HPUXTCSETATTRF _IOW('T', 19, struct hpux_termios) diff --git a/sys/compat/hpux/hpux_tty.c b/sys/compat/hpux/hpux_tty.c new file mode 100644 index 00000000000..d95e1731b5f --- /dev/null +++ b/sys/compat/hpux/hpux_tty.c @@ -0,0 +1,548 @@ +/* $NetBSD: hpux_tty.c,v 1.11 1995/10/07 06:26:40 mycroft Exp $ */ + +/* + * Copyright (c) 1988 University of Utah. + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * the Systems Programming Group of the University of Utah Computer + * Science Department. + * + * 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 the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. + * + * from: Utah $Hdr: hpux_tty.c 1.14 93/08/05$ + * + * @(#)hpux_tty.c 8.3 (Berkeley) 1/12/94 + */ + +/* + * stty/gtty/termio emulation stuff + */ + +#ifndef COMPAT_43 +#define COMPAT_43 +#endif + +#include <sys/param.h> +#include <sys/systm.h> +#include <sys/filedesc.h> +#include <sys/ioctl.h> +#include <sys/proc.h> +#include <sys/tty.h> +#include <sys/file.h> +#include <sys/conf.h> +#include <sys/buf.h> +#include <sys/kernel.h> + +#include <compat/hpux/hpux.h> +#include <compat/hpux/hpux_termio.h> +#include <compat/hpux/hpux_syscallargs.h> + +/* + * Map BSD/POSIX style termios info to and from SYS5 style termio stuff. + */ +int +hpux_termio(fd, com, data, p) + int fd, com; + caddr_t data; + struct proc *p; +{ + struct file *fp; + struct termios tios; + struct hpux_termios htios; + int line, error, (*ioctlrout)(); + int newi = 0; + + fp = p->p_fd->fd_ofiles[fd]; + ioctlrout = fp->f_ops->fo_ioctl; + switch (com) { + case HPUXTCGETATTR: + newi = 1; + /* fall into ... */ + case HPUXTCGETA: + /* + * Get BSD terminal state + */ + if (error = (*ioctlrout)(fp, TIOCGETA, (caddr_t)&tios, p)) + break; + bzero((char *)&htios, sizeof htios); + /* + * Set iflag. + * Same through ICRNL, no BSD equivs for IUCLC, IENQAK + */ + htios.c_iflag = tios.c_iflag & 0x1ff; + if (tios.c_iflag & IXON) + htios.c_iflag |= TIO_IXON; + if (tios.c_iflag & IXOFF) + htios.c_iflag |= TIO_IXOFF; + if (tios.c_iflag & IXANY) + htios.c_iflag |= TIO_IXANY; + /* + * Set oflag. + * No BSD equivs for OLCUC/OCRNL/ONOCR/ONLRET/OFILL/OFDEL + * or any of the delays. + */ + if (tios.c_oflag & OPOST) + htios.c_oflag |= TIO_OPOST; + if (tios.c_oflag & ONLCR) + htios.c_oflag |= TIO_ONLCR; + if (tios.c_oflag & OXTABS) + htios.c_oflag |= TIO_TAB3; + /* + * Set cflag. + * Baud from ospeed, rest from cflag. + */ + htios.c_cflag = bsdtohpuxbaud(tios.c_ospeed); + switch (tios.c_cflag & CSIZE) { + case CS5: + htios.c_cflag |= TIO_CS5; break; + case CS6: + htios.c_cflag |= TIO_CS6; break; + case CS7: + htios.c_cflag |= TIO_CS7; break; + case CS8: + htios.c_cflag |= TIO_CS8; break; + } + if (tios.c_cflag & CSTOPB) + htios.c_cflag |= TIO_CSTOPB; + if (tios.c_cflag & CREAD) + htios.c_cflag |= TIO_CREAD; + if (tios.c_cflag & PARENB) + htios.c_cflag |= TIO_PARENB; + if (tios.c_cflag & PARODD) + htios.c_cflag |= TIO_PARODD; + if (tios.c_cflag & HUPCL) + htios.c_cflag |= TIO_HUPCL; + if (tios.c_cflag & CLOCAL) + htios.c_cflag |= TIO_CLOCAL; + /* + * Set lflag. + * No BSD equiv for XCASE. + */ + if (tios.c_lflag & ECHOE) + htios.c_lflag |= TIO_ECHOE; + if (tios.c_lflag & ECHOK) + htios.c_lflag |= TIO_ECHOK; + if (tios.c_lflag & ECHO) + htios.c_lflag |= TIO_ECHO; + if (tios.c_lflag & ECHONL) + htios.c_lflag |= TIO_ECHONL; + if (tios.c_lflag & ISIG) + htios.c_lflag |= TIO_ISIG; + if (tios.c_lflag & ICANON) + htios.c_lflag |= TIO_ICANON; + if (tios.c_lflag & NOFLSH) + htios.c_lflag |= TIO_NOFLSH; + /* + * Line discipline + */ + if (!newi) { + line = 0; + (void) (*ioctlrout)(fp, TIOCGETD, (caddr_t)&line, p); + htios.c_reserved = line; + } + /* + * Set editing chars. + * No BSD equiv for VSWTCH. + */ + htios.c_cc[HPUXVINTR] = tios.c_cc[VINTR]; + htios.c_cc[HPUXVQUIT] = tios.c_cc[VQUIT]; + htios.c_cc[HPUXVERASE] = tios.c_cc[VERASE]; + htios.c_cc[HPUXVKILL] = tios.c_cc[VKILL]; + htios.c_cc[HPUXVEOF] = tios.c_cc[VEOF]; + htios.c_cc[HPUXVEOL] = tios.c_cc[VEOL]; + htios.c_cc[HPUXVEOL2] = tios.c_cc[VEOL2]; + htios.c_cc[HPUXVSWTCH] = 0; +#if 1 + /* + * XXX since VMIN and VTIME are not implemented, + * we need to return something reasonable. + * Otherwise a GETA/SETA combo would always put + * the tty in non-blocking mode (since VMIN == VTIME == 0). + */ + if (fp->f_flag & FNONBLOCK) { + htios.c_cc[HPUXVMINS] = 0; + htios.c_cc[HPUXVTIMES] = 0; + } else { + htios.c_cc[HPUXVMINS] = 6; + htios.c_cc[HPUXVTIMES] = 1; + } +#else + htios.c_cc[HPUXVMINS] = tios.c_cc[VMIN]; + htios.c_cc[HPUXVTIMES] = tios.c_cc[VTIME]; +#endif + htios.c_cc[HPUXVSUSP] = tios.c_cc[VSUSP]; + htios.c_cc[HPUXVSTART] = tios.c_cc[VSTART]; + htios.c_cc[HPUXVSTOP] = tios.c_cc[VSTOP]; + if (newi) + bcopy((char *)&htios, data, sizeof htios); + else + termiostotermio(&htios, (struct hpux_termio *)data); + break; + + case HPUXTCSETATTR: + case HPUXTCSETATTRD: + case HPUXTCSETATTRF: + newi = 1; + /* fall into ... */ + case HPUXTCSETA: + case HPUXTCSETAW: + case HPUXTCSETAF: + /* + * Get old characteristics and determine if we are a tty. + */ + if (error = (*ioctlrout)(fp, TIOCGETA, (caddr_t)&tios, p)) + break; + if (newi) + bcopy(data, (char *)&htios, sizeof htios); + else + termiototermios((struct termio *)data, &htios, &tios); + /* + * Set iflag. + * Same through ICRNL, no HP-UX equiv for IMAXBEL + */ + tios.c_iflag &= ~(IXON|IXOFF|IXANY|0x1ff); + tios.c_iflag |= htios.c_iflag & 0x1ff; + if (htios.c_iflag & TIO_IXON) + tios.c_iflag |= IXON; + if (htios.c_iflag & TIO_IXOFF) + tios.c_iflag |= IXOFF; + if (htios.c_iflag & TIO_IXANY) + tios.c_iflag |= IXANY; + /* + * Set oflag. + * No HP-UX equiv for ONOEOT + */ + tios.c_oflag &= ~(OPOST|ONLCR|OXTABS); + if (htios.c_oflag & TIO_OPOST) + tios.c_oflag |= OPOST; + if (htios.c_oflag & TIO_ONLCR) + tios.c_oflag |= ONLCR; + if (htios.c_oflag & TIO_TAB3) + tios.c_oflag |= OXTABS; + /* + * Set cflag. + * No HP-UX equiv for CCTS_OFLOW/CCTS_IFLOW/MDMBUF + */ + tios.c_cflag &= + ~(CSIZE|CSTOPB|CREAD|PARENB|PARODD|HUPCL|CLOCAL); + switch (htios.c_cflag & TIO_CSIZE) { + case TIO_CS5: + tios.c_cflag |= CS5; break; + case TIO_CS6: + tios.c_cflag |= CS6; break; + case TIO_CS7: + tios.c_cflag |= CS7; break; + case TIO_CS8: + tios.c_cflag |= CS8; break; + } + if (htios.c_cflag & TIO_CSTOPB) + tios.c_cflag |= CSTOPB; + if (htios.c_cflag & TIO_CREAD) + tios.c_cflag |= CREAD; + if (htios.c_cflag & TIO_PARENB) + tios.c_cflag |= PARENB; + if (htios.c_cflag & TIO_PARODD) + tios.c_cflag |= PARODD; + if (htios.c_cflag & TIO_HUPCL) + tios.c_cflag |= HUPCL; + if (htios.c_cflag & TIO_CLOCAL) + tios.c_cflag |= CLOCAL; + /* + * Set lflag. + * No HP-UX equiv for ECHOKE/ECHOPRT/ECHOCTL + * IEXTEN treated as part of ICANON + */ + tios.c_lflag &= ~(ECHOE|ECHOK|ECHO|ISIG|ICANON|IEXTEN|NOFLSH); + if (htios.c_lflag & TIO_ECHOE) + tios.c_lflag |= ECHOE; + if (htios.c_lflag & TIO_ECHOK) + tios.c_lflag |= ECHOK; + if (htios.c_lflag & TIO_ECHO) + tios.c_lflag |= ECHO; + if (htios.c_lflag & TIO_ECHONL) + tios.c_lflag |= ECHONL; + if (htios.c_lflag & TIO_ISIG) + tios.c_lflag |= ISIG; + if (htios.c_lflag & TIO_ICANON) + tios.c_lflag |= (ICANON|IEXTEN); + if (htios.c_lflag & TIO_NOFLSH) + tios.c_lflag |= NOFLSH; + /* + * Set editing chars. + * No HP-UX equivs of VWERASE/VREPRINT/VDSUSP/VLNEXT + * /VDISCARD/VSTATUS/VERASE2 + */ + tios.c_cc[VINTR] = htios.c_cc[HPUXVINTR]; + tios.c_cc[VQUIT] = htios.c_cc[HPUXVQUIT]; + tios.c_cc[VERASE] = htios.c_cc[HPUXVERASE]; + tios.c_cc[VKILL] = htios.c_cc[HPUXVKILL]; + tios.c_cc[VEOF] = htios.c_cc[HPUXVEOF]; + tios.c_cc[VEOL] = htios.c_cc[HPUXVEOL]; + tios.c_cc[VEOL2] = htios.c_cc[HPUXVEOL2]; + tios.c_cc[VMIN] = htios.c_cc[HPUXVMINS]; + tios.c_cc[VTIME] = htios.c_cc[HPUXVTIMES]; + tios.c_cc[VSUSP] = htios.c_cc[HPUXVSUSP]; + tios.c_cc[VSTART] = htios.c_cc[HPUXVSTART]; + tios.c_cc[VSTOP] = htios.c_cc[HPUXVSTOP]; + + /* + * Set the new stuff + */ + if (com == HPUXTCSETA || com == HPUXTCSETATTR) + com = TIOCSETA; + else if (com == HPUXTCSETAW || com == HPUXTCSETATTRD) + com = TIOCSETAW; + else + com = TIOCSETAF; + error = (*ioctlrout)(fp, com, (caddr_t)&tios, p); + if (error == 0) { + /* + * Set line discipline + */ + if (!newi) { + line = htios.c_reserved; + (void) (*ioctlrout)(fp, TIOCSETD, + (caddr_t)&line, p); + } + /* + * Set non-blocking IO if VMIN == VTIME == 0, clear + * if not. Should handle the other cases as well. + * Note it isn't correct to just turn NBIO off like + * we do as it could be on as the result of a fcntl + * operation. + * + * XXX - wouldn't need to do this at all if VMIN/VTIME + * were implemented. + */ + { + struct hpux_sys_fcntl_args { + int fdes, cmd, arg; + } args; + int flags, nbio; + + nbio = (htios.c_cc[HPUXVMINS] == 0 && + htios.c_cc[HPUXVTIMES] == 0); + if (nbio && (fp->f_flag & FNONBLOCK) == 0 || + !nbio && (fp->f_flag & FNONBLOCK)) { + args.fdes = fd; + args.cmd = F_GETFL; + args.arg = 0; + (void) hpux_sys_fcntl(p, &args, &flags); + if (nbio) + flags |= HPUXNDELAY; + else + flags &= ~HPUXNDELAY; + args.cmd = F_SETFL; + args.arg = flags; + (void) hpux_sys_fcntl(p, &args, &flags); + } + } + } + break; + + default: + error = EINVAL; + break; + } + return(error); +} + +int +termiototermios(tio, tios, bsdtios) + struct hpux_termio *tio; + struct hpux_termios *tios; + struct termios *bsdtios; +{ + int i; + + bzero((char *)tios, sizeof *tios); + tios->c_iflag = tio->c_iflag; + tios->c_oflag = tio->c_oflag; + tios->c_cflag = tio->c_cflag; + tios->c_lflag = tio->c_lflag; + tios->c_reserved = tio->c_line; + for (i = 0; i <= HPUXVSWTCH; i++) + tios->c_cc[i] = tio->c_cc[i]; + if (tios->c_lflag & TIO_ICANON) { + tios->c_cc[HPUXVEOF] = tio->c_cc[HPUXVEOF]; + tios->c_cc[HPUXVEOL] = tio->c_cc[HPUXVEOL]; + tios->c_cc[HPUXVMINS] = 0; + tios->c_cc[HPUXVTIMES] = 0; + } else { + tios->c_cc[HPUXVEOF] = 0; + tios->c_cc[HPUXVEOL] = 0; + tios->c_cc[HPUXVMINS] = tio->c_cc[HPUXVMIN]; + tios->c_cc[HPUXVTIMES] = tio->c_cc[HPUXVTIME]; + } + tios->c_cc[HPUXVSUSP] = bsdtios->c_cc[VSUSP]; + tios->c_cc[HPUXVSTART] = bsdtios->c_cc[VSTART]; + tios->c_cc[HPUXVSTOP] = bsdtios->c_cc[VSTOP]; +} + +int +termiostotermio(tios, tio) + struct hpux_termios *tios; + struct hpux_termio *tio; +{ + int i; + + tio->c_iflag = tios->c_iflag; + tio->c_oflag = tios->c_oflag; + tio->c_cflag = tios->c_cflag; + tio->c_lflag = tios->c_lflag; + tio->c_line = tios->c_reserved; + for (i = 0; i <= HPUXVSWTCH; i++) + tio->c_cc[i] = tios->c_cc[i]; + if (tios->c_lflag & TIO_ICANON) { + tio->c_cc[HPUXVEOF] = tios->c_cc[HPUXVEOF]; + tio->c_cc[HPUXVEOL] = tios->c_cc[HPUXVEOL]; + } else { + tio->c_cc[HPUXVMIN] = tios->c_cc[HPUXVMINS]; + tio->c_cc[HPUXVTIME] = tios->c_cc[HPUXVTIMES]; + } +} + +int +bsdtohpuxbaud(bsdspeed) + long bsdspeed; +{ + switch (bsdspeed) { + case B0: return(TIO_B0); + case B50: return(TIO_B50); + case B75: return(TIO_B75); + case B110: return(TIO_B110); + case B134: return(TIO_B134); + case B150: return(TIO_B150); + case B200: return(TIO_B200); + case B300: return(TIO_B300); + case B600: return(TIO_B600); + case B1200: return(TIO_B1200); + case B1800: return(TIO_B1800); + case B2400: return(TIO_B2400); + case B4800: return(TIO_B4800); + case B9600: return(TIO_B9600); + case B19200: return(TIO_B19200); + case B38400: return(TIO_B38400); + default: return(TIO_B0); + } +} + +int +hpuxtobsdbaud(hpux_speed) + int hpux_speed; +{ + static char hpuxtobsdbaudtab[32] = { + B0, B50, B75, B110, B134, B150, B200, B300, + B600, B0, B1200, B1800, B2400, B0, B4800, B0, + B9600, B19200, B38400, B0, B0, B0, B0, B0, + B0, B0, B0, B0, B0, B0, EXTA, EXTB + }; + + return(hpuxtobsdbaudtab[hpux_speed & TIO_CBAUD]); +} + +#ifdef COMPAT_HPUX_6X + +int +compat_hpux_6x_sys_gtty(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + struct compat_hpux_6x_sys_gtty_args *uap = v; + + return (getsettty(p, SCARG(uap, fd), HPUXTIOCGETP, SCARG(uap, arg))); +} + +int +compat_hpux_6x_sys_stty(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + struct compat_hpux_6x_sys_stty_args *uap = v; + + return (getsettty(p, SCARG(uap, fd), HPUXTIOCSETP, SCARG(uap, arg))); +} + +/* + * Simplified version of ioctl() for use by + * gtty/stty and TIOCGETP/TIOCSETP. + */ +int +getsettty(p, fdes, com, cmarg) + struct proc *p; + int fdes, com; + caddr_t cmarg; +{ + register struct filedesc *fdp = p->p_fd; + register struct file *fp; + struct hpux_sgttyb hsb; + struct sgttyb sb; + int error; + + if (((unsigned)fdes) >= fdp->fd_nfiles || + (fp = fdp->fd_ofiles[fdes]) == NULL) + return (EBADF); + if ((fp->f_flag & (FREAD|FWRITE)) == 0) + return (EBADF); + if (com == HPUXTIOCSETP) { + if (error = copyin(cmarg, (caddr_t)&hsb, sizeof hsb)) + return (error); + sb.sg_ispeed = hsb.sg_ispeed; + sb.sg_ospeed = hsb.sg_ospeed; + sb.sg_erase = hsb.sg_erase; + sb.sg_kill = hsb.sg_kill; + sb.sg_flags = hsb.sg_flags & ~(V7_HUPCL|V7_XTABS|V7_NOAL); + if (hsb.sg_flags & V7_XTABS) + sb.sg_flags |= XTABS; + if (hsb.sg_flags & V7_HUPCL) + (void)(*fp->f_ops->fo_ioctl) + (fp, TIOCHPCL, (caddr_t)0, p); + com = TIOCSETP; + } else { + bzero((caddr_t)&hsb, sizeof hsb); + com = TIOCGETP; + } + error = (*fp->f_ops->fo_ioctl)(fp, com, (caddr_t)&sb, p); + if (error == 0 && com == TIOCGETP) { + hsb.sg_ispeed = sb.sg_ispeed; + hsb.sg_ospeed = sb.sg_ospeed; + hsb.sg_erase = sb.sg_erase; + hsb.sg_kill = sb.sg_kill; + hsb.sg_flags = sb.sg_flags & ~(V7_HUPCL|V7_XTABS|V7_NOAL); + if (sb.sg_flags & XTABS) + hsb.sg_flags |= V7_XTABS; + error = copyout((caddr_t)&hsb, cmarg, sizeof hsb); + } + return (error); +} +#endif diff --git a/sys/compat/hpux/hpux_util.h b/sys/compat/hpux/hpux_util.h new file mode 100644 index 00000000000..bd59abddaac --- /dev/null +++ b/sys/compat/hpux/hpux_util.h @@ -0,0 +1,41 @@ +/* $NetBSD: hpux_util.h,v 1.2 1995/06/24 20:17:57 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 _HPUX_UTIL_H_ +#define _HPUX_UTIL_H_ + +#include <compat/common/compat_util.h> + +#ifdef DEBUG_HPUX +#define DPRINTF(a) printf a; +#else +#define DPRINTF(a) +#endif + +#endif /* !_HPUX_UTIL_H_ */ diff --git a/sys/compat/hpux/syscalls.conf b/sys/compat/hpux/syscalls.conf new file mode 100644 index 00000000000..27cb8450905 --- /dev/null +++ b/sys/compat/hpux/syscalls.conf @@ -0,0 +1,12 @@ +# $NetBSD: syscalls.conf,v 1.1 1995/05/10 16:45:46 christos Exp $ + +sysnames="hpux_syscalls.c" +sysnumhdr="hpux_syscall.h" +syssw="hpux_sysent.c" +sysarghdr="hpux_syscallargs.h" +compatopts="compat_hpux_6x" +libcompatopts="" + +switchname="hpux_sysent" +namesname="hpux_syscallnames" +constprefix="HPUX_SYS_" diff --git a/sys/compat/hpux/syscalls.master b/sys/compat/hpux/syscalls.master new file mode 100644 index 00000000000..aadc7871f9d --- /dev/null +++ b/sys/compat/hpux/syscalls.master @@ -0,0 +1,439 @@ + $NetBSD: syscalls.master,v 1.8 1995/10/07 06:26:42 mycroft Exp $ + +; @(#)syscalls.master 8.1 (Berkeley) 7/19/93 + +; NetBSD COMPAT_HPUX 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/hpux/hpux.h> +#include <compat/hpux/hpux_syscallargs.h> + +0 NOARGS { int sys_nosys(void); } syscall +1 NOARGS { int sys_exit(int rval); } +2 STD { int hpux_sys_fork(void); } +3 STD { int hpux_sys_read(int fd, char *buf, u_int nbyte); } +4 STD { int hpux_sys_write(int fd, char *buf, u_int nbyte); } +5 STD { int hpux_sys_open(char *path, int flags, int mode); } +6 NOARGS { int sys_close(int fd); } +7 STD { int hpux_sys_wait(int *status); } +8 STD { int hpux_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 hpux_sys_execv(char * path, char * * argp); } +12 NOARGS { int sys_chdir(char *path); } +13 COMPAT_HPUX_6X { int sys_time(time_t *t); } +14 NOARGS { int 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 NOARGS { int sys_obreak(char *nsize); } +18 COMPAT_HPUX_6X { int sys_stat(char *path, struct hpux_ostat *sb); } +19 NOARGS { long compat_43_sys_lseek(int fd, long offset, \ + int whence); } +20 NOARGS { pid_t sys_getpid(void); } +21 UNIMPL mount +22 UNIMPL umount +23 NOARGS { int sys_setuid(uid_t uid); } +24 NOARGS { uid_t sys_getuid(void); } +25 COMPAT_HPUX_6X { int sys_stime(int time); } +26 STD { int hpux_sys_ptrace(int req, int pid, int *addr, \ + int data); } +27 COMPAT_HPUX_6X { int sys_alarm(int deltat); } +28 COMPAT_HPUX_6X { int sys_fstat(int fd, struct hpux_ostat *sb); } +29 COMPAT_HPUX_6X { int sys_pause(void); } +30 COMPAT_HPUX_6X { int sys_utime(char *fname, time_t *tptr); } +31 COMPAT_HPUX_6X { int sys_stty(int fd, caddr_t arg); } +32 COMPAT_HPUX_6X { int sys_gtty(int fd, caddr_t arg); } +33 NOARGS { int sys_access(char *path, int flags); } +34 COMPAT_HPUX_6X { int sys_nice(int nval); } +35 COMPAT_HPUX_6X { int sys_ftime(struct hpux_timeb *tp); } +36 NOARGS { int sys_sync(void); } +37 STD { int hpux_sys_kill(pid_t pid, int signo); } +38 STD { int hpux_sys_stat(char *path, struct hpux_stat *sb); } +39 COMPAT_HPUX_6X { int sys_setpgrp(void); } +40 STD { int hpux_sys_lstat(char *path, struct hpux_stat *sb); } +41 STD { int hpux_sys_dup(int fd); } +42 NOARGS { int sys_pipe(void); } +43 COMPAT_HPUX_6X { int sys_times(struct tms *tms); } +44 NOARGS { int sys_profil(caddr_t samples, u_int size, \ + u_int offset, u_int scale); } + +45 UNIMPL ki_syscall +46 NOARGS { int sys_setgid(gid_t gid); } +47 NOARGS { gid_t sys_getgid(void); } +48 COMPAT_HPUX_6X { int sys_ssig(int signo, sig_t fun); } +49 UNIMPL reserved for USG +50 UNIMPL reserved for USG +51 UNIMPL acct +52 UNIMPL +53 UNIMPL +54 STD { int hpux_sys_ioctl(int fd, int com, caddr_t data); } +55 UNIMPL reboot +56 NOARGS { int sys_symlink(char *path, char *link); } +57 STD { int hpux_sys_utssys(struct hpux_utsname *uts, \ + int dev, int request); } +58 NOARGS { int sys_readlink(char *path, char *buf, int count); } +59 NOARGS { int 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 hpux_sys_fcntl(int fd, int cmd, int arg); } +63 STD { int hpux_sys_ulimit(int cmd, int newlimit); } +64 UNIMPL +65 UNIMPL +66 STD { int hpux_sys_vfork(void); } +67 NOARGS { int hpux_sys_read(int fd, char *buf, u_int nbyte); } vread +68 NOARGS { int hpux_sys_write(int fd, char *buf, u_int nbyte); } vwrite +69 UNIMPL +70 UNIMPL +71 STD { int hpux_sys_mmap(caddr_t addr, size_t len, \ + int prot, int flags, int fd, long pos); } +72 UNIMPL +73 NOARGS { int sys_munmap(caddr_t addr, size_t len); } +74 NOARGS { int sys_mprotect(caddr_t addr, size_t len, \ + int prot); } +75 UNIMPL +76 UNIMPL +77 UNIMPL +78 UNIMPL +79 NOARGS { int sys_getgroups(u_int gidsetsize, gid_t *gidset); } +80 NOARGS { int sys_setgroups(u_int gidsetsize, gid_t *gidset); } +81 STD { int hpux_sys_getpgrp2(pid_t pid); } +82 STD { int hpux_sys_setpgrp2(pid_t pid, pid_t pgid); } +83 NOARGS { int sys_setitimer(u_int which, \ + struct itimerval *itv, struct itimerval *oitv); } +84 STD { int hpux_sys_wait3(int *status, int options, \ + int rusage); } +85 UNIMPL swapon +86 NOARGS { int sys_getitimer(u_int which, \ + struct itimerval *itv); } +87 UNIMPL +88 UNIMPL +89 UNIMPL +90 NOARGS { int sys_dup2(u_int from, u_int to); } +91 UNIMPL +92 STD { int hpux_sys_fstat(int fd, struct hpux_stat *sb); } +93 NOARGS { int sys_select(u_int nd, fd_set *in, fd_set *ou, \ + fd_set *ex, struct timeval *tv); } +94 UNIMPL +95 NOARGS { int sys_fsync(int fd); } +96 UNIMPL +97 UNIMPL +98 UNIMPL +99 UNIMPL +100 UNIMPL +101 UNIMPL +102 UNIMPL +103 NOARGS { int sys_sigreturn(struct sigcontext *sigcntxp); } +104 UNIMPL +105 UNIMPL +106 UNIMPL +107 UNIMPL +108 STD { int hpux_sys_sigvec(int signo, struct sigvec *nsv, \ + struct sigvec *osv); } +109 STD { int hpux_sys_sigblock(int mask); } +110 STD { int hpux_sys_sigsetmask(int mask); } +111 STD { int hpux_sys_sigpause(int mask); } +112 NOARGS { int compat_43_sys_sigstack(struct sigstack *nss, \ + struct sigstack *oss); } +113 UNIMPL +114 UNIMPL +115 UNIMPL +116 NOARGS { int sys_gettimeofday(struct timeval *tp); } +117 UNIMPL +118 UNIMPL +119 UNIMPL io_stub +120 STD { int hpux_sys_readv(int fd, struct iovec *iovp, \ + u_int iovcnt); } +121 STD { int hpux_sys_writev(int fd, struct iovec *iovp, \ + u_int iovcnt); } +122 NOARGS { int sys_settimeofday(struct timeval *tv, \ + struct timezone *tzp); } +123 NOARGS { int sys_fchown(int fd, int uid, int gid); } +124 NOARGS { int sys_fchmod(int fd, int mode); } +125 UNIMPL +126 STD { int hpux_sys_setresuid(uid_t r, uid_t e, uid_t s); } +127 STD { int hpux_sys_setresgid(gid_t r, gid_t e, gid_t s); } +128 NOARGS { int sys_rename(char *from, char *to); } +129 NOARGS { int compat_43_sys_truncate(char *path, long length); } +130 NOARGS { int compat_43_sys_ftruncate(int fd, long length); } +131 UNIMPL +132 STD { int hpux_sys_sysconf(int name); } +133 UNIMPL +134 UNIMPL +135 UNIMPL +136 NOARGS { int sys_mkdir(char *path, int mode); } +137 NOARGS { int sys_rmdir(char *path); } +138 UNIMPL +139 UNIMPL +140 UNIMPL +141 UNIMPL +142 UNIMPL +143 UNIMPL +144 STD { int hpux_sys_getrlimit(u_int which, \ + struct ogetrlimit *rlp); } +145 STD { int hpux_sys_setrlimit(u_int which, \ + struct ogetrlimit *rlp); } +146 UNIMPL +147 UNIMPL +148 UNIMPL +149 UNIMPL +150 UNIMPL +151 UNIMPL privgrp +152 STD { int hpux_sys_rtprio(pid_t pid, int prio); } +153 UNIMPL plock +154 STD { int hpux_sys_netioctl(int call, int *args); } +155 STD { int hpux_sys_lockf(int fd, int func, long size); } +#ifdef SYSVSEM +156 NOARGS { int sys_semget(key_t key, int nsems, int semflg); } +157 NOARGS { int sys___semctl(int semid, int semnum, int cmd, \ + union semun *arg); } +158 NOARGS { int sys_semop(int semid, struct sembuf *sops, \ + u_int nsops); } +#else +156 UNIMPL semget +157 UNIMPL semctl +158 UNIMPL semop +#endif +#ifdef SYSVMSG +159 NOARGS { int sys_msgget(key_t key, int msgflg); } +160 NOARGS { int sys_msgctl(int msqid, int cmd, \ + struct msqid_ds *buf); } +161 NOARGS { int sys_msgsnd(int msqid, void *msgp, size_t msgsz, \ + int msgflg); } +162 NOARGS { int sys_msgrcv(int msqid, void *msgp, size_t msgsz, \ + long msgtyp, int msgflg); } +#else +159 UNIMPL msgget +160 UNIMPL msgctl +161 UNIMPL msgsnd +162 UNIMPL msgrcv +#endif +#ifdef SYSVSHM +163 NOARGS { int sys_shmget(key_t key, int size, int shmflg); } +164 STD { int hpux_sys_shmctl(int shmid, int cmd, \ + caddr_t buf); } +165 NOARGS { int sys_shmat(int shmid, void *shmaddr, int shmflg); } +166 NOARGS { int sys_shmdt(void *shmaddr); } +#else +163 UNIMPL shmget +164 UNIMPL shmctl +165 UNIMPL shmat +166 UNIMPL shmdt +#endif +167 STD { int hpux_sys_advise(int arg); } +168 UNIMPL nsp_init +169 UNIMPL cluster +170 UNIMPL mkrnod +171 UNIMPL +172 UNIMPL unsp_open +173 UNIMPL +174 STD { int hpux_sys_getcontext(char *buf, int len); } +175 UNIMPL +176 UNIMPL +177 UNIMPL +178 UNIMPL lsync +179 UNIMPL +180 UNIMPL mysite +181 UNIMPL sitels +182 UNIMPL +183 UNIMPL +184 UNIMPL dskless_stats +185 UNIMPL +186 UNIMPL setacl +187 UNIMPL fsetacl +188 UNIMPL getacl +189 UNIMPL fgetacl +190 STD { int hpux_sys_getaccess(char *path, uid_t uid, \ + int ngroups, gid_t *gidset, void *label, \ + void *privs); } +191 UNIMPL getaudid +192 UNIMPL setaudid +193 UNIMPL getaudproc +194 UNIMPL setaudproc +195 UNIMPL getevent +196 UNIMPL setevent +197 UNIMPL audwrite +198 UNIMPL audswitch +199 UNIMPL audctl +200 STD { int hpux_sys_waitpid(pid_t pid, int *status, \ + int options, struct rusage *rusage); } +201 UNIMPL +202 UNIMPL +203 UNIMPL +204 UNIMPL +205 UNIMPL +206 UNIMPL +207 UNIMPL +208 UNIMPL +209 UNIMPL +210 UNIMPL +211 UNIMPL +212 UNIMPL +213 UNIMPL +214 UNIMPL +215 UNIMPL +216 UNIMPL +217 UNIMPL +218 UNIMPL +219 UNIMPL +220 UNIMPL +221 UNIMPL +222 UNIMPL +223 UNIMPL +224 UNIMPL +225 NOARGS { int sys_pathconf(char *path, int name); } +226 NOARGS { int sys_fpathconf(int fd, int name); } +227 UNIMPL +228 UNIMPL +229 UNIMPL async_daemon +230 UNIMPL nfs_fcntl +231 NOARGS { int compat_43_sys_getdirentries(int fd, char *buf, \ + u_int count, long *basep); } +232 NOARGS { int compat_09_sys_getdomainname(char *domainname, \ + int len); } +233 UNIMPL nfs_getfh +234 UNIMPL vfsmount +235 UNIMPL nfs_svc +236 NOARGS { int compat_09_sys_setdomainname(char *domainname, \ + int len); } +237 UNIMPL statfs +238 UNIMPL fstatfs +239 STD { int hpux_sys_sigaction(int signo, \ + struct hpux_sigaction *nsa, \ + struct hpux_sigaction *osa); } +240 STD { int hpux_sys_sigprocmask(int how, \ + hpux_sigset_t *set, hpux_sigset_t *oset); } +241 STD { int hpux_sys_sigpending(hpux_sigset_t *set); } +242 STD { int hpux_sys_sigsuspend(hpux_sigset_t *set); } +243 UNIMPL fsctl +244 UNIMPL +245 UNIMPL pstat +246 UNIMPL +247 UNIMPL +248 UNIMPL +249 UNIMPL +250 UNIMPL +251 UNIMPL +252 UNIMPL +253 UNIMPL +254 UNIMPL +255 UNIMPL +256 UNIMPL +257 UNIMPL +258 UNIMPL +259 UNIMPL +260 UNIMPL +261 UNIMPL +262 UNIMPL +263 UNIMPL +264 UNIMPL +265 UNIMPL +266 UNIMPL +267 UNIMPL +268 NOARGS { int compat_43_sys_getdtablesize(void); } +269 UNIMPL +270 UNIMPL +271 UNIMPL +272 NOARGS { int sys_fchdir(int fd); } +273 UNIMPL +274 UNIMPL +275 NOARGS { int compat_43_sys_accept(int s, caddr_t name, \ + int *anamelen); } +276 NOARGS { int sys_bind(int s, caddr_t name, int namelen); } +277 NOARGS { int sys_connect(int s, caddr_t name, int namelen); } +278 NOARGS { int compat_43_sys_getpeername(int fdes, caddr_t asa, \ + int *alen); } +279 NOARGS { int compat_43_sys_getsockname(int fdec, caddr_t asa, \ + int *alen); } +280 NOARGS { int sys_getsockopt(int s, int level, int name, \ + caddr_t val, int *avalsize); } +281 NOARGS { int sys_listen(int s, int backlog); } +282 NOARGS { int compat_43_sys_recv(int s, caddr_t buf, int len, \ + int flags); } +283 NOARGS { int compat_43_sys_recvfrom(int s, caddr_t buf, \ + size_t len, int flags, caddr_t from, \ + int *fromlenaddr); } +284 NOARGS { int compat_43_sys_recvmsg(int s, \ + struct omsghdr *msg, int flags); } +285 NOARGS { int compat_43_sys_send(int s, caddr_t buf, int len, \ + int flags); } +286 NOARGS { int compat_43_sys_sendmsg(int s, caddr_t msg, \ + int flags); } +287 NOARGS { int sys_sendto(int s, caddr_t buf, size_t len, \ + int flags, caddr_t to, int tolen); } +288 STD { int hpux_sys_setsockopt2(int s, int level, int name, \ + caddr_t val, int valsize); } +289 NOARGS { int sys_shutdown(int s, int how); } +290 NOARGS { int sys_socket(int domain, int type, int protocol); } +291 NOARGS { int sys_socketpair(int domain, int type, \ + int protocol, int *rsv); } +292 UNIMPL +293 UNIMPL +294 UNIMPL +295 UNIMPL +296 UNIMPL +297 UNIMPL +298 UNIMPL +299 UNIMPL +300 UNIMPL +301 UNIMPL +302 UNIMPL +303 UNIMPL +304 UNIMPL +305 UNIMPL +306 UNIMPL +307 UNIMPL +308 UNIMPL +309 UNIMPL +310 UNIMPL +311 UNIMPL +#ifdef SYSVSEM +312 NOARGS { int sys___semctl(int semid, int semnum, int cmd, \ + union semun *arg); } nsemctl +#else +312 UNIMPL semctl +#endif +#ifdef SYSVMSG +313 NOARGS { int sys_msgctl(int msqid, int cmd, \ + struct msqid_ds *buf); } nmsgctl +#else +313 UNIMPL msgctl +#endif +#ifdef SYSVSHM +314 STD { int hpux_sys_nshmctl(int shmid, int cmd, \ + caddr_t buf); } +#else +314 UNIMPL shmctl +#endif |