Remove IRIX emulation

This commit is contained in:
joerg 2011-04-26 16:36:40 +00:00
parent 5aca2679d7
commit e958063324
61 changed files with 26 additions and 11561 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: ALL,v 1.304 2011/04/26 15:51:22 joerg Exp $
# $NetBSD: ALL,v 1.305 2011/04/26 16:36:40 joerg Exp $
# From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
#
# ALL machine description file
@ -17,7 +17,7 @@ include "arch/i386/conf/std.i386"
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
#ident "ALL-$Revision: 1.304 $"
#ident "ALL-$Revision: 1.305 $"
maxusers 64 # estimated number of users
@ -1959,7 +1959,6 @@ options DEBUG_GPIO2
options DEBUG_HPUX
options DEBUG_IBCS2
options DEBUG_IPR_VJ
options DEBUG_IRIX
options DEBUG_ISAPNP
options DEBUG_ISSIGNAL
options DEBUG_KERNADDR_ACCESS

View File

@ -1,4 +1,4 @@
# $NetBSD: files.mips,v 1.68 2011/04/14 05:07:00 cliff Exp $
# $NetBSD: files.mips,v 1.69 2011/04/26 16:36:40 joerg Exp $
#
defflag opt_cputype.h NOFPU FPEMUL
@ -94,6 +94,3 @@ include "compat/linux/files.linux"
include "compat/linux/arch/mips/files.linux_mips"
file arch/mips/mips/linux_trap.c compat_linux
file arch/mips/mips/linux_syscall.c compat_linux
# IRIX compatibility (COMPAT_IRIX) XXX even more experimental
include "compat/irix/files.irix"

View File

@ -1,38 +0,0 @@
/* $NetBSD: irix_syscall.c,v 1.4 2008/04/28 20:23:28 martin Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Emmanuel Dreyfus.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(1, "$NetBSD: irix_syscall.c,v 1.4 2008/04/28 20:23:28 martin Exp $");
#define EMULNAME(x) __CONCAT(irix_,x)
#define SYSCALL_SHIFT 1000
#include "syscall.c"

View File

@ -1,9 +1,8 @@
/* $NetBSD: sigcode.S,v 1.3 2005/12/11 12:18:09 christos Exp $ */
/* $NetBSD: sigcode.S,v 1.4 2011/04/26 16:36:41 joerg Exp $ */
#include "opt_compat_netbsd.h"
#include "opt_compat_ultrix.h"
#include "opt_compat_linux.h"
#include "opt_compat_irix.h"
#include <mips/signal.h>
#include <sys/syscall.h>
@ -13,9 +12,6 @@
#ifdef COMPAT_LINUX
#include <compat/linux/linux_syscall.h>
#endif
#ifdef COMPAT_IRIX
#include <compat/irix/irix_syscall.h>
#endif
#include <mips/asm.h>
#include "assym.h"

View File

@ -1,4 +1,4 @@
# $NetBSD: GENERIC32_IP12,v 1.10 2011/03/06 17:08:30 bouyer Exp $
# $NetBSD: GENERIC32_IP12,v 1.11 2011/04/26 16:36:41 joerg Exp $
#
# GENERIC32_IP12 machine description file
#
@ -32,7 +32,7 @@ makeoptions TEXTADDR=0x80002000 # entry point
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
#ident "GENERIC32-IP2x-$Revision: 1.10 $"
#ident "GENERIC32-IP2x-$Revision: 1.11 $"
maxusers 32
@ -86,7 +86,6 @@ options COMPAT_40 # NetBSD 4.0 compatibility.
options COMPAT_50 # NetBSD 5.0 compatibility.
#options TCP_COMPAT_42 # 4.2BSD TCP/IP bug compat. Not recommended.
#options COMPAT_IRIX # binary compatibility with IRIX
#options COMPAT_LINUX # binary compatibility with Linux
#options COMPAT_ULTRIX # binary compatibility with Ultrix
options COMPAT_BSDPTY # /dev/[pt]ty?? ptys.
@ -283,10 +282,6 @@ pseudo-device wsfont
# a pseudo device needed for Coda # also needs CODA (above)
#pseudo-device vcoda 4 # coda minicache <-> venus comm.
# pseudo devices used for IRIX binary compatibility
#pseudo-device irix_kmem # IRIX /dev/kmem
#pseudo-device irix_usema # IRIX /dev/usema
# Veriexec
#
# a pseudo device needed for veriexec

View File

@ -1,4 +1,4 @@
# $NetBSD: GENERIC32_IP2x,v 1.86 2011/03/06 17:08:30 bouyer Exp $
# $NetBSD: GENERIC32_IP2x,v 1.87 2011/04/26 16:36:41 joerg Exp $
#
# GENERIC32_IP2x machine description file
#
@ -29,7 +29,7 @@ makeoptions TEXTADDR=0x88069000 # entry point
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
#ident "GENERIC32-IP2x-$Revision: 1.86 $"
#ident "GENERIC32-IP2x-$Revision: 1.87 $"
maxusers 32
@ -86,7 +86,6 @@ options COMPAT_40 # NetBSD 4.0 compatibility.
options COMPAT_50 # NetBSD 5.0 compatibility.
#options TCP_COMPAT_42 # 4.2BSD TCP/IP bug compat. Not recommended.
#options COMPAT_IRIX # binary compatibility with IRIX
options COMPAT_LINUX # binary compatibility with Linux
#options COMPAT_ULTRIX # binary compatibility with Ultrix
options COMPAT_BSDPTY # /dev/[pt]ty?? ptys.
@ -329,10 +328,6 @@ pseudo-device putter # for puffs and pud
# a pseudo device needed for Coda # also needs CODA (above)
pseudo-device vcoda 4 # coda minicache <-> venus comm.
# pseudo devices used for IRIX binary compatibility
#pseudo-device irix_kmem # IRIX /dev/kmem
#pseudo-device irix_usema # IRIX /dev/usema
# Veriexec
#
# a pseudo device needed for veriexec

View File

@ -1,4 +1,4 @@
# $NetBSD: GENERIC32_IP3x,v 1.88 2011/03/06 17:08:31 bouyer Exp $
# $NetBSD: GENERIC32_IP3x,v 1.89 2011/04/26 16:36:41 joerg Exp $
#
# GENERIC32_IP3x machine description file
#
@ -28,7 +28,7 @@ makeoptions TEXTADDR="0x80069000" # entry point
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
#ident "GENERIC32_IP3x-$Revision: 1.88 $"
#ident "GENERIC32_IP3x-$Revision: 1.89 $"
maxusers 32
@ -79,7 +79,6 @@ options COMPAT_40 # NetBSD 4.0 compatibility.
options COMPAT_50 # NetBSD 5.0 compatibility.
#options TCP_COMPAT_42 # 4.2BSD TCP/IP bug compat. Not recommended.
#options COMPAT_IRIX # binary compatibility with IRIX
options COMPAT_LINUX # binary compatibility with Linux
#options COMPAT_ULTRIX # binary compatibility with Ultrix
options COMPAT_BSDPTY # /dev/[pt]ty?? ptys.
@ -475,10 +474,6 @@ pseudo-device drvctl
# a pseudo device needed for Coda # also needs CODA (above)
pseudo-device vcoda 4 # coda minicache <-> venus comm.
# pseudo devices used for IRIX binary compatibility
#pseudo-device irix_kmem # IRIX /dev/kmem
#pseudo-device irix_usema # IRIX /dev/usema
# Veriexec
#
# a pseudo device needed for veriexec

View File

@ -1,4 +1,4 @@
# $NetBSD: GENERIC64_IP2x,v 1.2 2009/12/14 00:46:12 matt Exp $
# $NetBSD: GENERIC64_IP2x,v 1.3 2011/04/26 16:36:41 joerg Exp $
#
# GENERIC32_IP2x machine description file
#
@ -29,7 +29,7 @@ include "arch/sgimips/conf/std.sgimips64"
no makeoptions TEXTADDR # entry point
makeoptions TEXTADDR=0xffffffff88069000 # entry point
#ident "GENERIC64-IP2x-$Revision: 1.2 $"
#ident "GENERIC64-IP2x-$Revision: 1.3 $"
no makeoptions WANT_ECOFF
makeoptions WANT_ECOFF="no" # Create an ECOFF kernel in addition
@ -45,7 +45,6 @@ makeoptions WANT_ECOFF="no" # Create an ECOFF kernel in addition
#options COMPAT_40 # NetBSD 4.0 compatibility.
#options TCP_COMPAT_42 # 4.2BSD TCP/IP bug compat. Not recommended.
#options COMPAT_IRIX # binary compatibility with IRIX
#options COMPAT_LINUX # binary compatibility with Linux
#options COMPAT_ULTRIX # binary compatibility with Ultrix
#options COMPAT_BSDPTY # /dev/[pt]ty?? ptys.

View File

@ -1,4 +1,4 @@
# $NetBSD: GENERIC64_IP3x,v 1.2 2009/12/14 00:46:12 matt Exp $
# $NetBSD: GENERIC64_IP3x,v 1.3 2011/04/26 16:36:41 joerg Exp $
#
# GENERIC32_IP3x machine description file
#
@ -28,7 +28,7 @@ include "arch/sgimips/conf/std.sgimips64"
no makeoptions TEXTADDR
makeoptions TEXTADDR="0xffffffff80069000" # entry point
#ident "GENERIC64_IP3x-$Revision: 1.2 $"
#ident "GENERIC64_IP3x-$Revision: 1.3 $"
# Compatibility options
#options COMPAT_15 # NetBSD 1.5
@ -38,7 +38,6 @@ makeoptions TEXTADDR="0xffffffff80069000" # entry point
#options COMPAT_40 # NetBSD 4.0 compatibility.
#options TCP_COMPAT_42 # 4.2BSD TCP/IP bug compat. Not recommended.
#options COMPAT_IRIX # binary compatibility with IRIX
#options COMPAT_LINUX # binary compatibility with Linux
#options COMPAT_ULTRIX # binary compatibility with Ultrix
#options COMPAT_BSDPTY # /dev/[pt]ty?? ptys.

View File

@ -1,4 +1,4 @@
# $NetBSD: majors.sgimips,v 1.25 2010/03/06 23:45:40 plunky Exp $
# $NetBSD: majors.sgimips,v 1.26 2011/04/26 16:36:41 joerg Exp $
#
# Device majors for sgimips
#
@ -51,8 +51,6 @@ device-major wsmux char 53 wsmux
device-major wsfont char 54 wsfont
device-major clockctl char 60 clockctl
device-major irix_kmem char 61 compat_irix
device-major irix_usema char 62 compat_irix
device-major audio char 64 audio
device-major pci char 65 pci
device-major irframe char 66 irframedrv

View File

@ -1,13 +0,0 @@
# $NetBSD: Makefile,v 1.5 2005/12/11 12:20:12 christos Exp $
.include <bsd.sys.mk> # for HOST_SH
DEP= syscalls.conf syscalls.master ../../kern/makesyscalls.sh
OBJS= irix_sysent.c irix_syscalls.c irix_syscall.h irix_syscallargs.h
${OBJS}: ${DEP}
${HOST_SH} ../../kern/makesyscalls.sh syscalls.conf syscalls.master
all: ${OBJS}
.include <bsd.kinc.mk>

View File

@ -1,47 +0,0 @@
# $NetBSD: files.irix,v 1.27 2009/12/14 00:47:10 matt Exp $
#
file arch/mips/mips/irix_syscall.c compat_irix
file compat/irix/irix_dirent.c compat_irix
file compat/irix/irix_errno.c compat_irix
file compat/irix/irix_exec.c compat_irix
file compat/irix/irix_exec_elf32.c compat_irix & exec_elf32
file compat/irix/irix_exec_elf64.c compat_irix & exec_elf64
file compat/irix/irix_fcntl.c compat_irix
file compat/irix/irix_ioctl.c compat_irix
file compat/irix/irix_kmem.c compat_irix
file compat/irix/irix_mman.c compat_irix
file compat/irix/irix_misc.c compat_irix
file compat/irix/irix_mod.c compat_irix
file compat/irix/irix_mount.c compat_irix
file compat/irix/irix_prctl.c compat_irix
file compat/irix/irix_resource.c compat_irix
file compat/irix/irix_signal.c compat_irix
file compat/irix/irix_stat.c compat_irix
file compat/irix/irix_swap.c compat_irix
file compat/irix/irix_syscalls.c compat_irix
file compat/irix/irix_sysctl.c compat_irix
file compat/irix/irix_sysent.c compat_irix
file compat/irix/irix_syssgi.c compat_irix
file compat/irix/irix_sysmp.c compat_irix
file compat/irix/irix_systeminfo.c compat_irix
file compat/irix/irix_usema.c compat_irix
file arch/mips/mips/svr4_machdep.c compat_irix
file compat/svr4/svr4_fcntl.c compat_irix
file compat/svr4/svr4_filio.c compat_irix
file compat/svr4/svr4_ioctl.c compat_irix
file compat/svr4/svr4_ipc.c compat_irix
file compat/svr4/svr4_misc.c compat_irix
file compat/svr4/svr4_net.c compat_irix
file compat/svr4/svr4_signal.c compat_irix
file compat/svr4/svr4_signo.c compat_irix
file compat/svr4/svr4_socket.c compat_irix
file compat/svr4/svr4_sockio.c compat_irix
file compat/svr4/svr4_stat.c compat_irix
file compat/svr4/svr4_stream.c compat_irix
file compat/svr4/svr4_termios.c compat_irix
file compat/svr4/svr4_ttold.c compat_irix

View File

@ -1,370 +0,0 @@
/* $NetBSD: irix_dirent.c,v 1.25 2010/06/24 13:03:06 hannken Exp $ */
/*-
* Copyright (c) 1994, 2001, 2008 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Christos Zoulas and Emmanuel Dreyfus.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: irix_dirent.c,v 1.25 2010/06/24 13:03:06 hannken Exp $");
#include <sys/types.h>
#include <sys/signal.h>
#include <sys/param.h>
#include <sys/proc.h>
#include <sys/dirent.h>
#include <sys/fcntl.h>
#include <sys/file.h>
#include <sys/filedesc.h>
#include <sys/mount.h>
#include <sys/malloc.h>
#include <sys/namei.h>
#include <sys/systm.h>
#include <sys/vnode.h>
#include <compat/common/compat_util.h>
#include <compat/irix/irix_types.h>
#include <compat/irix/irix_signal.h>
#include <compat/irix/irix_syscall.h>
#include <compat/irix/irix_syscallargs.h>
/*
* irix_sys_ngetdents() is nearly a plain copy of svr4_sys_getdents(), from
* sys/compat/svr4/svr4_misc.c. We need a customized version to handle the
* eof flag.
* Obviously the code should be merged, but it would require some
* change to the way COMPAT_SVR4 code is set up.
*/
#define SVR4_RECLEN(de,namlen) ALIGN((SVR4_NAMEOFF(de) + (namlen) + 1))
#define SVR4_NAMEOFF(dp) ((char *)&(dp)->d_name - (char *)dp)
int
irix_sys_ngetdents(struct lwp *l, const struct irix_sys_ngetdents_args *uap, register_t *retval)
{
/* {
syscallarg(int) fildes;
syscallarg(irix_dirent_t *) buf;
syscallarg(unsigned short) nbyte;
syscallarg(int *) eof;
} */
struct dirent *bdp;
struct vnode *vp;
char *inp, *buf; /* BSD-format */
int len, reclen; /* BSD-format */
char *outp; /* SVR4-format */
int resid, svr4_reclen; /* SVR4-format */
struct file *fp;
struct uio auio;
struct iovec aiov;
struct irix_dirent idb;
off_t off; /* true file offset */
int buflen, error, eofflag;
off_t *cookiebuf = NULL, *cookie;
int ncookies, fd;
fd = SCARG(uap, fildes);
if ((error = fd_getvnode(fd, &fp)) != 0)
return (error);
if ((fp->f_flag & FREAD) == 0) {
error = EBADF;
goto out1;
}
vp = (struct vnode *)fp->f_data;
if (vp->v_type != VDIR) {
error = EINVAL;
goto out1;
}
buflen = min(MAXBSIZE, SCARG(uap, nbyte));
buf = malloc(buflen, M_TEMP, M_WAITOK);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
off = fp->f_offset;
again:
aiov.iov_base = buf;
aiov.iov_len = buflen;
auio.uio_iov = &aiov;
auio.uio_iovcnt = 1;
auio.uio_rw = UIO_READ;
auio.uio_resid = buflen;
auio.uio_offset = off;
UIO_SETUP_SYSSPACE(&auio);
/*
* First we read into the malloc'ed buffer, then
* we massage it into user space, one record at a time.
*/
error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, &cookiebuf,
&ncookies);
if (error)
goto out;
inp = buf;
outp = (char *)SCARG(uap, buf);
resid = SCARG(uap, nbyte);
if ((len = buflen - auio.uio_resid) == 0)
goto eof;
for (cookie = cookiebuf; len > 0; len -= reclen) {
bdp = (struct dirent *)inp;
reclen = bdp->d_reclen;
if (reclen & 3)
panic("irix_getdents: bad reclen");
if (cookie)
off = *cookie++; /* each entry points to the next */
else
off += reclen;
if ((off >> 32) != 0) {
compat_offseterr(vp, "irix_getdents");
error = EINVAL;
goto out;
}
if (bdp->d_fileno == 0) {
inp += reclen; /* it is a hole; squish it out */
continue;
}
svr4_reclen = SVR4_RECLEN(&idb, bdp->d_namlen);
if (reclen > len || resid < svr4_reclen) {
/* entry too big for buffer, so just stop */
outp++;
break;
}
/*
* Massage in place to make a SVR4-shaped dirent (otherwise
* we have to worry about touching user memory outside of
* the copyout() call).
*/
idb.d_ino = (irix_ino_t)bdp->d_fileno;
idb.d_off = (irix_off_t)off;
idb.d_reclen = (u_short)svr4_reclen;
strlcpy(idb.d_name, bdp->d_name, sizeof(idb.d_name));
if ((error = copyout((void *)&idb, outp, svr4_reclen)))
goto out;
/* advance past this real entry */
inp += reclen;
/* advance output past SVR4-shaped entry */
outp += svr4_reclen;
resid -= svr4_reclen;
}
/* if we squished out the whole block, try again */
if (outp == (char *)SCARG(uap, buf)) {
if (cookiebuf)
free(cookiebuf, M_TEMP);
cookiebuf = NULL;
goto again;
}
fp->f_offset = off; /* update the vnode offset */
eof:
*retval = SCARG(uap, nbyte) - resid;
out:
VOP_UNLOCK(vp);
if (cookiebuf)
free(cookiebuf, M_TEMP);
free(buf, M_TEMP);
out1:
fd_putfile(fd);
if (SCARG(uap, eof) != NULL)
error = copyout(&eofflag, SCARG(uap, eof), sizeof(int));
return error;
}
int
irix_sys_getdents(struct lwp *l, const struct irix_sys_getdents_args *uap, register_t *retval)
{
/* {
syscallarg(int) fildes;
syscallarg(irix_dirent_t *) buf;
syscallarg(unsigned short) nbyte;
syscallarg(int *) eof;
} */
struct irix_sys_ngetdents_args cup;
SCARG(&cup, fildes) = SCARG(uap, fildes);
SCARG(&cup, buf) = SCARG(uap, buf);
SCARG(&cup, nbyte) = SCARG(uap, nbytes);
SCARG(&cup, eof) = NULL;
return irix_sys_ngetdents(l, (void *)&cup, retval);
}
/*
* The 64 versions are very close to the
* 32 bit versions (only 3 lines of diff)
*/
int
irix_sys_ngetdents64(struct lwp *l, const struct irix_sys_ngetdents64_args *uap, register_t *retval)
{
/* {
syscallarg(int) fildes;
syscallarg(irix_dirent64_t *) buf;
syscallarg(unsigned short) nbyte;
syscallarg(int *) eof;
} */
struct dirent *bdp;
struct vnode *vp;
char *inp, *buf; /* BSD-format */
int len, reclen; /* BSD-format */
char *outp; /* SVR4-format */
int resid, svr4_reclen; /* SVR4-format */
file_t *fp;
struct uio auio;
struct iovec aiov;
struct irix_dirent64 idb;
off_t off; /* true file offset */
int buflen, error, eofflag;
off_t *cookiebuf = NULL, *cookie;
int ncookies, fd;
fd = SCARG(uap, fildes);
if ((error = fd_getvnode(fd, &fp)) != 0)
return (error);
if ((fp->f_flag & FREAD) == 0) {
error = EBADF;
goto out1;
}
vp = fp->f_data;
if (vp->v_type != VDIR) {
error = EINVAL;
goto out1;
}
buflen = min(MAXBSIZE, SCARG(uap, nbyte));
buf = malloc(buflen, M_TEMP, M_WAITOK);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
off = fp->f_offset;
again:
aiov.iov_base = buf;
aiov.iov_len = buflen;
auio.uio_iov = &aiov;
auio.uio_iovcnt = 1;
auio.uio_rw = UIO_READ;
auio.uio_resid = buflen;
auio.uio_offset = off;
UIO_SETUP_SYSSPACE(&auio);
/*
* First we read into the malloc'ed buffer, then
* we massage it into user space, one record at a time.
*/
error = VOP_READDIR(vp, &auio, fp->f_cred, &eofflag, &cookiebuf,
&ncookies);
if (error)
goto out;
inp = buf;
outp = (char *)SCARG(uap, buf);
resid = SCARG(uap, nbyte);
if ((len = buflen - auio.uio_resid) == 0)
goto eof;
for (cookie = cookiebuf; len > 0; len -= reclen) {
bdp = (struct dirent *)inp;
reclen = bdp->d_reclen;
if (reclen & 3)
panic("irix_getdents64: bad reclen");
if (bdp->d_fileno == 0) {
inp += reclen; /* it is a hole; squish it out */
if (cookie)
off = *cookie++;
else
off += reclen;
continue;
}
svr4_reclen = SVR4_RECLEN(&idb, bdp->d_namlen);
if (reclen > len || resid < svr4_reclen) {
/* entry too big for buffer, so just stop */
outp++;
break;
}
if (cookie)
off = *cookie++; /* each entry points to the next */
else
off += reclen;
/*
* Massage in place to make a SVR4-shaped dirent (otherwise
* we have to worry about touching user memory outside of
* the copyout() call).
*/
idb.d_ino = (irix_ino64_t)bdp->d_fileno;
idb.d_off = (irix_off64_t)off;
idb.d_reclen = (u_short)svr4_reclen;
strlcpy(idb.d_name, bdp->d_name, sizeof(idb.d_name));
if ((error = copyout((void *)&idb, outp, svr4_reclen)))
goto out;
/* advance past this real entry */
inp += reclen;
/* advance output past SVR4-shaped entry */
outp += svr4_reclen;
resid -= svr4_reclen;
}
/* if we squished out the whole block, try again */
if (outp == (char *)SCARG(uap, buf)) {
if (cookiebuf)
free(cookiebuf, M_TEMP);
cookiebuf = NULL;
goto again;
}
fp->f_offset = off; /* update the vnode offset */
eof:
*retval = SCARG(uap, nbyte) - resid;
out:
VOP_UNLOCK(vp);
if (cookiebuf)
free(cookiebuf, M_TEMP);
free(buf, M_TEMP);
out1:
fd_putfile(fd);
if (SCARG(uap, eof) != NULL)
error = copyout(&eofflag, SCARG(uap, eof), sizeof(int));
return error;
}
int
irix_sys_getdents64(struct lwp *l, const struct irix_sys_getdents64_args *uap, register_t *retval)
{
/* {
syscallarg(int) fildes;
syscallarg(irix_dirent64_t *) buf;
syscallarg(unsigned short) nbyte;
syscallarg(int *) eof;
} */
struct irix_sys_ngetdents64_args cup;
SCARG(&cup, fildes) = SCARG(uap, fildes);
SCARG(&cup, buf) = SCARG(uap, buf);
SCARG(&cup, nbyte) = SCARG(uap, nbytes);
SCARG(&cup, eof) = NULL;
return irix_sys_ngetdents64(l, (void *)&cup, retval);
}

View File

@ -1,130 +0,0 @@
/* $NetBSD: irix_errno.c,v 1.2 2008/04/28 20:23:41 martin Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Emmanuel Dreyfus
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: irix_errno.c,v 1.2 2008/04/28 20:23:41 martin Exp $");
#include <compat/irix/irix_errno.h>
const int native_to_irix_errno[] = {
0, /* 0 */
IRIX_EPERM,
IRIX_ENOENT,
IRIX_ESRCH,
IRIX_EINTR,
IRIX_EIO, /* 5 */
IRIX_ENXIO,
IRIX_E2BIG,
IRIX_ENOEXEC,
IRIX_EBADF,
IRIX_ECHILD, /* 10 */
IRIX_EAGAIN,
IRIX_ENOMEM,
IRIX_EACCES,
IRIX_EFAULT,
IRIX_ENOTBLK, /* 15 */
IRIX_EBUSY,
IRIX_EEXIST,
IRIX_EXDEV,
IRIX_ENODEV,
IRIX_ENOTDIR, /* 20 */
IRIX_EISDIR,
IRIX_EINVAL,
IRIX_ENFILE,
IRIX_EMFILE,
IRIX_ENOTTY, /* 25 */
IRIX_ETXTBSY,
IRIX_EFBIG,
IRIX_ENOSPC,
IRIX_ESPIPE,
IRIX_EROFS, /* 30 */
IRIX_EMLINK,
IRIX_EPIPE,
IRIX_EDOM,
IRIX_ERANGE,
IRIX_EAGAIN, /* 35 */
IRIX_EWOULDBLOCK,
IRIX_EINPROGRESS,
IRIX_EALREADY,
IRIX_ENOTSOCK,
IRIX_EDESTADDRREQ, /* 40 */
IRIX_EMSGSIZE,
IRIX_EPROTOTYPE,
IRIX_ENOPROTOOPT,
IRIX_EPROTONOSUPPORT,
IRIX_ESOCKTNOSUPPORT, /* 45 */
IRIX_EOPNOTSUPP,
IRIX_EPFNOSUPPORT,
IRIX_EAFNOSUPPORT,
IRIX_EADDRINUSE,
IRIX_EADDRNOTAVAIL, /* 50 */
IRIX_ENETDOWN,
IRIX_ENETUNREACH,
IRIX_ENETRESET,
IRIX_ECONNABORTED,
IRIX_ECONNRESET, /* 55 */
IRIX_ENOBUFS,
IRIX_EISCONN,
IRIX_ENOTCONN,
IRIX_ESHUTDOWN,
IRIX_ETOOMANYREFS, /* 60 */
IRIX_ETIMEDOUT,
IRIX_ECONNREFUSED,
IRIX_ELOOP,
IRIX_ENAMETOOLONG,
IRIX_EHOSTDOWN, /* 65 */
IRIX_EHOSTUNREACH,
IRIX_ENOTEMPTY,
IRIX_EPROCLIM,
IRIX_EUSERS,
IRIX_EDQUOT, /* 70 */
IRIX_ESTALE,
IRIX_EREMOTE,
0, /* EBADRPC */
0, /* ERPCMISMATCH */
0, /* EPROGUNAVAIL */ /* 75 */
0, /* EPROGMISMATCH */
0, /* EPROCUNAVAIL */
IRIX_ENOLCK,
IRIX_ENOSYS,
0, /* EFTYPE */ /* 80 */
0, /* EAUTH */
0, /* ENEEDAUTH */
IRIX_EIDRM,
IRIX_ENOMSG,
IRIX_EOVERFLOW, /* 85 */
0, /* EILSEG */
0, /* ELAST */
IRIX_ERESTART,
0, /* EJUSTRETURN */
};

View File

@ -1,215 +0,0 @@
/* $NetBSD: irix_errno.h,v 1.4 2008/04/28 20:23:41 martin Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Emmanuel Dreyfus
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _IRIX_ERRNO_H_
#define _IRIX_ERRNO_H_
extern const int native_to_irix_errno[];
/* From IRIX's <sys/errno.h> */
#define IRIX_EPERM 1
#define IRIX_ENOENT 2
#define IRIX_ESRCH 3
#define IRIX_EINTR 4
#define IRIX_EIO 5
#define IRIX_ENXIO 6
#define IRIX_E2BIG 7
#define IRIX_ENOEXEC 8
#define IRIX_EBADF 9
#define IRIX_ECHILD 10
#define IRIX_EAGAIN 11
#define IRIX_ENOMEM 12
#define IRIX_EACCES 13
#define IRIX_EFAULT 14
#define IRIX_ENOTBLK 15
#define IRIX_EBUSY 16
#define IRIX_EEXIST 17
#define IRIX_EXDEV 18
#define IRIX_ENODEV 19
#define IRIX_ENOTDIR 20
#define IRIX_EISDIR 21
#define IRIX_EINVAL 22
#define IRIX_ENFILE 23
#define IRIX_EMFILE 24
#define IRIX_ENOTTY 25
#define IRIX_ETXTBSY 26
#define IRIX_EFBIG 27
#define IRIX_ENOSPC 28
#define IRIX_ESPIPE 29
#define IRIX_EROFS 30
#define IRIX_EMLINK 31
#define IRIX_EPIPE 32
#define IRIX_EDOM 33
#define IRIX_ERANGE 34
#define IRIX_ENOMSG 35
#define IRIX_EIDRM 36
#define IRIX_ECHRNG 37
#define IRIX_EL2NSYNC 38
#define IRIX_EL3HLT 39
#define IRIX_EL3RST 40
#define IRIX_ELNRNG 41
#define IRIX_EUNATCH 42
#define IRIX_ENOCSI 43
#define IRIX_EL2HLT 44
#define IRIX_EDEADLK 45
#define IRIX_ENOLCK 46
#define IRIX_ECKPT 47
#define IRIX_EBADE 50
#define IRIX_EBADR 51
#define IRIX_EXFULL 52
#define IRIX_ENOANO 53
#define IRIX_EBADRQC 54
#define IRIX_EBADSLT 55
#define IRIX_EDEADLOCK 56
#define IRIX_EBFONT 57
#define IRIX_ENOSTR 60
#define IRIX_ENODATA 61
#define IRIX_ETIME 62
#define IRIX_ENOSR 63
#define IRIX_ENONET 64
#define IRIX_ENOPKG 65
#define IRIX_EREMOTE 66
#define IRIX_ENOLINK 67
#define IRIX_EADV 68
#define IRIX_ESRMNT 69
#define IRIX_ECOMM 70
#define IRIX_EPROTO 71
#define IRIX_EMULTIHOP 74
#define IRIX_EBADMSG 77
#define IRIX_ENAMETOOLONG 78
#define IRIX_EOVERFLOW 79
#define IRIX_ENOTUNIQ 80
#define IRIX_EBADFD 81
#define IRIX_EREMCHG 82
#define IRIX_ELIBACC 83
#define IRIX_ELIBBAD 84
#define IRIX_ELIBSCN 85
#define IRIX_ELIBMAX 86
#define IRIX_ELIBEXEC 87
#define IRIX_EILSEQ 88
#define IRIX_ENOSYS 89
#define IRIX_ELOOP 90
#define IRIX_ERESTART 91
#define IRIX_ESTRPIPE 92
#define IRIX_ENOTEMPTY 93
#define IRIX_EUSERS 94
#define IRIX_ENOTSOCK 95
#define IRIX_EDESTADDRREQ 96
#define IRIX_EMSGSIZE 97
#define IRIX_EPROTOTYPE 98
#define IRIX_ENOPROTOOPT 99
#define IRIX_EPROTONOSUPPORT 120
#define IRIX_ESOCKTNOSUPPORT 121
#define IRIX_EOPNOTSUPP 122
#define IRIX_EPFNOSUPPORT 123
#define IRIX_EAFNOSUPPORT 124
#define IRIX_EADDRINUSE 125
#define IRIX_EADDRNOTAVAIL 126
#define IRIX_ENETDOWN 127
#define IRIX_ENETUNREACH 128
#define IRIX_ENETRESET 129
#define IRIX_ECONNABORTED 130
#define IRIX_ECONNRESET 131
#define IRIX_ENOBUFS 132
#define IRIX_EISCONN 133
#define IRIX_ENOTCONN 134
#define IRIX_ESHUTDOWN 143
#define IRIX_ETOOMANYREFS 144
#define IRIX_ETIMEDOUT 145
#define IRIX_ECONNREFUSED 146
#define IRIX_EHOSTDOWN 147
#define IRIX_EHOSTUNREACH 148
#define IRIX_LASTERRNO IRIX_ENOTCONN
#define IRIX_EWOULDBLOCK IRIX_EAGAIN
#define IRIX_EALREADY 149
#define IRIX_EINPROGRESS 150
#define IRIX_ESTALE 151
#define IRIX_EIORESID 500
#define IRIX_EUCLEAN 135
#define IRIX_ENOTNAM 137
#define IRIX_ENAVAIL 138
#define IRIX_EISNAM 139
#define IRIX_EREMOTEIO 140
#define IRIX_EINIT 141
#define IRIX_EREMDEV 142
#define IRIX_ECANCELED 158
/*
* The following seems to be kernel specific, it
* is possible that we don't need them.
*/
#define IRIX_ENOLIMFILE 1001
#define IRIX_EPROCLIM 1002
#define IRIX_EDISJOINT 1003
#define IRIX_ENOLOGIN 1004
#define IRIX_ELOGINLIM 1005
#define IRIX_EGROUPLOOP 1006
#define IRIX_ENOATTACH 1007
#define IRIX_ENOTSUP 1008
#define IRIX_ENOATTR 1009
#define IRIX_EFSCORRUPTED 1010
#define IRIX_EDIRCORRUPTED 1010
#define IRIX_EWRONGFS 1011
#define IRIX_EDQUOT 1133
#define IRIX_ENFSREMOTE 1135
#define IRIX_ECONTROLLER 1300
#define IRIX_ENOTCONTROLLER 1301
#define IRIX_EENQUEUED 1302
#define IRIX_ENOTENQUEUED 1303
#define IRIX_EJOINED 1304
#define IRIX_ENOTJOINED 1305
#define IRIX_ENOPROC 1306
#define IRIX_EMUSTRUN 1307
#define IRIX_ENOTSTOPPED 1308
#define IRIX_ECLOCKCPU 1309
#define IRIX_EINVALSTATE 1310
#define IRIX_ENOEXIST 1311
#define IRIX_EENDOFMINOR 1312
#define IRIX_EBUFSIZE 1313
#define IRIX_EEMPTY 1314
#define IRIX_ENOINTRGROUP 1315
#define IRIX_EINVALMODE 1316
#define IRIX_ECANTEXTENT 1317
#define IRIX_EINVALTIME 1318
#define IRIX_EDESTROYED 1319
#define IRIX_EBDHDL 1400
#define IRIX_EDELAY 1401
#define IRIX_ENOBWD 1402
#define IRIX_EBADRSPEC 1403
#define IRIX_EBADTSPEC 1404
#define IRIX_EBADFILT 1405
#define IRIX_EMIGRATED 1500
#define IRIX_EMIGRATING 1501
#define IRIX_ECELLDOWN 1502
#define IRIX_EMEMRETRY 1600
#endif /* _IRIX_ERRNO_H_ */

View File

@ -1,280 +0,0 @@
/* $NetBSD: irix_exec.c,v 1.59 2011/02/20 08:08:57 matt Exp $ */
/*-
* Copyright (c) 2001-2002 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Emmanuel Dreyfus.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: irix_exec.c,v 1.59 2011/02/20 08:08:57 matt Exp $");
#ifdef _KERNEL_OPT
#include "opt_syscall_debug.h"
#endif
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/proc.h>
#include <sys/rwlock.h>
#include <sys/exec.h>
#include <sys/types.h>
#include <sys/malloc.h>
#include <mips/locore.h>
#include <mips/regnum.h>
#include <uvm/uvm_extern.h>
#include <compat/irix/irix_syscall.h>
#include <compat/irix/irix_types.h>
#include <compat/irix/irix_exec.h>
#include <compat/irix/irix_prctl.h>
#include <compat/irix/irix_signal.h>
#include <compat/irix/irix_errno.h>
#include <compat/irix/irix_sysctl.h>
#include <compat/irix/irix_usema.h>
extern const int native_to_svr4_signo[];
static void irix_e_proc_exec(struct proc *, struct exec_package *);
static void irix_e_proc_fork(struct proc *, struct lwp *, int);
static void irix_e_proc_exit(struct proc *);
static void irix_e_proc_init(struct proc *);
extern struct sysent irix_sysent[];
extern const char * const irix_syscallnames[];
#ifndef __HAVE_SYSCALL_INTERN
void irix_syscall(void);
#else
void irix_syscall_intern(struct proc *);
#endif
/*
* Fake sigcode. COMPAT_IRIX does not use it, since the
* signal trampoline is provided by libc. However, some
* other part of the kernel will be happier if we still
* provide non NULL sigcode and esigcode.
*/
char irix_sigcode[] = { 0 };
struct emul emul_irix = {
.e_name = "irix",
.e_path = "/emul/irix",
#ifndef __HAVE_MINIMAL_EMUL
.e_flags = 0,
.e_errno = native_to_irix_errno,
.e_nosys = IRIX_SYS_syscall,
.e_nsysent = IRIX_SYS_NSYSENT,
#endif
.e_sysent = irix_sysent,
#ifdef SYSCALL_DEBUG
.e_syscallnames = irix_syscallnames,
#else
.e_syscallnames = NULL,
#endif
.e_sendsig = irix_sendsig,
.e_trapsignal = trapsignal,
.e_tracesig = NULL,
.e_sigcode = irix_sigcode,
.e_esigcode = irix_sigcode,
.e_sigobject = NULL,
.e_setregs = setregs,
.e_proc_exec = irix_e_proc_exec,
.e_proc_fork = irix_e_proc_fork,
.e_proc_exit = irix_e_proc_exit,
.e_lwp_fork = NULL,
.e_lwp_exit = NULL,
#ifdef __HAVE_SYSCALL_INTERN
.e_syscall_intern = irix_syscall_intern,
#else
.e_syscall = irix_syscall,
#endif
.e_fault = irix_vm_fault,
.e_vm_default_addr = uvm_default_mapaddr,
};
/*
* set registers on exec for N32 applications
*/
void
irix_n32_setregs(struct lwp *l, struct exec_package *pack, vaddr_t stack)
{
struct trapframe *tf = l->l_md.md_utf;
/* Enable 64 bit instructions (eg: sd) */
tf->tf_regs[_R_SR] |= MIPS3_SR_UX | MIPS3_SR_FR;
#ifdef _LP64
tf->tf_regs[_R_SR] |= MIPS3_SR_KX;
#endif
}
/*
* per-process emuldata allocation
*/
static void
irix_e_proc_init(struct proc *p)
{
struct irix_emuldata *ied;
struct vmspace *vmspace = p->p_vmspace;
vaddr_t vm_min;
vsize_t vm_len;
if (!p->p_emuldata)
p->p_emuldata = malloc(sizeof(struct irix_emuldata),
M_EMULDATA, M_WAITOK | M_ZERO);
ied = p->p_emuldata;
ied->ied_p = p;
LIST_INIT(&ied->ied_shared_regions);
vm_min = vm_map_min(&vmspace->vm_map);
vm_len = vm_map_max(&vmspace->vm_map) - vm_min;
irix_isrr_insert(vm_min, vm_len, IRIX_ISRR_SHARED, p);
}
/*
* exec() hook used to allocate per process structures
*/
static void
irix_e_proc_exec(struct proc *p, struct exec_package *epp)
{
int error;
irix_e_proc_init(p);
/* Initialize the process private area (PRDA) */
error = irix_prda_init(p);
#ifdef DEBUG_IRIX
if (error != 0)
printf("irix_e_proc_exec(): PRDA map failed ");
#endif
}
/*
* exit() hook used to free per process data structures
*/
static void
irix_e_proc_exit(struct proc *p)
{
struct proc *pp;
struct irix_emuldata *ied;
struct irix_share_group *isg;
struct irix_shared_regions_rec *isrr;
/*
* Send SIGHUP to child process as requested using prctl(2)
*/
mutex_enter(proc_lock);
PROCLIST_FOREACH(pp, &allproc) {
/* Select IRIX processes */
if (irix_check_exec(pp) == 0)
continue;
ied = (struct irix_emuldata *)(pp->p_emuldata);
if (ied->ied_termchild && pp->p_pptr == p)
psignal(pp, native_to_svr4_signo[SIGHUP]);
}
mutex_exit(proc_lock);
/*
* Remove the process from share group processes list, if relevant.
*/
ied = (struct irix_emuldata *)(p->p_emuldata);
if ((isg = ied->ied_share_group) != NULL) {
rw_enter(&isg->isg_lock, RW_WRITER);
LIST_REMOVE(ied, ied_sglist);
isg->isg_refcount--;
if (isg->isg_refcount == 0) {
/*
* This was the last process in the share group.
* Call irix_usema_exit_cleanup() to free in-kernel
* structures hold by the share group through
* the irix_usync_cntl system call.
*/
irix_usema_exit_cleanup(p, NULL);
/*
* Free the share group structure (no need to free
* the lock since we destroy it now).
*/
rw_destroy(&isg->isg_lock);
free(isg, M_EMULDATA);
ied->ied_share_group = NULL;
} else {
/*
* There are other processes remaining in the share
* group. Call irix_usema_exit_cleanup() to set the
* first of them as the owner of the structures
* hold in the kernel by the share group.
*/
irix_usema_exit_cleanup(p,
LIST_FIRST(&isg->isg_head)->ied_p);
rw_exit(&isg->isg_lock);
}
} else {
/*
* The process is not part of a share group. Call
* irix_usema_exit_cleanup() to free in-kernel structures hold
* by the process through the irix_usync_cntl system call.
*/
irix_usema_exit_cleanup(p, NULL);
}
/* Free (un)shared region list */
while (!LIST_EMPTY(&ied->ied_shared_regions)) {
isrr = LIST_FIRST(&ied->ied_shared_regions);
LIST_REMOVE(isrr , isrr_list);
free(isrr, M_EMULDATA);
}
free(p->p_emuldata, M_EMULDATA);
p->p_emuldata = NULL;
}
/*
* fork() hook used to allocate per process structures
*/
static void
irix_e_proc_fork(struct proc *p2, struct lwp *l1, int forkflags)
{
struct irix_emuldata *ied1;
struct irix_emuldata *ied2;
p2->p_emuldata = NULL;
irix_e_proc_init(p2);
ied1 = p2->p_emuldata;
ied2 = l1->l_proc->p_emuldata;
(void) memcpy(ied1, ied2, (unsigned)
((char *)&ied1->ied_endcopy - (char *)&ied1->ied_startcopy));
}

View File

@ -1,104 +0,0 @@
/* $NetBSD: irix_exec.h,v 1.28 2009/12/14 00:47:10 matt Exp $ */
/*-
* Copyright (c) 2001-2002 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Emmanuel Dreyfus.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _IRIX_EXEC_H_
#define _IRIX_EXEC_H_
#include <sys/types.h>
#include <sys/exec.h>
#include <sys/signal.h>
#include <sys/queue.h>
#include <sys/rwlock.h>
#include <sys/exec_elf.h>
#include <machine/vmparam.h>
#include <compat/svr4/svr4_types.h>
#include <compat/svr4/svr4_signal.h>
/* IRIX specific per-process data, zero'ed on allocation */
struct irix_emuldata {
#define ied_startcopy ied_sigtramp
void *ied_sigtramp[SVR4_NSIG]; /* Address of signal trampoline */
#define ied_endcopy ied_termchild
int ied_termchild; /* want SIGHUP on parent's exit */
int ied_procblk_count; /* semaphore for blockproc */
/* share group proc list head and lock */
struct irix_share_group *ied_share_group;
/* share group proc list itself */
LIST_ENTRY(irix_emuldata) ied_sglist;
struct proc *ied_p; /* points back to struct proc */
int ied_shareaddr; /* share VM with the group */
LIST_HEAD(ied_shared_regions, irix_shared_regions_rec)
ied_shared_regions; /* list of (un)shared memory regions */
};
/* e_flags used by IRIX for ABI selection */
#define IRIX_EF_IRIX_ABI64 0x00000010
#define IRIX_EF_IRIX_ABIN32 0x00000020
#define IRIX_EF_IRIX_ABIO32 0x00000000
#define IRIX_EF_IRIX_ABI_MASK 0x00000030
#define IRIX_ELF_AUX_ENTRIES 7
#define irix_check_exec(p) ((p)->p_emul == &emul_irix)
#ifdef EXEC_ELF32
#define IRIX_AUX_ARGSIZ howmany(IRIX_ELF_AUX_ENTRIES * \
sizeof(Aux32Info), sizeof (Elf32_Addr))
int irix_elf32_copyargs(struct lwp *, struct exec_package *,
struct ps_strings *, char **, void *);
int irix_elf32_probe_o32(struct lwp *, struct exec_package *, void *,
char *, vaddr_t *);
int irix_elf32_probe_n32(struct lwp *, struct exec_package *, void *,
char *, vaddr_t *);
#endif
#ifdef EXEC_ELF64
/* #define IRIX_AUX_ARGSIZ howmany(IRIX_ELF_AUX_ENTRIES * \
sizeof(Aux64Info), sizeof (Elf64_Addr)) */
int irix_elf64_copyargs(struct lwp *, struct exec_package *,
struct ps_strings *, char **, void *);
int irix_elf64_probe_n64(struct lwp *, struct exec_package *, void *,
char *, vaddr_t *);
#endif
void irix_n32_setregs(struct lwp *, struct exec_package *, vaddr_t);
extern struct emul emul_irix;
#endif /* !_IRIX_EXEC_H_ */

View File

@ -1,284 +0,0 @@
/* $NetBSD: irix_exec_elf32.c,v 1.16 2009/12/14 00:47:10 matt Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Emmanuel Dreyfus.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: irix_exec_elf32.c,v 1.16 2009/12/14 00:47:10 matt Exp $");
#ifndef ELFSIZE
#define ELFSIZE 32 /* XXX should die */
#endif
#include "opt_execfmt.h"
#include <sys/param.h>
#include <sys/types.h>
#include <sys/systm.h>
#include <sys/null.h>
#include <sys/malloc.h>
#include <sys/syslimits.h>
#include <sys/exec.h>
#include <sys/exec_elf.h>
#include <sys/errno.h>
#include <sys/namei.h> /* Used for irix_load_addr */
#include <sys/vnode.h> /* Used for irix_load_addr */
#include <machine/vmparam.h>
#include <uvm/uvm_extern.h>
#include <compat/common/compat_util.h>
#include <compat/irix/irix_exec.h>
#if ELFSIZE == 32
/*
* IRIX o32 ABI probe function
*/
int
ELFNAME2(irix,probe_o32)(struct lwp *l, struct exec_package *epp, void *eh,
char *itp, vaddr_t *pos)
{
int error = 0;
#ifdef DEBUG_IRIX
printf("irix_probe_o32()\n");
#endif
if ((((Elf_Ehdr *)epp->ep_hdr)->e_flags & IRIX_EF_IRIX_ABI_MASK) !=
IRIX_EF_IRIX_ABIO32)
return error;
if (itp) {
/* o32 binaries use /lib/libc.so.1 */
if (strncmp(itp, "/lib/libc.so", 12) &&
strncmp(itp, "/usr/lib/libc.so", 16))
return ENOEXEC;
if ((error = emul_find_interp(l, epp, itp)))
return error;
*pos = ELF_LINK_ADDR;
}
#ifdef DEBUG_IRIX
printf("irix_probe_o32: returning 0\n");
printf("epp->ep_vm_minaddr = 0x%lx\n", epp->ep_vm_minaddr);
#endif
epp->ep_vm_minaddr = epp->ep_vm_minaddr & ~0xfUL;
l->l_proc->p_md.md_abi = _MIPS_BSD_API_O32;
return 0;
}
/*
* IRIX n32 ABI probe function
*/
int
ELFNAME2(irix,probe_n32)(struct lwp *l, struct exec_package *epp, void *eh,
char *itp, vaddr_t *pos)
{
int error = 0;
#ifdef DEBUG_IRIX
printf("irix_probe_n32()\n");
#endif
if ((((Elf_Ehdr *)epp->ep_hdr)->e_flags & IRIX_EF_IRIX_ABI_MASK) !=
IRIX_EF_IRIX_ABIN32)
return error;
if (itp) {
/* n32 binaries use /lib32/libc.so.1 */
if (strncmp(itp, "/lib32/libc.so", 14) &&
strncmp(itp, "/usr/lib32/libc.so", 18))
return ENOEXEC;
if ((error = emul_find_interp(l, epp, itp)))
return error;
}
#ifdef DEBUG_IRIX
printf("irix_probe_n32: returning 0\n");
printf("epp->ep_vm_minaddr = 0x%lx\n", epp->ep_vm_minaddr);
#endif
epp->ep_vm_minaddr = epp->ep_vm_minaddr & ~0xfUL;
l->l_proc->p_md.md_abi = _MIPS_BSD_API_N32;
return 0;
}
#endif /* ELFSIZE == 32 */
#if ELFSIZE == 64
/*
* IRIX n64 ABI probe function
*/
int
irix_elf64_probe_n64(struct lwp *l, struct exec_package *epp, void *eh,
char *itp, vaddr_t *pos)
{
int error = 0;
#ifdef DEBUG_IRIX
printf("irix_probe_n64()\n");
#endif
if ((((Elf_Ehdr *)epp->ep_hdr)->e_flags & IRIX_EF_IRIX_ABI_MASK) !=
IRIX_EF_IRIX_ABI64)
return error;
if (itp) {
/* n32 binaries use /lib64/libc.so.1 */
if (strncmp(itp, "/lib64/libc.so", 14) &&
strncmp(itp, "/usr/lib64/libc.so", 18))
return ENOEXEC;
if ((error = emul_find_interp(l, epp, itp)))
return error;
}
#ifdef DEBUG_IRIX
printf("irix_probe_n32: returning 0\n");
printf("epp->ep_vm_minaddr = 0x%lx\n", epp->ep_vm_minaddr);
#endif
epp->ep_vm_minaddr = epp->ep_vm_minaddr & ~0xfUL;
l->l_proc->p_md.md_abi = _MIPS_BSD_API_N32;
return 0;
}
#endif /* ELFSIZE == 64 */
int
ELFNAME2(irix,copyargs)(l, pack, arginfo, stackp, argp)
struct lwp *l;
struct exec_package *pack;
struct ps_strings *arginfo;
char **stackp;
void *argp;
{
char **cpp, *dp, *sp;
size_t len;
void *nullp;
long argc, envc;
AuxInfo ai[IRIX_ELF_AUX_ENTRIES], *a;
struct elf_args *ap;
int error;
/*
* IRIX seems to expect argc and **argv to be aligned on a
* 16 bytes boundary. It seems there is no other way of
* getting **argv aligned than duplicating and customizing
* the code that sets up the stack in copyargs():
*/
#ifdef DEBUG_IRIX
printf("%s(): *stackp = %p\n", __func__, *stackp);
#endif
/*
* This is borrowed from sys/kern/kern_exec.c:copyargs()
*/
cpp = (char **)*stackp;
nullp = NULL;
argc = arginfo->ps_nargvstr;
envc = arginfo->ps_nenvstr;
if ((error = copyout(&argc, cpp++, sizeof(argc))) != 0)
return error;
dp = (char *) (cpp + argc + envc + 2 + pack->ep_esch->es_arglen);
/* Align **argv on a 16 bytes boundary */
dp = (char *)(((unsigned long)dp + 0xf) & ~0xfUL);
sp = argp;
arginfo->ps_argvstr = cpp; /* remember location of argv for later */
for (; --argc >= 0; sp += len, dp += len) {
#ifdef DEBUG_IRIX
printf("irix_elf32_copyargs(): argc = %d, cpp = %p, dp = %p\n", (int)argc, cpp, dp);
#endif
if ((error = copyout(&dp, cpp++, sizeof(dp))) != 0 ||
(error = copyoutstr(sp, dp, ARG_MAX, &len)) != 0)
return error;
}
if ((error = copyout(&nullp, cpp++, sizeof(nullp))) != 0)
return error;
arginfo->ps_envstr = cpp; /* remember location of envp for later */
for (; --envc >= 0; sp += len, dp += len)
if ((error = copyout(&dp, cpp++, sizeof(dp))) != 0 ||
(error = copyoutstr(sp, dp, ARG_MAX, &len)) != 0)
return error;
if ((error = copyout(&nullp, cpp++, sizeof(nullp))) != 0)
return error;
*stackp = (char *)cpp;
/*
* This is borrowed from sys/kern/exec_elf32.c:elf32_copyargs
*/
a = ai;
/*
* Push extra arguments on the stack needed by dynamically
* linked binaries
*/
if ((ap = (struct elf_args *)pack->ep_emul_arg)) {
a->a_type = AT_PHDR;
a->a_v = ap->arg_phaddr;
a++;
a->a_type = AT_PHENT;
a->a_v = ap->arg_phentsize;
a++;
a->a_type = AT_PHNUM;
a->a_v = ap->arg_phnum;
a++;
a->a_type = AT_ENTRY;
a->a_v = ap->arg_entry;
a++;
a->a_type = AT_BASE;
a->a_v = ap->arg_interp;
a++;
a->a_type = AT_PAGESZ;
a->a_v = PAGE_SIZE;
a++;
free((char *)ap, M_TEMP);
pack->ep_emul_arg = NULL;
}
a->a_type = AT_NULL;
a->a_v = 0;
a++;
len = (a - ai) * sizeof(AuxInfo);
if ((error = copyout(ai, *stackp, len)) != 0)
return error;
/* *stackp += len; */
#ifdef DEBUG_IRIX
printf("*stackp = %p\n", *stackp);
#endif
return 0;
}

View File

@ -1,5 +0,0 @@
/* $NetBSD: irix_exec_elf64.c,v 1.2 2009/12/14 00:47:10 matt Exp $ */
#define ELFSIZE 64
#include "irix_exec_elf32.c"

View File

@ -1,372 +0,0 @@
/* $NetBSD: irix_fcntl.c,v 1.28 2009/12/14 00:47:10 matt Exp $ */
/*-
* Copyright (c) 2001-2002 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Emmanuel Dreyfus.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: irix_fcntl.c,v 1.28 2009/12/14 00:47:10 matt Exp $");
#include <sys/types.h>
#include <sys/signal.h>
#include <sys/param.h>
#include <sys/mount.h>
#include <sys/proc.h>
#include <sys/conf.h>
#include <sys/malloc.h>
#include <sys/vnode.h>
#include <sys/file.h>
#include <sys/filedesc.h>
#include <sys/systm.h>
#include <sys/fcntl.h>
#include <sys/syscallargs.h>
#include <miscfs/specfs/specdev.h>
#include <compat/irix/irix_types.h>
#include <compat/irix/irix_signal.h>
#include <compat/irix/irix_fcntl.h>
#include <compat/irix/irix_usema.h>
#include <compat/irix/irix_syscallargs.h>
#include <compat/svr4/svr4_types.h>
#include <compat/svr4/svr4_signal.h>
#include <compat/svr4/svr4_ucontext.h>
#include <compat/svr4/svr4_lwp.h>
#include <compat/svr4/svr4_fcntl.h>
#include <compat/svr4/svr4_syscallargs.h>
static int fd_truncate(struct lwp *, int, int, off_t, register_t *);
static uintptr_t bsd_to_irix_fcntl_flags(uintptr_t);
static uintptr_t irix_to_bsd_fcntl_flags(uintptr_t);
int
irix_sys_lseek64(struct lwp *l, const struct irix_sys_lseek64_args *uap, register_t *retval)
{
/*
* Note: we have an alignement problem here. If pad2, pad3 and pad4
* are removed, lseek64 will break, because whence will be wrong.
*/
/* {
syscallarg(int) fd;
syscallarg(int) pad1;
syscallarg(irix_off64_t) offset;
syscallarg(int) whence;
syscallarg(int) pad2;
syscallarg(int) pad3;
syscallarg(int) pad4;
} */
struct sys_lseek_args cup;
#ifdef DEBUG_IRIX
printf("irix_sys_lseek64(): fd = %d, pad1 = 0x%08x, offset = 0x%llx\n",
SCARG(uap, fd), SCARG(uap, pad1), SCARG(uap, offset));
printf("whence = 0x%08x, pad2 = 0x%08x, pad3 = 0x%08x, pad4 = 0x%08x\n",
SCARG(uap, whence), SCARG(uap, pad2), SCARG(uap, pad3),
SCARG(uap, pad4));
#endif
SCARG(&cup, fd) = SCARG(uap, fd);
SCARG(&cup, PAD) = 0;
SCARG(&cup, offset) = SCARG(uap, offset);
SCARG(&cup, whence) = SCARG(uap, whence);
return sys_lseek(l, (void *)&cup, retval);
}
int
irix_sys_fcntl(struct lwp *l, const struct irix_sys_fcntl_args *uap, register_t *retval)
{
/* {
syscallarg(int) fd;
syscallarg(int) cmd;
syscallarg(char *)arg;
} */
struct svr4_sys_fcntl_args cup;
struct sys_fcntl_args bsd_ua;
int cmd;
int error;
cmd = SCARG(uap, cmd);
switch (cmd) {
case SVR4_F_FREESP:
case SVR4_F_ALLOCSP: {
struct svr4_flock fl;
if ((error = copyin(SCARG(uap, arg), &fl, sizeof(fl))) != 0)
return error;
return fd_truncate(l, SCARG(uap, fd),
fl.l_whence, fl.l_start, retval);
break;
}
case SVR4_F_FREESP64:
case IRIX_F_ALLOCSP64: {
struct svr4_flock64 fl;
if ((error = copyin(SCARG(uap, arg), &fl, sizeof(fl))) != 0)
return error;
return fd_truncate(l, SCARG(uap, fd),
fl.l_whence, fl.l_start, retval);
break;
}
case IRIX_F_SETBSDLKW:
cmd = SVR4_F_SETLKW;
break;
case IRIX_F_SETBSDLK:
cmd = SVR4_F_SETLK;
break;
case IRIX_F_GETFL:
SCARG(&bsd_ua, fd) = SCARG(uap, fd);
SCARG(&bsd_ua, cmd) = F_GETFL;
SCARG(&bsd_ua, arg) = SCARG(uap, arg);
if ((error = sys_fcntl(l, &bsd_ua, retval)) != 0)
return error;
*retval = bsd_to_irix_fcntl_flags(*retval);
return 0;
break;
case IRIX_F_SETFL:
/*
* All unsupported flags are silently ignored
* except FDIRECT taht will return EINVAL
*/
if ((uintptr_t)SCARG(uap, arg) & IRIX_FDIRECT)
return EINVAL;
SCARG(&bsd_ua, fd) = SCARG(uap, fd);
SCARG(&bsd_ua, arg) =
(char *)irix_to_bsd_fcntl_flags((uintptr_t)SCARG(uap, arg));
SCARG(&bsd_ua, cmd) = F_SETFL;
return sys_fcntl(l, &bsd_ua, retval);
break;
case SVR4_F_DUPFD:
case SVR4_F_GETFD:
case SVR4_F_SETFD:
case SVR4_F_SETLK:
case SVR4_F_SETLKW:
case SVR4_F_CHKFL:
case SVR4_F_GETLK:
case SVR4_F_RSETLK:
case SVR4_F_RGETLK:
case SVR4_F_RSETLKW:
case SVR4_F_GETOWN:
case SVR4_F_SETOWN:
case SVR4_F_GETLK64:
case SVR4_F_SETLK64:
case SVR4_F_SETLKW64:
break;
case IRIX_F_CHKLK:
case IRIX_F_CHKLKW:
case IRIX_F_CLNLK:
case IRIX_F_DIOINFO:
case IRIX_F_FSGETXATTR:
case IRIX_F_FSSETXATTR:
case IRIX_F_GETBMAP:
case IRIX_F_FSSETDM:
case IRIX_F_RESVSP:
case IRIX_F_UNRESVSP:
case IRIX_F_RESVSP64:
case IRIX_F_UNRESVSP64:
case IRIX_F_GETBMAPA:
case IRIX_F_FSGETXATTRA:
case IRIX_F_SETBIOSIZE:
case IRIX_F_GETBIOSIZE:
case IRIX_F_GETOPS:
case IRIX_F_DMAPI:
case IRIX_F_FSYNC:
case IRIX_F_FSYNC64:
case IRIX_F_GETBDSATTR:
case IRIX_F_SETBDSATTR:
case IRIX_F_GETBMAPX:
case IRIX_F_SETPRIO:
case IRIX_F_GETPRIO:
default:
printf("Warning: unimplemented IRIX fcntl() command %d\n",
cmd);
return EINVAL;
break;
}
SCARG(&cup, fd) = SCARG(uap, fd);
SCARG(&cup, cmd) = cmd;
SCARG(&cup, arg) = SCARG(uap, arg);
return svr4_sys_fcntl(l, &cup, retval);
}
static int
fd_truncate(struct lwp *l, int fd, int whence, off_t start, register_t *retval)
{
file_t *fp;
struct vnode *vp;
struct vattr vattr;
struct sys_ftruncate_args ft;
int error;
if ((error = fd_getvnode(fd, &fp)) != 0)
return EBADF;
vp = fp->f_data;
if (vp->v_type == VFIFO) {
fd_putfile(fd);
return ESPIPE;
}
switch (whence) {
case SEEK_CUR:
SCARG(&ft, length) = fp->f_offset + start;
break;
case SEEK_END:
if ((error = VOP_GETATTR(vp, &vattr, l->l_cred)) != 0)
return error;
SCARG(&ft, length) = vattr.va_size + start;
break;
case SEEK_SET:
SCARG(&ft, length) = start;
break;
default:
return EINVAL;
break;
}
fd_putfile(fd);
SCARG(&ft, fd) = fd;
return sys_ftruncate(l, &ft, retval);
}
int
irix_sys_open(struct lwp *l, const struct irix_sys_open_args *uap, register_t *retval)
{
/* {
syscallarg(char *) path;
syscallarg(int) flags;
syscallarg(mode_t) mode;
} */
extern const struct cdevsw irix_usema_cdevsw;
int error;
int fd;
file_t *fp;
struct vnode *vp;
struct vnode *nvp;
if ((error = svr4_sys_open(l, (const void *)uap, retval)) != 0)
return error;
fd = (int)*retval;
if ((fp = fd_getfile(fd)) == NULL)
return EBADF;
vp = fp->f_data;
/*
* A special hook for the usemaclone driver: we need to clone
* the vnode, because the driver method need a context for each
* usemaclone open instance, and because we need to overload
* some vnode operations like setattr.
* The original vnode is stored in the v_data field of the cloned
* vnode.
*/
if (vp->v_type == VCHR &&
cdevsw_lookup(vp->v_rdev) == &irix_usema_cdevsw &&
minor(vp->v_rdev) == IRIX_USEMACLNDEV_MINOR) {
if ((error = getnewvnode(VCHR, vp->v_mount,
irix_usema_vnodeop_p,
(struct vnode **)&fp->f_data)) != 0) {
(void) vn_close(vp, fp->f_flag, fp->f_cred);
fd_close(fd);
return error;
}
nvp = (struct vnode *)fp->f_data;
if (SCARG(uap, flags) & O_RDWR || SCARG(uap, flags) & O_WRONLY)
nvp->v_writecount++;
nvp->v_type = VCHR;
nvp->v_rdev = vp->v_rdev;
nvp->v_specmountpoint = vp->v_specmountpoint;
nvp->v_data = (void *)vp;
vref(vp);
}
fd_putfile(fd);
return 0;
}
static uintptr_t
irix_to_bsd_fcntl_flags(uintptr_t flags)
{
uintptr_t ret = 0;
if (flags & IRIX_FNDELAY) ret |= FNDELAY;
if (flags & IRIX_FAPPEND) ret |= FAPPEND;
if (flags & IRIX_FSYNC) ret |= FFSYNC;
if (flags & IRIX_FDSYNC) ret |= FDSYNC;
if (flags & IRIX_FASYNC) ret |= FASYNC;
if (flags & IRIX_FRSYNC) ret |= FRSYNC;
if (flags & IRIX_FNONBLOCK) ret |= FNONBLOCK;
if (flags & IRIX_FLARGEFILE)
printf("Warning: ignored fcntl IRIX_FLARGEFILE flag");
if (flags & IRIX_FDIRECT)
printf("Warning: ignored fcntl IRIX_FDIRECT flag");
if (flags & IRIX_FBULK)
printf("Warning: ignored fcntl IRIX_FBULK flag");
if (flags & IRIX_FLCINVAL)
printf("Warning: ignored fcntl IRIX_FLCINVAL flag");
if (flags & IRIX_FLCFLUSH)
printf("Warning: ignored fcntl IRIX_FLCFLUSH flag");
return ret;
}
static uintptr_t
bsd_to_irix_fcntl_flags(uintptr_t flags)
{
uintptr_t ret = 0;
if (flags & FNDELAY) ret |= IRIX_FNDELAY;
if (flags & FAPPEND) ret |= IRIX_FAPPEND;
if (flags & FFSYNC) ret |= IRIX_FSYNC;
if (flags & FDSYNC) ret |= IRIX_FDSYNC;
if (flags & FRSYNC) ret |= IRIX_FRSYNC;
if (flags & FNONBLOCK) ret |= IRIX_FNONBLOCK;
if (flags & FASYNC) ret |= IRIX_FASYNC;
return ret;
}

View File

@ -1,101 +0,0 @@
/* $NetBSD: irix_fcntl.h,v 1.3 2008/04/28 20:23:41 martin Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Emmanuel Dreyfus
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _IRIX_FCNTL_H_
#define _IRIX_FCNTL_H_
#include <compat/svr4/svr4_fcntl.h>
/* From IRIX's <sys/fcntl.h> */
#define IRIX_F_DUPFD SVR4_F_DUPFD
#define IRIX_F_GETFD SVR4_F_GETFD
#define IRIX_F_SETFD SVR4_F_SETFD
#define IRIX_F_GETFL SVR4_F_GETFL
#define IRIX_F_SETFL SVR4_F_SETFL
#define IRIX_F_SETLK SVR4_F_SETLK
#define IRIX_F_SETLKW SVR4_F_SETLKW
#define IRIX_F_CHKFL SVR4_F_CHKFL
#define IRIX_F_ALLOCSP SVR4_F_ALLOCSP
#define IRIX_F_FREESP SVR4_F_FREESP
#define IRIX_F_SETBSDLK 12
#define IRIX_F_SETBSDLKW 13
#define IRIX_F_GETLK SVR4_F_GETLK
#define IRIX_F_CHKLK 15
#define IRIX_F_CHKLKW 16
#define IRIX_F_CLNLK 17
#define IRIX_F_RSETLK SVR4_F_RSETLK
#define IRIX_F_RGETLK SVR4_F_RGETLK
#define IRIX_F_RSETLKW SVR4_F_RSETLKW
#define IRIX_F_GETOWN SVR4_F_GETOWN
#define IRIX_F_SETOWN SVR4_F_SETOWN
#define IRIX_F_DIOINFO 30
#define IRIX_F_FSGETXATTR 31
#define IRIX_F_FSSETXATTR 32
#define IRIX_F_GETLK64 SVR4_F_GETLK64
#define IRIX_F_SETLK64 SVR4_F_SETLK64
#define IRIX_F_SETLKW64 SVR4_F_SETLKW64
#define IRIX_F_ALLOCSP64 36
#define IRIX_F_FREESP64 SVR4_F_FREESP64
#define IRIX_F_GETBMAP 38
#define IRIX_F_FSSETDM 39
#define IRIX_F_RESVSP 40
#define IRIX_F_UNRESVSP 41
#define IRIX_F_RESVSP64 42
#define IRIX_F_UNRESVSP64 43
#define IRIX_F_GETBMAPA 44
#define IRIX_F_FSGETXATTRA 45
#define IRIX_F_SETBIOSIZE 46
#define IRIX_F_GETBIOSIZE 47
#define IRIX_F_GETOPS 50
#define IRIX_F_DMAPI 51
#define IRIX_F_FSYNC 52
#define IRIX_F_FSYNC64 53
#define IRIX_F_GETBDSATTR 54
#define IRIX_F_SETBDSATTR 55
#define IRIX_F_GETBMAPX 56
#define IRIX_F_SETPRIO 57
#define IRIX_F_GETPRIO 58
/* fcntl F_GETFL flags */
#define IRIX_FNDELAY 0x000004
#define IRIX_FAPPEND 0x000008
#define IRIX_FSYNC 0x000010
#define IRIX_FDSYNC 0x000020
#define IRIX_FRSYNC 0x000040
#define IRIX_FNONBLOCK 0x000080
#define IRIX_FASYNC 0x001000
#define IRIX_FLARGEFILE 0x002000
#define IRIX_FDIRECT 0x008000
#define IRIX_FBULK 0x010000
#define IRIX_FLCINVAL 0x020000
#define IRIX_FLCFLUSH 0x040000
#endif /* _IRIX_FCNTL_H_ */

View File

@ -1,178 +0,0 @@
/* $NetBSD: irix_ioctl.c,v 1.20 2008/04/28 20:23:41 martin Exp $ */
/*-
* Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Emmanuel Dreyfus
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: irix_ioctl.c,v 1.20 2008/04/28 20:23:41 martin Exp $");
#include <sys/param.h>
#include <sys/proc.h>
#include <sys/systm.h>
#include <sys/mount.h>
#include <sys/file.h>
#include <sys/filio.h>
#include <sys/filedesc.h>
#include <sys/ioctl.h>
#include <sys/vnode.h>
#include <sys/types.h>
#include <sys/syscallargs.h>
#include <sys/conf.h>
#include <miscfs/specfs/specdev.h>
#include <compat/common/compat_util.h>
#include <compat/svr4/svr4_types.h>
#include <compat/svr4/svr4_lwp.h>
#include <compat/svr4/svr4_ucontext.h>
#include <compat/svr4/svr4_signal.h>
#include <compat/svr4/svr4_syscall.h>
#include <compat/svr4/svr4_syscallargs.h>
#include <compat/irix/irix_ioctl.h>
#include <compat/irix/irix_usema.h>
#include <compat/irix/irix_signal.h>
#include <compat/irix/irix_types.h>
#include <compat/irix/irix_exec.h>
#include <compat/irix/irix_syscallargs.h>
int
irix_sys_ioctl(struct lwp *l, const struct irix_sys_ioctl_args *uap, register_t *retval)
{
/* {
syscallarg(int) fd;
syscallarg(u_long) com;
syscallarg(void *) data;
} */
extern const struct cdevsw irix_usema_cdevsw;
u_long cmd;
void *data;
file_t *fp;
struct vnode *vp;
struct vattr vattr;
struct irix_ioctl_usrdata iiu;
int error, val, fd;
/*
* This duplicates 6 lines from svr4_sys_ioctl()
* It would be nice to merge it.
*/
fd = SCARG(uap, fd);
cmd = SCARG(uap, com);
data = SCARG(uap, data);
if ((fp = fd_getfile(fd)) == NULL)
return EBADF;
if ((fp->f_flag & (FREAD | FWRITE)) == 0) {
fd_putfile(fd);
return EBADF;
}
/*
* A special hook for /dev/usemaclone ioctls. Some of the ioctl
* commands need to set the return value, which is normally
* impossible in the file methods and lower. We do the job by
* copying the retval address and the data argument to a
* struct irix_ioctl_usrdata. The data argument
* is set to the address of the structure, and the underlying
* code will be able to retreive both data and the retval address
* from the struct irix_ioctl_usrdata.
*
* We also bypass the checks in sys_ioctl() because theses ioctl
* are defined _IO but really are _IOR. XXX need security review.
*/
if ((cmd & IRIX_UIOC_MASK) == IRIX_UIOC) {
if (fp->f_type != DTYPE_VNODE) {
fd_putfile(fd);
return ENOTTY;
}
vp = fp->f_data;
if (vp->v_type != VCHR ||
cdevsw_lookup(vp->v_rdev) != &irix_usema_cdevsw ||
minor(vp->v_rdev) != IRIX_USEMACLNDEV_MINOR) {
error = ENOTTY;
goto out;
}
iiu.iiu_data = data;
iiu.iiu_retval = retval;
error = (*fp->f_ops->fo_ioctl)(fp, cmd, &iiu);
out:
fd_putfile(fd);
return error;
}
switch (cmd) {
case IRIX_SIOCNREAD: /* number of bytes to read */
error = (*(fp->f_ops->fo_ioctl))(fp, FIONREAD,
SCARG(uap, data));
fd_putfile(fd);
return error;
case IRIX_MTIOCGETBLKSIZE: /* get tape block size in 512B units */
if (fp->f_type != DTYPE_VNODE) {
fd_putfile(fd);
return ENOSYS;
}
vp = fp->f_data;
switch (vp->v_type) {
case VREG:
case VLNK:
case VDIR:
error = ENOTTY;
break;
case VCHR:
case VFIFO:
error = EINVAL;
break;
case VBLK:
error = VOP_GETATTR(vp, &vattr, l->l_cred);
if (error == 0) {
val = vattr.va_blocksize / 512;
error = copyout(&val, data, sizeof(int));
}
default:
error = ENOSYS;
break;
}
fd_putfile(fd);
return error;
default: /* Fallback to the standard SVR4 ioctl's */
fd_putfile(fd);
return svr4_sys_ioctl(l, (const void *)uap, retval);
}
}

View File

@ -1,49 +0,0 @@
/* $NetBSD: irix_ioctl.h,v 1.7 2008/04/28 20:23:41 martin Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Emmanuel Dreyfus
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _IRIX_IOCTL_H_
#define _IRIX_IOCTL_H_
#include <compat/svr4/svr4_ioctl.h>
struct irix_ioctl_usrdata {
void *iiu_data;
register_t *iiu_retval;
};
/* From IRIX's <net/raw.h> */
#define IRIX_SIOCNREAD SVR4_IOR('s', 10, int)
/* From IRIX's <sys/mtio.h> */
#define IRIX_MTIOCODE(x) ('t'<<8|(x))
#define IRIX_MTIOCGETBLKSIZE IRIX_MTIOCODE('c')
#endif /* _IRIX_IOCTL_H_ */

View File

@ -1,132 +0,0 @@
/* $NetBSD: irix_kmem.c,v 1.10 2009/08/31 05:36:23 dholland Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Emmanuel Dreyfus.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: irix_kmem.c,v 1.10 2009/08/31 05:36:23 dholland Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/proc.h>
#include <sys/errno.h>
#include <sys/ioctl.h>
#include <sys/device.h>
#include <sys/vnode.h>
#include <sys/conf.h>
#include <compat/irix/irix_kmem.h>
#include <compat/irix/irix_sysmp.h>
/*
* We have no idea of theses value's meaning yet, but time will come
*/
long irix_kernel_var[32] = { 0x7fff2fc8, 0x0fb72194, 0x00000000, 0x0fb68890,
0x7fff2f74, 0x7fff2fc8, 0x7fff2fc8, 0x7fff2f74,
0x7fff2f7c, 0x0fb7246c, 0x0fbd9178, 0x0fb910d4,
0x0fb65440, 0x00000800, 0x00400034, 0x0000000a,
0x00000008, 0x0fb73fb0, 0x00000000, 0x00000000,
0x00000000, 0x7fff3000, 0x00000001, 0x7fff2f74,
0x7fff2d24, 0x0fa85880, 0x00000001, 0x0fb60188,
0x00000004, 0x00000000, 0x00000000, 0x00000001,
};
struct irix_kmem_softc {
struct device irix_kmem_dev;
};
dev_type_open(irix_kmemopen);
dev_type_close(irix_kmemclose);
dev_type_read(irix_kmemread);
dev_type_write(irix_kmemwrite);
const struct cdevsw irix_kmem_cdevsw = {
irix_kmemopen, irix_kmemclose, irix_kmemread, irix_kmemwrite,
noioctl, nostop, notty, nopoll, nommap, nokqfilter,
};
void
irix_kmemattach(struct device *parent, struct device *self, void *aux)
{
return;
}
int
irix_kmemopen(dev_t dev, int flags, int fmt, struct lwp *l)
{
return 0;
}
int
irix_kmemread(dev_t dev, struct uio *uio, int flag)
{
void *buf = NULL;
off_t buflen = 0;
void *offset;
int error = 0;
#ifdef DEBUG_IRIX
printf("irix_kmemread(): offset = 0x%08lx\n", (long)uio->uio_offset);
printf("irix_kmemread(): addr = %p\n", uio->uio_iov->iov_base);
printf("irix_kmemread(): len = 0x%08lx\n", (long)uio->uio_iov->iov_len);
#endif
offset = (void *)(uintptr_t)uio->uio_offset; /* XXX */
if (offset == &averunnable) { /* load average */
struct irix_loadavg iav;
int scale = averunnable.fscale / IRIX_LOADAVG_SCALE;
(void)memset(&iav, 0, sizeof(iav));
iav.ldavg[0] = averunnable.ldavg[0] / scale;
iav.ldavg[1] = averunnable.ldavg[1] / scale;
iav.ldavg[2] = averunnable.ldavg[2] / scale;
buf = (void *)&iav;
buflen = sizeof(iav);
}
if (offset == &irix_kernel_var) { /* kernel variables */
buf = &irix_kernel_var;
buflen = sizeof(irix_kernel_var);
}
if (buflen != 0)
error = uiomove(buf, buflen, uio);
return error;
}
int
irix_kmemwrite(dev_t dev, struct uio *uio, int flag)
{
return 0;
}
int
irix_kmemclose(dev_t dev, int flags, int fmt, struct lwp *l)
{
return 0;
}

View File

@ -1,49 +0,0 @@
/* $NetBSD: irix_kmem.h,v 1.4 2008/04/28 20:23:41 martin Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Emmanuel Dreyfus.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _IRIX_KMEM_H_
#define _IRIX_KMEM_H_
#include <sys/param.h>
#include <sys/device.h>
#ifdef _KERNEL
void irix_kmemattach(struct device *, struct device *, void *);
#endif
/* IRIX well-known kernel structures referenced by sysmp() */
#define IRIX_LOADAVG_SCALE 1000;
struct irix_loadavg {
uint32_t ldavg[3];
uint32_t pad;
};
#endif /* _IRIX_KMEM_H_ */

View File

@ -1,141 +0,0 @@
/* $NetBSD: irix_misc.c,v 1.12 2008/04/28 20:23:41 martin Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Emmanuel Dreyfus.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: irix_misc.c,v 1.12 2008/04/28 20:23:41 martin Exp $");
#include <sys/types.h>
#include <sys/signal.h>
#include <sys/systm.h>
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/proc.h>
#include <sys/mount.h>
#include <sys/syscallargs.h>
#include <compat/svr4/svr4_types.h>
#include <compat/svr4/svr4_lwp.h>
#include <compat/svr4/svr4_signal.h>
#include <compat/svr4/svr4_ucontext.h>
#include <compat/svr4/svr4_utsname.h>
#include <compat/svr4/svr4_syscallargs.h>
#include <compat/irix/irix_types.h>
#include <compat/irix/irix_signal.h>
#include <compat/irix/irix_exec.h>
#include <compat/irix/irix_sysctl.h>
#include <compat/irix/irix_syscallargs.h>
/*
* This is copied from sys/compat/sunos/sunos_misc.c:sunos_sys_setpgrp()
* Maybe consider moving this to sys/compat/common/compat_util.c?
*/
int
irix_sys_setpgrp(struct lwp *l, const struct irix_sys_setpgrp_args *uap, register_t *retval)
{
/* {
syscallarg(int) pid;
syscallarg(int) pgid;
} */
struct proc *p = l->l_proc;
/*
* difference to our setpgid call is to include backwards
* compatibility to pre-setsid() binaries. Do setsid()
* instead of setpgid() in those cases where the process
* tries to create a new session the old way.
*/
if (!SCARG(uap, pgid) &&
(!SCARG(uap, pid) || SCARG(uap, pid) == p->p_pid))
return sys_setsid(l, uap, retval);
else
return sys_setpgid(l, (const void *)uap, retval);
}
#define BUF_SIZE 16
int
irix_sys_uname(struct lwp *l, const struct irix_sys_uname_args *uap, register_t *retval)
{
/* {
syscallarg(struct irix_utsname *) name;
} */
struct irix_utsname sut;
char irix_release[BUF_SIZE + 1];
snprintf(irix_release, sizeof(irix_release), "%s.%s",
irix_si_osrel_maj, irix_si_osrel_min);
memset(&sut, 0, sizeof(sut));
strncpy(sut.sysname, irix_si_os_name, sizeof(sut.sysname));
sut.sysname[sizeof(sut.sysname) - 1] = '\0';
strncpy(sut.nodename, hostname, sizeof(sut.nodename));
sut.nodename[sizeof(sut.nodename) - 1] = '\0';
strncpy(sut.release, irix_release, sizeof(sut.release));
sut.release[sizeof(sut.release) - 1] = '\0';
strncpy(sut.version, irix_si_version, sizeof(sut.version));
sut.version[sizeof(sut.version) - 1] = '\0';
strncpy(sut.machine, irix_si_hw_name, sizeof(sut.machine));
sut.machine[sizeof(sut.machine) - 1] = '\0';
return copyout((void *) &sut, (void *) SCARG(uap, name),
sizeof(struct irix_utsname));
}
int
irix_sys_utssys(struct lwp *l, const struct irix_sys_utssys_args *uap, register_t *retval)
{
/* {
syscallarg(void *) a1;
syscallarg(void *) a2;
syscallarg(int) sel;
syscallarg(void) a3;
} */
switch (SCARG(uap, sel)) {
case 0: { /* uname(2) */
struct irix_sys_uname_args ua;
SCARG(&ua, name) = SCARG(uap, a1);
return irix_sys_uname(l, &ua, retval);
}
break;
default:
return(svr4_sys_utssys(l, (const void *)uap, retval));
break;
}
return 0;
}

View File

@ -1,268 +0,0 @@
/* $NetBSD: irix_mman.c,v 1.24 2010/06/24 13:03:06 hannken Exp $ */
/*-
* Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Emmanuel Dreyfus.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: irix_mman.c,v 1.24 2010/06/24 13:03:06 hannken Exp $");
#if defined(_KERNEL_OPT)
#include "opt_sysv.h"
#endif
#include <sys/types.h>
#include <sys/param.h>
#include <sys/signal.h>
#include <sys/proc.h>
#include <sys/exec.h>
#include <sys/filedesc.h>
#include <sys/file.h>
#include <sys/vnode.h>
#include <sys/vnode_if.h>
#include <sys/mount.h>
#include <sys/rwlock.h>
#include <sys/systm.h>
#include <sys/syscallargs.h>
#include <compat/svr4/svr4_types.h>
#include <compat/svr4/svr4_lwp.h>
#include <compat/svr4/svr4_ucontext.h>
#include <compat/svr4/svr4_signal.h>
#include <compat/svr4/svr4_syscallargs.h>
#include <compat/irix/irix_types.h>
#include <compat/irix/irix_signal.h>
#include <compat/irix/irix_mman.h>
#include <compat/irix/irix_prctl.h>
#include <compat/irix/irix_exec.h>
#include <compat/irix/irix_syscallargs.h>
static int irix_mmap(struct lwp *, void *, size_t, int ,
int, int, off_t, register_t *);
int
irix_sys_mmap(struct lwp *l, const struct irix_sys_mmap_args *uap, register_t *retval)
{
/* {
syscallarg(void *) addr;
syscallarg(irix_size_t) len;
syscallarg(int) prot;
syscallarg(int) flags;
syscallarg(int) fd;
syscallarg(irix_off_t) pos;
} */
return irix_mmap(l, SCARG(uap, addr), SCARG(uap, len),
SCARG(uap, prot), SCARG(uap, flags), SCARG(uap, fd),
SCARG(uap, pos), retval);
}
int
irix_sys_mmap64(struct lwp *l, const struct irix_sys_mmap64_args *uap, register_t *retval)
{
/* {
syscallarg(void *) addr;
syscallarg(irix_size_t) len;
syscallarg(int) prot;
syscallarg(int) flags;
syscallarg(int) fd;
syscallarg(int) pad1;
syscallarg(irix_off64_t) pos;
} */
return irix_mmap(l, SCARG(uap, addr), SCARG(uap, len),
SCARG(uap, prot), SCARG(uap, flags), SCARG(uap, fd),
SCARG(uap, pos), retval);
}
static int
irix_mmap(struct lwp *l, void *addr, size_t len, int prot, int flags, int fd, off_t pos, register_t *retval)
{
struct proc *p = l->l_proc;
struct sys_mmap_args cup;
int bsd_flags = 0;
int error = 0;
#ifdef DEBUG_IRIX
printf("irix_sys_mmap(): addr = %p, len = 0x%x, prot = 0x%x ",
addr, len, prot);
printf("flags = 0x%x, fd = %d, pos = 0x%lx\n", flags, fd, (long)pos);
#endif
if (flags & IRIX_MAP_SHARED)
bsd_flags |= MAP_SHARED;
if (flags & IRIX_MAP_PRIVATE)
bsd_flags |= MAP_PRIVATE;
if (flags & IRIX_MAP_COPY)
bsd_flags |= MAP_PRIVATE;
/*
* Note about MAP_FIXED: IRIX's mmap(2) states that
* when MAP_FIXED is unset, range 0x30000000 to 0x40000000
* will not be used except if MAP_SGI_ANYADDR is set
* or if syssgi(SGI_UNSUPPORTED_MAP_RESERVED_RANGE) was
* enabled. We do not emulate this behavior for now.
*/
if (flags & IRIX_MAP_FIXED)
bsd_flags |= MAP_FIXED;
if (flags & IRIX_MAP_RENAME)
bsd_flags |= MAP_RENAME;
if (flags & IRIX_MAP_AUTORESRV)
printf("Warning: unsupported IRIX mmap() flag MAP_AUTORESV\n");
if (flags & IRIX_MAP_TEXT)
printf("Warning: unsupported IRIX mmap() flag MAP_TEXT\n");
if (flags & IRIX_MAP_BRK)
printf("Warning: unsupported IRIX mmap() flag MAP_BRK\n");
if (flags & IRIX_MAP_PRIMARY)
printf("Warning: unsupported IRIX mmap() flag MAP_PRIMARY\n");
if (flags & IRIX_MAP_SGI_ANYADDR)
printf("Warning: unsupported IRIX mmap() flag IRIX_MAP_SGI_ANYADDR\n");
/*
* When AUTOGROW is set and the mapping is bigger than
* the file, if pages beyond the end of file are touched,
* IRIX will increase the file size accordingly. We are
* not able to emulate this (yet), hence we immediatly
* grow the file to fit the mapping, before mapping it.
*/
if (flags & IRIX_MAP_AUTOGROW) {
file_t *fp;
struct vnode *vp;
struct vattr vattr;
if ((error = fd_getvnode(fd, &fp)) != 0)
return error;
if ((fp->f_flag & FWRITE) == 0) {
error = EINVAL;
goto out;
}
vp = fp->f_data;
if (vp->v_type == VFIFO) {
error = ESPIPE;
goto out;
}
if (vp->v_type == VDIR) {
error = EISDIR;
goto out;
}
if ((error = VOP_GETATTR(vp, &vattr, l->l_cred)) != 0)
goto out;
if (pos + len > vattr.va_size) {
vattr_null(&vattr);
vattr.va_size = round_page(pos + len);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
error = VOP_SETATTR(vp, &vattr, l->l_cred);
VOP_UNLOCK(vp);
}
out:
fd_putfile(fd);
if (error)
return error;
}
SCARG(&cup, addr) = addr;
SCARG(&cup, len) = len;
SCARG(&cup, prot) = prot;
SCARG(&cup, flags) = bsd_flags;
SCARG(&cup, fd) = fd;
SCARG(&cup, pos) = pos;
/* A private mapping that should not be visible to the share group */
if (flags & IRIX_MAP_LOCAL) {
if ((error = sys_mmap(l, &cup, retval)) != 0)
return error;
addr = (void *)*retval;
irix_isrr_insert((vaddr_t)addr, len, IRIX_ISRR_PRIVATE, p);
return 0;
}
IRIX_VM_SYNC(p, error = sys_mmap(l, &cup, retval));
return error;
}
int
irix_sys_munmap(struct lwp *l, const struct irix_sys_munmap_args *uap, register_t *retval)
{
/* {
syscallarg(void *) addr;
syscallarg(size_t) len;
} */
struct proc *p = l->l_proc;
int error;
IRIX_VM_SYNC(p, error = sys_munmap(l, (const void *)uap, retval));
if (error == 0)
irix_isrr_insert((vaddr_t)SCARG(uap, addr),
SCARG(uap, len), IRIX_ISRR_SHARED, p);
return error;
}
int
irix_sys_break(struct lwp *l, const struct irix_sys_break_args *uap, register_t *retval)
{
struct proc *p = l->l_proc;
int error;
IRIX_VM_SYNC(p, error = svr4_sys_break(l, (const void *)uap, retval));
return error;
}
#ifdef SYSVSHM
int
irix_sys_shmsys(struct lwp *l, const struct irix_sys_shmsys_args *uap, register_t *retval)
{
struct proc *p = l->l_proc;
int error;
IRIX_VM_SYNC(p, error = svr4_sys_shmsys(l, (const void *)uap, retval));
return error;
}
#endif
int
irix_sys_mprotect(struct lwp *l, const struct irix_sys_mprotect_args *uap, register_t *retval)
{
struct proc *p = l->l_proc;
int error;
IRIX_VM_SYNC(p, error = sys_mprotect(l, (const void *)uap, retval));
return error;
}

View File

@ -1,52 +0,0 @@
/* $NetBSD: irix_mman.h,v 1.2 2008/04/28 20:23:41 martin Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Emmanuel Dreyfus.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _IRIX_MMAN_H_
#define _IRIX_MMAN_H_
#include <sys/mman.h>
/* From IRIX's <sys/mman.h> */
#define IRIX_MAP_SHARED MAP_SHARED
#define IRIX_MAP_PRIVATE MAP_PRIVATE
#define IRIX_MAP_COPY 0x0004
#define IRIX_MAP_FIXED MAP_FIXED
#define IRIX_MAP_RENAME MAP_RENAME
#define IRIX_MAP_AUTOGROW 0x0040
#define IRIX_MAP_LOCAL 0x0080
#define IRIX_MAP_AUTORESRV 0x0100
#define IRIX_MAP_TEXT 0x0200
#define IRIX_MAP_BRK 0x0400
#define IRIX_MAP_PRIMARY 0x0800
#define IRIX_MAP_SGI_ANYADDR 0x1000
#endif /* _IRIX_MMAN_H_ */

View File

@ -1,104 +0,0 @@
/* $NetBSD: irix_mod.c,v 1.2 2008/11/21 20:53:28 cegger Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software developed for The NetBSD Foundation
* by Andrew Doran.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: irix_mod.c,v 1.2 2008/11/21 20:53:28 cegger Exp $");
#ifndef ELFSIZE
#define ELFSIZE ARCH_ELFSIZE
#endif
#include <sys/param.h>
#include <sys/module.h>
#include <sys/exec.h>
#include <sys/exec_elf.h>
#include <compat/irix/irix_sysctl.h>
#include <compat/irix/irix_exec.h>
#if defined(EXEC_ELF32)
# define MD1 ",exec_elf32"
#else
# define MD1 ""
#endif
MODULE(MODULE_CLASS_MISC, compat_irix, "compat,compat_svr4" MD1);
static struct execsw irix_execsw[] = {
#if defined(EXEC_ELF32)
/* IRIX Elf32 n32 ABI */
{ sizeof (Elf32_Ehdr),
exec_elf32_makecmds,
{ irix_elf32_probe_n32 },
&emul_irix,
EXECSW_PRIO_ANY,
IRIX_AUX_ARGSIZ,
irix_elf32_copyargs,
irix_n32_setregs,
coredump_elf32,
exec_setup_stack },
/* IRIX Elf32 o32 ABI */
{ sizeof (Elf32_Ehdr),
exec_elf32_makecmds,
{ irix_elf32_probe_o32 },
&emul_irix,
EXECSW_PRIO_ANY,
IRIX_AUX_ARGSIZ,
irix_elf32_copyargs,
NULL,
coredump_elf32,
exec_setup_stack },
#endif
};
static int
compat_irix_modcmd(modcmd_t cmd, void *arg)
{
int error;
switch (cmd) {
case MODULE_CMD_INIT:
irix_sysctl_init();
error = exec_add(irix_execsw, __arraycount(irix_execsw));
if (error != 0)
irix_sysctl_fini();
return error;
case MODULE_CMD_FINI:
error = exec_remove(irix_execsw, __arraycount(irix_execsw));
if (error == 0)
irix_sysctl_fini();
return error;
default:
return ENOTTY;
}
}

View File

@ -1,105 +0,0 @@
/* $NetBSD: irix_mount.c,v 1.24 2010/11/19 06:44:37 dholland Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Emmanuel Dreyfus.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: irix_mount.c,v 1.24 2010/11/19 06:44:37 dholland Exp $");
#include <sys/types.h>
#include <sys/signal.h>
#include <sys/param.h>
#include <sys/proc.h>
#include <sys/mount.h>
#include <sys/namei.h>
#include <sys/systm.h>
#include <sys/vnode.h>
#include <sys/vnode_if.h>
#include <sys/kauth.h>
#include <compat/common/compat_util.h>
#include <compat/irix/irix_types.h>
#include <compat/irix/irix_signal.h>
#include <compat/irix/irix_syscall.h>
#include <compat/irix/irix_syscallargs.h>
int
irix_sys_getmountid(struct lwp *l, const struct irix_sys_getmountid_args *uap, register_t *retval)
{
/* {
syscallarg(const char *) path;
syscallarg(irix_mountid_t *) buf;
} */
kauth_cred_t cred;
struct vnode *vp;
int error = 0;
struct pathbuf *pb;
struct nameidata nd;
irix_mountid_t mountid;
void *addr;
error = pathbuf_copyin(SCARG(uap, path), &pb);
if (error) {
return error;
}
cred = kauth_cred_dup(l->l_cred);
kauth_cred_seteuid(cred, kauth_cred_getuid(l->l_cred));
kauth_cred_setegid(cred, kauth_cred_getgid(l->l_cred));
/* Get the vnode for the requested path */
NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | TRYEMULROOT, pb);
nd.ni_cnd.cn_cred = cred;
if ((error = namei(&nd)) != 0) {
pathbuf_destroy(pb);
goto out;
}
vp = nd.ni_vp;
pathbuf_destroy(pb);
/* Check for accessibility */
if ((error = VOP_ACCESS(vp, VREAD | VEXEC, cred)) != 0)
goto bad;
/*
* Return the address of the mount structure
* as the unique ID for the filesystem
*/
addr = (void *)&vp->v_mount;
memset((void *)&mountid, 0, sizeof(mountid));
(void)memcpy((void *)&mountid, &addr, sizeof(addr));
error = copyout(&mountid, SCARG(uap, buf), sizeof(mountid));
bad:
vput(vp);
out:
kauth_cred_free(cred);
return (error);
}

View File

@ -1,949 +0,0 @@
/* $NetBSD: irix_prctl.c,v 1.52 2011/02/20 08:08:57 matt Exp $ */
/*-
* Copyright (c) 2001-2002 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Emmanuel Dreyfus.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: irix_prctl.c,v 1.52 2011/02/20 08:08:57 matt Exp $");
#include <sys/errno.h>
#include <sys/types.h>
#include <sys/param.h>
#include <sys/signal.h>
#include <sys/signalvar.h>
#include <sys/systm.h>
#include <sys/exec.h>
#include <sys/malloc.h>
#include <sys/pool.h>
#include <sys/rwlock.h>
#include <sys/filedesc.h>
#include <sys/vnode.h>
#include <sys/resourcevar.h>
#include <sys/kauth.h>
#include <uvm/uvm_extern.h>
#include <uvm/uvm_map.h>
#include <mips/locore.h>
#include <machine/regnum.h>
#include <machine/vmparam.h>
#include <compat/svr4/svr4_types.h>
#include <compat/irix/irix_types.h>
#include <compat/irix/irix_exec.h>
#include <compat/irix/irix_prctl.h>
#include <compat/irix/irix_signal.h>
#include <compat/irix/irix_syscallargs.h>
struct irix_sproc_child_args {
struct proc **isc_proc;
void *isc_entry;
void *isc_arg;
size_t isc_len;
int isc_inh;
struct lwp *isc_parent_lwp;
struct irix_share_group *isc_share_group;
int isc_child_done;
};
static void irix_sproc_child(struct irix_sproc_child_args *);
static int irix_sproc(void *, unsigned int, void *, void *, size_t,
pid_t, struct lwp *, register_t *);
static struct irix_shared_regions_rec *irix_isrr_create(vaddr_t,
vsize_t, int);
#ifdef DEBUG_IRIX
static void irix_isrr_debug(struct proc *);
#endif
static void irix_isrr_cleanup(struct proc *);
int
irix_sys_prctl(struct lwp *l, const struct irix_sys_prctl_args *uap, register_t *retval)
{
/* {
syscallarg(unsigned) option;
syscallarg(void *) arg1;
} */
struct proc *p = l->l_proc;
unsigned int option = SCARG(uap, option);
#ifdef DEBUG_IRIX
printf("irix_sys_prctl(): option = %d\n", option);
#endif
switch(option) {
case IRIX_PR_GETSHMASK: { /* Get shared resources */
struct proc *p2;
int shmask = 0;
struct irix_emuldata *ied;
mutex_enter(proc_lock);
p2 = proc_find((pid_t)(uintptr_t)SCARG(uap, arg1));
if (p2 == p || SCARG(uap, arg1) == NULL) {
mutex_exit(proc_lock);
/* XXX return our own shmask */
return 0;
}
if (p2 == NULL) {
mutex_exit(proc_lock);
return EINVAL;
}
ied = (struct irix_emuldata *)p->p_emuldata;
if (ied->ied_shareaddr)
shmask |= IRIX_PR_SADDR;
if (p->p_fd == p2->p_fd)
shmask |= IRIX_PR_SFDS;
if (p->p_cwdi == p2->p_cwdi)
shmask |= (IRIX_PR_SDIR|IRIX_PR_SUMASK);
mutex_exit(proc_lock);
*retval = (register_t)shmask;
return 0;
break;
}
case IRIX_PR_LASTSHEXIT: /* "Last sproc exit" */
/* We no nothing */
break;
case IRIX_PR_GETNSHARE: { /* Number of sproc share group memb.*/
struct irix_emuldata *ied;
struct irix_emuldata *iedp;
struct irix_share_group *isg;
int count;
ied = (struct irix_emuldata *)p->p_emuldata;
if ((isg = ied->ied_share_group) == NULL) {
*retval = 0;
return 0;
}
count = 0;
rw_enter(&isg->isg_lock, RW_READER);
LIST_FOREACH(iedp, &isg->isg_head, ied_sglist)
count++;
rw_exit(&isg->isg_lock);
*retval = count;
return 0;
break;
}
case IRIX_PR_TERMCHILD: { /* Get SIGHUP when parent's exit */
struct irix_emuldata *ied;
ied = (struct irix_emuldata *)(p->p_emuldata);
ied->ied_termchild = 1;
break;
}
case IRIX_PR_ISBLOCKED: { /* Is process blocked? */
pid_t pid = (pid_t)(uintptr_t)SCARG(uap, arg1);
struct irix_emuldata *ied;
struct proc *target;
if (pid == 0)
pid = p->p_pid;
mutex_enter(proc_lock);
if ((target = proc_find(pid)) == NULL) {
mutex_exit(proc_lock);
return ESRCH;
}
if (irix_check_exec(target) == 0) {
mutex_exit(proc_lock);
return 0;
}
if (kauth_authorize_process(l->l_cred, KAUTH_PROCESS_CANSEE,
target, KAUTH_ARG(KAUTH_REQ_PROCESS_CANSEE_ENTRY), NULL,
NULL) != 0) {
mutex_exit(proc_lock);
return EPERM;
}
ied = (struct irix_emuldata *)(target->p_emuldata);
*retval = (ied->ied_procblk_count < 0);
mutex_exit(proc_lock);
return 0;
break;
}
default:
printf("Warning: call to unimplemented prctl() command %d\n",
option);
return EINVAL;
break;
}
return 0;
}
int
irix_sys_pidsprocsp(struct lwp *l, const struct irix_sys_pidsprocsp_args *uap, register_t *retval)
{
/* {
syscallarg(void *) entry;
syscallarg(unsigned) inh;
syscallarg(void *) arg;
syscallarg(void *) sp;
syscallarg(irix_size_t) len;
syscallarg(irix_pid_t) pid;
} */
/* pid is ignored for now */
printf("Warning: unsupported pid argument to IRIX sproc\n");
return irix_sproc(SCARG(uap, entry), SCARG(uap, inh), SCARG(uap, arg),
SCARG(uap, sp), SCARG(uap, len), SCARG(uap, pid), l, retval);
}
int
irix_sys_sprocsp(struct lwp *l, const struct irix_sys_sprocsp_args *uap, register_t *retval)
{
/* {
syscallarg(void *) entry;
syscallarg(unsigned) inh;
syscallarg(void *) arg;
syscallarg(void *) sp;
syscallarg(irix_size_t) len;
} */
return irix_sproc(SCARG(uap, entry), SCARG(uap, inh), SCARG(uap, arg),
SCARG(uap, sp), SCARG(uap, len), 0, l, retval);
}
int
irix_sys_sproc(struct lwp *l, const struct irix_sys_sproc_args *uap, register_t *retval)
{
/* {
syscallarg(void *) entry;
syscallarg(unsigned) inh;
syscallarg(void *) arg;
} */
struct proc *p = l->l_proc;
return irix_sproc(SCARG(uap, entry), SCARG(uap, inh), SCARG(uap, arg),
NULL, p->p_rlimit[RLIMIT_STACK].rlim_cur, 0, l, retval);
}
static int
irix_sproc(void *entry, unsigned int inh, void *arg, void *sp, size_t len, pid_t pid, struct lwp *l, register_t *retval)
{
struct proc *p = l->l_proc;
int bsd_flags = 0;
struct exec_vmcmd vmc;
int error;
struct proc *p2;
struct irix_sproc_child_args *isc;
struct irix_emuldata *ied;
struct irix_emuldata *iedp;
struct irix_share_group *isg = NULL;
segsz_t stacksize;
#ifdef DEBUG_IRIX
printf("irix_sproc(): entry = %p, inh = %x, arg = %p, sp = 0x%08lx, len = 0x%08lx, pid = %d\n", entry, inh, arg, (u_long)sp, (u_long)len, pid);
#endif
if (len == 0)
return EINVAL;
if (inh & IRIX_PR_SFDS)
bsd_flags |= FORK_SHAREFILES;
if (inh & IRIX_PR_SUMASK && inh & IRIX_PR_SDIR) {
bsd_flags |= FORK_SHARECWD;
/* Forget them so that we don't get warning below */
inh &= ~(IRIX_PR_SUMASK|IRIX_PR_SDIR);
}
/* We know how to do PR_SUMASK and PR_SDIR together only */
if (inh & IRIX_PR_SUMASK)
printf("Warning: unimplemented IRIX sproc flag PR_SUMASK\n");
if (inh & IRIX_PR_SDIR)
printf("Warning: unimplemented IRIX sproc flag PR_SDIR\n");
if (inh & IRIX_PR_SULIMIT)
bsd_flags |= FORK_SHARELIMIT;
/*
* If relevant, initialize the share group structure
*/
ied = (struct irix_emuldata *)(p->p_emuldata);
if (ied->ied_share_group == NULL) {
isg = malloc(sizeof(struct irix_share_group),
M_EMULDATA, M_WAITOK);
rw_init(&isg->isg_lock);
isg->isg_refcount = 0;
rw_enter(&isg->isg_lock, RW_WRITER);
LIST_INIT(&isg->isg_head);
LIST_INSERT_HEAD(&isg->isg_head, ied, ied_sglist);
isg->isg_refcount++;
rw_exit(&isg->isg_lock);
ied->ied_share_group = isg;
}
/*
* Setting up child stack
*/
if (inh & IRIX_PR_SADDR) {
if (sp == NULL) {
/*
* All share group members have vm_maxsaddr set
* to the bottom of the lowest stack in address space,
* therefore we map the new stack there.
*/
sp = p->p_vmspace->vm_maxsaddr;
/* Compute new stacks's bottom address */
sp = (void *)trunc_page((u_long)sp - len);
}
/* Now map the new stack */
memset(&vmc, 0, sizeof(vmc));
vmc.ev_addr = trunc_page((u_long)sp);
vmc.ev_len = round_page(len);
vmc.ev_prot = UVM_PROT_RWX;
vmc.ev_flags = UVM_FLAG_COPYONW|UVM_FLAG_FIXED|UVM_FLAG_OVERLAY;
vmc.ev_proc = vmcmd_map_zero;
#ifdef DEBUG_IRIX
printf("irix_sproc(): new stack addr=0x%08lx, len=0x%08lx\n",
(u_long)sp, (u_long)len);
#endif
/* Normally it cannot be NULL since we just initialized it */
if ((isg = ied->ied_share_group) == NULL)
panic("irix_sproc: NULL ied->ied_share_group");
IRIX_VM_SYNC(p, error = (*vmc.ev_proc)(l, &vmc));
if (error)
return error;
/* Update stack parameters for the share group members */
ied = (struct irix_emuldata *)p->p_emuldata;
stacksize = ((char *)p->p_vmspace->vm_minsaddr - (char *)sp)
/ PAGE_SIZE;
rw_enter(&isg->isg_lock, RW_WRITER);
LIST_FOREACH(iedp, &isg->isg_head, ied_sglist) {
iedp->ied_p->p_vmspace->vm_maxsaddr = (void *)sp;
iedp->ied_p->p_vmspace->vm_ssize = stacksize;
}
rw_exit(&isg->isg_lock);
}
/*
* Arguments for irix_sproc_child()
* This will be freed by the child.
*/
isc = malloc(sizeof(*isc), M_TEMP, M_WAITOK);
isc->isc_proc = &p2;
isc->isc_entry = entry;
isc->isc_arg = arg;
isc->isc_len = len;
isc->isc_inh = inh;
isc->isc_parent_lwp = l;
isc->isc_share_group = isg;
isc->isc_child_done = 0;
if (inh & IRIX_PR_SADDR) {
ied->ied_shareaddr = 1;
}
if ((error = fork1(l, bsd_flags, SIGCHLD, (void *)sp, len,
(void *)irix_sproc_child, (void *)isc, retval, &p2)) != 0)
return error;
/*
* The child needs the parent to stay alive until it has
* copied a few things from it. We sleep whatever happen
* until the child is done.
*/
while (!isc->isc_child_done)
(void)tsleep(&isc->isc_child_done, PZERO, "sproc", 0);
free(isc, M_TEMP);
retval[0] = (register_t)p2->p_pid;
retval[1] = 0;
return 0;
}
static void
irix_sproc_child(struct irix_sproc_child_args *isc)
{
struct proc *p2 = *isc->isc_proc;
struct lwp *l2 = curlwp;
int inh = isc->isc_inh;
struct lwp *lparent = isc->isc_parent_lwp;
struct proc *parent = lparent->l_proc;
struct trapframe *tf = l2->l_md.md_utf;
struct trapframe *ptf = lparent->l_md.md_utf;
kauth_cred_t pc;
struct irix_emuldata *ied;
struct irix_emuldata *parent_ied;
#ifdef DEBUG_IRIX
printf("irix_sproc_child()\n");
#endif
/*
* Handle shared VM space. The process private arena is not shared
*/
if (inh & IRIX_PR_SADDR) {
int error;
vaddr_t minp, maxp;
vsize_t len;
struct irix_shared_regions_rec *isrr;
/*
* First, unmap the whole address space
*/
minp = vm_map_min(&p2->p_vmspace->vm_map);
maxp = vm_map_max(&p2->p_vmspace->vm_map);
uvm_unmap(&p2->p_vmspace->vm_map, minp, maxp);
/*
* Now, copy the mapping from the parent for shared regions
*/
parent_ied = (struct irix_emuldata *)parent->p_emuldata;
LIST_FOREACH(isrr, &parent_ied->ied_shared_regions, isrr_list) {
minp = isrr->isrr_start;
len = isrr->isrr_len;
maxp = minp + len;
/* If this is a private region, skip */
if (isrr->isrr_shared == IRIX_ISRR_PRIVATE)
continue;
/* Copy the new mapping from the parent */
error = uvm_map_extract(&parent->p_vmspace->vm_map,
minp, len, &p2->p_vmspace->vm_map, &minp, 0);
if (error != 0) {
#ifdef DEBUG_IRIX
printf("irix_sproc_child(): error %d\n", error);
#endif
isc->isc_child_done = 1;
wakeup(&isc->isc_child_done);
mutex_enter(proc_lock);
killproc(p2,
"failed to initialize share group VM");
mutex_exit(proc_lock);
}
}
/* Map and initialize the process private arena (unshared) */
error = irix_prda_init(p2);
if (error != 0) {
isc->isc_child_done = 1;
wakeup(&isc->isc_child_done);
mutex_enter(proc_lock);
killproc(p2, "failed to initialize the PRDA");
mutex_exit(proc_lock);
}
}
/*
* Handle shared process UID/GID
*/
if (inh & IRIX_PR_SID) {
pc = p2->p_cred;
kauth_cred_hold(parent->p_cred);
p2->p_cred = parent->p_cred;
kauth_cred_free(pc);
}
/*
* Setup PC to return to the child entry point
*/
tf->tf_regs[_R_PC] = (unsigned long)isc->isc_entry;
tf->tf_regs[_R_RA] = 0;
/*
* Setup child arguments
*/
tf->tf_regs[_R_A0] = (unsigned long)isc->isc_arg;
tf->tf_regs[_R_A1] = 0;
tf->tf_regs[_R_A2] = 0;
tf->tf_regs[_R_A3] = 0;
if (ptf->tf_regs[_R_S3] == (unsigned long)isc->isc_len) {
tf->tf_regs[_R_S0] = ptf->tf_regs[_R_S0];
tf->tf_regs[_R_S1] = ptf->tf_regs[_R_S1];
tf->tf_regs[_R_S2] = ptf->tf_regs[_R_S2];
tf->tf_regs[_R_S3] = ptf->tf_regs[_R_S3];
}
/*
* Join the share group
*/
ied = (struct irix_emuldata *)(p2->p_emuldata);
parent_ied = (struct irix_emuldata *)(parent->p_emuldata);
ied->ied_share_group = parent_ied->ied_share_group;
rw_enter(&ied->ied_share_group->isg_lock, RW_WRITER);
LIST_INSERT_HEAD(&ied->ied_share_group->isg_head, ied, ied_sglist);
ied->ied_share_group->isg_refcount++;
rw_exit(&ied->ied_share_group->isg_lock);
if (inh & IRIX_PR_SADDR)
ied->ied_shareaddr = 1;
/*
* wakeup the parent as it can now die without
* causing a panic in the child.
*/
isc->isc_child_done = 1;
wakeup(&isc->isc_child_done);
/*
* Return to userland for a newly created process
*/
child_return((void *)l2);
return;
}
int
irix_sys_procblk(struct lwp *l, const struct irix_sys_procblk_args *uap, register_t *retval)
{
/* {
syscallarg(int) cmd;
syscallarg(pid_t) pid;
syscallarg(int) count;
} */
int cmd = SCARG(uap, cmd);
struct irix_emuldata *ied;
struct irix_emuldata *iedp;
struct irix_share_group *isg;
struct proc *target;
int oldcount;
struct lwp *ied_lwp;
int error, last_error;
struct irix_sys_procblk_args cup;
/*
* FIXME: Locking is totally broken all here.
*/
/* Find the process */
mutex_enter(proc_lock);
if ((target = proc_find(SCARG(uap, pid))) == NULL) {
mutex_exit(proc_lock);
return ESRCH;
}
mutex_exit(proc_lock);
/* May we stop it? */
/* XXX-elad: Is hardcoding SIGSTOP here correct? */
if (kauth_authorize_process(l->l_cred, KAUTH_PROCESS_SIGNAL, target,
KAUTH_ARG(SIGSTOP), NULL, NULL) != 0)
return EPERM;
/* Is it an IRIX process? */
if (irix_check_exec(target) == 0)
return EPERM;
ied = (struct irix_emuldata *)(target->p_emuldata);
oldcount = ied->ied_procblk_count;
switch (cmd) {
case IRIX_PROCBLK_BLOCK:
ied->ied_procblk_count--;
break;
case IRIX_PROCBLK_UNBLOCK:
ied->ied_procblk_count++;
break;
case IRIX_PROCBLK_COUNT:
if (SCARG(uap, count) > IRIX_PR_MAXBLOCKCNT ||
SCARG(uap, count) < IRIX_PR_MINBLOCKCNT)
return EINVAL;
ied->ied_procblk_count = SCARG(uap, count);
break;
case IRIX_PROCBLK_BLOCKALL:
case IRIX_PROCBLK_UNBLOCKALL:
case IRIX_PROCBLK_COUNTALL:
SCARG(&cup, cmd) = cmd -IRIX_PROCBLK_ONLYONE;
SCARG(&cup, count) = SCARG(uap, count);
last_error = 0;
/*
* If the process does not belong to a
* share group, do it just for the process
*/
if ((isg = ied->ied_share_group) == NULL) {
SCARG(&cup, pid) = SCARG(uap, pid);
return irix_sys_procblk(l, &cup, retval);
}
rw_enter(&isg->isg_lock, RW_READER);
LIST_FOREACH(iedp, &isg->isg_head, ied_sglist) {
struct proc *p;
/* Recall procblk for this process */
p = iedp->ied_p;
SCARG(&cup, pid) = p->p_pid;
ied_lwp = LIST_FIRST(&p->p_lwps);
KASSERT(ied_lwp != NULL);
error = irix_sys_procblk(ied_lwp, &cup, retval);
if (error != 0)
last_error = error;
}
rw_exit(&isg->isg_lock);
return last_error;
break;
default:
printf("Warning: unimplemented IRIX procblk command %d\n", cmd);
return EINVAL;
break;
}
/*
* We emulate the process block/unblock using SIGSTOP and SIGCONT
* signals. This is not very accurate, since on IRIX theses way
* of blocking a process are completely separated.
*/
mutex_enter(proc_lock);
if (oldcount >= 0 && ied->ied_procblk_count < 0) /* blocked */
psignal(target, SIGSTOP);
if (oldcount < 0 && ied->ied_procblk_count >= 0) /* unblocked */
psignal(target, SIGCONT);
mutex_exit(proc_lock);
return 0;
}
int
irix_prda_init(struct proc *p)
{
int error;
struct exec_vmcmd evc;
struct irix_prda *ip;
struct irix_prda_sys ips;
struct lwp *l;
memset(&evc, 0, sizeof(evc));
evc.ev_addr = (u_long)IRIX_PRDA;
evc.ev_len = sizeof(struct irix_prda);
evc.ev_prot = UVM_PROT_RW;
evc.ev_proc = *vmcmd_map_zero;
/* XXXSMP */
l = LIST_FIRST(&p->p_lwps);
KASSERT(l != NULL);
if ((error = (*evc.ev_proc)(l, &evc)) != 0)
return error;
ip = (struct irix_prda *)IRIX_PRDA;
memset(&ips, 0, sizeof(ips));
ips.t_pid = p->p_pid;
/*
* The PRDA ID must be unique for a PRDA. IRIX uses a small
* integer, but we don't know how it is chosen. The PID
* should be unique enough to get the work done.
*/
ips.t_prid = p->p_pid;
error = copyout(&ips, (void *)&ip->sys_prda.prda_sys, sizeof(ips));
if (error)
return error;
/* Remeber the PRDA is private */
irix_isrr_insert((vaddr_t)IRIX_PRDA, sizeof(ips), IRIX_ISRR_PRIVATE, p);
return 0;
}
int
irix_vm_fault(struct proc *p, vaddr_t vaddr, vm_prot_t access_type)
{
int error;
struct irix_emuldata *ied;
struct vm_map *map;
ied = (struct irix_emuldata *)p->p_emuldata;
map = &p->p_vmspace->vm_map;
if (ied->ied_share_group == NULL || ied->ied_shareaddr == 0)
return uvm_fault(map, vaddr, access_type);
/* share group version */
rw_enter(&ied->ied_share_group->isg_lock, RW_WRITER);
error = uvm_fault(map, vaddr, access_type);
irix_vm_sync(p);
rw_exit(&ied->ied_share_group->isg_lock);
return error;
}
/*
* Propagate changes to address space to other members of the share group
*/
void
irix_vm_sync(struct proc *p)
{
struct proc *pp;
struct irix_emuldata *iedp;
struct irix_emuldata *ied = (struct irix_emuldata *)p->p_emuldata;
struct irix_shared_regions_rec *isrr;
vaddr_t minp;
vaddr_t maxp;
vsize_t len;
int error;
LIST_FOREACH(iedp, &ied->ied_share_group->isg_head, ied_sglist) {
if (iedp->ied_shareaddr != 1 || iedp->ied_p == p)
continue;
pp = iedp->ied_p;
error = 0;
/* for each region in the target process ... */
LIST_FOREACH(isrr, &iedp->ied_shared_regions, isrr_list) {
/* skip regions private to the target process */
if (isrr->isrr_shared == IRIX_ISRR_PRIVATE)
continue;
/*
* XXX We should also skip regions private to the
* original process...
*/
/* The region is shared */
minp = isrr->isrr_start;
len = isrr->isrr_len;
maxp = minp + len;
/* Drop the region */
uvm_unmap(&pp->p_vmspace->vm_map, minp, maxp);
/* Clone it from the parent */
error = uvm_map_extract(&p->p_vmspace->vm_map,
minp, len, &pp->p_vmspace->vm_map, &minp, 0);
if (error)
break;
}
if (error) {
mutex_enter(proc_lock);
killproc(pp, "failed to keep share group VM in sync");
mutex_exit(proc_lock);
}
}
return;
}
static struct irix_shared_regions_rec *
irix_isrr_create(vaddr_t start, vsize_t len, int shared)
{
struct irix_shared_regions_rec *new_isrr;
new_isrr = malloc(sizeof(struct irix_shared_regions_rec),
M_EMULDATA, M_WAITOK);
new_isrr->isrr_start = start;
new_isrr->isrr_len = len;
new_isrr->isrr_shared = shared;
return new_isrr;
}
/*
* Insert a record for a new region in the list. The new region may be
* overlaping or be included in an existing region.
*/
void
irix_isrr_insert(vaddr_t start, vsize_t len, int shared, struct proc *p)
{
struct irix_emuldata *ied = (struct irix_emuldata *)p->p_emuldata;
struct irix_shared_regions_rec *isrr;
struct irix_shared_regions_rec *new_isrr;
vaddr_t end, cur_start, cur_end;
int cur_shared;
start = trunc_page(start);
len = round_page(len);
end = start + len;
new_isrr = irix_isrr_create(start, len, shared);
/* Do we need to insert the new region at the begining of the list? */
if (LIST_EMPTY(&ied->ied_shared_regions) ||
LIST_FIRST(&ied->ied_shared_regions)->isrr_start > start) {
LIST_INSERT_HEAD(&ied->ied_shared_regions, new_isrr, isrr_list);
} else {
/* Find the place where to insert it */
LIST_FOREACH(isrr, &ied->ied_shared_regions, isrr_list) {
cur_start = isrr->isrr_start;
cur_end = isrr->isrr_start + isrr->isrr_len;
cur_shared = isrr->isrr_shared;
/*
* if there is no intersection between inserted
* and current region: skip to next region
*/
if (cur_end <= start)
continue;
/*
* if new region is included into the current
* region. Right-crop the current region,
* insert a new one, and insert a new region
* for the end of the split region
*/
if (cur_end > end && cur_start < start) {
isrr->isrr_len = start - isrr->isrr_start;
LIST_INSERT_AFTER(isrr, new_isrr, isrr_list);
isrr = new_isrr;
new_isrr = irix_isrr_create(end,
cur_end - end, cur_shared);
LIST_INSERT_AFTER(isrr, new_isrr, isrr_list);
/* Nothing more to do, exit now */
#ifdef DEBUG_IRIX
irix_isrr_debug(p);
#endif
irix_isrr_cleanup(p);
#ifdef DEBUG_IRIX
irix_isrr_debug(p);
#endif
return;
}
/*
* if inserted block overlap some part
* of current region: right-crop current region
* and insert the new region
*/
if (start < cur_end) {
isrr->isrr_len = start - cur_start;
LIST_INSERT_AFTER(isrr, new_isrr, isrr_list);
/* exit the FOREACH loop */
break;
}
}
}
/*
* At this point, we inserted the new region (new_isrr) but
* it may be overlaping with next regions, so we need to clean
* this up and remove or crop next regions
*/
LIST_FOREACH(isrr, &ied->ied_shared_regions, isrr_list) {
cur_start = isrr->isrr_start;
cur_end = isrr->isrr_start + isrr->isrr_len;
/* skip until we get beyond new_isrr */
if (cur_start <= start)
continue;
if (end >= cur_end) { /* overlap */
LIST_REMOVE(isrr, isrr_list);
free(isrr, M_EMULDATA);
/* isrr is now invalid */
isrr = new_isrr;
continue;
}
/*
* Here end < cur_end, therefore we need to
* right-crop the current region
*/
isrr->isrr_start = end;
isrr->isrr_len = cur_end - end;
break;
}
#ifdef DEBUG_IRIX
irix_isrr_debug(p);
#endif
irix_isrr_cleanup(p);
#ifdef DEBUG_IRIX
irix_isrr_debug(p);
#endif
return;
}
/*
* Cleanup the region list by
* (1) removing regions with length 0, and
* (2) merging contiguous regions with the same status
*/
static void
irix_isrr_cleanup(struct proc *p)
{
struct irix_emuldata *ied = (struct irix_emuldata *)p->p_emuldata;
struct irix_shared_regions_rec *isrr;
struct irix_shared_regions_rec *new_isrr;
isrr = LIST_FIRST(&ied->ied_shared_regions);
do {
new_isrr = LIST_NEXT(isrr, isrr_list);
if (isrr->isrr_len == 0) {
LIST_REMOVE(isrr, isrr_list);
free(isrr, M_EMULDATA);
isrr = new_isrr;
if (isrr == NULL)
break;
}
if (new_isrr == NULL)
break;
if (isrr->isrr_shared == new_isrr->isrr_shared) {
isrr->isrr_len += new_isrr->isrr_len;
new_isrr->isrr_len = 0;
}
isrr = new_isrr;
} while (1);
return;
}
#ifdef DEBUG_IRIX
static void
irix_isrr_debug(struct proc *p)
{
struct irix_emuldata *ied = (struct irix_emuldata *)p->p_emuldata;
struct irix_shared_regions_rec *isrr;
printf("isrr for pid %d\n", p->p_pid);
LIST_FOREACH(isrr, &ied->ied_shared_regions, isrr_list) {
printf(" addr = %p, len = %p, shared = %d\n",
(void *)isrr->isrr_start,
(void *)isrr->isrr_len,
isrr->isrr_shared);
}
}
#endif /* DEBUG_IRIX */

View File

@ -1,169 +0,0 @@
/* $NetBSD: irix_prctl.h,v 1.14 2008/04/28 20:23:41 martin Exp $ */
/*-
* Copyright (c) 2001-2002 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Emmanuel Dreyfus.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _IRIX_PRCTL_H_
#define _IRIX_PRCTL_H_
/* IRIX share group structure */
struct irix_share_group {
LIST_HEAD(isg_head, irix_emuldata) isg_head; /* list head */
krwlock_t isg_lock; /* list lock */
int isg_refcount;
};
/*
* List of shared vs unshared regions in the VM space. We need to maintain
* this for all processes, not only processes belonging to a share group,
* because a process can request a private mapping (MAP_LOCAL option to
* mmap(2)) before becoming the member of a share group.
*/
struct irix_shared_regions_rec {
vaddr_t isrr_start;
vsize_t isrr_len;
int isrr_shared; /* shared or not shared */
#define IRIX_ISRR_SHARED 1
#define IRIX_ISRR_PRIVATE 0
LIST_ENTRY(irix_shared_regions_rec) isrr_list;
};
int irix_prda_init(struct proc *);
void irix_vm_sync(struct proc *);
int irix_vm_fault(struct proc *, vaddr_t, vm_prot_t);
void irix_isrr_insert(vaddr_t, vsize_t, int, struct proc *);
/* macro used to wrap irix_vm_sync calls */
#define IRIX_VM_SYNC(q,cmd) \
if (((struct irix_emuldata *)((q)->p_emuldata))->ied_share_group == NULL || \
((struct irix_emuldata *)((q)->p_emuldata))->ied_shareaddr == 0) { \
(cmd); \
} else { \
rw_enter(&((struct irix_emuldata *) \
((q)->p_emuldata))->ied_share_group->isg_lock, RW_WRITER); \
(cmd); \
irix_vm_sync((q)); \
rw_exit(&((struct irix_emuldata *) \
((q)->p_emuldata))->ied_share_group->isg_lock); \
}
/* From IRIX's <sys/prctl.h> */
#define IRIX_PR_MAXPROCS 1
#define IRIX_PR_ISBLOCKED 2
#define IRIX_PR_SETSTACKSIZE 3
#define IRIX_PR_GETSTACKSIZE 4
#define IRIX_PR_MAXPPROCS 5
#define IRIX_PR_UNBLKONEXEC 6
#define IRIX_PR_SETEXITSIG 8
#define IRIX_PR_RESIDENT 9
#define IRIX_PR_ATTACHADDR 10
#define IRIX_PR_DETACHADDR 11
#define IRIX_PR_TERMCHILD 12
#define IRIX_PR_GETSHMASK 13
#define IRIX_PR_GETNSHARE 14
#define IRIX_PR_COREPID 15
#define IRIX_PR_ATTACHADDRPERM 16
#define IRIX_PR_PTHREADEXIT 17
#define IRIX_PR_SETABORTSIG 18
#define IRIX_PR_INIT_THREADS 20
#define IRIX_PR_THREAD_CTL 21
#define IRIX_PR_LASTSHEXIT 22
/* sproc flags */
#define IRIX_PR_SPROC 0x00000001
#define IRIX_PR_SFDS 0x00000002
#define IRIX_PR_SDIR 0x00000004
#define IRIX_PR_SUMASK 0x00000008
#define IRIX_PR_SULIMIT 0x00000010
#define IRIX_PR_SID 0x00000020
#define IRIX_PR_SADDR 0x00000040
#define IRIX_PR_THREADS 0x00000080
#define IRIX_PR_BLOCK 0x01000000
#define IRIX_PR_NOLIBC 0x02000000
#define IRIX_PR_EVENT 0x04000000
/* blockproc constants */
#define IRIX_PR_MAXBLOCKCNT 10000
#define IRIX_PR_MINBLOCKCNT -10000
/* This is undocumented */
#define IRIX_PROCBLK_BLOCK 0
#define IRIX_PROCBLK_UNBLOCK 1
#define IRIX_PROCBLK_COUNT 2
#define IRIX_PROCBLK_BLOCKALL 3
#define IRIX_PROCBLK_UNBLOCKALL 4
#define IRIX_PROCBLK_COUNTALL 5
#define IRIX_PROCBLK_ONLYONE -3
/* From <sys/prctl.h> */
#define IRIX_PRDA ((struct prda *)0x00200000L)
struct irix_prda_sys {
irix_pid_t t_pid;
uint32_t t_hint;
uint32_t t_dlactseq;
uint32_t t_fpflags;
uint32_t t_prid;
uint32_t t_dlendseq;
uint64_t t_unused1[5];
irix_pid_t t_rpid;
int32_t t_resched;
int32_t t_syserror;
int32_t t_nid;
int32_t t_affinity_nid;
uint32_t t_unused2[5];
uint32_t t_cpu;
uint32_t t_flags;
irix_k_sigset_t t_hold;
};
struct irix_prda {
char unused[2048];
union {
char fill[512];
uint32_t rsvd[8];
} sys2_prda;
union {
char fill[512];
} lib2_prda;
union {
char fill[512];
} usr2rda;
union {
struct irix_prda_sys prda_sys;
char fill[128];
} sys_prda;
union {
char fill[256];
} lib_prda;
union {
char fill[128];
} usr_prda;
};
#endif /* _IRIX_PRCTL_H_ */

View File

@ -1,215 +0,0 @@
/* $NetBSD: irix_resource.c,v 1.15 2009/03/29 01:02:49 mrg Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Emmanuel Dreyfus.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: irix_resource.c,v 1.15 2009/03/29 01:02:49 mrg Exp $");
#include <sys/types.h>
#include <sys/signal.h>
#include <sys/param.h>
#include <sys/mount.h>
#include <sys/proc.h>
#include <sys/systm.h>
#include <sys/resource.h>
#include <sys/resourcevar.h>
#include <sys/syscallargs.h>
#include <compat/common/compat_util.h>
#include <compat/irix/irix_types.h>
#include <compat/irix/irix_signal.h>
#include <compat/irix/irix_resource.h>
#include <compat/irix/irix_syscallargs.h>
static int irix_to_native_resource(int);
static int
irix_to_native_resource(int irix_res)
{
int bsd_res;
switch(irix_res) {
case IRIX_RLIMIT_CPU:
bsd_res = RLIMIT_CPU;
break;
case IRIX_RLIMIT_FSIZE:
bsd_res = RLIMIT_FSIZE;
break;
case IRIX_RLIMIT_DATA:
bsd_res = RLIMIT_DATA;
break;
case IRIX_RLIMIT_STACK:
bsd_res = RLIMIT_STACK;
break;
case IRIX_RLIMIT_CORE:
bsd_res = RLIMIT_CORE;
break;
case IRIX_RLIMIT_NOFILE:
bsd_res = RLIMIT_NOFILE;
break;
case IRIX_RLIMIT_VMEM:
bsd_res = RLIMIT_AS;
break;
case IRIX_RLIMIT_RSS:
bsd_res = RLIMIT_RSS;
break;
case IRIX_RLIMIT_PTHREAD:
printf("Warning: ignored IRIX pthread rlimit flag\n");
default:
bsd_res = -1;
break;
}
return bsd_res;
}
int
irix_sys_getrlimit(struct lwp *l, const struct irix_sys_getrlimit_args *uap, register_t *retval)
{
/* {
syscallarg(int) resource;
syscallarg(struct irix_rlimit *) rlp;
} */
struct rlimit *rlp;
struct irix_rlimit irlp;
int which;
which = irix_to_native_resource(SCARG(uap, resource));
if (which < 0)
return EINVAL;
rlp = &l->l_proc->p_rlimit[which];
if (rlp->rlim_cur == RLIM_INFINITY)
irlp.rlim_cur = IRIX_RLIM_INFINITY;
else
irlp.rlim_cur = rlp->rlim_cur;
if (rlp->rlim_max == RLIM_INFINITY)
irlp.rlim_max = IRIX_RLIM_INFINITY;
else
irlp.rlim_max = rlp->rlim_cur;
return copyout(&irlp, SCARG(uap, rlp), sizeof(irlp));
}
int
irix_sys_getrlimit64(struct lwp *l, const struct irix_sys_getrlimit64_args *uap, register_t *retval)
{
/* {
syscallarg(int) resource;
syscallarg(struct irix_rlimit64 *) rlp;
} */
struct rlimit *rlp;
struct irix_rlimit64 irlp;
int which;
which = irix_to_native_resource(SCARG(uap, resource));
if (which < 0)
return EINVAL;
rlp = &l->l_proc->p_rlimit[which];
if (rlp->rlim_cur == RLIM_INFINITY)
irlp.rlim_cur = IRIX_RLIM64_INFINITY;
else
irlp.rlim_cur = rlp->rlim_cur;
if (rlp->rlim_max == RLIM_INFINITY)
irlp.rlim_max = IRIX_RLIM64_INFINITY;
else
irlp.rlim_max = rlp->rlim_cur;
return copyout(&irlp, SCARG(uap, rlp), sizeof(irlp));
}
int
irix_sys_setrlimit(struct lwp *l, const struct irix_sys_setrlimit_args *uap, register_t *retval)
{
/* {
syscallarg(int) resource;
syscallarg(const struct irix_rlimit *) rlp;
} */
struct irix_rlimit irlp;
struct rlimit rlp;
int which;
int error;
which = irix_to_native_resource(SCARG(uap, resource));
if (which < 0)
return EINVAL;
if ((error = copyin(SCARG(uap, rlp), &irlp, sizeof(irlp))) != 0)
return error;
if (irlp.rlim_cur == IRIX_RLIM_INFINITY)
rlp.rlim_cur = RLIM_INFINITY;
else
rlp.rlim_cur = irlp.rlim_cur;
if (irlp.rlim_max == IRIX_RLIM_INFINITY)
rlp.rlim_max = RLIM_INFINITY;
else
rlp.rlim_max = irlp.rlim_cur;
return dosetrlimit(l, l->l_proc, which, &rlp);
}
int
irix_sys_setrlimit64(struct lwp *l, const struct irix_sys_setrlimit64_args *uap, register_t *retval)
{
/* {
syscallarg(int) resource;
syscallarg(const struct irix_rlimit64 *) rlp;
} */
struct rlimit rlp;
struct irix_rlimit64 irlp;
int which;
int error;
which = irix_to_native_resource(SCARG(uap, resource));
if (which < 0)
return EINVAL;
if ((error = copyin(SCARG(uap, rlp), &irlp, sizeof(irlp))) != 0)
return error;
if (irlp.rlim_cur == IRIX_RLIM64_INFINITY)
rlp.rlim_cur = RLIM_INFINITY;
else
rlp.rlim_cur = irlp.rlim_cur;
if (irlp.rlim_max == IRIX_RLIM64_INFINITY)
rlp.rlim_max = RLIM_INFINITY;
else
rlp.rlim_max = irlp.rlim_cur;
return dosetrlimit(l, l->l_proc, which, &rlp);
}

View File

@ -1,63 +0,0 @@
/* $NetBSD: irix_resource.h,v 1.2 2008/04/28 20:23:42 martin Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Emmanuel Dreyfus.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _IRIX_RESOURCE_H_
#define _IRIX_RESOURCE_H_
/* From IRIX's <sys/resource.h> */
#define IRIX_RLIMIT_CPU 0
#define IRIX_RLIMIT_FSIZE 1
#define IRIX_RLIMIT_DATA 2
#define IRIX_RLIMIT_STACK 3
#define IRIX_RLIMIT_CORE 4
#define IRIX_RLIMIT_NOFILE 5
#define IRIX_RLIMIT_VMEM 6
#define IRIX_RLIMIT_RSS 7
#define IRIX_RLIMIT_PTHREAD 8
#define IRIX_RLIM_NLIMITS 9;
#define IRIX_RLIM64_INFINITY 0x7fffffffffffffffLL
#define IRIX_RLIM_INFINITY 0x7fffffff
typedef uint32_t irix_rlim_t;
typedef uint64_t irix_rlim64_t;
struct irix_rlimit {
irix_rlim_t rlim_cur;
irix_rlim_t rlim_max;
};
struct irix_rlimit64 {
irix_rlim64_t rlim_cur;
irix_rlim64_t rlim_max;
};
#endif /* _IRIX_RESOURCE_H_ */

View File

@ -1,966 +0,0 @@
/* $NetBSD: irix_signal.c,v 1.57 2011/02/20 08:08:57 matt Exp $ */
/*-
* Copyright (c) 1994, 2001-2002 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Christos Zoulas and Emmanuel Dreyfus.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: irix_signal.c,v 1.57 2011/02/20 08:08:57 matt Exp $");
#include <sys/types.h>
#include <sys/signal.h>
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/pool.h>
#include <sys/ptrace.h>
#include <sys/proc.h>
#include <sys/resourcevar.h>
#include <sys/systm.h>
#include <sys/vnode.h>
#include <sys/wait.h>
#include <mips/locore.h>
#include <mips/regnum.h>
#include <mips/trap.h>
#include <mips/pcb.h>
#include <compat/common/compat_util.h>
#include <compat/svr4/svr4_types.h>
#include <compat/svr4/svr4_wait.h>
#include <compat/svr4/svr4_signal.h>
#include <compat/svr4/svr4_lwp.h>
#include <compat/svr4/svr4_ucontext.h>
#include <compat/svr4/svr4_syscallargs.h>
#include <compat/irix/irix_signal.h>
#include <compat/irix/irix_errno.h>
#include <compat/irix/irix_exec.h>
#include <compat/irix/irix_syscallargs.h>
extern const int native_to_svr4_signo[];
extern const int svr4_to_native_signo[];
static int irix_wait_siginfo(int, struct rusage *, int,
struct irix_irix5_siginfo *);
static void irix_signal_siginfo(struct irix_irix5_siginfo *,
int, u_long, void *);
static void irix_set_ucontext(struct irix_ucontext*, const sigset_t *,
int, struct lwp *);
static void irix_set_sigcontext(struct irix_sigcontext*, const sigset_t *,
int, struct lwp *);
static void irix_get_ucontext(struct irix_ucontext*, struct lwp *);
static void irix_get_sigcontext(struct irix_sigcontext*, struct lwp *);
#define irix_sigmask(n) (1 << (((n) - 1) & 31))
#define irix_sigword(n) (((n) - 1) >> 5)
#define irix_sigemptyset(s) memset((s), 0, sizeof(*(s)))
#define irix_sigismember(s, n) ((s)->bits[irix_sigword(n)] & irix_sigmask(n))
#define irix_sigaddset(s, n) ((s)->bits[irix_sigword(n)] |= irix_sigmask(n))
/*
* Build a struct siginfo wor waitsys/waitid
* This is ripped from svr4_setinfo. See irix_sys_waitsys...
*/
static int
irix_wait_siginfo(int pid, struct rusage *ru, int st, struct irix_irix5_siginfo *s)
{
struct irix_irix5_siginfo i;
int sig;
memset(&i, 0, sizeof(i));
i.isi_signo = SVR4_SIGCHLD;
i.isi_errno = 0; /* XXX? */
i.isi_pid = pid;
if (pid != 0) {
i.isi_stime = ru->ru_stime.tv_sec;
i.isi_utime = ru->ru_utime.tv_sec;
}
if (WIFEXITED(st)) {
i.isi_status = WEXITSTATUS(st);
i.isi_code = SVR4_CLD_EXITED;
} else if (WIFSTOPPED(st)) {
sig = WSTOPSIG(st);
if (sig >= 0 && sig < NSIG)
i.isi_status = native_to_svr4_signo[sig];
if (i.isi_status == SVR4_SIGCONT)
i.isi_code = SVR4_CLD_CONTINUED;
else
i.isi_code = SVR4_CLD_STOPPED;
} else {
sig = WTERMSIG(st);
if (sig >= 0 && sig < NSIG)
i.isi_status = native_to_svr4_signo[sig];
if (WCOREDUMP(st))
i.isi_code = SVR4_CLD_DUMPED;
else
i.isi_code = SVR4_CLD_KILLED;
}
return copyout(&i, s, sizeof(i));
}
/*
* Build a struct siginfo for signal delivery
*/
static void
irix_signal_siginfo(struct irix_irix5_siginfo *isi, int sig, u_long code, void *addr)
{
if (sig < 0 || sig >= SVR4_NSIG) {
isi->isi_errno = IRIX_EINVAL;
return;
}
isi->isi_signo = native_to_svr4_signo[sig];
isi->isi_errno = 0;
isi->isi_addr = (intptr_t)addr;
switch (code) {
case T_TLB_MOD:
case T_TLB_LD_MISS:
case T_TLB_ST_MISS:
switch (sig) {
case SIGSEGV:
isi->isi_code = IRIX_SEGV_MAPERR;
isi->isi_errno = IRIX_EFAULT;
break;
case SIGBUS:
isi->isi_code = IRIX_BUS_ADRERR;
isi->isi_errno = IRIX_EACCES;
break;
case SIGKILL:
isi->isi_code = IRIX_SEGV_MAPERR;
isi->isi_errno = IRIX_ENOMEM;
break;
default:
isi->isi_code = 0;
}
break;
case T_ADDR_ERR_LD:
case T_ADDR_ERR_ST:
case T_BUS_ERR_IFETCH:
case T_BUS_ERR_LD_ST:
/* NetBSD issues a SIGSEGV here, IRIX rather uses SIGBUS */
isi->isi_code = IRIX_SEGV_MAPERR;
isi->isi_errno = IRIX_EFAULT;
break;
case T_BREAK:
isi->isi_code = IRIX_TRAP_BRKPT;
break;
case T_RES_INST:
case T_COP_UNUSABLE:
/* NetBSD issues SIGSEGV here, IRIX rather uses SIGILL */
isi->isi_code = IRIX_SEGV_MAPERR;
isi->isi_errno = IRIX_EFAULT;
break;
case T_OVFLOW:
isi->isi_errno = IRIX_EOVERFLOW;
case T_TRAP:
isi->isi_code = IRIX_FPE_INTOVF;
break;
case T_FPE:
isi->isi_code = IRIX_FPE_FLTINV;
break;
case T_WATCH:
case T_VCEI:
case T_VCED:
case T_INT:
case T_SYSCALL:
default:
isi->isi_code = 0;
#ifdef DEBUG_IRIX
printf("irix_signal_siginfo: sig %d code %ld\n", sig, code);
#endif
break;
}
}
void
native_to_irix_sigset(const sigset_t *bss, irix_sigset_t *sss)
{
int i, newsig;
irix_sigemptyset(sss);
for (i = 1; i < NSIG; i++) {
if (sigismember(bss, i)) {
newsig = native_to_svr4_signo[i];
if (newsig)
irix_sigaddset(sss, newsig);
}
}
}
void
irix_to_native_sigset(const irix_sigset_t *sss, sigset_t *bss)
{
int i, newsig;
sigemptyset(bss);
for (i = 1; i < SVR4_NSIG; i++) {
if (irix_sigismember(sss, i)) {
newsig = svr4_to_native_signo[i];
if (newsig)
sigaddset(bss, newsig);
}
}
}
void
irix_sendsig(const ksiginfo_t *ksi, const sigset_t *mask)
{
struct lwp *l = curlwp;
struct proc *p = l->l_proc;
void *sp;
struct trapframe *tf = l->l_md.md_utf;
int onstack;
int error;
sig_t catcher = SIGACTION(p, ksi->ksi_signo).sa_handler;
struct irix_sigframe sf;
#ifdef DEBUG_IRIX
printf("irix_sendsig()\n");
printf("catcher = %p, sig = %d, code = 0x%x\n",
(void *)catcher, ksi->ksi_signo, ksi->ksi_trap);
printf("irix_sendsig(): starting [PC=0x%#"PRIxREGISTER
" SP=%#"PRIxREGISTER" SR=0x%08lx]\n",
tf->tf_regs[_R_PC], tf->tf_regs[_R_SP], tf->tf_regs[_R_SR]);
#endif /* DEBUG_IRIX */
/*
* Do we need to jump onto the signal stack?
*/
onstack =
(l->l_sigstk.ss_flags & (SS_DISABLE | SS_ONSTACK)) == 0
&& (SIGACTION(p, ksi->ksi_signo).sa_flags & SA_ONSTACK) != 0;
#ifdef DEBUG_IRIX
if (onstack)
printf("irix_sendsig: using signal stack\n");
#endif
/*
* Allocate space for the signal handler context.
*/
if (onstack)
sp = (void *)((char *)l->l_sigstk.ss_sp
+ l->l_sigstk.ss_size);
else
/* cast for O64 case */
sp = (void *)(intptr_t)tf->tf_regs[_R_SP];
/*
* Build the signal frame
*/
memset(&sf, 0, sizeof(sf));
if (SIGACTION(p, ksi->ksi_signo).sa_flags & SA_SIGINFO) {
irix_set_ucontext(&sf.isf_ctx.iss.iuc, mask, ksi->ksi_trap, l);
irix_signal_siginfo(&sf.isf_ctx.iss.iis, ksi->ksi_signo,
ksi->ksi_trap, (void *)tf->tf_regs[_R_BADVADDR]);
} else {
irix_set_sigcontext(&sf.isf_ctx.isc, mask, ksi->ksi_trap, l);
}
/*
* Compute the new stack address after copying sigframe
*/
sp = (void *)((intptr_t)sp - sizeof(sf.isf_ctx));
sp = (void *)((intptr_t)sp & ~0xfUL); /* 16 bytes alignement */
/*
* Install the sigframe onto the stack
*/
sendsig_reset(l, ksi->ksi_signo);
mutex_exit(p->p_lock);
error = copyout(&sf.isf_ctx, sp, sizeof(sf.isf_ctx));
mutex_enter(p->p_lock);
if (error != 0) {
/*
* Process has trashed its stack; give it an illegal
* instruction to halt it in its tracks.
*/
#ifdef DEBUG_IRIX
printf("irix_sendsig: stack trashed\n");
#endif /* DEBUG_IRIX */
sigexit(l, SIGILL);
/* NOTREACHED */
}
/*
* Set up signal trampoline arguments.
*/
tf->tf_regs[_R_A0] = native_to_svr4_signo[ksi->ksi_signo];/* signo */
tf->tf_regs[_R_A1] = 0; /* NULL */
tf->tf_regs[_R_A2] = (intptr_t)sp; /* ucontext/sigcontext */
tf->tf_regs[_R_A3] = (intptr_t)catcher; /* signal handler address */
/*
* When siginfo is selected, the higher bit of A0 is set
* This is how the signal trampoline is able to discover if A2
* points to a struct irix_sigcontext or struct irix_ucontext.
* Also, A1 points to struct siginfo instead of being NULL.
*/
if (SIGACTION(p, ksi->ksi_signo).sa_flags & SA_SIGINFO) {
tf->tf_regs[_R_A0] |= 0x80000000;
tf->tf_regs[_R_A1] = (intptr_t)sp +
((intptr_t)&sf.isf_ctx.iss.iis - (intptr_t)&sf);
}
/*
* Set up the new stack pointer
*/
tf->tf_regs[_R_SP] = (intptr_t)sp;
#ifdef DEBUG_IRIX
printf("stack pointer at %p, A1 = %p\n", sp, (void *)tf->tf_regs[_R_A1]);
#endif /* DEBUG_IRIX */
/*
* Set up the registers to jump to the signal trampoline
* on return to userland.
* see irix_sys_sigaction for details about how we get
* the signal trampoline address.
*/
tf->tf_regs[_R_PC] = (intptr_t)
(((struct irix_emuldata *)(p->p_emuldata))->ied_sigtramp[ksi->ksi_signo]);
/*
* Remember that we're now on the signal stack.
*/
if (onstack)
l->l_sigstk.ss_flags |= SS_ONSTACK;
#ifdef DEBUG_IRIX
printf("returning from irix_sendsig()\n");
#endif
}
static void
irix_set_sigcontext (struct irix_sigcontext *scp, const sigset_t *mask,
int code, struct lwp *l)
{
struct trapframe * const tf = l->l_md.md_utf;
struct pcb * const pcb = lwp_getpcb(l);
KASSERT(mutex_owned(l->l_proc->p_lock));
#ifdef DEBUG_IRIX
printf("irix_set_sigcontext()\n");
#endif
/*
* Build stack frame for signal trampoline.
*/
native_to_irix_sigset(mask, &scp->isc_sigset);
for (u_int i = 1; i < 32; i++) { /* save gpr1 - gpr31 */
scp->isc_regs[i] = tf->tf_regs[i];
}
scp->isc_regs[0] = 0;
scp->isc_fp_rounded_result = 0;
scp->isc_regmask = -2;
scp->isc_mdhi = tf->tf_regs[_R_MULHI];
scp->isc_mdlo = tf->tf_regs[_R_MULLO];
scp->isc_pc = tf->tf_regs[_R_PC];
scp->isc_badvaddr = tf->tf_regs[_R_BADVADDR];
scp->isc_cause = tf->tf_regs[_R_CAUSE];
/*
* Save the floating-point state, if necessary, then copy it.
*/
#if !defined(NOFPU) || defined(FPEMUL)
scp->isc_ownedfp = fpu_used_p(l);
if (scp->isc_ownedfp) {
/* if FPU has current state, save it first */
fpu_save_lwp(l);
memcpy(&scp->isc_fpregs, &pcb->pcb_fpregs,
sizeof(scp->isc_fpregs));
scp->isc_fpc_csr = pcb->pcb_fpregs.r_regs[32];
}
#else
memcpy(&scp->isc_fpregs, &pcb->pcb_fpregs, sizeof(scp->isc_fpregs));
#endif
/*
* Save signal stack
*/
scp->isc_ssflags =
(l->l_sigstk.ss_flags & SS_ONSTACK) ? IRIX_SS_ONSTACK : 0;
return;
}
void
irix_set_ucontext(struct irix_ucontext *ucp, const sigset_t *mask,
int code, struct lwp *l)
{
struct trapframe * const tf = l->l_md.md_utf;
KASSERT(mutex_owned(l->l_proc->p_lock));
#ifdef DEBUG_IRIX
printf("irix_set_ucontext()\n");
#endif
/*
* Save general purpose registers
*/
native_to_irix_sigset(mask, &ucp->iuc_sigmask);
memcpy(&ucp->iuc_mcontext.svr4___gregs,
&tf->tf_regs, 32 * sizeof(mips_reg_t));
/* Theses registers have different order on NetBSD and IRIX */
ucp->iuc_mcontext.svr4___gregs[IRIX_CTX_MDLO] = tf->tf_regs[_R_MULLO];
ucp->iuc_mcontext.svr4___gregs[IRIX_CTX_MDHI] = tf->tf_regs[_R_MULHI];
ucp->iuc_mcontext.svr4___gregs[IRIX_CTX_EPC] = tf->tf_regs[_R_PC];
ucp->iuc_mcontext.svr4___gregs[IRIX_CTX_CAUSE] = tf->tf_regs[_R_CAUSE];
/*
* Save the floating-point state, if necessary, then copy it.
*/
#if !defined(NOFPU) || defined(FPEMUL)
if (fpu_used_p(l)) {
struct pcb * const pcb = lwp_getpcb(l);
/* FPU has current state, save it first */
fpu_save_lwp(l);
memcpy(&ucp->iuc_mcontext.svr4___fpregs,
&pcb->pcb_fpregs, sizeof(ucp->iuc_mcontext.svr4___fpregs));
ucp->iuc_mcontext.svr4___fpregs.svr4___fp_csr =
pcb->pcb_fpregs.r_regs[32];
}
#else
memcpy(&ucp->iuc_mcontext.svr4___fpregs,
&pcb->pcb_fpregs, sizeof(ucp->iuc_mcontext.svr4___fpregs));
#endif
/*
* Save signal stack
*/
ucp->iuc_stack.ss_sp = l->l_sigstk.ss_sp;
ucp->iuc_stack.ss_size = l->l_sigstk.ss_size;
if (l->l_sigstk.ss_flags & SS_ONSTACK)
ucp->iuc_stack.ss_flags |= IRIX_SS_ONSTACK;
else
ucp->iuc_stack.ss_flags &= ~IRIX_SS_ONSTACK;
if (l->l_sigstk.ss_flags & SS_DISABLE)
ucp->iuc_stack.ss_flags |= IRIX_SS_DISABLE;
else
ucp->iuc_stack.ss_flags &= ~IRIX_SS_DISABLE;
/*
* Used fields in irix_ucontext: all
*/
ucp->iuc_flags = IRIX_UC_ALL;
return;
}
int
irix_sys_sigreturn(struct lwp *l, const struct irix_sys_sigreturn_args *uap, register_t *retval)
{
/* {
syscallarg(struct irix_sigcontext *) scp;
syscallarg(struct irix_ucontext *) ucp;
syscallarg(int) signo;
} */
void *usf;
struct irix_sigframe ksf;
struct proc *p = l->l_proc;
int error;
#ifdef DEBUG_IRIX
printf("irix_sys_sigreturn()\n");
printf("scp = %p, ucp = %p, sig = %d\n",
(void *)SCARG(uap, scp), (void *)SCARG(uap, ucp),
SCARG(uap, signo));
#endif /* DEBUG_IRIX */
/*
* The trampoline code hands us the context.
* It is unsafe to keep track of it ourselves, in the event that a
* program jumps out of a signal handler.
*/
usf = (void *)SCARG(uap, scp);
if (usf == NULL) {
usf = (void *)SCARG(uap, ucp);
if ((error = copyin(usf, &ksf.isf_ctx.iss.iuc,
sizeof(ksf.isf_ctx))) != 0)
return error;
mutex_enter(p->p_lock);
irix_get_ucontext(&ksf.isf_ctx.iss.iuc, l);
mutex_exit(p->p_lock);
} else {
if ((error = copyin(usf, &ksf.isf_ctx.isc,
sizeof(ksf.isf_ctx))) != 0)
return error;
mutex_enter(p->p_lock);
irix_get_sigcontext(&ksf.isf_ctx.isc, l);
mutex_exit(p->p_lock);
}
#ifdef DEBUG_IRIX
printf("irix_sys_sigreturn(): returning [PC=%p SP=%p SR=0x%08lx]\n",
(void *)l->l_md.md_utf->tf_regs[_R_PC],
(void *)(l->l_md.md_utf->tf_regs[_R_SP],
l->l_md.md_utf->tf_regs[_R_SR]);
#endif
return EJUSTRETURN;
}
static void
irix_get_ucontext(struct irix_ucontext *ucp, struct lwp *l)
{
struct trapframe *tf = l->l_md.md_utf;
sigset_t mask;
KASSERT(mutex_owned(l->l_proc->p_lock));
/* Restore the register context. */
if (ucp->iuc_flags & IRIX_UC_CPU) {
(void)memcpy(&tf->tf_regs, &ucp->iuc_mcontext.svr4___gregs,
32 * sizeof(mips_reg_t));
/* Theses registers have different order on NetBSD and IRIX */
tf->tf_regs[_R_MULLO] =
ucp->iuc_mcontext.svr4___gregs[IRIX_CTX_MDLO];
tf->tf_regs[_R_MULHI] =
ucp->iuc_mcontext.svr4___gregs[IRIX_CTX_MDHI];
tf->tf_regs[_R_PC] =
ucp->iuc_mcontext.svr4___gregs[IRIX_CTX_EPC];
}
if (ucp->iuc_flags & IRIX_UC_MAU) {
struct pcb * const pcb = lwp_getpcb(l);
#if !defined(NOFPU) || defined(FPEMUL)
fpu_discard();
memcpy(&pcb->pcb_fpregs, &ucp->iuc_mcontext.svr4___fpregs,
sizeof(pcb->pcb_fpregs));
pcb->pcb_fpregs.r_regs[32] =
ucp->iuc_mcontext.svr4___fpregs.svr4___fp_csr;
#else
memcpy(&pcb->pcb_fpregs, &ucp->iuc_mcontext.svr4___fpregs,
sizeof(pcb->pcb_fpregs));
#endif
}
/*
* Restore stack
*/
if (ucp->iuc_flags & IRIX_UC_STACK) {
l->l_sigstk.ss_sp = ucp->iuc_stack.ss_sp;
l->l_sigstk.ss_size = ucp->iuc_stack.ss_size;
if (ucp->iuc_stack.ss_flags & IRIX_SS_ONSTACK)
l->l_sigstk.ss_flags |= SS_ONSTACK;
else
l->l_sigstk.ss_flags &= ~SS_ONSTACK;
if (ucp->iuc_stack.ss_flags & IRIX_SS_DISABLE)
l->l_sigstk.ss_flags |= IRIX_SS_DISABLE;
else
l->l_sigstk.ss_flags &= ~IRIX_SS_DISABLE;
}
/*
* Restore signal mask
*/
if (ucp->iuc_flags & IRIX_UC_SIGMASK) {
/* Restore signal mask. */
irix_to_native_sigset(&ucp->iuc_sigmask, &mask);
(void)sigprocmask1(l, SIG_SETMASK, &mask, 0);
}
return;
}
static void
irix_get_sigcontext(struct irix_sigcontext *scp, struct lwp *l)
{
struct trapframe * const tf = l->l_md.md_utf;
struct pcb * const pcb = lwp_getpcb(l);
sigset_t mask;
int i;
KASSERT(mutex_owned(l->l_proc->p_lock));
/* Restore the register context. */
for (i = 1; i < 32; i++) /* restore gpr1 to gpr31 */
tf->tf_regs[i] = scp->isc_regs[i];
tf->tf_regs[_R_MULLO] = scp->isc_mdlo;
tf->tf_regs[_R_MULHI] = scp->isc_mdhi;
tf->tf_regs[_R_PC] = scp->isc_pc;
#if !defined(NOFPU) || defined(FPEMUL)
if (scp->isc_ownedfp) {
fpu_discard();
memcpy(&pcb->pcb_fpregs, &scp->isc_fpregs,
sizeof(scp->isc_fpregs));
pcb->pcb_fpregs.r_regs[32] = scp->isc_fpc_csr;
}
#else
memcpy(&pcb->pcb_fpregs, &scp->isc_fpregs, sizeof(pcb->pcb_fpregs));
#endif
/* Restore signal stack. */
if (scp->isc_ssflags & IRIX_SS_ONSTACK)
l->l_sigstk.ss_flags |= SS_ONSTACK;
else
l->l_sigstk.ss_flags &= ~SS_ONSTACK;
/* Restore signal mask. */
irix_to_native_sigset(&scp->isc_sigset, &mask);
(void)sigprocmask1(l, SIG_SETMASK, &mask, 0);
return;
}
int
irix_sys_sginap(struct lwp *l, const struct irix_sys_sginap_args *uap, register_t *retval)
{
/* {
syscallarg(long) ticks;
} */
int rticks = SCARG(uap, ticks);
struct timeval tvb, tve, tvd;
long long delta;
int dontcare;
if (rticks != 0)
microtime(&tvb);
if ((tsleep(&dontcare, PZERO|PCATCH, 0, rticks) != 0) &&
(rticks != 0)) {
microtime(&tve);
timersub(&tve, &tvb, &tvd);
delta = ((tvd.tv_sec * 1000000) + tvd.tv_usec); /* XXX */
*retval = (register_t)(rticks - (delta / tick));
}
return 0;
}
/*
* XXX Untested. Expect bugs and security problems here
*/
int
irix_sys_getcontext(struct lwp *l, const struct irix_sys_getcontext_args *uap, register_t *retval)
{
/* {
syscallarg(struct irix_ucontext *) ucp;
} */
struct proc *p = l->l_proc;
struct trapframe *tf = l->l_md.md_utf;
struct irix_ucontext kucp;
int i, error;
memset(&kucp, 0, sizeof(kucp));
kucp.iuc_flags = IRIX_UC_ALL;
kucp.iuc_link = NULL; /* XXX */
mutex_enter(p->p_lock);
native_to_irix_sigset(&l->l_sigmask, &kucp.iuc_sigmask);
kucp.iuc_stack.ss_sp = l->l_sigstk.ss_sp;
kucp.iuc_stack.ss_size = l->l_sigstk.ss_size;
kucp.iuc_stack.ss_flags = 0;
if (l->l_sigstk.ss_flags & SS_ONSTACK)
kucp.iuc_stack.ss_flags &= IRIX_SS_ONSTACK;
if (l->l_sigstk.ss_flags & SS_DISABLE)
kucp.iuc_stack.ss_flags &= IRIX_SS_DISABLE;
mutex_exit(p->p_lock);
for (i = 0; i < 36; i++) /* Is order correct? */
kucp.iuc_mcontext.svr4___gregs[i] = tf->tf_regs[i];
for (i = 0; i < 32; i++)
kucp.iuc_mcontext.svr4___fpregs.svr4___fp_r.svr4___fp_regs[i]
= 0; /* XXX where are FP registers? */
for (i = 0; i < 47; i++)
kucp.iuc_filler[i] = 0; /* XXX */
kucp.iuc_triggersave = 0; /* XXX */
error = copyout(&kucp, SCARG(uap, ucp), sizeof(kucp));
return error;
}
/*
* XXX Untested. Expect bugs and security problems here
*/
int
irix_sys_setcontext(struct lwp *l, const struct irix_sys_setcontext_args *uap, register_t *retval)
{
/* {
syscallarg(struct irix_ucontext *) ucp;
} */
struct proc *p = l->l_proc;
struct trapframe *tf = l->l_md.md_utf;
struct irix_ucontext kucp;
int i, error;
error = copyin(SCARG(uap, ucp), &kucp, sizeof(kucp));
if (error)
goto out;
mutex_enter(p->p_lock);
if (kucp.iuc_flags & IRIX_UC_SIGMASK)
irix_to_native_sigset(&kucp.iuc_sigmask,
&l->l_sigmask);
if (kucp.iuc_flags & IRIX_UC_STACK) {
l->l_sigstk.ss_sp = kucp.iuc_stack.ss_sp;
l->l_sigstk.ss_size =
(unsigned long)kucp.iuc_stack.ss_sp;
l->l_sigstk.ss_flags = 0;
if (kucp.iuc_stack.ss_flags & IRIX_SS_ONSTACK)
l->l_sigstk.ss_flags &= SS_ONSTACK;
if (kucp.iuc_stack.ss_flags & IRIX_SS_DISABLE)
l->l_sigstk.ss_flags &= SS_DISABLE;
}
mutex_exit(p->p_lock);
if (kucp.iuc_flags & IRIX_UC_CPU)
for (i = 0; i < 36; i++) /* Is register order right? */
tf->tf_regs[i] = kucp.iuc_mcontext.svr4___gregs[i];
if (kucp.iuc_flags & IRIX_UC_MAU) { /* XXX */
#ifdef DEBUG_IRIX
printf("irix_sys_setcontext(): IRIX_UC_MAU requested\n");
#endif
}
out:
return error;
}
/*
* The following code is from svr4_sys_waitsys(), with a few lines added
* for supporting the rusage argument which is present in the IRIX version
* and not in the SVR4 version.
* Both version could be merged by creating a svr4_sys_waitsys1() with the
* rusage argument, and by calling it with NULL from svr4_sys_waitsys().
* irix_wait_siginfo is here because 1) svr4_setinfo is static and cannot be
* used here and 2) because struct irix_irix5_siginfo is quite different
* from svr4_siginfo. In order to merge, we need to include irix_signal.h
* from svr4_misc.c, or push the irix_irix5_siginfo into svr4_siginfo.h
*/
int
irix_sys_waitsys(struct lwp *l, const struct irix_sys_waitsys_args *uap,
register_t *retval)
{
/* {
syscallarg(int) type;
syscallarg(int) pid;
syscallarg(struct irix_irix5_siginfo *) info;
syscallarg(int) options;
syscallarg(struct rusage *) ru;
} */
struct proc *parent = l->l_proc;
int error, status, options, pid;
struct rusage ru;
switch (SCARG(uap, type)) {
case SVR4_P_PID:
pid = SCARG(uap, pid);
break;
case SVR4_P_PGID:
pid = -parent->p_pgid;
break;
case SVR4_P_ALL:
pid = WAIT_ANY;
break;
default:
return EINVAL;
}
#ifdef DEBUG_IRIX
printf("waitsys(%d, %d, %p, %x, %p)\n",
SCARG(uap, type), pid,
SCARG(uap, info), SCARG(uap, options), SCARG(uap, ru));
#endif
/* Translate options */
options = WOPTSCHECKED;
if (SCARG(uap, options) & SVR4_WNOWAIT)
options |= WNOWAIT;
if (SCARG(uap, options) & SVR4_WNOHANG)
options |= WNOHANG;
if ((SCARG(uap, options) & (SVR4_WEXITED|SVR4_WTRAPPED)) == 0)
options |= WNOZOMBIE;
if (SCARG(uap, options) & (SVR4_WSTOPPED|SVR4_WCONTINUED))
options |= WUNTRACED;
error = do_sys_wait(&pid, &status, options, &ru);
if (error != 0)
return error;
if (SCARG(uap, ru)) {
error = copyout(&ru, SCARG(uap, ru), sizeof(ru));
if (error != 0)
return error;
}
return irix_wait_siginfo(pid, &ru, status, SCARG(uap,info));
}
int
irix_sys_sigprocmask(struct lwp *l, const struct irix_sys_sigprocmask_args *uap, register_t *retval)
{
/* {
syscallarg(int) how;
syscallarg(const irix_sigset_t *) set;
syscallarg(irix_sigset_t *) oset;
} */
struct proc *p = l->l_proc;
struct svr4_sys_sigprocmask_args cup;
int error;
sigset_t obss, nbss;
irix_sigset_t niss, oiss;
if (SCARG(uap, how) != IRIX_SIG_SETMASK32) {
SCARG(&cup, how) = SCARG(uap, how);
SCARG(&cup, set) = (const svr4_sigset_t *)SCARG(uap, set);
SCARG(&cup, oset) = (svr4_sigset_t *)SCARG(uap, oset);
return svr4_sys_sigprocmask(l, &cup, retval);
}
if ((error = copyin(SCARG(uap, set), &niss, sizeof(niss))) != 0)
return error;
/* We must preserve the high bits of the irix sigmask, so mustget them */
native_to_irix_sigset(&l->l_sigmask, &oiss);
/* The irix bitmask is 128 bits, I think we only have the bottom 32 */
niss.bits[1] = oiss.bits[1];
niss.bits[2] = oiss.bits[2];
niss.bits[3] = oiss.bits[3];
/* We now need the corresponding netbsd mask */
irix_to_native_sigset(&niss, &nbss);
mutex_enter(p->p_lock);
error = sigprocmask1(l, SIG_SETMASK, &nbss, &obss);
mutex_exit(p->p_lock);
if (error != 0 || SCARG(&cup, oset) == NULL)
return error;
native_to_irix_sigset(&obss, &oiss);
/* XXX: should this copyout only be 4 bytes ? */
return copyout(&oiss, SCARG(&cup, oset), sizeof(oiss));
}
int
irix_sys_sigaction(struct lwp *l, const struct irix_sys_sigaction_args *uap, register_t *retval)
{
/* {
syscallarg(int) signum;
syscallarg(const struct svr4_sigaction *) nsa;
syscallarg(struct svr4_sigaction *) osa;
syscallarg(void *) sigtramp;
} */
struct proc *p = l->l_proc;
int signum;
struct svr4_sys_sigaction_args cup;
struct irix_emuldata *ied;
#ifdef DEBUG_IRIX
void *sigtramp;
#endif
/*
* On IRIX, the sigaction() system call has a fourth argument, which
* is a pointer to the signal trampoline code. The kernel does not
* seems to provide a signal trampoline, the user process has to
* embed it. Of course, the sigaction() stub in libc only has three
* argument. The fourth argument to the system call is filled by the
* libc.
*
* The signal trampoline does the following job:
* - holds extra bytes on the stack (48 on IRIX 6, 24 on IRIX 5)
* for the signal frame. See struct irix_sigframe in irix_signal.h
* for the details of the signal frame fields for IRIX 6.
* - checks if the higher bit of a0 is set (the kernel sets this
* when SA_SIGINFO is set)
* - if so, stores in a2 sf.isf_ucp, and NULL in sf.isf_scp
* SA_SIGACTION is set, we are using a struct irix_ucontext in a2
* - if not, stores a2 in sf.isf_scp. Here SA_SIGACTION is clear
* and we are using a struct irix_sigcontext in a2.
* - finds the address of errno, and stores it in sf.isf_uep (IRIX 6
* only). This is done by looking up the Global Offset Table and
* assuming that the errnoaddr symbol is at a fixed offset from
* the signal trampoline.
* - invoke the signal handler
* - sets errno using sf.isf_uep and sf.isf_errno (IRIX 6 only)
* - calls sigreturn(sf.isf_scp, sf.isf_ucp, sf.isf_signo) on IRIX 6
* and sigreturn(sf.isf_scp, sf.isf_ucp) on IRIX 5. Note that if
* SA_SIGINFO was set, then the higher bit of sf.isf_signo is
* still set.
*
* The signal trampoline is hence saved in the p_emuldata field
* of struct proc, in an array (one element for each signal)
*/
signum = SCARG(uap, signum);
if (signum < 0 || signum >= SVR4_NSIG)
return EINVAL;
signum = svr4_to_native_signo[signum];
ied = (struct irix_emuldata *)(p->p_emuldata);
#ifdef DEBUG_IRIX
sigtramp = ied->ied_sigtramp[signum];
if (sigtramp != NULL && sigtramp != SCARG(uap, sigtramp))
printf("Warning: sigtramp changed from %p to %p for sig. %d\n",
sigtramp, SCARG(uap, sigtramp), signum);
#endif
ied->ied_sigtramp[signum] = SCARG(uap, sigtramp);
SCARG(&cup, signum) = signum;
SCARG(&cup, nsa) = SCARG(uap, nsa);
SCARG(&cup, osa) = SCARG(uap, osa);
return svr4_sys_sigaction(l, &cup, retval);
}

View File

@ -1,250 +0,0 @@
/* $NetBSD: irix_signal.h,v 1.18 2008/04/28 20:23:42 martin Exp $ */
/*-
* Copyright (c) 2001-2002 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Emmanuel Dreyfus.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _IRIX_SIGNAL_H_
#define _IRIX_SIGNAL_H_
#include <sys/types.h>
#include <sys/signal.h>
#include <machine/svr4_machdep.h>
#include <compat/irix/irix_types.h>
/* From IRIX's <sys/signal.h> */
#define IRIX_SIG_SETMASK32 256
typedef struct irix_sigcontext {
__uint32_t isc_regmask;
__uint32_t isc_status;
__uint64_t isc_pc;
__uint64_t isc_regs[32];
__uint64_t isc_fpregs[32];
__uint32_t isc_ownedfp;
__uint32_t isc_fpc_csr;
__uint32_t isc_fpc_eir;
__uint32_t isc_ssflags;
__uint64_t isc_mdhi;
__uint64_t isc_mdlo;
__uint64_t isc_cause;
__uint64_t isc_badvaddr;
__uint64_t isc_triggersave;
irix_sigset_t isc_sigset;
__uint64_t isc_fp_rounded_result;
__uint64_t isc_pad[31];
} irix_sigcontext_t;
#define IRIX_SS_ONSTACK 0x00000001
#define IRIX_SS_DISABLE 0x00000002
/* From IRIX's <sys/ucontext.h> */
#define IRIX_UC_SIGMASK 001
#define IRIX_UC_STACK 002
#define IRIX_UC_CPU 004
#define IRIX_UC_MAU 010
#define IRIX_UC_MCONTEXT (IRIX_UC_CPU|IRIX_UC_MAU)
#define IRIX_UC_ALL (IRIX_UC_SIGMASK|IRIX_UC_STACK|IRIX_UC_MCONTEXT)
#define IRIX_CTX_MDLO 32
#define IRIX_CTX_MDHI 33
#define IRIX_CTX_CAUSE 34
#define IRIX_CTX_EPC 35
#if 1 /* _MIPS_SZLONG == 32 */
typedef struct irix__sigaltstack {
void *ss_sp;
irix_size_t ss_size;
int ss_flags;
} irix_stack_t;
#endif
#if 0 /* _MIPS_SZLONG == 64 */
typedef struct irix__sigaltstack {
void *ss_sp;
__uint32_t ss_size;
int ss_flags;
} irix_stack_t;
#endif
typedef struct irix_ucontext {
unsigned long iuc_flags;
struct irix_ucontext *iuc_link;
irix_sigset_t iuc_sigmask;
irix_stack_t iuc_stack;
svr4_mcontext_t iuc_mcontext;
long iuc_filler[47];
int iuc_triggersave;
} irix_ucontext_t;
/* From IRIX's <sys/siginfo.h> */
#define IRIX_ILL_ILLOPC 1
#define IRIX_ILL_ILLOPN 2
#define IRIX_ILL_ILLADR 3
#define IRIX_ILL_ILLTRP 4
#define IRIX_ILL_PRVOPC 5
#define IRIX_ILL_PRVREG 6
#define IRIX_ILL_COPROC 7
#define IRIX_ILL_BADSTK 8
#define IRIX_FPE_INTDIV 1
#define IRIX_FPE_INTOVF 2
#define IRIX_FPE_FLTDIV 3
#define IRIX_FPE_FLTOVF 4
#define IRIX_FPE_FLTUND 5
#define IRIX_FPE_FLTRES 6
#define IRIX_FPE_FLTINV 7
#define IRIX_FPE_FLTSUB 8
#define IRIX_SEGV_MAPERR 1
#define IRIX_SEGV_ACCERR 2
#define IRIX_BUS_ADRALN 1
#define IRIX_BUS_ADRERR 2
#define IRIX_BUS_OBJERR 3
#define IRIX_TRAP_BRKPT 1
#define IRIX_TRAP_TRACE 2
#define IRIX_CLD_EXITED 1
#define IRIX_CLD_KILLED 2
#define IRIX_CLD_DUMPED 3
#define IRIX_CLD_TRAPPED 4
#define IRIX_CLD_STOPPED 5
#define IRIX_CLD_CONTINUED 6
#define IRIX_POLL_IN 1
#define IRIX_POLL_OUT 2
#define IRIX_POLL_MSG 3
#define IRIX_POLL_ERR 4
#define IRIX_POLL_PRI 5
#define IRIX_POLL_HUP 6
#define IRIX_UME_ECCERR 1
/* From IRIX's <sys/fault.h> */
#define IRIX_FLTILL 1
#define IRIX_FLTPRIV 2
#define IRIX_FLTBPT 3
#define IRIX_FLTTRACE 4
#define IRIX_FLTACCESS 5
#define IRIX_FLTBOUNDS 6
#define IRIX_FLTIOVF 7
#define IRIX_FLTIZDIV 8
#define IRIX_FLTFPE 9
#define IRIX_FLTSTACK 10
#define IRIX_FLTPAGE 11
#define IRIX_FLTPCINVAL 12
#define IRIX_FLTWATCH 13
#define IRIX_FLTKWATCH 14
#define IRIX_FLTSCWATCH 15
#define IRIX_SI_MAXSZ 128
#define IRIX_SI_PAD ((IRIX_SI_MAXSZ / sizeof(__int32_t)) - 3)
/* From IRIX's <sys/ksignal.h> */
typedef union irix_irix5_sigval {
irix_app32_int_t sigbval_int;
irix_app32_ptr_t sival_ptr;
} irix_irix5_sigval_t;
typedef struct irix_irix5_siginfo {
irix_app32_int_t isi_signo;
irix_app32_int_t isi_code;
irix_app32_int_t isi_errno;
union {
irix_app32_int_t si_pad[IRIX_SI_PAD];
struct {
irix_irix5_pid_t __pid;
union {
struct {
irix_irix5_uid_t __uid;
} __kill;
struct {
irix_irix5_clock_t __utime;
irix_app32_int_t __status;
irix_irix5_clock_t __stime;
irix_app32_int_t __swap;
} __cld;
} __pdata;
} __proc;
struct {
irix_app32_ptr_t __addr;
} __fault;
struct {
irix_app32_int_t __fd;
irix_app32_long_t __band;
} __file;
union irix_irix5_sigval __value;
} __data;
} irix_irix5_siginfo_t;
#define isi_pid __data.__proc.__pid
#define isi_stime __data.__proc.__pdata.__cld.__stime
#define isi_utime __data.__proc.__pdata.__cld.__utime
#define isi_status __data.__proc.__pdata.__cld.__status
#define isi_addr __data.__fault.__addr
#define isi_trap
/*
* This is the signal frame, as seen by the signal handler. The
* kernel only sets up isf_ctx, the signal trampoline does the
* other fields.
*/
struct irix_sigframe {
int isf_pad1[7];
int *isf_uep; /* Pointer to errno in userspace */
int isf_errno;
int isf_signo;
struct irix_sigcontext *isf_scp;
struct irix_ucontext *isf_ucp;
union {
struct irix_sigcontext isc;
struct irix_sigcontext_siginfo {
struct irix_ucontext iuc;
struct irix_irix5_siginfo iis;
} iss;
} isf_ctx;
};
#ifdef _KERNEL
__BEGIN_DECLS
void native_to_irix_sigset(const sigset_t *, irix_sigset_t *);
void irix_to_native_sigset(const irix_sigset_t *, sigset_t *);
void irix_sendsig(const ksiginfo_t *, const sigset_t *);
__END_DECLS
#endif /* _KERNEL */
#endif /* _IRIX_SIGNAL_H_ */

View File

@ -1,195 +0,0 @@
/* $NetBSD: irix_stat.c,v 1.24 2008/04/28 20:23:42 martin Exp $ */
/*-
* Copyright (c) 2001, 2008 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Emmanuel Dreyfus.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: irix_stat.c,v 1.24 2008/04/28 20:23:42 martin Exp $");
#include <sys/errno.h>
#include <sys/types.h>
#include <sys/signal.h>
#include <sys/param.h>
#include <sys/filedesc.h>
#include <sys/proc.h>
#include <sys/mount.h>
#include <sys/namei.h>
#include <sys/stdint.h>
#include <sys/stat.h>
#include <sys/systm.h>
#include <sys/syscallargs.h>
#include <sys/vfs_syscalls.h>
#include <compat/common/compat_util.h>
#include <compat/svr4/svr4_types.h>
#include <compat/irix/irix_types.h>
#include <compat/irix/irix_signal.h>
#include <compat/irix/irix_syscall.h>
#include <compat/irix/irix_syscallargs.h>
static void bsd_to_irix_stat(struct stat *, struct irix_stat *);
static void bsd_to_irix_stat64(struct stat *, struct irix_stat64 *);
static void
bsd_to_irix_stat(struct stat *bsp, struct irix_stat *isp)
{
memset(isp, 0, sizeof(*isp));
isp->ist_dev = (irix_dev_t)bsd_to_svr4_dev_t(bsp->st_dev);
isp->ist_ino = bsp->st_ino;
isp->ist_mode = bsp->st_mode; /* XXX translate it */
isp->ist_nlink = bsp->st_nlink;
isp->ist_uid = bsp->st_uid;
isp->ist_gid = bsp->st_gid;
if ((bsp->st_mode & S_IFMT) == S_IFBLK ||
(bsp->st_mode & S_IFMT) == S_IFCHR)
isp->ist_rdev = (irix_dev_t)bsd_to_svr4_dev_t(bsp->st_rdev);
else
isp->ist_rdev = 0;
isp->ist_size = bsp->st_size;
isp->ist_atim.tv_sec = bsp->st_atimespec.tv_sec;
isp->ist_atim.tv_nsec = bsp->st_atimespec.tv_nsec;
isp->ist_mtim.tv_sec = bsp->st_mtimespec.tv_sec;
isp->ist_mtim.tv_nsec = bsp->st_mtimespec.tv_nsec;
isp->ist_ctim.tv_sec = bsp->st_ctimespec.tv_sec;
isp->ist_ctim.tv_nsec = bsp->st_ctimespec.tv_nsec;
isp->ist_size = bsp->st_size;
isp->ist_blocks = bsp->st_blocks;
isp->ist_blksize = bsp->st_blksize;
strlcpy(isp->ist_fstype, "unknown", sizeof(isp->ist_fstype));
return;
}
static void
bsd_to_irix_stat64(struct stat *bsp, struct irix_stat64 *isp)
{
memset(isp, 0, sizeof(*isp));
isp->ist_dev = (irix_dev_t)bsd_to_svr4_dev_t(bsp->st_dev);
isp->ist_ino = bsp->st_ino;
isp->ist_mode = bsp->st_mode; /* XXX translate it */
isp->ist_nlink = bsp->st_nlink;
isp->ist_uid = bsp->st_uid;
isp->ist_gid = bsp->st_gid;
if ((bsp->st_mode & S_IFMT) == S_IFBLK ||
(bsp->st_mode & S_IFMT) == S_IFCHR)
isp->ist_rdev = (irix_dev_t)bsd_to_svr4_dev_t(bsp->st_rdev);
else
isp->ist_rdev = 0;
isp->ist_size = bsp->st_size;
isp->ist_atim.tv_sec = bsp->st_atimespec.tv_sec;
isp->ist_atim.tv_nsec = bsp->st_atimespec.tv_nsec;
isp->ist_mtim.tv_sec = bsp->st_mtimespec.tv_sec;
isp->ist_mtim.tv_nsec = bsp->st_mtimespec.tv_nsec;
isp->ist_ctim.tv_sec = bsp->st_ctimespec.tv_sec;
isp->ist_ctim.tv_nsec = bsp->st_ctimespec.tv_nsec;
isp->ist_size = bsp->st_size;
isp->ist_blocks = bsp->st_blocks;
isp->ist_blksize = bsp->st_blksize;
strlcpy(isp->ist_fstype, "unknown", sizeof(isp->ist_fstype));
return;
}
static int
convert_irix_stat(struct stat *st, void *buf, int stat_version)
{
switch (stat_version) {
case IRIX__STAT_VER: {
struct irix_stat ist;
bsd_to_irix_stat(st, &ist);
return copyout(&ist, buf, sizeof (ist));
}
case IRIX__STAT64_VER: {
struct irix_stat64 ist;
bsd_to_irix_stat64(st, &ist);
return copyout(&ist, buf, sizeof (ist));
}
case IRIX__R3_STAT_VER:
default:
printf("Warning: unimplemented irix_sys_?stat() version %d\n",
stat_version);
return EINVAL;
}
}
int
irix_sys_xstat(struct lwp *l, const struct irix_sys_xstat_args *uap, register_t *retval)
{
/* {
syscallarg(const int) version;
syscallarg(const char *) path;
syscallarg(struct stat *) buf;
} */
struct stat st;
int error;
error = do_sys_stat(SCARG(uap, path), FOLLOW, &st);
if (error != 0)
return error;
return convert_irix_stat(&st, SCARG(uap, buf), SCARG(uap, version));
}
int
irix_sys_lxstat(struct lwp *l, const struct irix_sys_lxstat_args *uap, register_t *retval)
{
/* {
syscallarg(const int) version;
syscallarg(const char *) path;
syscallarg(struct stat *) buf;
} */
struct stat st;
int error;
error = do_sys_stat(SCARG(uap, path), NOFOLLOW, &st);
if (error != 0)
return error;
return convert_irix_stat(&st, SCARG(uap, buf), SCARG(uap, version));
}
int
irix_sys_fxstat(struct lwp *l, const struct irix_sys_fxstat_args *uap, register_t *retval)
{
/* {
syscallarg(const int) version;
syscallarg(const int) fd;
syscallarg(struct stat *) buf;
} */
struct stat st;
int error;
error = do_sys_fstat(SCARG(uap, fd), &st);
if (error != 0)
return error;
return convert_irix_stat(&st, SCARG(uap, buf), SCARG(uap, version));
}

View File

@ -1,213 +0,0 @@
/* $NetBSD: irix_swap.c,v 1.21 2008/04/28 20:23:42 martin Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Emmanuel Dreyfus.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: irix_swap.c,v 1.21 2008/04/28 20:23:42 martin Exp $");
#include <sys/types.h>
#include <sys/signal.h>
#include <sys/param.h>
#include <sys/mount.h>
#include <sys/malloc.h>
#include <sys/proc.h>
#include <sys/systm.h>
#include <sys/swap.h>
#include <sys/vnode.h>
#include <sys/namei.h>
#include <sys/syscallargs.h>
#include <uvm/uvm_page.h>
#include <uvm/uvm_swap.h>
#include <compat/common/compat_util.h>
#include <compat/irix/irix_types.h>
#include <compat/irix/irix_signal.h>
#include <compat/irix/irix_swap.h>
#include <compat/irix/irix_syscall.h>
#include <compat/irix/irix_syscallargs.h>
int
irix_sys_swapctl(struct lwp *l, const struct irix_sys_swapctl_args *uap, register_t *retval)
{
/* {
syscallarg(int) cmd;
syscallarg(void *) arg;
} */
struct sys_swapctl_args cup;
int error = 0;
#ifdef DEBUG_IRIX
printf("irix_sys_swapctl(): cmd = %d, arg = %p\n", SCARG(uap, cmd),
SCARG(uap, arg));
#endif
switch (SCARG(uap, cmd)) {
case IRIX_SC_ADD: /* Add a swap resource */
case IRIX_SC_SGIADD: /* Add a swap resource */
case IRIX_SC_REMOVE: {/* Remove a swap resource */
struct irix_xswapres isr;
size_t len = (SCARG(uap, cmd) == IRIX_SC_SGIADD) ?
sizeof(struct irix_xswapres) : sizeof(struct irix_swapres);
if ((error = copyin(SCARG(uap, arg), &isr, len)) != 0)
return error;
#ifdef DEBUG_IRIX
printf("irix_sys_swapctl(): sr_start=%d, sr_length=%d",
isr.sr_start, isr.sr_length);
if (SCARG(uap, cmd) == IRIX_SC_SGIADD)
printf(", sr_maxlength=%d, sr_vlength=%d",
isr.sr_maxlength, isr.sr_vlength);
printf("\n");
#endif
if (isr.sr_start != 0) {
printf("Warning: irix_sys_swapctl(): ");
printf("unsupported non null sr_start\n");
return EINVAL;
}
SCARG(&cup, cmd) =
(SCARG(uap, cmd) == IRIX_SC_REMOVE) ? SWAP_OFF : SWAP_ON;
SCARG(&cup, arg) = isr.sr_name;
SCARG(&cup, misc) =
(SCARG(uap, cmd) == IRIX_SC_SGIADD) ? isr.sr_pri : 0;
return sys_swapctl(l, &cup, retval);
break;
}
case IRIX_SC_GETNSWP: /* Get number of swap items */
SCARG(&cup, cmd) = SWAP_NSWAP;
SCARG(&cup, arg) = NULL;
SCARG(&cup, misc) = 0;
return sys_swapctl(l, &cup, retval);
break;
case IRIX_SC_LIST: { /* Get swap list */
struct irix_swaptable ist;
struct swapent *bse;
struct irix_swapent *ise, *uise;
int len, ilen, pathlen;
int i;
size_t blksz = dbtob(1); /* One swap block size in bytes */
int scale = (PAGE_SIZE / blksz);
if ((error = copyin(SCARG(uap, arg), &ist, sizeof(ist))) != 0)
return error;
uise = (struct irix_swapent *)((char *)SCARG(uap, arg) +
sizeof(ist.swt_n));
len = sizeof(struct swapent) * ist.swt_n;
bse = (struct swapent *)malloc(len, M_TEMP, M_WAITOK);
ilen = sizeof(struct irix_swapent) * ist.swt_n;
ise = (struct irix_swapent *)malloc(ilen, M_TEMP, M_WAITOK);
if ((error = copyin(uise, ise, ilen)) != 0)
return error;
uvm_swap_stats(SWAP_STATS, bse, ist.swt_n, retval);
for (i = 0; i < ist.swt_n; i++) {
pathlen = MIN(strlen(bse[i].se_path), IRIX_PATH_MAX);
if (ise[i].ste_path != NULL &&
((error = copyout(&(bse[i].se_path),
ise[i].ste_path, pathlen)) != 0))
goto bad;
ise[i].ste_start = 0;
ise[i].ste_length = bse[i].se_nblks * blksz;
ise[i].ste_pages = bse[i].se_nblks / scale;
ise[i].ste_free = (bse[i].se_nblks - bse[i].se_inuse) /
scale;
ise[i].ste_flags = 0;
if (bse[i].se_flags & SWF_FAKE)
ise[i].ste_flags |= IRIX_ST_NOTREADY;
ise[i].ste_vpages = bse[i].se_inuse / scale;
ise[i].ste_maxpages = bse[i].se_nblks / scale;
ise[i].ste_lswap = 1; /* XXX */
ise[i].ste_pri = bse[i].se_priority;
}
error = copyout(ise, uise, ilen);
bad:
free(bse, M_TEMP);
free(ise, M_TEMP);
return error;
break;
}
case IRIX_SC_GETFREESWAP:
case IRIX_SC_GETSWAPVIRT: {
int entries;
struct swapent *sep;
int i, dontcare, sum = 0;
SCARG(&cup, cmd) = SWAP_NSWAP;
SCARG(&cup, arg) = NULL;
SCARG(&cup, misc) = 0;
if ((error = sys_swapctl(l, &cup,
(register_t *)(void *)&entries)) != 0)
return error;
sep = (struct swapent *)malloc(
sizeof(struct swapent) * entries, M_TEMP, M_WAITOK);
uvm_swap_stats(SWAP_STATS, sep, entries,
(register_t *)(void *)&dontcare);
if (SCARG(uap, cmd) == IRIX_SC_GETFREESWAP)
for (i = 0; i < entries; i++)
sum += (sep[i].se_nblks - sep[i].se_inuse);
if (SCARG(uap, cmd) == IRIX_SC_GETSWAPVIRT)
for (i = 0; i < entries; i++)
sum += sep[i].se_nblks;
/* dbtob(1) is the size in byte of one swap block */
sum = sum * IRIX_SWAP_BLKSZ / dbtob(1);
if ((error = copyout(&sum, SCARG(uap, arg), sizeof(sum))) != 0)
return error;
break;
}
default:
printf("irix_sys_swapctl(): unsupported command %d\n",
SCARG(uap, cmd));
return EINVAL;
break;
}
return 0;
}

View File

@ -1,95 +0,0 @@
/* $NetBSD: irix_swap.h,v 1.4 2008/04/28 20:23:42 martin Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Emmanuel Dreyfus.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _IRIX_SWAPCTL_H_
#define _IRIX_SWAPCTL_H_
/* swap block size for swapctl(2), from swapctl(2) man page */
#define IRIX_SWAP_BLKSZ 512
/* From IRIX's <sys/swap.h> */
#define IRIX_SC_ADD 1
#define IRIX_SC_LIST 2
#define IRIX_SC_REMOVE 3
#define IRIX_SC_GETNSWP 4
#define IRIX_SC_SGIADD 100
#define IRIX_SC_KSGIADD 101
#define IRIX_SC_LREMOVE 102
#define IRIX_SC_GETFREESWAP 103
#define IRIX_SC_GETSWAPMAX 104
#define IRIX_SC_GETSWAPVIRT 105
#define IRIX_SC_GETRESVSWAP 106
#define IRIX_SC_GETSWAPTOT 107
#define IRIX_SC_GETLSWAPTOT 108
struct irix_swapent {
char *ste_path;
irix_off_t ste_start;
irix_off_t ste_length;
long ste_pages;
long ste_free;
long ste_flags;
long ste_vpages;
long ste_maxpages;
short ste_lswap;
signed char ste_pri;
};
struct irix_swaptable {
int swt_n;
struct irix_swapent swt_ent[1];
};
#define IRIX_ST_INDEL 0x01
#define IRIX_ST_NOTREADY 0x02
#define IRIX_ST_STALE 0x04
#define IRIX_ST_LOCAP_SWAP 0x08
#define IRIX_ST_IOERR 0x10
#define IRIX_ST_EACCESS 0x20
#define IRIX_ST_BOOTSWAP 0x40
struct irix_swapres {
char *sr_name;
irix_off_t sr_start;
irix_off_t sr_length;
};
struct irix_xswapres {
char *sr_name;
irix_off_t sr_start;
irix_off_t sr_length;
irix_off_t sr_maxlength;
irix_off_t sr_vlength;
signed char sr_pri;
};
#endif /* _IRIX_SWAPCTL_H_ */

View File

@ -1,443 +0,0 @@
/* $NetBSD: irix_syscall.h,v 1.61 2009/12/14 00:58:36 matt Exp $ */
/*
* System call numbers.
*
* DO NOT EDIT-- this file is automatically generated.
* created from NetBSD: syscalls.master,v 1.54 2009/01/13 22:27:43 pooka Exp
*/
#ifndef _IRIX_SYS_SYSCALL_H_
#define _IRIX_SYS_SYSCALL_H_
#define IRIX_SYS_MAXSYSARGS 8
/* syscall: "syscall" ret: "int" args: */
#define IRIX_SYS_syscall 0
/* syscall: "exit" ret: "int" args: "int" */
#define IRIX_SYS_exit 1
/* syscall: "fork" ret: "int" args: */
#define IRIX_SYS_fork 2
/* syscall: "read" ret: "int" args: "int" "char *" "u_int" */
#define IRIX_SYS_read 3
/* syscall: "write" ret: "int" args: "int" "char *" "u_int" */
#define IRIX_SYS_write 4
/* syscall: "open" ret: "int" args: "const char *" "int" "int" */
#define IRIX_SYS_open 5
/* syscall: "close" ret: "int" args: "int" */
#define IRIX_SYS_close 6
/* 7 is obsolete wait */
/* syscall: "creat" ret: "int" args: "const char *" "int" */
#define IRIX_SYS_creat 8
/* syscall: "link" ret: "int" args: "char *" "char *" */
#define IRIX_SYS_link 9
/* syscall: "unlink" ret: "int" args: "char *" */
#define IRIX_SYS_unlink 10
/* syscall: "execv" ret: "int" args: "const char *" "char **" */
#define IRIX_SYS_execv 11
/* syscall: "chdir" ret: "int" args: "char *" */
#define IRIX_SYS_chdir 12
/* syscall: "time" ret: "int" args: "svr4_time_t *" */
#define IRIX_SYS_time 13
/* 14 is obsolete mknod */
/* syscall: "chmod" ret: "int" args: "char *" "int" */
#define IRIX_SYS_chmod 15
/* syscall: "chown" ret: "int" args: "char *" "int" "int" */
#define IRIX_SYS_chown 16
/* syscall: "break" ret: "int" args: "void *" */
#define IRIX_SYS_break 17
/* 18 is obsolete stat */
/* syscall: "lseek" ret: "long" args: "int" "long" "int" */
#define IRIX_SYS_lseek 19
/* syscall: "getpid" ret: "pid_t" args: */
#define IRIX_SYS_getpid 20
/* syscall: "setuid" ret: "int" args: "uid_t" */
#define IRIX_SYS_setuid 23
/* syscall: "getuid_with_euid" ret: "uid_t" args: */
#define IRIX_SYS_getuid_with_euid 24
/* syscall: "alarm" ret: "int" args: "unsigned" */
#define IRIX_SYS_alarm 27
/* syscall: "fstat" ret: "int" args: "int" "struct svr4_stat *" */
#define IRIX_SYS_fstat 28
/* syscall: "pause" ret: "int" args: */
#define IRIX_SYS_pause 29
/* syscall: "utime" ret: "int" args: "const char *" "struct svr4_utimbuf *" */
#define IRIX_SYS_utime 30
/* syscall: "access" ret: "int" args: "const char *" "int" */
#define IRIX_SYS_access 33
/* syscall: "nice" ret: "int" args: "int" */
#define IRIX_SYS_nice 34
/* syscall: "sync" ret: "int" args: */
#define IRIX_SYS_sync 36
/* syscall: "kill" ret: "int" args: "int" "int" */
#define IRIX_SYS_kill 37
/* syscall: "pgrpsys" ret: "int" args: "int" "int" "int" */
#define IRIX_SYS_pgrpsys 39
/* syscall: "syssgi" ret: "ptrdiff_t" args: "int" "void *" "void *" "void *" "void *" "void *" */
#define IRIX_SYS_syssgi 40
/* syscall: "dup" ret: "int" args: "u_int" */
#define IRIX_SYS_dup 41
/* syscall: "pipe" ret: "int" args: */
#define IRIX_SYS_pipe 42
/* syscall: "times" ret: "int" args: "struct tms *" */
#define IRIX_SYS_times 43
/* syscall: "setgid" ret: "int" args: "gid_t" */
#define IRIX_SYS_setgid 46
/* syscall: "getgid_with_egid" ret: "gid_t" args: */
#define IRIX_SYS_getgid_with_egid 47
/* 48 is obsolete ssig */
#ifdef SYSVMSG
/* syscall: "msgsys" ret: "int" args: "int" "int" "int" "int" "int" */
#define IRIX_SYS_msgsys 49
#else
#endif
#ifdef SYSVSHM
/* syscall: "shmsys" ret: "int" args: "int" "int" "int" "int" */
#define IRIX_SYS_shmsys 52
#else
#endif
#ifdef SYSVSEM
/* syscall: "semsys" ret: "int" args: "int" "int" "int" "int" "int" */
#define IRIX_SYS_semsys 53
#else
#endif
/* syscall: "ioctl" ret: "int" args: "int" "u_long" "void *" */
#define IRIX_SYS_ioctl 54
/* syscall: "sysmp" ret: "int" args: "int" "void *" "void *" "void *" "void *" */
#define IRIX_SYS_sysmp 56
/* syscall: "utssys" ret: "int" args: "void *" "void *" "int" "void *" */
#define IRIX_SYS_utssys 57
/* syscall: "execve" ret: "int" args: "const char *" "char **" "char **" */
#define IRIX_SYS_execve 59
/* syscall: "umask" ret: "int" args: "int" */
#define IRIX_SYS_umask 60
/* syscall: "chroot" ret: "int" args: "char *" */
#define IRIX_SYS_chroot 61
/* syscall: "fcntl" ret: "int" args: "int" "int" "char *" */
#define IRIX_SYS_fcntl 62
/* syscall: "ulimit" ret: "long" args: "int" "long" */
#define IRIX_SYS_ulimit 63
/* 70 is obsolete advfs */
/* 71 is obsolete unadvfs */
/* 72 is obsolete rmount */
/* 73 is obsolete rumount */
/* 74 is obsolete rfstart */
/* syscall: "getrlimit64" ret: "int" args: "int" "struct irix_rlimit64 *" */
#define IRIX_SYS_getrlimit64 75
/* syscall: "setrlimit64" ret: "int" args: "int" "const struct irix_rlimit64 *" */
#define IRIX_SYS_setrlimit64 76
/* syscall: "nanosleep" ret: "int" args: "const struct timespec50 *" "struct timespec50 *" */
#define IRIX_SYS_nanosleep 77
/* syscall: "lseek64" ret: "irix_off64_t" args: "int" "int" "irix_off64_t" "int" "int" "int" "int" */
#define IRIX_SYS_lseek64 78
/* syscall: "rmdir" ret: "int" args: "char *" */
#define IRIX_SYS_rmdir 79
/* syscall: "mkdir" ret: "int" args: "char *" "int" */
#define IRIX_SYS_mkdir 80
/* syscall: "getdents" ret: "int" args: "int" "irix_dirent_t *" "int" */
#define IRIX_SYS_getdents 81
/* syscall: "sginap" ret: "long" args: "long" */
#define IRIX_SYS_sginap 82
/* syscall: "getmsg" ret: "int" args: "int" "struct svr4_strbuf *" "struct svr4_strbuf *" "int *" */
#define IRIX_SYS_getmsg 85
/* syscall: "putmsg" ret: "int" args: "int" "struct svr4_strbuf *" "struct svr4_strbuf *" "int" */
#define IRIX_SYS_putmsg 86
/* syscall: "poll" ret: "int" args: "struct pollfd *" "u_int" "int" */
#define IRIX_SYS_poll 87
/* syscall: "sigreturn" ret: "int" args: "struct irix_sigcontext *" "struct irix_ucontext *" "int" */
#define IRIX_SYS_sigreturn 88
/* syscall: "accept" ret: "int" args: "int" "struct sockaddr *" "int *" */
#define IRIX_SYS_accept 89
/* syscall: "bind" ret: "int" args: "int" "const struct sockaddr *" "int" */
#define IRIX_SYS_bind 90
/* syscall: "connect" ret: "int" args: "int" "const struct sockaddr *" "int" */
#define IRIX_SYS_connect 91
/* syscall: "gethostid" ret: "int32_t" args: */
#define IRIX_SYS_gethostid 92
/* syscall: "getpeername" ret: "int" args: "int" "struct sockaddr *" "int *" */
#define IRIX_SYS_getpeername 93
/* syscall: "getsockname" ret: "int" args: "int" "struct sockaddr *" "int *" */
#define IRIX_SYS_getsockname 94
/* syscall: "getsockopt" ret: "int" args: "int" "int" "int" "void *" "int *" */
#define IRIX_SYS_getsockopt 95
/* syscall: "listen" ret: "int" args: "int" "int" */
#define IRIX_SYS_listen 96
/* syscall: "recv" ret: "int" args: "int" "void *" "int" "int" */
#define IRIX_SYS_recv 97
/* syscall: "recvfrom" ret: "ssize_t" args: "int" "void *" "size_t" "int" "struct sockaddr *" "int *" */
#define IRIX_SYS_recvfrom 98
/* syscall: "recvmsg" ret: "ssize_t" args: "int" "struct msghdr *" "int" */
#define IRIX_SYS_recvmsg 99
/* syscall: "select" ret: "int" args: "int" "fd_set *" "fd_set *" "fd_set *" "struct timeval50 *" */
#define IRIX_SYS_select 100
/* syscall: "send" ret: "int" args: "int" "void *" "int" "int" */
#define IRIX_SYS_send 101
/* syscall: "sendmsg" ret: "ssize_t" args: "int" "const struct msghdr *" "int" */
#define IRIX_SYS_sendmsg 102
/* syscall: "sendto" ret: "ssize_t" args: "int" "const void *" "size_t" "int" "const struct sockaddr *" "int" */
#define IRIX_SYS_sendto 103
/* syscall: "sethostid" ret: "int" args: "int32_t" */
#define IRIX_SYS_sethostid 104
/* syscall: "setsockopt" ret: "int" args: "int" "int" "int" "const void *" "int" */
#define IRIX_SYS_setsockopt 105
/* syscall: "shutdown" ret: "int" args: "int" "int" */
#define IRIX_SYS_shutdown 106
/* syscall: "socket" ret: "int" args: "int" "int" "int" */
#define IRIX_SYS_socket 107
/* syscall: "gethostname" ret: "int" args: "char *" "u_int" */
#define IRIX_SYS_gethostname 108
/* syscall: "sethostname" ret: "int" args: "const char *" "u_int" */
#define IRIX_SYS_sethostname 109
/* syscall: "getdomainname" ret: "int" args: "char *" "int" */
#define IRIX_SYS_getdomainname 110
/* syscall: "setdomainname" ret: "int" args: "char *" "int" */
#define IRIX_SYS_setdomainname 111
/* syscall: "truncate" ret: "int" args: "const char *" "long" */
#define IRIX_SYS_truncate 112
/* syscall: "ftruncate" ret: "int" args: "int" "long" */
#define IRIX_SYS_ftruncate 113
/* syscall: "rename" ret: "int" args: "const char *" "const char *" */
#define IRIX_SYS_rename 114
/* syscall: "symlink" ret: "int" args: "const char *" "const char *" */
#define IRIX_SYS_symlink 115
/* syscall: "readlink" ret: "int" args: "const char *" "char *" "size_t" */
#define IRIX_SYS_readlink 116
/* syscall: "setregid" ret: "int" args: "gid_t" "gid_t" */
#define IRIX_SYS_setregid 123
/* syscall: "setreuid" ret: "int" args: "uid_t" "uid_t" */
#define IRIX_SYS_setreuid 124
/* syscall: "getitimer" ret: "int" args: "u_int" "struct itimerval *" */
#define IRIX_SYS_getitimer 125
/* syscall: "setitimer" ret: "int" args: "u_int" "struct itimerval *" "struct itimerval *" */
#define IRIX_SYS_setitimer 126
/* syscall: "adjtime" ret: "int" args: "struct timeval50 *" "struct timeval50 *" */
#define IRIX_SYS_adjtime 127
/* syscall: "gettimeofday" ret: "int" args: "struct timeval50 *" */
#define IRIX_SYS_gettimeofday 128
/* syscall: "sproc" ret: "irix_pid_t" args: "void *" "unsigned int" "void *" */
#define IRIX_SYS_sproc 129
/* syscall: "prctl" ret: "ptrdiff_t" args: "unsigned int" "void *" */
#define IRIX_SYS_prctl 130
/* syscall: "procblk" ret: "int" args: "int" "pid_t" "int" */
#define IRIX_SYS_procblk 131
/* syscall: "sprocsp" ret: "irix_pid_t" args: "void *" "unsigned int" "void *" "void *" "irix_size_t" */
#define IRIX_SYS_sprocsp 132
/* syscall: "mmap" ret: "void *" args: "void *" "irix_size_t" "int" "int" "int" "irix_off_t" */
#define IRIX_SYS_mmap 134
/* syscall: "munmap" ret: "int" args: "void *" "int" */
#define IRIX_SYS_munmap 135
/* syscall: "mprotect" ret: "int" args: "void *" "int" "int" */
#define IRIX_SYS_mprotect 136
/* syscall: "__msync13" ret: "int" args: "void *" "size_t" "int" */
#define IRIX_SYS___msync13 137
/* syscall: "getpgrp" ret: "int" args: */
#define IRIX_SYS_getpgrp 143
/* syscall: "setpgrp" ret: "int" args: "int" "int" */
#define IRIX_SYS_setpgrp 144
/* syscall: "fsync" ret: "int" args: "int" */
#define IRIX_SYS_fsync 146
/* syscall: "fchdir" ret: "int" args: "int" */
#define IRIX_SYS_fchdir 147
/* syscall: "getrlimit" ret: "int" args: "int" "struct irix_rlimit *" */
#define IRIX_SYS_getrlimit 148
/* syscall: "setrlimit" ret: "int" args: "int" "const struct irix_rlimit *" */
#define IRIX_SYS_setrlimit 149
/* syscall: "fchown" ret: "int" args: "int" "int" "int" */
#define IRIX_SYS_fchown 152
/* syscall: "fchmod" ret: "int" args: "int" "int" */
#define IRIX_SYS_fchmod 153
/* syscall: "systeminfo" ret: "long" args: "int" "char *" "long" */
#define IRIX_SYS_systeminfo 156
/* syscall: "uname" ret: "int" args: "struct irix_utsname *" */
#define IRIX_SYS_uname 157
/* syscall: "xstat" ret: "int" args: "const int" "const char *" "struct stat *" */
#define IRIX_SYS_xstat 158
/* syscall: "lxstat" ret: "int" args: "const int" "const char *" "struct stat *" */
#define IRIX_SYS_lxstat 159
/* syscall: "fxstat" ret: "int" args: "const int" "const int" "struct stat *" */
#define IRIX_SYS_fxstat 160
/* syscall: "sigaction" ret: "int" args: "int" "const struct svr4_sigaction *" "struct svr4_sigaction *" "void *" */
#define IRIX_SYS_sigaction 162
/* syscall: "sigpending" ret: "int" args: "int" "svr4_sigset_t *" */
#define IRIX_SYS_sigpending 163
/* syscall: "sigprocmask" ret: "int" args: "int" "const irix_sigset_t *" "irix_sigset_t *" */
#define IRIX_SYS_sigprocmask 164
/* syscall: "sigsuspend" ret: "int" args: "const svr4_sigset_t *" */
#define IRIX_SYS_sigsuspend 165
/* syscall: "swapctl" ret: "int" args: "int" "void *" */
#define IRIX_SYS_swapctl 167
/* syscall: "getcontext" ret: "int" args: "irix_ucontext_t *" */
#define IRIX_SYS_getcontext 168
/* syscall: "setcontext" ret: "int" args: "const irix_ucontext_t *" */
#define IRIX_SYS_setcontext 169
/* syscall: "waitsys" ret: "int" args: "int" "int" "struct irix_irix5_siginfo *" "int" "struct rusage *" */
#define IRIX_SYS_waitsys 170
/* syscall: "statvfs" ret: "int" args: "const char *" "struct svr4_statvfs *" */
#define IRIX_SYS_statvfs 174
/* syscall: "fstatvfs" ret: "int" args: "int" "struct svr4_statvfs *" */
#define IRIX_SYS_fstatvfs 175
/* syscall: "readv" ret: "ssize_t" args: "int" "const struct iovec *" "int" */
#define IRIX_SYS_readv 181
/* syscall: "writev" ret: "ssize_t" args: "int" "const struct iovec *" "int" */
#define IRIX_SYS_writev 182
/* syscall: "truncate64" ret: "int" args: "const char *" "int" "off_t" */
#define IRIX_SYS_truncate64 183
/* syscall: "ftruncate64" ret: "int" args: "int" "int" "off_t" */
#define IRIX_SYS_ftruncate64 184
/* syscall: "mmap64" ret: "void *" args: "void *" "irix_size_t" "int" "int" "int" "int" "irix_off_t" */
#define IRIX_SYS_mmap64 185
/* syscall: "pread" ret: "ssize_t" args: "int" "void *" "size_t" "svr4_off_t" */
#define IRIX_SYS_pread 187
/* syscall: "pwrite" ret: "ssize_t" args: "int" "const void *" "size_t" "svr4_off_t" */
#define IRIX_SYS_pwrite 188
/* syscall: "getmountid" ret: "int" args: "const char *" "irix_mountid_t *" */
#define IRIX_SYS_getmountid 203
/* syscall: "getdents64" ret: "int" args: "int" "irix_dirent64_t *" "int" */
#define IRIX_SYS_getdents64 205
/* syscall: "ngetdents" ret: "int" args: "int" "irix_dirent_t *" "unsigned short" "int *" */
#define IRIX_SYS_ngetdents 207
/* syscall: "ngetdents64" ret: "int" args: "int" "irix_dirent64_t *" "unsigned short" "int *" */
#define IRIX_SYS_ngetdents64 208
/* syscall: "pidsprocsp" ret: "irix_pid_t" args: "void *" "unsigned int" "void *" "void *" "irix_size_t" "irix_pid_t" */
#define IRIX_SYS_pidsprocsp 210
/* syscall: "usync_cntl" ret: "int" args: "int" "void *" */
#define IRIX_SYS_usync_cntl 223
#define IRIX_SYS_MAXSYSCALL 236
#define IRIX_SYS_NSYSENT 256
#endif /* _IRIX_SYS_SYSCALL_H_ */

View File

@ -1,794 +0,0 @@
/* $NetBSD: irix_syscallargs.h,v 1.61 2009/12/14 00:58:36 matt Exp $ */
/*
* System call argument lists.
*
* DO NOT EDIT-- this file is automatically generated.
* created from NetBSD: syscalls.master,v 1.54 2009/01/13 22:27:43 pooka Exp
*/
#ifndef _IRIX_SYS_SYSCALLARGS_H_
#define _IRIX_SYS_SYSCALLARGS_H_
#define IRIX_SYS_MAXSYSARGS 8
#undef syscallarg
#define syscallarg(x) \
union { \
register_t pad; \
struct { x datum; } le; \
struct { /* LINTED zero array dimension */ \
int8_t pad[ /* CONSTCOND */ \
(sizeof (register_t) < sizeof (x)) \
? 0 \
: sizeof (register_t) - sizeof (x)]; \
x datum; \
} be; \
}
#undef check_syscall_args
#define check_syscall_args(call) \
typedef char call##_check_args[sizeof (struct call##_args) \
<= IRIX_SYS_MAXSYSARGS * sizeof (register_t) ? 1 : -1];
struct sys_exit_args;
struct sys_read_args;
struct sys_write_args;
struct irix_sys_open_args {
syscallarg(const char *) path;
syscallarg(int) flags;
syscallarg(int) mode;
};
check_syscall_args(irix_sys_open)
struct sys_close_args;
struct svr4_sys_creat_args;
struct sys_link_args;
struct sys_unlink_args;
struct svr4_sys_execv_args;
struct sys_chdir_args;
struct svr4_sys_time_args;
struct sys_chmod_args;
struct sys___posix_chown_args;
struct irix_sys_break_args {
syscallarg(void *) nsize;
};
check_syscall_args(irix_sys_break)
struct compat_43_sys_lseek_args;
struct sys_setuid_args;
struct svr4_sys_alarm_args;
struct svr4_sys_fstat_args;
struct svr4_sys_utime_args;
struct svr4_sys_access_args;
struct svr4_sys_nice_args;
struct svr4_sys_kill_args;
struct svr4_sys_pgrpsys_args;
struct irix_sys_syssgi_args {
syscallarg(int) request;
syscallarg(void *) arg1;
syscallarg(void *) arg2;
syscallarg(void *) arg3;
syscallarg(void *) arg4;
syscallarg(void *) arg5;
};
check_syscall_args(irix_sys_syssgi)
struct sys_dup_args;
struct svr4_sys_times_args;
struct sys_setgid_args;
#ifdef SYSVMSG
struct svr4_sys_msgsys_args;
#else
#endif
#ifdef SYSVSHM
struct irix_sys_shmsys_args {
syscallarg(int) what;
syscallarg(int) a2;
syscallarg(int) a3;
syscallarg(int) a4;
};
check_syscall_args(irix_sys_shmsys)
#else
#endif
#ifdef SYSVSEM
struct svr4_sys_semsys_args;
#else
#endif
struct irix_sys_ioctl_args {
syscallarg(int) fd;
syscallarg(u_long) com;
syscallarg(void *) data;
};
check_syscall_args(irix_sys_ioctl)
struct irix_sys_sysmp_args {
syscallarg(int) cmd;
syscallarg(void *) arg1;
syscallarg(void *) arg2;
syscallarg(void *) arg3;
syscallarg(void *) arg4;
};
check_syscall_args(irix_sys_sysmp)
struct irix_sys_utssys_args {
syscallarg(void *) a1;
syscallarg(void *) a2;
syscallarg(int) sel;
syscallarg(void *) a3;
};
check_syscall_args(irix_sys_utssys)
struct svr4_sys_execve_args;
struct sys_umask_args;
struct sys_chroot_args;
struct irix_sys_fcntl_args {
syscallarg(int) fd;
syscallarg(int) cmd;
syscallarg(char *) arg;
};
check_syscall_args(irix_sys_fcntl)
struct svr4_sys_ulimit_args;
struct irix_sys_getrlimit64_args {
syscallarg(int) resource;
syscallarg(struct irix_rlimit64 *) rlp;
};
check_syscall_args(irix_sys_getrlimit64)
struct irix_sys_setrlimit64_args {
syscallarg(int) resource;
syscallarg(const struct irix_rlimit64 *) rlp;
};
check_syscall_args(irix_sys_setrlimit64)
struct compat_50_sys_nanosleep_args;
struct irix_sys_lseek64_args {
syscallarg(int) fd;
syscallarg(int) pad1;
syscallarg(irix_off64_t) offset;
syscallarg(int) whence;
syscallarg(int) pad2;
syscallarg(int) pad3;
syscallarg(int) pad4;
};
check_syscall_args(irix_sys_lseek64)
struct sys_rmdir_args;
struct sys_mkdir_args;
struct irix_sys_getdents_args {
syscallarg(int) fildes;
syscallarg(irix_dirent_t *) buf;
syscallarg(int) nbytes;
};
check_syscall_args(irix_sys_getdents)
struct irix_sys_sginap_args {
syscallarg(long) ticks;
};
check_syscall_args(irix_sys_sginap)
struct svr4_sys_getmsg_args;
struct svr4_sys_putmsg_args;
struct sys_poll_args;
struct irix_sys_sigreturn_args {
syscallarg(struct irix_sigcontext *) scp;
syscallarg(struct irix_ucontext *) ucp;
syscallarg(int) signo;
};
check_syscall_args(irix_sys_sigreturn)
struct compat_43_sys_accept_args;
struct sys_bind_args;
struct sys_connect_args;
struct compat_43_sys_getpeername_args;
struct compat_43_sys_getsockname_args;
struct sys_getsockopt_args;
struct sys_listen_args;
struct compat_43_sys_recv_args;
struct compat_43_sys_recvfrom_args;
struct compat_43_sys_recvmsg_args;
struct compat_50_sys_select_args;
struct compat_43_sys_send_args;
struct compat_43_sys_sendmsg_args;
struct sys_sendto_args;
struct compat_43_sys_sethostid_args;
struct sys_setsockopt_args;
struct sys_shutdown_args;
struct svr4_sys_socket_args;
struct compat_43_sys_gethostname_args;
struct compat_43_sys_sethostname_args;
struct compat_09_sys_getdomainname_args;
struct compat_09_sys_setdomainname_args;
struct sys_truncate_args;
struct sys_ftruncate_args;
struct sys_rename_args;
struct sys_symlink_args;
struct sys_readlink_args;
struct sys_setregid_args;
struct sys_setreuid_args;
struct compat_50_sys_getitimer_args;
struct compat_50_sys_setitimer_args;
struct compat_50_sys_adjtime_args;
struct svr4_sys_gettimeofday_args;
struct irix_sys_sproc_args {
syscallarg(void *) entry;
syscallarg(unsigned int) inh;
syscallarg(void *) arg;
};
check_syscall_args(irix_sys_sproc)
struct irix_sys_prctl_args {
syscallarg(unsigned int) option;
syscallarg(void *) arg1;
};
check_syscall_args(irix_sys_prctl)
struct irix_sys_procblk_args {
syscallarg(int) cmd;
syscallarg(pid_t) pid;
syscallarg(int) count;
};
check_syscall_args(irix_sys_procblk)
struct irix_sys_sprocsp_args {
syscallarg(void *) entry;
syscallarg(unsigned int) inh;
syscallarg(void *) arg;
syscallarg(void *) sp;
syscallarg(irix_size_t) len;
};
check_syscall_args(irix_sys_sprocsp)
struct irix_sys_mmap_args {
syscallarg(void *) addr;
syscallarg(irix_size_t) len;
syscallarg(int) prot;
syscallarg(int) flags;
syscallarg(int) fd;
syscallarg(irix_off_t) pos;
};
check_syscall_args(irix_sys_mmap)
struct irix_sys_munmap_args {
syscallarg(void *) addr;
syscallarg(int) len;
};
check_syscall_args(irix_sys_munmap)
struct irix_sys_mprotect_args {
syscallarg(void *) addr;
syscallarg(int) len;
syscallarg(int) prot;
};
check_syscall_args(irix_sys_mprotect)
struct sys___msync13_args;
struct irix_sys_setpgrp_args {
syscallarg(int) pid;
syscallarg(int) pgid;
};
check_syscall_args(irix_sys_setpgrp)
struct sys_fsync_args;
struct sys_fchdir_args;
struct irix_sys_getrlimit_args {
syscallarg(int) resource;
syscallarg(struct irix_rlimit *) rlp;
};
check_syscall_args(irix_sys_getrlimit)
struct irix_sys_setrlimit_args {
syscallarg(int) resource;
syscallarg(const struct irix_rlimit *) rlp;
};
check_syscall_args(irix_sys_setrlimit)
struct sys___posix_fchown_args;
struct sys_fchmod_args;
struct irix_sys_systeminfo_args {
syscallarg(int) what;
syscallarg(char *) buf;
syscallarg(long) len;
};
check_syscall_args(irix_sys_systeminfo)
struct irix_sys_uname_args {
syscallarg(struct irix_utsname *) name;
};
check_syscall_args(irix_sys_uname)
struct irix_sys_xstat_args {
syscallarg(const int) version;
syscallarg(const char *) path;
syscallarg(struct stat *) buf;
};
check_syscall_args(irix_sys_xstat)
struct irix_sys_lxstat_args {
syscallarg(const int) version;
syscallarg(const char *) path;
syscallarg(struct stat *) buf;
};
check_syscall_args(irix_sys_lxstat)
struct irix_sys_fxstat_args {
syscallarg(const int) version;
syscallarg(const int) fd;
syscallarg(struct stat *) buf;
};
check_syscall_args(irix_sys_fxstat)
struct irix_sys_sigaction_args {
syscallarg(int) signum;
syscallarg(const struct svr4_sigaction *) nsa;
syscallarg(struct svr4_sigaction *) osa;
syscallarg(void *) sigtramp;
};
check_syscall_args(irix_sys_sigaction)
struct svr4_sys_sigpending_args;
struct irix_sys_sigprocmask_args {
syscallarg(int) how;
syscallarg(const irix_sigset_t *) set;
syscallarg(irix_sigset_t *) oset;
};
check_syscall_args(irix_sys_sigprocmask)
struct svr4_sys_sigsuspend_args;
struct irix_sys_swapctl_args {
syscallarg(int) cmd;
syscallarg(void *) arg;
};
check_syscall_args(irix_sys_swapctl)
struct irix_sys_getcontext_args {
syscallarg(irix_ucontext_t *) ucp;
};
check_syscall_args(irix_sys_getcontext)
struct irix_sys_setcontext_args {
syscallarg(const irix_ucontext_t *) ucp;
};
check_syscall_args(irix_sys_setcontext)
struct irix_sys_waitsys_args {
syscallarg(int) type;
syscallarg(int) pid;
syscallarg(struct irix_irix5_siginfo *) info;
syscallarg(int) options;
syscallarg(struct rusage *) ru;
};
check_syscall_args(irix_sys_waitsys)
struct svr4_sys_statvfs_args;
struct svr4_sys_fstatvfs_args;
struct sys_readv_args;
struct sys_writev_args;
struct sys_truncate_args;
struct sys_ftruncate_args;
struct irix_sys_mmap64_args {
syscallarg(void *) addr;
syscallarg(irix_size_t) len;
syscallarg(int) prot;
syscallarg(int) flags;
syscallarg(int) fd;
syscallarg(int) pad1;
syscallarg(irix_off_t) pos;
};
check_syscall_args(irix_sys_mmap64)
struct svr4_sys_pread_args;
struct svr4_sys_pwrite_args;
struct irix_sys_getmountid_args {
syscallarg(const char *) path;
syscallarg(irix_mountid_t *) buf;
};
check_syscall_args(irix_sys_getmountid)
struct irix_sys_getdents64_args {
syscallarg(int) fildes;
syscallarg(irix_dirent64_t *) buf;
syscallarg(int) nbytes;
};
check_syscall_args(irix_sys_getdents64)
struct irix_sys_ngetdents_args {
syscallarg(int) fildes;
syscallarg(irix_dirent_t *) buf;
syscallarg(unsigned short) nbyte;
syscallarg(int *) eof;
};
check_syscall_args(irix_sys_ngetdents)
struct irix_sys_ngetdents64_args {
syscallarg(int) fildes;
syscallarg(irix_dirent64_t *) buf;
syscallarg(unsigned short) nbyte;
syscallarg(int *) eof;
};
check_syscall_args(irix_sys_ngetdents64)
struct irix_sys_pidsprocsp_args {
syscallarg(void *) entry;
syscallarg(unsigned int) inh;
syscallarg(void *) arg;
syscallarg(void *) sp;
syscallarg(irix_size_t) len;
syscallarg(irix_pid_t) pid;
};
check_syscall_args(irix_sys_pidsprocsp)
struct irix_sys_usync_cntl_args {
syscallarg(int) cmd;
syscallarg(void *) arg;
};
check_syscall_args(irix_sys_usync_cntl)
/*
* System call prototypes.
*/
int sys_nosys(struct lwp *, const void *, register_t *);
int sys_exit(struct lwp *, const struct sys_exit_args *, register_t *);
int sys_fork(struct lwp *, const void *, register_t *);
int sys_read(struct lwp *, const struct sys_read_args *, register_t *);
int sys_write(struct lwp *, const struct sys_write_args *, register_t *);
int irix_sys_open(struct lwp *, const struct irix_sys_open_args *, register_t *);
int sys_close(struct lwp *, const struct sys_close_args *, register_t *);
int svr4_sys_creat(struct lwp *, const struct svr4_sys_creat_args *, register_t *);
int sys_link(struct lwp *, const struct sys_link_args *, register_t *);
int sys_unlink(struct lwp *, const struct sys_unlink_args *, register_t *);
int svr4_sys_execv(struct lwp *, const struct svr4_sys_execv_args *, register_t *);
int sys_chdir(struct lwp *, const struct sys_chdir_args *, register_t *);
int svr4_sys_time(struct lwp *, const struct svr4_sys_time_args *, register_t *);
int sys_chmod(struct lwp *, const struct sys_chmod_args *, register_t *);
int sys___posix_chown(struct lwp *, const struct sys___posix_chown_args *, register_t *);
int irix_sys_break(struct lwp *, const struct irix_sys_break_args *, register_t *);
int compat_43_sys_lseek(struct lwp *, const struct compat_43_sys_lseek_args *, register_t *);
int sys_getpid(struct lwp *, const void *, register_t *);
int sys_setuid(struct lwp *, const struct sys_setuid_args *, register_t *);
int sys_getuid_with_euid(struct lwp *, const void *, register_t *);
int svr4_sys_alarm(struct lwp *, const struct svr4_sys_alarm_args *, register_t *);
int svr4_sys_fstat(struct lwp *, const struct svr4_sys_fstat_args *, register_t *);
int svr4_sys_pause(struct lwp *, const void *, register_t *);
int svr4_sys_utime(struct lwp *, const struct svr4_sys_utime_args *, register_t *);
int svr4_sys_access(struct lwp *, const struct svr4_sys_access_args *, register_t *);
int svr4_sys_nice(struct lwp *, const struct svr4_sys_nice_args *, register_t *);
int sys_sync(struct lwp *, const void *, register_t *);
int svr4_sys_kill(struct lwp *, const struct svr4_sys_kill_args *, register_t *);
int svr4_sys_pgrpsys(struct lwp *, const struct svr4_sys_pgrpsys_args *, register_t *);
int irix_sys_syssgi(struct lwp *, const struct irix_sys_syssgi_args *, register_t *);
int sys_dup(struct lwp *, const struct sys_dup_args *, register_t *);
int sys_pipe(struct lwp *, const void *, register_t *);
int svr4_sys_times(struct lwp *, const struct svr4_sys_times_args *, register_t *);
int sys_setgid(struct lwp *, const struct sys_setgid_args *, register_t *);
int sys_getgid_with_egid(struct lwp *, const void *, register_t *);
#ifdef SYSVMSG
int svr4_sys_msgsys(struct lwp *, const struct svr4_sys_msgsys_args *, register_t *);
#else
#endif
#ifdef SYSVSHM
int irix_sys_shmsys(struct lwp *, const struct irix_sys_shmsys_args *, register_t *);
#else
#endif
#ifdef SYSVSEM
int svr4_sys_semsys(struct lwp *, const struct svr4_sys_semsys_args *, register_t *);
#else
#endif
int irix_sys_ioctl(struct lwp *, const struct irix_sys_ioctl_args *, register_t *);
int irix_sys_sysmp(struct lwp *, const struct irix_sys_sysmp_args *, register_t *);
int irix_sys_utssys(struct lwp *, const struct irix_sys_utssys_args *, register_t *);
int svr4_sys_execve(struct lwp *, const struct svr4_sys_execve_args *, register_t *);
int sys_umask(struct lwp *, const struct sys_umask_args *, register_t *);
int sys_chroot(struct lwp *, const struct sys_chroot_args *, register_t *);
int irix_sys_fcntl(struct lwp *, const struct irix_sys_fcntl_args *, register_t *);
int svr4_sys_ulimit(struct lwp *, const struct svr4_sys_ulimit_args *, register_t *);
int irix_sys_getrlimit64(struct lwp *, const struct irix_sys_getrlimit64_args *, register_t *);
int irix_sys_setrlimit64(struct lwp *, const struct irix_sys_setrlimit64_args *, register_t *);
int compat_50_sys_nanosleep(struct lwp *, const struct compat_50_sys_nanosleep_args *, register_t *);
int irix_sys_lseek64(struct lwp *, const struct irix_sys_lseek64_args *, register_t *);
int sys_rmdir(struct lwp *, const struct sys_rmdir_args *, register_t *);
int sys_mkdir(struct lwp *, const struct sys_mkdir_args *, register_t *);
int irix_sys_getdents(struct lwp *, const struct irix_sys_getdents_args *, register_t *);
int irix_sys_sginap(struct lwp *, const struct irix_sys_sginap_args *, register_t *);
int svr4_sys_getmsg(struct lwp *, const struct svr4_sys_getmsg_args *, register_t *);
int svr4_sys_putmsg(struct lwp *, const struct svr4_sys_putmsg_args *, register_t *);
int sys_poll(struct lwp *, const struct sys_poll_args *, register_t *);
int irix_sys_sigreturn(struct lwp *, const struct irix_sys_sigreturn_args *, register_t *);
int compat_43_sys_accept(struct lwp *, const struct compat_43_sys_accept_args *, register_t *);
int sys_bind(struct lwp *, const struct sys_bind_args *, register_t *);
int sys_connect(struct lwp *, const struct sys_connect_args *, register_t *);
int compat_43_sys_gethostid(struct lwp *, const void *, register_t *);
int compat_43_sys_getpeername(struct lwp *, const struct compat_43_sys_getpeername_args *, register_t *);
int compat_43_sys_getsockname(struct lwp *, const struct compat_43_sys_getsockname_args *, register_t *);
int sys_getsockopt(struct lwp *, const struct sys_getsockopt_args *, register_t *);
int sys_listen(struct lwp *, const struct sys_listen_args *, register_t *);
int compat_43_sys_recv(struct lwp *, const struct compat_43_sys_recv_args *, register_t *);
int compat_43_sys_recvfrom(struct lwp *, const struct compat_43_sys_recvfrom_args *, register_t *);
int compat_43_sys_recvmsg(struct lwp *, const struct compat_43_sys_recvmsg_args *, register_t *);
int compat_50_sys_select(struct lwp *, const struct compat_50_sys_select_args *, register_t *);
int compat_43_sys_send(struct lwp *, const struct compat_43_sys_send_args *, register_t *);
int compat_43_sys_sendmsg(struct lwp *, const struct compat_43_sys_sendmsg_args *, register_t *);
int sys_sendto(struct lwp *, const struct sys_sendto_args *, register_t *);
int compat_43_sys_sethostid(struct lwp *, const struct compat_43_sys_sethostid_args *, register_t *);
int sys_setsockopt(struct lwp *, const struct sys_setsockopt_args *, register_t *);
int sys_shutdown(struct lwp *, const struct sys_shutdown_args *, register_t *);
int svr4_sys_socket(struct lwp *, const struct svr4_sys_socket_args *, register_t *);
int compat_43_sys_gethostname(struct lwp *, const struct compat_43_sys_gethostname_args *, register_t *);
int compat_43_sys_sethostname(struct lwp *, const struct compat_43_sys_sethostname_args *, register_t *);
int compat_09_sys_getdomainname(struct lwp *, const struct compat_09_sys_getdomainname_args *, register_t *);
int compat_09_sys_setdomainname(struct lwp *, const struct compat_09_sys_setdomainname_args *, register_t *);
int sys_truncate(struct lwp *, const struct sys_truncate_args *, register_t *);
int sys_ftruncate(struct lwp *, const struct sys_ftruncate_args *, register_t *);
int sys_rename(struct lwp *, const struct sys_rename_args *, register_t *);
int sys_symlink(struct lwp *, const struct sys_symlink_args *, register_t *);
int sys_readlink(struct lwp *, const struct sys_readlink_args *, register_t *);
int sys_setregid(struct lwp *, const struct sys_setregid_args *, register_t *);
int sys_setreuid(struct lwp *, const struct sys_setreuid_args *, register_t *);
int compat_50_sys_getitimer(struct lwp *, const struct compat_50_sys_getitimer_args *, register_t *);
int compat_50_sys_setitimer(struct lwp *, const struct compat_50_sys_setitimer_args *, register_t *);
int compat_50_sys_adjtime(struct lwp *, const struct compat_50_sys_adjtime_args *, register_t *);
int svr4_sys_gettimeofday(struct lwp *, const struct svr4_sys_gettimeofday_args *, register_t *);
int irix_sys_sproc(struct lwp *, const struct irix_sys_sproc_args *, register_t *);
int irix_sys_prctl(struct lwp *, const struct irix_sys_prctl_args *, register_t *);
int irix_sys_procblk(struct lwp *, const struct irix_sys_procblk_args *, register_t *);
int irix_sys_sprocsp(struct lwp *, const struct irix_sys_sprocsp_args *, register_t *);
int irix_sys_mmap(struct lwp *, const struct irix_sys_mmap_args *, register_t *);
int irix_sys_munmap(struct lwp *, const struct irix_sys_munmap_args *, register_t *);
int irix_sys_mprotect(struct lwp *, const struct irix_sys_mprotect_args *, register_t *);
int sys___msync13(struct lwp *, const struct sys___msync13_args *, register_t *);
int sys_getpgrp(struct lwp *, const void *, register_t *);
int irix_sys_setpgrp(struct lwp *, const struct irix_sys_setpgrp_args *, register_t *);
int sys_fsync(struct lwp *, const struct sys_fsync_args *, register_t *);
int sys_fchdir(struct lwp *, const struct sys_fchdir_args *, register_t *);
int irix_sys_getrlimit(struct lwp *, const struct irix_sys_getrlimit_args *, register_t *);
int irix_sys_setrlimit(struct lwp *, const struct irix_sys_setrlimit_args *, register_t *);
int sys___posix_fchown(struct lwp *, const struct sys___posix_fchown_args *, register_t *);
int sys_fchmod(struct lwp *, const struct sys_fchmod_args *, register_t *);
int irix_sys_systeminfo(struct lwp *, const struct irix_sys_systeminfo_args *, register_t *);
int irix_sys_uname(struct lwp *, const struct irix_sys_uname_args *, register_t *);
int irix_sys_xstat(struct lwp *, const struct irix_sys_xstat_args *, register_t *);
int irix_sys_lxstat(struct lwp *, const struct irix_sys_lxstat_args *, register_t *);
int irix_sys_fxstat(struct lwp *, const struct irix_sys_fxstat_args *, register_t *);
int irix_sys_sigaction(struct lwp *, const struct irix_sys_sigaction_args *, register_t *);
int svr4_sys_sigpending(struct lwp *, const struct svr4_sys_sigpending_args *, register_t *);
int irix_sys_sigprocmask(struct lwp *, const struct irix_sys_sigprocmask_args *, register_t *);
int svr4_sys_sigsuspend(struct lwp *, const struct svr4_sys_sigsuspend_args *, register_t *);
int irix_sys_swapctl(struct lwp *, const struct irix_sys_swapctl_args *, register_t *);
int irix_sys_getcontext(struct lwp *, const struct irix_sys_getcontext_args *, register_t *);
int irix_sys_setcontext(struct lwp *, const struct irix_sys_setcontext_args *, register_t *);
int irix_sys_waitsys(struct lwp *, const struct irix_sys_waitsys_args *, register_t *);
int svr4_sys_statvfs(struct lwp *, const struct svr4_sys_statvfs_args *, register_t *);
int svr4_sys_fstatvfs(struct lwp *, const struct svr4_sys_fstatvfs_args *, register_t *);
int sys_readv(struct lwp *, const struct sys_readv_args *, register_t *);
int sys_writev(struct lwp *, const struct sys_writev_args *, register_t *);
int irix_sys_mmap64(struct lwp *, const struct irix_sys_mmap64_args *, register_t *);
int svr4_sys_pread(struct lwp *, const struct svr4_sys_pread_args *, register_t *);
int svr4_sys_pwrite(struct lwp *, const struct svr4_sys_pwrite_args *, register_t *);
int irix_sys_getmountid(struct lwp *, const struct irix_sys_getmountid_args *, register_t *);
int irix_sys_getdents64(struct lwp *, const struct irix_sys_getdents64_args *, register_t *);
int irix_sys_ngetdents(struct lwp *, const struct irix_sys_ngetdents_args *, register_t *);
int irix_sys_ngetdents64(struct lwp *, const struct irix_sys_ngetdents64_args *, register_t *);
int irix_sys_pidsprocsp(struct lwp *, const struct irix_sys_pidsprocsp_args *, register_t *);
int irix_sys_usync_cntl(struct lwp *, const struct irix_sys_usync_cntl_args *, register_t *);
#endif /* _IRIX_SYS_SYSCALLARGS_H_ */

View File

@ -1,286 +0,0 @@
/* $NetBSD: irix_syscalls.c,v 1.61 2009/12/14 00:58:36 matt Exp $ */
/*
* System call names.
*
* DO NOT EDIT-- this file is automatically generated.
* created from NetBSD: syscalls.master,v 1.54 2009/01/13 22:27:43 pooka Exp
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: irix_syscalls.c,v 1.61 2009/12/14 00:58:36 matt Exp $");
#if defined(_KERNEL_OPT)
#if defined(_KERNEL_OPT)
#include "opt_ntp.h"
#include "opt_sysv.h"
#include "opt_compat_43.h"
#endif
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/signal.h>
#include <sys/mount.h>
#include <sys/poll.h>
#include <sys/ioctl_compat.h>
#include <sys/syscallargs.h>
#include <compat/svr4/svr4_types.h>
#include <compat/svr4/svr4_signal.h>
#include <compat/svr4/svr4_ucontext.h>
#include <compat/svr4/svr4_lwp.h>
#include <compat/svr4/svr4_statvfs.h>
#include <compat/svr4/svr4_syscallargs.h>
#include <compat/irix/irix_types.h>
#include <compat/irix/irix_signal.h>
#include <compat/irix/irix_syscallargs.h>
#endif /* _KERNEL_OPT */
const char *const irix_syscallnames[] = {
/* 0 */ "syscall",
/* 1 */ "exit",
/* 2 */ "fork",
/* 3 */ "read",
/* 4 */ "write",
/* 5 */ "open",
/* 6 */ "close",
/* 7 */ "#7 (obsolete wait)",
/* 8 */ "creat",
/* 9 */ "link",
/* 10 */ "unlink",
/* 11 */ "execv",
/* 12 */ "chdir",
/* 13 */ "time",
/* 14 */ "#14 (obsolete mknod)",
/* 15 */ "chmod",
/* 16 */ "chown",
/* 17 */ "break",
/* 18 */ "#18 (obsolete stat)",
/* 19 */ "lseek",
/* 20 */ "getpid",
/* 21 */ "#21 (unimplemented old_mount)",
/* 22 */ "#22 (unimplemented System V umount)",
/* 23 */ "setuid",
/* 24 */ "getuid_with_euid",
/* 25 */ "#25 (unimplemented stime)",
/* 26 */ "#26 (unimplemented ptrace)",
/* 27 */ "alarm",
/* 28 */ "fstat",
/* 29 */ "pause",
/* 30 */ "utime",
/* 31 */ "#31 (unimplemented was stty)",
/* 32 */ "#32 (unimplemented was gtty)",
/* 33 */ "access",
/* 34 */ "nice",
/* 35 */ "#35 (unimplemented statfs)",
/* 36 */ "sync",
/* 37 */ "kill",
/* 38 */ "#38 (unimplemented fstatfs)",
/* 39 */ "pgrpsys",
/* 40 */ "syssgi",
/* 41 */ "dup",
/* 42 */ "pipe",
/* 43 */ "times",
/* 44 */ "#44 (unimplemented profil)",
/* 45 */ "#45 (unimplemented plock)",
/* 46 */ "setgid",
/* 47 */ "getgid_with_egid",
/* 48 */ "#48 (obsolete ssig)",
#ifdef SYSVMSG
/* 49 */ "msgsys",
#else
/* 49 */ "#49 (unimplemented msgsys)",
#endif
/* 50 */ "#50 (unimplemented sysmips)",
/* 51 */ "#51 (unimplemented acct)",
#ifdef SYSVSHM
/* 52 */ "shmsys",
#else
/* 52 */ "#52 (unimplemented shmsys)",
#endif
#ifdef SYSVSEM
/* 53 */ "semsys",
#else
/* 53 */ "#53 (unimplemented semsys)",
#endif
/* 54 */ "ioctl",
/* 55 */ "#55 (unimplemented uadmin)",
/* 56 */ "sysmp",
/* 57 */ "utssys",
/* 58 */ "#58 (unimplemented)",
/* 59 */ "execve",
/* 60 */ "umask",
/* 61 */ "chroot",
/* 62 */ "fcntl",
/* 63 */ "ulimit",
/* 64 */ "#64 (unimplemented reserved for unix/pc)",
/* 65 */ "#65 (unimplemented reserved for unix/pc)",
/* 66 */ "#66 (unimplemented reserved for unix/pc)",
/* 67 */ "#67 (unimplemented reserved for unix/pc)",
/* 68 */ "#68 (unimplemented reserved for unix/pc)",
/* 69 */ "#69 (unimplemented reserved for unix/pc)",
/* 70 */ "#70 (obsolete advfs)",
/* 71 */ "#71 (obsolete unadvfs)",
/* 72 */ "#72 (obsolete rmount)",
/* 73 */ "#73 (obsolete rumount)",
/* 74 */ "#74 (obsolete rfstart)",
/* 75 */ "getrlimit64",
/* 76 */ "setrlimit64",
/* 77 */ "nanosleep",
/* 78 */ "lseek64",
/* 79 */ "rmdir",
/* 80 */ "mkdir",
/* 81 */ "getdents",
/* 82 */ "sginap",
/* 83 */ "#83 (unimplemented sgikopt)",
/* 84 */ "#84 (unimplemented sysfs)",
/* 85 */ "getmsg",
/* 86 */ "putmsg",
/* 87 */ "poll",
/* 88 */ "sigreturn",
/* 89 */ "accept",
/* 90 */ "bind",
/* 91 */ "connect",
/* 92 */ "gethostid",
/* 93 */ "getpeername",
/* 94 */ "getsockname",
/* 95 */ "getsockopt",
/* 96 */ "listen",
/* 97 */ "recv",
/* 98 */ "recvfrom",
/* 99 */ "recvmsg",
/* 100 */ "select",
/* 101 */ "send",
/* 102 */ "sendmsg",
/* 103 */ "sendto",
/* 104 */ "sethostid",
/* 105 */ "setsockopt",
/* 106 */ "shutdown",
/* 107 */ "socket",
/* 108 */ "gethostname",
/* 109 */ "sethostname",
/* 110 */ "getdomainname",
/* 111 */ "setdomainname",
/* 112 */ "truncate",
/* 113 */ "ftruncate",
/* 114 */ "rename",
/* 115 */ "symlink",
/* 116 */ "readlink",
/* 117 */ "#117 (unimplemented lstat)",
/* 118 */ "#118 (unimplemented)",
/* 119 */ "#119 (unimplemented nfs_svc)",
/* 120 */ "#120 (unimplemented nfs_getfh)",
/* 121 */ "#121 (unimplemented async_daemon)",
/* 122 */ "#122 (unimplemented exportfs)",
/* 123 */ "setregid",
/* 124 */ "setreuid",
/* 125 */ "getitimer",
/* 126 */ "setitimer",
/* 127 */ "adjtime",
/* 128 */ "gettimeofday",
/* 129 */ "sproc",
/* 130 */ "prctl",
/* 131 */ "procblk",
/* 132 */ "sprocsp",
/* 133 */ "#133 (unimplemented sgigsc)",
/* 134 */ "mmap",
/* 135 */ "munmap",
/* 136 */ "mprotect",
/* 137 */ "__msync13",
/* 138 */ "#138 (unimplemented madvise)",
/* 139 */ "#139 (unimplemented pagelock)",
/* 140 */ "#140 (unimplemented getpagesize)",
/* 141 */ "#141 (unimplemented quotactl)",
/* 142 */ "#142 (unimplemented)",
/* 143 */ "getpgrp",
/* 144 */ "setpgrp",
/* 145 */ "#145 (unimplemented vhangup)",
/* 146 */ "fsync",
/* 147 */ "fchdir",
/* 148 */ "getrlimit",
/* 149 */ "setrlimit",
/* 150 */ "#150 (unimplemented cacheflush)",
/* 151 */ "#151 (unimplemented cachectl)",
/* 152 */ "fchown",
/* 153 */ "fchmod",
/* 154 */ "#154 (unimplemented wait3)",
/* 155 */ "#155 (unimplemented socketpair)",
/* 156 */ "systeminfo",
/* 157 */ "uname",
/* 158 */ "xstat",
/* 159 */ "lxstat",
/* 160 */ "fxstat",
/* 161 */ "#161 (unimplemented xmknod)",
/* 162 */ "sigaction",
/* 163 */ "sigpending",
/* 164 */ "sigprocmask",
/* 165 */ "sigsuspend",
/* 166 */ "#166 (unimplemented sigpoll_sys)",
/* 167 */ "swapctl",
/* 168 */ "getcontext",
/* 169 */ "setcontext",
/* 170 */ "waitsys",
/* 171 */ "#171 (unimplemented sigstack)",
/* 172 */ "#172 (unimplemented sigaltstack)",
/* 173 */ "#173 (unimplemented sigsendset)",
/* 174 */ "statvfs",
/* 175 */ "fstatvfs",
/* 176 */ "#176 (unimplemented getpmsg)",
/* 177 */ "#177 (unimplemented putpmsg)",
/* 178 */ "#178 (unimplemented lchown)",
/* 179 */ "#179 (unimplemented priocntl)",
/* 180 */ "#180 (unimplemented sigqueue)",
/* 181 */ "readv",
/* 182 */ "writev",
/* 183 */ "truncate64",
/* 184 */ "ftruncate64",
/* 185 */ "mmap64",
/* 186 */ "#186 (unimplemented dmi)",
/* 187 */ "pread",
/* 188 */ "pwrite",
/* 189 */ "#189 (unimplemented fdatasync)",
/* 190 */ "#190 (unimplemented sgifastpath)",
/* 191 */ "#191 (unimplemented attr_get)",
/* 192 */ "#192 (unimplemented attr_getf)",
/* 193 */ "#193 (unimplemented attr_set)",
/* 194 */ "#194 (unimplemented attr_setf)",
/* 195 */ "#195 (unimplemented attr_remove)",
/* 196 */ "#196 (unimplemented attr_removef)",
/* 197 */ "#197 (unimplemented attr_list)",
/* 198 */ "#198 (unimplemented attr_listf)",
/* 199 */ "#199 (unimplemented attr_multi)",
/* 200 */ "#200 (unimplemented attr_multif)",
/* 201 */ "#201 (unimplemented statvfs64)",
/* 202 */ "#202 (unimplemented fstatvfs64)",
/* 203 */ "getmountid",
/* 204 */ "#204 (unimplemented nsproc)",
/* 205 */ "getdents64",
/* 206 */ "#206 (unimplemented afs_syscall)",
/* 207 */ "ngetdents",
/* 208 */ "ngetdents64",
/* 209 */ "#209 (unimplemented sgi_sesmgr)",
/* 210 */ "pidsprocsp",
/* 211 */ "#211 (unimplemented rexec)",
/* 212 */ "#212 (unimplemented timer_create)",
/* 213 */ "#213 (unimplemented timer_delete)",
/* 214 */ "#214 (unimplemented timer_settime)",
/* 215 */ "#215 (unimplemented timer_gettime)",
/* 216 */ "#216 (unimplemented timer_setoverrun)",
/* 217 */ "#217 (unimplemented sched_rr_get_interval)",
/* 218 */ "#218 (unimplemented sched_yield)",
/* 219 */ "#219 (unimplemented sched_getscheduler)",
/* 220 */ "#220 (unimplemented sched_setscheduler)",
/* 221 */ "#221 (unimplemented sched_getparam)",
/* 222 */ "#222 (unimplemented sched_setparam)",
/* 223 */ "usync_cntl",
/* 224 */ "#224 (unimplemented psema_cntl)",
/* 225 */ "#225 (unimplemented restartreturn)",
/* 226 */ "#226 (unimplemented sysget)",
/* 227 */ "#227 (unimplemented xpg4_recvmsg)",
/* 228 */ "#228 (unimplemented umfscall)",
/* 229 */ "#229 (unimplemented nsproctid)",
/* 230 */ "#230 (unimplemented rexec_complete)",
/* 231 */ "#231 (unimplemented xpg4_sigaltstack)",
/* 232 */ "#232 (unimplemented xpg4_sigaltstack)",
/* 233 */ "#233 (unimplemented xpg4_setregid)",
/* 234 */ "#234 (unimplemented linkfollow)",
/* 235 */ "#235 (unimplemented utimets)",
};

View File

@ -1,135 +0,0 @@
/* $NetBSD: irix_sysctl.c,v 1.7 2008/11/19 18:36:03 ad Exp $ */
/*-
* Copyright (c) 2003, 2008 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Andrew Brown.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: irix_sysctl.c,v 1.7 2008/11/19 18:36:03 ad Exp $");
#include <sys/param.h>
#include <sys/signal.h>
#include <sys/sysctl.h>
#include <compat/irix/irix_sysctl.h>
static struct sysctllog *irix_clog;
void
irix_sysctl_fini(void)
{
sysctl_teardown(&irix_clog);
}
void
irix_sysctl_init(void)
{
sysctl_createv(&irix_clog, 0, NULL, NULL,
CTLFLAG_PERMANENT,
CTLTYPE_NODE, "emul", NULL,
NULL, 0, NULL, 0,
CTL_EMUL, CTL_EOL);
sysctl_createv(&irix_clog, 0, NULL, NULL,
CTLFLAG_PERMANENT,
CTLTYPE_NODE, "irix",
SYSCTL_DESCR("IRIX emulation settings"),
NULL, 0, NULL, 0,
CTL_EMUL, EMUL_IRIX, CTL_EOL);
sysctl_createv(&irix_clog, 0, NULL, NULL,
CTLFLAG_PERMANENT,
CTLTYPE_NODE, "kern",
SYSCTL_DESCR("IRIX kernel emulation settings"),
NULL, 0, NULL, 0,
CTL_EMUL, EMUL_IRIX, EMUL_IRIX_KERN, CTL_EOL);
sysctl_createv(&irix_clog, 0, NULL, NULL,
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
CTLTYPE_STRING, "vendor",
SYSCTL_DESCR("Emulated IRIX vendor name"),
NULL, 0, irix_si_vendor, 128,
CTL_EMUL, EMUL_IRIX, EMUL_IRIX_KERN,
EMUL_IRIX_KERN_VENDOR, CTL_EOL);
sysctl_createv(&irix_clog, 0, NULL, NULL,
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
CTLTYPE_STRING, "osprovider",
SYSCTL_DESCR("Emulated IRIX system manufacturer"),
NULL, 0, irix_si_os_provider, 128,
CTL_EMUL, EMUL_IRIX, EMUL_IRIX_KERN,
EMUL_IRIX_KERN_OSPROVIDER, CTL_EOL);
sysctl_createv(&irix_clog, 0, NULL, NULL,
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
CTLTYPE_STRING, "osname",
SYSCTL_DESCR("Emulated IRIX operating system name"),
NULL, 0, irix_si_os_name, 128,
CTL_EMUL, EMUL_IRIX, EMUL_IRIX_KERN,
EMUL_IRIX_KERN_OSNAME, CTL_EOL);
sysctl_createv(&irix_clog, 0, NULL, NULL,
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
CTLTYPE_STRING, "hwname",
SYSCTL_DESCR("Emulated IRIX system type"),
NULL, 0, irix_si_hw_name, 128,
CTL_EMUL, EMUL_IRIX, EMUL_IRIX_KERN,
EMUL_IRIX_KERN_HWNAME, CTL_EOL);
sysctl_createv(&irix_clog, 0, NULL, NULL,
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
CTLTYPE_STRING, "osrelmaj",
SYSCTL_DESCR("Emulated IRIX major release number"),
NULL, 0, irix_si_osrel_maj, 128,
CTL_EMUL, EMUL_IRIX, EMUL_IRIX_KERN,
EMUL_IRIX_KERN_OSRELMAJ, CTL_EOL);
sysctl_createv(&irix_clog, 0, NULL, NULL,
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
CTLTYPE_STRING, "osrelmin",
SYSCTL_DESCR("Emulated IRIX minor release number"),
NULL, 0, irix_si_osrel_min, 128,
CTL_EMUL, EMUL_IRIX, EMUL_IRIX_KERN,
EMUL_IRIX_KERN_OSRELMIN, CTL_EOL);
sysctl_createv(&irix_clog, 0, NULL, NULL,
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
CTLTYPE_STRING, "osrelpatch",
SYSCTL_DESCR("Emulated IRIX patch level"),
NULL, 0, irix_si_osrel_patch, 128,
CTL_EMUL, EMUL_IRIX, EMUL_IRIX_KERN,
EMUL_IRIX_KERN_OSRELPATCH, CTL_EOL);
sysctl_createv(&irix_clog, 0, NULL, NULL,
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
CTLTYPE_STRING, "processor",
SYSCTL_DESCR("Emulated IRIX processor type"),
NULL, 0, irix_si_processors, 128,
CTL_EMUL, EMUL_IRIX, EMUL_IRIX_KERN,
EMUL_IRIX_KERN_PROCESSOR, CTL_EOL);
sysctl_createv(&irix_clog, 0, NULL, NULL,
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
CTLTYPE_STRING, "version",
SYSCTL_DESCR("Emulated IRIX version number"),
NULL, 0, irix_si_version, 128,
CTL_EMUL, EMUL_IRIX, EMUL_IRIX_KERN,
EMUL_IRIX_KERN_VERSION, CTL_EOL);
}

View File

@ -1,83 +0,0 @@
/* $NetBSD: irix_sysctl.h,v 1.7 2008/11/19 18:36:03 ad Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Emmanuel Dreyfus.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _IRIX_SYSCTL_H_
#define _IRIX_SYSCTL_H_
extern char irix_si_vendor[128];
extern char irix_si_os_provider[128];
extern char irix_si_os_name[128];
extern char irix_si_hw_name[128];
extern char irix_si_osrel_maj[128];
extern char irix_si_osrel_min[128];
extern char irix_si_osrel_patch[128];
extern char irix_si_processors[128];
extern char irix_si_version[128];
#define EMUL_IRIX_KERN 1
#define EMUL_IRIX_MAXID 2
#define EMUL_IRIX_NAMES { \
{ 0, 0 }, \
{ "kern", CTLTYPE_NODE }, \
}
#define EMUL_IRIX_KERN_VENDOR 1
#define EMUL_IRIX_KERN_OSPROVIDER 2
#define EMUL_IRIX_KERN_OSNAME 3
#define EMUL_IRIX_KERN_HWNAME 4
#define EMUL_IRIX_KERN_OSRELMAJ 5
#define EMUL_IRIX_KERN_OSRELMIN 6
#define EMUL_IRIX_KERN_OSRELPATCH 7
#define EMUL_IRIX_KERN_PROCESSOR 8
#define EMUL_IRIX_KERN_VERSION 9
#define EMUL_IRIX_KERN_MAXID 10
#define EMUL_IRIX_KERN_NAMES { \
{ 0, 0 }, \
{ "vendor", CTLTYPE_STRING }, \
{ "osprovider", CTLTYPE_STRING }, \
{ "osname", CTLTYPE_STRING }, \
{ "hwname", CTLTYPE_STRING }, \
{ "osrelmaj", CTLTYPE_STRING }, \
{ "osrelmin", CTLTYPE_STRING }, \
{ "osrelpatch", CTLTYPE_STRING }, \
{ "processor", CTLTYPE_STRING }, \
{ "version", CTLTYPE_STRING }, \
}
int irix_sysctl(int *, u_int, void *, size_t *,
void *, size_t, struct proc *);
void irix_sysctl_init(void);
void irix_sysctl_fini(void);
#endif /* _IRIX_SYSCTL_H_ */

View File

@ -1,567 +0,0 @@
/* $NetBSD: irix_sysent.c,v 1.61 2009/12/14 00:58:36 matt Exp $ */
/*
* System call switch table.
*
* DO NOT EDIT-- this file is automatically generated.
* created from NetBSD: syscalls.master,v 1.54 2009/01/13 22:27:43 pooka Exp
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: irix_sysent.c,v 1.61 2009/12/14 00:58:36 matt Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ntp.h"
#include "opt_sysv.h"
#include "opt_compat_43.h"
#endif
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/signal.h>
#include <sys/mount.h>
#include <sys/poll.h>
#include <sys/ioctl_compat.h>
#include <sys/syscallargs.h>
#include <compat/svr4/svr4_types.h>
#include <compat/svr4/svr4_signal.h>
#include <compat/svr4/svr4_ucontext.h>
#include <compat/svr4/svr4_lwp.h>
#include <compat/svr4/svr4_statvfs.h>
#include <compat/svr4/svr4_syscallargs.h>
#include <compat/irix/irix_types.h>
#include <compat/irix/irix_signal.h>
#include <compat/irix/irix_syscallargs.h>
#define s(type) sizeof(type)
#define n(type) (sizeof(type)/sizeof (register_t))
#define ns(type) n(type), s(type)
struct sysent irix_sysent[] = {
{ 0, 0, 0,
(sy_call_t *)sys_nosys }, /* 0 = syscall */
{ ns(struct sys_exit_args), 0,
(sy_call_t *)sys_exit }, /* 1 = exit */
{ 0, 0, 0,
(sy_call_t *)sys_fork }, /* 2 = fork */
{ ns(struct sys_read_args), 0,
(sy_call_t *)sys_read }, /* 3 = read */
{ ns(struct sys_write_args), 0,
(sy_call_t *)sys_write }, /* 4 = write */
{ ns(struct irix_sys_open_args), 0,
(sy_call_t *)irix_sys_open }, /* 5 = open */
{ ns(struct sys_close_args), 0,
(sy_call_t *)sys_close }, /* 6 = close */
{ 0, 0, 0,
sys_nosys }, /* 7 = obsolete wait */
{ ns(struct svr4_sys_creat_args), 0,
(sy_call_t *)svr4_sys_creat }, /* 8 = creat */
{ ns(struct sys_link_args), 0,
(sy_call_t *)sys_link }, /* 9 = link */
{ ns(struct sys_unlink_args), 0,
(sy_call_t *)sys_unlink }, /* 10 = unlink */
{ ns(struct svr4_sys_execv_args), 0,
(sy_call_t *)svr4_sys_execv }, /* 11 = execv */
{ ns(struct sys_chdir_args), 0,
(sy_call_t *)sys_chdir }, /* 12 = chdir */
{ ns(struct svr4_sys_time_args), 0,
(sy_call_t *)svr4_sys_time }, /* 13 = time */
{ 0, 0, 0,
sys_nosys }, /* 14 = obsolete mknod */
{ ns(struct sys_chmod_args), 0,
(sy_call_t *)sys_chmod }, /* 15 = chmod */
{ ns(struct sys___posix_chown_args), 0,
(sy_call_t *)sys___posix_chown }, /* 16 = chown */
{ ns(struct irix_sys_break_args), 0,
(sy_call_t *)irix_sys_break }, /* 17 = break */
{ 0, 0, 0,
sys_nosys }, /* 18 = obsolete stat */
{ ns(struct compat_43_sys_lseek_args), 0,
(sy_call_t *)compat_43_sys_lseek }, /* 19 = lseek */
{ 0, 0, 0,
(sy_call_t *)sys_getpid }, /* 20 = getpid */
{ 0, 0, 0,
sys_nosys }, /* 21 = unimplemented old_mount */
{ 0, 0, 0,
sys_nosys }, /* 22 = unimplemented System V umount */
{ ns(struct sys_setuid_args), 0,
(sy_call_t *)sys_setuid }, /* 23 = setuid */
{ 0, 0, 0,
(sy_call_t *)sys_getuid_with_euid },/* 24 = getuid_with_euid */
{ 0, 0, 0,
sys_nosys }, /* 25 = unimplemented stime */
{ 0, 0, 0,
sys_nosys }, /* 26 = unimplemented ptrace */
{ ns(struct svr4_sys_alarm_args), 0,
(sy_call_t *)svr4_sys_alarm }, /* 27 = alarm */
{ ns(struct svr4_sys_fstat_args), 0,
(sy_call_t *)svr4_sys_fstat }, /* 28 = fstat */
{ 0, 0, 0,
(sy_call_t *)svr4_sys_pause }, /* 29 = pause */
{ ns(struct svr4_sys_utime_args), 0,
(sy_call_t *)svr4_sys_utime }, /* 30 = utime */
{ 0, 0, 0,
sys_nosys }, /* 31 = unimplemented was stty */
{ 0, 0, 0,
sys_nosys }, /* 32 = unimplemented was gtty */
{ ns(struct svr4_sys_access_args), 0,
(sy_call_t *)svr4_sys_access }, /* 33 = access */
{ ns(struct svr4_sys_nice_args), 0,
(sy_call_t *)svr4_sys_nice }, /* 34 = nice */
{ 0, 0, 0,
sys_nosys }, /* 35 = unimplemented statfs */
{ 0, 0, 0,
(sy_call_t *)sys_sync }, /* 36 = sync */
{ ns(struct svr4_sys_kill_args), 0,
(sy_call_t *)svr4_sys_kill }, /* 37 = kill */
{ 0, 0, 0,
sys_nosys }, /* 38 = unimplemented fstatfs */
{ ns(struct svr4_sys_pgrpsys_args), 0,
(sy_call_t *)svr4_sys_pgrpsys }, /* 39 = pgrpsys */
{ ns(struct irix_sys_syssgi_args), 0,
(sy_call_t *)irix_sys_syssgi }, /* 40 = syssgi */
{ ns(struct sys_dup_args), 0,
(sy_call_t *)sys_dup }, /* 41 = dup */
{ 0, 0, 0,
(sy_call_t *)sys_pipe }, /* 42 = pipe */
{ ns(struct svr4_sys_times_args), 0,
(sy_call_t *)svr4_sys_times }, /* 43 = times */
{ 0, 0, 0,
sys_nosys }, /* 44 = unimplemented profil */
{ 0, 0, 0,
sys_nosys }, /* 45 = unimplemented plock */
{ ns(struct sys_setgid_args), 0,
(sy_call_t *)sys_setgid }, /* 46 = setgid */
{ 0, 0, 0,
(sy_call_t *)sys_getgid_with_egid },/* 47 = getgid_with_egid */
{ 0, 0, 0,
sys_nosys }, /* 48 = obsolete ssig */
#ifdef SYSVMSG
{ ns(struct svr4_sys_msgsys_args), 0,
(sy_call_t *)svr4_sys_msgsys }, /* 49 = msgsys */
#else
{ 0, 0, 0,
sys_nosys }, /* 49 = unimplemented msgsys */
#endif
{ 0, 0, 0,
sys_nosys }, /* 50 = unimplemented sysmips */
{ 0, 0, 0,
sys_nosys }, /* 51 = unimplemented acct */
#ifdef SYSVSHM
{ ns(struct irix_sys_shmsys_args), 0,
(sy_call_t *)irix_sys_shmsys }, /* 52 = shmsys */
#else
{ 0, 0, 0,
sys_nosys }, /* 52 = unimplemented shmsys */
#endif
#ifdef SYSVSEM
{ ns(struct svr4_sys_semsys_args), 0,
(sy_call_t *)svr4_sys_semsys }, /* 53 = semsys */
#else
{ 0, 0, 0,
sys_nosys }, /* 53 = unimplemented semsys */
#endif
{ ns(struct irix_sys_ioctl_args), 0,
(sy_call_t *)irix_sys_ioctl }, /* 54 = ioctl */
{ 0, 0, 0,
sys_nosys }, /* 55 = unimplemented uadmin */
{ ns(struct irix_sys_sysmp_args), 0,
(sy_call_t *)irix_sys_sysmp }, /* 56 = sysmp */
{ ns(struct irix_sys_utssys_args), 0,
(sy_call_t *)irix_sys_utssys }, /* 57 = utssys */
{ 0, 0, 0,
sys_nosys }, /* 58 = unimplemented */
{ ns(struct svr4_sys_execve_args), 0,
(sy_call_t *)svr4_sys_execve }, /* 59 = execve */
{ ns(struct sys_umask_args), 0,
(sy_call_t *)sys_umask }, /* 60 = umask */
{ ns(struct sys_chroot_args), 0,
(sy_call_t *)sys_chroot }, /* 61 = chroot */
{ ns(struct irix_sys_fcntl_args), 0,
(sy_call_t *)irix_sys_fcntl }, /* 62 = fcntl */
{ ns(struct svr4_sys_ulimit_args), 0,
(sy_call_t *)svr4_sys_ulimit }, /* 63 = ulimit */
{ 0, 0, 0,
sys_nosys }, /* 64 = unimplemented reserved for unix/pc */
{ 0, 0, 0,
sys_nosys }, /* 65 = unimplemented reserved for unix/pc */
{ 0, 0, 0,
sys_nosys }, /* 66 = unimplemented reserved for unix/pc */
{ 0, 0, 0,
sys_nosys }, /* 67 = unimplemented reserved for unix/pc */
{ 0, 0, 0,
sys_nosys }, /* 68 = unimplemented reserved for unix/pc */
{ 0, 0, 0,
sys_nosys }, /* 69 = unimplemented reserved for unix/pc */
{ 0, 0, 0,
sys_nosys }, /* 70 = obsolete advfs */
{ 0, 0, 0,
sys_nosys }, /* 71 = obsolete unadvfs */
{ 0, 0, 0,
sys_nosys }, /* 72 = obsolete rmount */
{ 0, 0, 0,
sys_nosys }, /* 73 = obsolete rumount */
{ 0, 0, 0,
sys_nosys }, /* 74 = obsolete rfstart */
{ ns(struct irix_sys_getrlimit64_args), 0,
(sy_call_t *)irix_sys_getrlimit64 },/* 75 = getrlimit64 */
{ ns(struct irix_sys_setrlimit64_args), 0,
(sy_call_t *)irix_sys_setrlimit64 },/* 76 = setrlimit64 */
{ ns(struct compat_50_sys_nanosleep_args), 0,
(sy_call_t *)compat_50_sys_nanosleep },/* 77 = nanosleep */
{ ns(struct irix_sys_lseek64_args), 0,
(sy_call_t *)irix_sys_lseek64 }, /* 78 = lseek64 */
{ ns(struct sys_rmdir_args), 0,
(sy_call_t *)sys_rmdir }, /* 79 = rmdir */
{ ns(struct sys_mkdir_args), 0,
(sy_call_t *)sys_mkdir }, /* 80 = mkdir */
{ ns(struct irix_sys_getdents_args), 0,
(sy_call_t *)irix_sys_getdents }, /* 81 = getdents */
{ ns(struct irix_sys_sginap_args), 0,
(sy_call_t *)irix_sys_sginap }, /* 82 = sginap */
{ 0, 0, 0,
sys_nosys }, /* 83 = unimplemented sgikopt */
{ 0, 0, 0,
sys_nosys }, /* 84 = unimplemented sysfs */
{ ns(struct svr4_sys_getmsg_args), 0,
(sy_call_t *)svr4_sys_getmsg }, /* 85 = getmsg */
{ ns(struct svr4_sys_putmsg_args), 0,
(sy_call_t *)svr4_sys_putmsg }, /* 86 = putmsg */
{ ns(struct sys_poll_args), 0,
(sy_call_t *)sys_poll }, /* 87 = poll */
{ ns(struct irix_sys_sigreturn_args), 0,
(sy_call_t *)irix_sys_sigreturn }, /* 88 = sigreturn */
{ ns(struct compat_43_sys_accept_args), 0,
(sy_call_t *)compat_43_sys_accept },/* 89 = accept */
{ ns(struct sys_bind_args), 0,
(sy_call_t *)sys_bind }, /* 90 = bind */
{ ns(struct sys_connect_args), 0,
(sy_call_t *)sys_connect }, /* 91 = connect */
{ 0, 0, 0,
(sy_call_t *)compat_43_sys_gethostid },/* 92 = gethostid */
{ ns(struct compat_43_sys_getpeername_args), 0,
(sy_call_t *)compat_43_sys_getpeername },/* 93 = getpeername */
{ ns(struct compat_43_sys_getsockname_args), 0,
(sy_call_t *)compat_43_sys_getsockname },/* 94 = getsockname */
{ ns(struct sys_getsockopt_args), 0,
(sy_call_t *)sys_getsockopt }, /* 95 = getsockopt */
{ ns(struct sys_listen_args), 0,
(sy_call_t *)sys_listen }, /* 96 = listen */
{ ns(struct compat_43_sys_recv_args), 0,
(sy_call_t *)compat_43_sys_recv }, /* 97 = recv */
{ ns(struct compat_43_sys_recvfrom_args), 0,
(sy_call_t *)compat_43_sys_recvfrom },/* 98 = recvfrom */
{ ns(struct compat_43_sys_recvmsg_args), 0,
(sy_call_t *)compat_43_sys_recvmsg },/* 99 = recvmsg */
{ ns(struct compat_50_sys_select_args), 0,
(sy_call_t *)compat_50_sys_select },/* 100 = select */
{ ns(struct compat_43_sys_send_args), 0,
(sy_call_t *)compat_43_sys_send }, /* 101 = send */
{ ns(struct compat_43_sys_sendmsg_args), 0,
(sy_call_t *)compat_43_sys_sendmsg },/* 102 = sendmsg */
{ ns(struct sys_sendto_args), 0,
(sy_call_t *)sys_sendto }, /* 103 = sendto */
{ ns(struct compat_43_sys_sethostid_args), 0,
(sy_call_t *)compat_43_sys_sethostid },/* 104 = sethostid */
{ ns(struct sys_setsockopt_args), 0,
(sy_call_t *)sys_setsockopt }, /* 105 = setsockopt */
{ ns(struct sys_shutdown_args), 0,
(sy_call_t *)sys_shutdown }, /* 106 = shutdown */
{ ns(struct svr4_sys_socket_args), 0,
(sy_call_t *)svr4_sys_socket }, /* 107 = socket */
{ ns(struct compat_43_sys_gethostname_args), 0,
(sy_call_t *)compat_43_sys_gethostname },/* 108 = gethostname */
{ ns(struct compat_43_sys_sethostname_args), 0,
(sy_call_t *)compat_43_sys_sethostname },/* 109 = sethostname */
{ ns(struct compat_09_sys_getdomainname_args), 0,
(sy_call_t *)compat_09_sys_getdomainname },/* 110 = getdomainname */
{ ns(struct compat_09_sys_setdomainname_args), 0,
(sy_call_t *)compat_09_sys_setdomainname },/* 111 = setdomainname */
{ ns(struct sys_truncate_args), 0,
(sy_call_t *)sys_truncate }, /* 112 = truncate */
{ ns(struct sys_ftruncate_args), 0,
(sy_call_t *)sys_ftruncate }, /* 113 = ftruncate */
{ ns(struct sys_rename_args), 0,
(sy_call_t *)sys_rename }, /* 114 = rename */
{ ns(struct sys_symlink_args), 0,
(sy_call_t *)sys_symlink }, /* 115 = symlink */
{ ns(struct sys_readlink_args), 0,
(sy_call_t *)sys_readlink }, /* 116 = readlink */
{ 0, 0, 0,
sys_nosys }, /* 117 = unimplemented lstat */
{ 0, 0, 0,
sys_nosys }, /* 118 = unimplemented */
{ 0, 0, 0,
sys_nosys }, /* 119 = unimplemented nfs_svc */
{ 0, 0, 0,
sys_nosys }, /* 120 = unimplemented nfs_getfh */
{ 0, 0, 0,
sys_nosys }, /* 121 = unimplemented async_daemon */
{ 0, 0, 0,
sys_nosys }, /* 122 = unimplemented exportfs */
{ ns(struct sys_setregid_args), 0,
(sy_call_t *)sys_setregid }, /* 123 = setregid */
{ ns(struct sys_setreuid_args), 0,
(sy_call_t *)sys_setreuid }, /* 124 = setreuid */
{ ns(struct compat_50_sys_getitimer_args), 0,
(sy_call_t *)compat_50_sys_getitimer },/* 125 = getitimer */
{ ns(struct compat_50_sys_setitimer_args), 0,
(sy_call_t *)compat_50_sys_setitimer },/* 126 = setitimer */
{ ns(struct compat_50_sys_adjtime_args), 0,
(sy_call_t *)compat_50_sys_adjtime },/* 127 = adjtime */
{ ns(struct svr4_sys_gettimeofday_args), 0,
(sy_call_t *)svr4_sys_gettimeofday },/* 128 = gettimeofday */
{ ns(struct irix_sys_sproc_args), 0,
(sy_call_t *)irix_sys_sproc }, /* 129 = sproc */
{ ns(struct irix_sys_prctl_args), 0,
(sy_call_t *)irix_sys_prctl }, /* 130 = prctl */
{ ns(struct irix_sys_procblk_args), 0,
(sy_call_t *)irix_sys_procblk }, /* 131 = procblk */
{ ns(struct irix_sys_sprocsp_args), 0,
(sy_call_t *)irix_sys_sprocsp }, /* 132 = sprocsp */
{ 0, 0, 0,
sys_nosys }, /* 133 = unimplemented sgigsc */
{ ns(struct irix_sys_mmap_args), 0,
(sy_call_t *)irix_sys_mmap }, /* 134 = mmap */
{ ns(struct irix_sys_munmap_args), 0,
(sy_call_t *)irix_sys_munmap }, /* 135 = munmap */
{ ns(struct irix_sys_mprotect_args), 0,
(sy_call_t *)irix_sys_mprotect }, /* 136 = mprotect */
{ ns(struct sys___msync13_args), 0,
(sy_call_t *)sys___msync13 }, /* 137 = __msync13 */
{ 0, 0, 0,
sys_nosys }, /* 138 = unimplemented madvise */
{ 0, 0, 0,
sys_nosys }, /* 139 = unimplemented pagelock */
{ 0, 0, 0,
sys_nosys }, /* 140 = unimplemented getpagesize */
{ 0, 0, 0,
sys_nosys }, /* 141 = unimplemented quotactl */
{ 0, 0, 0,
sys_nosys }, /* 142 = unimplemented */
{ 0, 0, 0,
(sy_call_t *)sys_getpgrp }, /* 143 = getpgrp */
{ ns(struct irix_sys_setpgrp_args), 0,
(sy_call_t *)irix_sys_setpgrp }, /* 144 = setpgrp */
{ 0, 0, 0,
sys_nosys }, /* 145 = unimplemented vhangup */
{ ns(struct sys_fsync_args), 0,
(sy_call_t *)sys_fsync }, /* 146 = fsync */
{ ns(struct sys_fchdir_args), 0,
(sy_call_t *)sys_fchdir }, /* 147 = fchdir */
{ ns(struct irix_sys_getrlimit_args), 0,
(sy_call_t *)irix_sys_getrlimit }, /* 148 = getrlimit */
{ ns(struct irix_sys_setrlimit_args), 0,
(sy_call_t *)irix_sys_setrlimit }, /* 149 = setrlimit */
{ 0, 0, 0,
sys_nosys }, /* 150 = unimplemented cacheflush */
{ 0, 0, 0,
sys_nosys }, /* 151 = unimplemented cachectl */
{ ns(struct sys___posix_fchown_args), 0,
(sy_call_t *)sys___posix_fchown }, /* 152 = fchown */
{ ns(struct sys_fchmod_args), 0,
(sy_call_t *)sys_fchmod }, /* 153 = fchmod */
{ 0, 0, 0,
sys_nosys }, /* 154 = unimplemented wait3 */
{ 0, 0, 0,
sys_nosys }, /* 155 = unimplemented socketpair */
{ ns(struct irix_sys_systeminfo_args), 0,
(sy_call_t *)irix_sys_systeminfo }, /* 156 = systeminfo */
{ ns(struct irix_sys_uname_args), 0,
(sy_call_t *)irix_sys_uname }, /* 157 = uname */
{ ns(struct irix_sys_xstat_args), 0,
(sy_call_t *)irix_sys_xstat }, /* 158 = xstat */
{ ns(struct irix_sys_lxstat_args), 0,
(sy_call_t *)irix_sys_lxstat }, /* 159 = lxstat */
{ ns(struct irix_sys_fxstat_args), 0,
(sy_call_t *)irix_sys_fxstat }, /* 160 = fxstat */
{ 0, 0, 0,
sys_nosys }, /* 161 = unimplemented xmknod */
{ ns(struct irix_sys_sigaction_args), 0,
(sy_call_t *)irix_sys_sigaction }, /* 162 = sigaction */
{ ns(struct svr4_sys_sigpending_args), 0,
(sy_call_t *)svr4_sys_sigpending }, /* 163 = sigpending */
{ ns(struct irix_sys_sigprocmask_args), 0,
(sy_call_t *)irix_sys_sigprocmask },/* 164 = sigprocmask */
{ ns(struct svr4_sys_sigsuspend_args), 0,
(sy_call_t *)svr4_sys_sigsuspend }, /* 165 = sigsuspend */
{ 0, 0, 0,
sys_nosys }, /* 166 = unimplemented sigpoll_sys */
{ ns(struct irix_sys_swapctl_args), 0,
(sy_call_t *)irix_sys_swapctl }, /* 167 = swapctl */
{ ns(struct irix_sys_getcontext_args), 0,
(sy_call_t *)irix_sys_getcontext }, /* 168 = getcontext */
{ ns(struct irix_sys_setcontext_args), 0,
(sy_call_t *)irix_sys_setcontext }, /* 169 = setcontext */
{ ns(struct irix_sys_waitsys_args), 0,
(sy_call_t *)irix_sys_waitsys }, /* 170 = waitsys */
{ 0, 0, 0,
sys_nosys }, /* 171 = unimplemented sigstack */
{ 0, 0, 0,
sys_nosys }, /* 172 = unimplemented sigaltstack */
{ 0, 0, 0,
sys_nosys }, /* 173 = unimplemented sigsendset */
{ ns(struct svr4_sys_statvfs_args), 0,
(sy_call_t *)svr4_sys_statvfs }, /* 174 = statvfs */
{ ns(struct svr4_sys_fstatvfs_args), 0,
(sy_call_t *)svr4_sys_fstatvfs }, /* 175 = fstatvfs */
{ 0, 0, 0,
sys_nosys }, /* 176 = unimplemented getpmsg */
{ 0, 0, 0,
sys_nosys }, /* 177 = unimplemented putpmsg */
{ 0, 0, 0,
sys_nosys }, /* 178 = unimplemented lchown */
{ 0, 0, 0,
sys_nosys }, /* 179 = unimplemented priocntl */
{ 0, 0, 0,
sys_nosys }, /* 180 = unimplemented sigqueue */
{ ns(struct sys_readv_args), 0,
(sy_call_t *)sys_readv }, /* 181 = readv */
{ ns(struct sys_writev_args), 0,
(sy_call_t *)sys_writev }, /* 182 = writev */
{ ns(struct sys_truncate_args), SYCALL_NARGS64_VAL(1) | SYCALL_ARG2_64,
(sy_call_t *)sys_truncate }, /* 183 = truncate64 */
{ ns(struct sys_ftruncate_args), SYCALL_NARGS64_VAL(1) | SYCALL_ARG2_64,
(sy_call_t *)sys_ftruncate }, /* 184 = ftruncate64 */
{ ns(struct irix_sys_mmap64_args), 0,
(sy_call_t *)irix_sys_mmap64 }, /* 185 = mmap64 */
{ 0, 0, 0,
sys_nosys }, /* 186 = unimplemented dmi */
{ ns(struct svr4_sys_pread_args), 0,
(sy_call_t *)svr4_sys_pread }, /* 187 = pread */
{ ns(struct svr4_sys_pwrite_args), 0,
(sy_call_t *)svr4_sys_pwrite }, /* 188 = pwrite */
{ 0, 0, 0,
sys_nosys }, /* 189 = unimplemented fdatasync */
{ 0, 0, 0,
sys_nosys }, /* 190 = unimplemented sgifastpath */
{ 0, 0, 0,
sys_nosys }, /* 191 = unimplemented attr_get */
{ 0, 0, 0,
sys_nosys }, /* 192 = unimplemented attr_getf */
{ 0, 0, 0,
sys_nosys }, /* 193 = unimplemented attr_set */
{ 0, 0, 0,
sys_nosys }, /* 194 = unimplemented attr_setf */
{ 0, 0, 0,
sys_nosys }, /* 195 = unimplemented attr_remove */
{ 0, 0, 0,
sys_nosys }, /* 196 = unimplemented attr_removef */
{ 0, 0, 0,
sys_nosys }, /* 197 = unimplemented attr_list */
{ 0, 0, 0,
sys_nosys }, /* 198 = unimplemented attr_listf */
{ 0, 0, 0,
sys_nosys }, /* 199 = unimplemented attr_multi */
{ 0, 0, 0,
sys_nosys }, /* 200 = unimplemented attr_multif */
{ 0, 0, 0,
sys_nosys }, /* 201 = unimplemented statvfs64 */
{ 0, 0, 0,
sys_nosys }, /* 202 = unimplemented fstatvfs64 */
{ ns(struct irix_sys_getmountid_args), 0,
(sy_call_t *)irix_sys_getmountid }, /* 203 = getmountid */
{ 0, 0, 0,
sys_nosys }, /* 204 = unimplemented nsproc */
{ ns(struct irix_sys_getdents64_args), 0,
(sy_call_t *)irix_sys_getdents64 }, /* 205 = getdents64 */
{ 0, 0, 0,
sys_nosys }, /* 206 = unimplemented afs_syscall */
{ ns(struct irix_sys_ngetdents_args), 0,
(sy_call_t *)irix_sys_ngetdents }, /* 207 = ngetdents */
{ ns(struct irix_sys_ngetdents64_args), 0,
(sy_call_t *)irix_sys_ngetdents64 },/* 208 = ngetdents64 */
{ 0, 0, 0,
sys_nosys }, /* 209 = unimplemented sgi_sesmgr */
{ ns(struct irix_sys_pidsprocsp_args), 0,
(sy_call_t *)irix_sys_pidsprocsp }, /* 210 = pidsprocsp */
{ 0, 0, 0,
sys_nosys }, /* 211 = unimplemented rexec */
{ 0, 0, 0,
sys_nosys }, /* 212 = unimplemented timer_create */
{ 0, 0, 0,
sys_nosys }, /* 213 = unimplemented timer_delete */
{ 0, 0, 0,
sys_nosys }, /* 214 = unimplemented timer_settime */
{ 0, 0, 0,
sys_nosys }, /* 215 = unimplemented timer_gettime */
{ 0, 0, 0,
sys_nosys }, /* 216 = unimplemented timer_setoverrun */
{ 0, 0, 0,
sys_nosys }, /* 217 = unimplemented sched_rr_get_interval */
{ 0, 0, 0,
sys_nosys }, /* 218 = unimplemented sched_yield */
{ 0, 0, 0,
sys_nosys }, /* 219 = unimplemented sched_getscheduler */
{ 0, 0, 0,
sys_nosys }, /* 220 = unimplemented sched_setscheduler */
{ 0, 0, 0,
sys_nosys }, /* 221 = unimplemented sched_getparam */
{ 0, 0, 0,
sys_nosys }, /* 222 = unimplemented sched_setparam */
{ ns(struct irix_sys_usync_cntl_args), 0,
(sy_call_t *)irix_sys_usync_cntl }, /* 223 = usync_cntl */
{ 0, 0, 0,
sys_nosys }, /* 224 = unimplemented psema_cntl */
{ 0, 0, 0,
sys_nosys }, /* 225 = unimplemented restartreturn */
{ 0, 0, 0,
sys_nosys }, /* 226 = unimplemented sysget */
{ 0, 0, 0,
sys_nosys }, /* 227 = unimplemented xpg4_recvmsg */
{ 0, 0, 0,
sys_nosys }, /* 228 = unimplemented umfscall */
{ 0, 0, 0,
sys_nosys }, /* 229 = unimplemented nsproctid */
{ 0, 0, 0,
sys_nosys }, /* 230 = unimplemented rexec_complete */
{ 0, 0, 0,
sys_nosys }, /* 231 = unimplemented xpg4_sigaltstack */
{ 0, 0, 0,
sys_nosys }, /* 232 = unimplemented xpg4_sigaltstack */
{ 0, 0, 0,
sys_nosys }, /* 233 = unimplemented xpg4_setregid */
{ 0, 0, 0,
sys_nosys }, /* 234 = unimplemented linkfollow */
{ 0, 0, 0,
sys_nosys }, /* 235 = unimplemented utimets */
{ 0, 0, 0,
sys_nosys }, /* 236 = filler */
{ 0, 0, 0,
sys_nosys }, /* 237 = filler */
{ 0, 0, 0,
sys_nosys }, /* 238 = filler */
{ 0, 0, 0,
sys_nosys }, /* 239 = filler */
{ 0, 0, 0,
sys_nosys }, /* 240 = filler */
{ 0, 0, 0,
sys_nosys }, /* 241 = filler */
{ 0, 0, 0,
sys_nosys }, /* 242 = filler */
{ 0, 0, 0,
sys_nosys }, /* 243 = filler */
{ 0, 0, 0,
sys_nosys }, /* 244 = filler */
{ 0, 0, 0,
sys_nosys }, /* 245 = filler */
{ 0, 0, 0,
sys_nosys }, /* 246 = filler */
{ 0, 0, 0,
sys_nosys }, /* 247 = filler */
{ 0, 0, 0,
sys_nosys }, /* 248 = filler */
{ 0, 0, 0,
sys_nosys }, /* 249 = filler */
{ 0, 0, 0,
sys_nosys }, /* 250 = filler */
{ 0, 0, 0,
sys_nosys }, /* 251 = filler */
{ 0, 0, 0,
sys_nosys }, /* 252 = filler */
{ 0, 0, 0,
sys_nosys }, /* 253 = filler */
{ 0, 0, 0,
sys_nosys }, /* 254 = filler */
{ 0, 0, 0,
sys_nosys }, /* 255 = filler */
};

View File

@ -1,194 +0,0 @@
/* $NetBSD: irix_sysmp.c,v 1.23 2009/12/14 00:47:10 matt Exp $ */
/*-
* Copyright (c) 2001-2002 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Emmanuel Dreyfus.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: irix_sysmp.c,v 1.23 2009/12/14 00:47:10 matt Exp $");
#include <sys/errno.h>
#include <sys/param.h>
#include <sys/types.h>
#include <sys/systm.h>
#include <sys/sysctl.h>
#include <sys/resource.h>
#include <sys/buf.h>
#include <sys/malloc.h>
#include <uvm/uvm_extern.h>
#include <machine/vmparam.h>
#include <compat/common/compat_util.h>
#include <compat/svr4/svr4_types.h>
#include <compat/irix/irix_types.h>
#include <compat/irix/irix_signal.h>
#include <compat/irix/irix_sysmp.h>
#include <compat/irix/irix_syscallargs.h>
/* IRIX /dev/kmem diggers emulation */
static int irix_sysmp_kernaddr(int, register_t *);
static int irix_sysmp_sasz(int, register_t *);
static int irix_sysmp_saget(int, char *, size_t);
extern struct loadavg averunnable;
extern long irix_kernel_var[32];
int
irix_sys_sysmp(struct lwp *l, const struct irix_sys_sysmp_args *uap, register_t *retval)
{
/* {
syscallarg(int) cmd;
syscallarg(void *) arg1;
syscallarg(void *) arg2;
syscallarg(void *) arg3;
syscallarg(void *) arg4;
} */
int cmd = SCARG(uap, cmd);
#ifdef DEBUG_IRIX
printf("irix_sys_sysmp(): cmd = %d\n", cmd);
#endif
switch(cmd) {
case IRIX_MP_NPROCS: /* Number of processors in complex */
case IRIX_MP_NAPROCS: { /* Number of active processors in complex */
*retval = ncpu;
return 0;
break;
}
case IRIX_MP_PGSIZE: /* Page size */
*retval = (register_t)PAGE_SIZE;
break;
case IRIX_MP_KERNADDR: /* Kernel structure addresses */
return irix_sysmp_kernaddr((intptr_t)SCARG(uap, arg1), retval);
break;
case IRIX_MP_SASZ: /* System accounting structure size */
return irix_sysmp_sasz((intptr_t)SCARG(uap, arg1), retval);
break;
case IRIX_MP_SAGET1: /* Get system accounting structure for one CPU */
case IRIX_MP_SAGET: /* Get system accounting structure for all CPU */
return irix_sysmp_saget((intptr_t)SCARG(uap, arg1),
(char *)SCARG(uap, arg2), (size_t)SCARG(uap, arg3));
break;
default:
printf("Warning: call to unimplemented sysmp() command %d\n",
cmd);
return EINVAL;
break;
}
return 0;
}
static int
irix_sysmp_kernaddr(int kernaddr, register_t *retval)
{
switch (kernaddr) {
case IRIX_MPKA_AVENRUN:
*retval = (register_t)&averunnable;
break;
case IRIX_MPKA_VAR:
*retval = (register_t)&irix_kernel_var;
break;
default:
printf("Warning: sysmp(KERNADDR) unimplemented address %d\n",
kernaddr);
return EINVAL;
break;
}
return 0;
}
static int
irix_sysmp_sasz(int cmd, register_t *retval)
{
switch (cmd) {
case IRIX_MPSA_RMINFO:
*retval = sizeof(struct irix_sysmp_rminfo);
break;
default:
printf("Warning: sysmp(SASZ) unimplemented struct %d\n",
cmd);
return EINVAL;
break;
}
return 0;
}
static int
irix_sysmp_saget(int cmd, char *buf, size_t len)
{
void *kbuf;
int error = 0;
kbuf = malloc(len, M_TEMP, M_WAITOK);
switch (cmd) {
case IRIX_MPSA_RMINFO: {
struct irix_sysmp_rminfo *irm =
(struct irix_sysmp_rminfo *)kbuf;
int active, inactive;
uvm_estimatepageable(&active, &inactive);
irm->freemem = uvmexp.free + uvmexp.filepages;
irm->availsmem = uvmexp.free + active + inactive
+ uvmexp.wired + (uvmexp.swpages - uvmexp.swpgonly);
irm->availrmem = uvmexp.free + active + inactive + uvmexp.wired;
irm->bufmem = uvmexp.filepages;
irm->physmem = uvmexp.npages;
irm->dchunkpages = 0; /* unsupported */
irm->pmapmem = 0; /* unsupported */
irm->strmem = 0; /* unsupported */
irm->chunkpages = 0; /* unsupported */
irm->dpages = 0; /* unsupported */
irm->emptymem = uvmexp.free;
irm->ravailrmem = active + inactive + uvmexp.free;
break;
}
default:
printf("Warning: sysmp(SAGET) unimplemented struct %d\n",
cmd);
error = EINVAL;
break;
}
if (error == 0)
error = copyout(kbuf, buf, len);
free(kbuf, M_TEMP);
return error;
}

View File

@ -1,172 +0,0 @@
/* $NetBSD: irix_sysmp.h,v 1.4 2008/04/28 20:23:42 martin Exp $ */
/*-
* Copyright (c) 2001-2002 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Emmanuel Dreyfus.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _IRIX_SYSMP_H_
#define _IRIX_SYSMP_H_
/* From IRIX's <sys/sysmp.h> */
#define IRIX_MP_NPROCS 1
#define IRIX_MP_NAPROCS 2
#define IRIX_MP_SPACE 3
#define IRIX_MP_ENABLE 4
#define IRIX_MP_DISABLE 5
#define IRIX_MP_KERNADDR 8
#define IRIX_MP_SASZ 9
#define IRIX_MP_SAGET 10
#define IRIX_MP_SCHED 13
#define IRIX_MP_PGSIZE 14
#define IRIX_MP_SAGET1 15
#define IRIX_MP_EMPOWER 16
#define IRIX_MP_RESTRICT 17
#define IRIX_MP_CLOCK 18
#define IRIX_MP_MUSTRUN 19
#define IRIX_MP_RUNANYWHERE 20
#define IRIX_MP_STAT 21
#define IRIX_MP_ISOLATE 22
#define IRIX_MP_UNISOLATE 23
#define IRIX_MP_PREEMPTIVE 24
#define IRIX_MP_NONPREEMPTIVE 25
#define IRIX_MP_FASTCLOCK 26
#define IRIX_MP_CLEARNFSSTAT 28
#define IRIX_MP_GETMUSTRUN 29
#define IRIX_MP_MUSTRUN_PID 30
#define IRIX_MP_RUNANYWHERE_PID 31
#define IRIX_MP_GETMUSTRUN_PID 32
#define IRIX_MP_CLEARCFSSTAT 33
#define IRIX_MP_CPUSET 35
#define IRIX_MP_MISER_GETREQUEST 36
#define IRIX_MP_MISER_SENDREQUEST 37
#define IRIX_MP_MISER_RESPOND 38
#define IRIX_MP_MISER_GETRESOURCE 39
#define IRIX_MP_MISER_SETRESOURCE 40
#define IRIX_MP_MISER_CHECKACCESS 41
#define IRIX_MP_NUMNODES 42
#define IRIX_MP_NUMA_GETDISTMATRIX 43
#define IRIX_MP_NUMA_GETCPUNODEMAP 44
#define IRIX_MP_DISABLE_CPU 45
#define IRIX_MP_ENABLE_CPU 46
#define IRIX_MP_CPU_PATH 47
#define IRIX_MP_KLSTAT 48
#define IRIX_MP_NUM_CPU_PER_NODE 49
/* IRIX_MP_KERNADDR subcommands */
#define IRIX_MPKA_VAR 2
#define IRIX_MPKA_SWPLO 3
#define IRIX_MPKA_INO 4
#define IRIX_MPKA_SEMAMETER 7
#define IRIX_MPKA_PROCSIZE 9
#define IRIX_MPKA_TIME 10
#define IRIX_MPKA_MSG 11
#define IRIX_MPKA_MSGINFO 14
#define IRIX_MPKA_SPLOCKMETER 17
#define IRIX_MPKA_SPLOCKMETERTAB 18
#define IRIX_MPKA_AVENRUN 19
#define IRIX_MPKA_PHYSMEM 20
#define IRIX_MPKA_KPBASE 21
#define IRIX_MPKA_PFDAT 22
#define IRIX_MPKA_FREEMEM 23
#define IRIX_MPKA_USERMEM 24
#define IRIX_MPKA_PDWRIMEM 25
#define IRIX_MPKA_BUFMEM 26
#define IRIX_MPKA_BUF 27
#define IRIX_MPKA_CHUNKMEM 30
#define IRIX_MPKA_MAXCLICK 31
#define IRIX_MPKA_PSTART 32
#define IRIX_MPKA_TEXT 33
#define IRIX_MPKA_ETEXT 34
#define IRIX_MPKA_EDATA 35
#define IRIX_MPKA_END 36
#define IRIX_MPKA_SYSSEGSZ 37
#define IRIX_MPKA_SEM_MAC 38
#define IRIX_MPKA_MSG_MAC 40
#define IRIX_MPKA_BSD_KERNADDRS 41
/* SASZ/SAGET subcommands */
#define IRIX_MPSA_SINFO 1
#define IRIX_MPSA_MINFO 2
#define IRIX_MPSA_DINFO 3
#define IRIX_MPSA_SERR 4
#define IRIX_MPSA_NCSTATS 5
#define IRIX_MPSA_EFS 6
#define IRIX_MPSA_RMINFO 8
#define IRIX_MPSA_BUFINFO 9
#define IRIX_MPSA_RUNQ 10
#define IRIX_MPSA_DISPQ 11
#define IRIX_MPSA_VOPINFO 13
#define IRIX_MPSA_TCPIPSTATS 14
#define IRIX_MPSA_RCSTAT 15
#define IRIX_MPSA_CLSTAT 16
#define IRIX_MPSA_RSSTAT 17
#define IRIX_MPSA_SVSTAT 18
#define IRIX_MPSA_XFSSTATS 20
#define IRIX_MPSA_CLSTAT3 21
#define IRIX_MPSA_TILEINFO 22
#define IRIX_MPSA_CFSSTAT 23
#define IRIX_MPSA_SVSTAT3 24
#define IRIX_MPSA_NODE_INFO 25
#define IRIX_MPSA_LPGSTATS 26
#define IRIX_MPSA_SHMSTAT 27
#define IRIX_MPSA_KSYM 28
#define IRIX_MPSA_MSGQUEUE 29
#define IRIX_MPSA_SEM 30
#define IRIX_MPSA_SOCKSTATS 31
#define IRIX_MPSA_SINFO_CPU 32
#define IRIX_MPSA_STREAMSTATS 33
#define IRIX_MPSA_TILEINFO 22
#define IRIX_MPSA_CFSSTAT 23
#define IRIX_MPSA_SVSTAT3 24
#define IRIX_MPSA_NODE_INFO 25
#define IRIX_MPSA_LPGSTATS 26
#define IRIX_MPSA_SHMSTAT 27
#define IRIX_MPSA_KSYM 28
#define IRIX_MPSA_MSGQUEUE 29
#define IRIX_MPSA_SEM 30
#define IRIX_MPSA_SOCKSTATS 31
#define IRIX_MPSA_SINFO_CPU 32
#define IRIX_MPSA_STREAMSTATS 33
/* Real Memory system accounting struct */
struct irix_sysmp_rminfo {
uint32_t freemem;
uint32_t availsmem;
uint32_t availrmem;
uint32_t bufmem;
uint32_t physmem;
uint32_t dchunkpages;
uint32_t pmapmem;
uint32_t strmem;
uint32_t chunkpages;
uint32_t dpages;
uint32_t emptymem;
uint32_t ravailrmem;
};
#endif /* _IRIX_SYSIRIX_IRIX_MP_H_ */

View File

@ -1,550 +0,0 @@
/* $NetBSD: irix_syssgi.c,v 1.51 2010/07/01 02:38:28 rmind Exp $ */
/*-
* Copyright (c) 2001, 2002, 2008 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Emmanuel Dreyfus.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: irix_syssgi.c,v 1.51 2010/07/01 02:38:28 rmind Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ddb.h"
#endif
#ifndef ELFSIZE
#ifdef _LP64
#define ELFSIZE 64
#else
#define ELFSIZE 32
#endif
#endif
/* round up and down to page boundaries. Borrowed from sys/kern/exec_elf32.c */
#define ELF_ROUND(a, b) (((a) + (b) - 1) & ~((b) - 1))
#define ELF_TRUNC(a, b) ((a) & ~((b) - 1))
#include <sys/types.h>
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/systm.h>
#include <sys/filedesc.h>
#include <sys/buf.h>
#include <sys/vnode.h>
#include <sys/file.h>
#include <sys/resourcevar.h>
#include <sys/sysctl.h>
#include <sys/exec.h>
#include <sys/exec_elf.h>
#include <sys/mount.h>
#include <sys/syscallargs.h>
#include <uvm/uvm_extern.h>
#include <compat/common/compat_util.h>
#include <compat/svr4/svr4_types.h>
#include <compat/irix/irix_types.h>
#include <compat/irix/irix_signal.h>
#include <compat/irix/irix_exec.h>
#include <compat/irix/irix_prctl.h>
#include <compat/irix/irix_syscall.h>
#include <compat/irix/irix_syscallargs.h>
#include <compat/irix/irix_syssgi.h>
/* In sys/kern/exec_elf32.c */
void ELFNAME(load_psection)(struct exec_vmcmd_set *, struct vnode *,
const Elf_Phdr *, Elf_Addr *, u_long *, int *, int);
static int irix_syssgi_mapelf(int, Elf_Phdr *, int,
struct lwp *, register_t *);
static int irix_syssgi_sysconf(int name, struct lwp *, register_t *);
static int irix_syssgi_pathconf(char *, int, struct lwp *, register_t *);
int
irix_sys_syssgi(struct lwp *l, const struct irix_sys_syssgi_args *uap, register_t *retval)
{
/* {
syscallarg(int) request;
syscallarg(void *) arg1;
syscallarg(void *) arg2;
syscallarg(void *) arg3;
syscallarg(void *) arg4;
syscallarg(void *) arg5;
} */
struct proc *p = l->l_proc;
int request = SCARG(uap, request);
void *arg1, *arg2, *arg3;
#ifdef DEBUG_IRIX
printf("irix_sys_syssgi(): request = %d\n", request);
#endif
switch(request) {
case IRIX_SGI_SYSID: /* Get HostID */
*retval = (register_t)hostid;
break;
case IRIX_SGI_SETGROUPS: { /* setgroups(2) */
struct sys_setgroups_args cup;
SCARG(&cup, gidsetsize) = (intptr_t)SCARG(uap, arg1);
SCARG(&cup, gidset) = (gid_t *)SCARG(uap, arg2);
return (sys_setgroups(l, &cup, retval));
break;
}
case IRIX_SGI_GETGROUPS: { /* getgroups(2) */
struct sys_getgroups_args cup;
SCARG(&cup, gidsetsize) = (intptr_t)SCARG(uap, arg1);
SCARG(&cup, gidset) = (gid_t *)SCARG(uap, arg2);
return (sys_getgroups(l, &cup, retval));
break;
}
case IRIX_SGI_SETSID: /* Set session ID: setsid(2) */
return (sys_setsid(l, NULL, retval));
break;
case IRIX_SGI_GETSID: { /* Get session ID: getsid(2) */
struct sys_getsid_args cup;
SCARG(&cup, pid) = (pid_t)(intptr_t)SCARG(uap, arg1);
return (sys_getsid(l, &cup, retval));
break;
}
case IRIX_SGI_GETPGID: {/* Get parent process GID: getpgid(2) */
struct sys_getpgid_args cup;
SCARG(&cup, pid) = (pid_t)(intptr_t)SCARG(uap, arg1);
return (sys_getpgid(l, &cup, retval));
break;
}
case IRIX_SGI_SETPGID: {/* Get parent process GID: setpgid(2) */
struct sys_setpgid_args cup;
SCARG(&cup, pid) = (pid_t)(intptr_t)SCARG(uap, arg1);
SCARG(&cup, pgid) = (pid_t)(intptr_t)SCARG(uap, arg2);
return (sys_setpgid(l, &cup, retval));
break;
}
case IRIX_SGI_PATHCONF: /* Get file limits: pathconf(3) */
return irix_syssgi_pathconf((char *)SCARG(uap, arg1),
(intptr_t)SCARG(uap, arg2), l, retval);
break;
case IRIX_SGI_RUSAGE: { /* BSD getrusage(2) */
struct compat_50_sys_getrusage_args cup;
SCARG(&cup, who) = (intptr_t)SCARG(uap, arg1);
SCARG(&cup, rusage) = (struct rusage50 *)SCARG(uap, arg2);
return compat_50_sys_getrusage(l, &cup, retval);
}
case IRIX_SGI_NUM_MODULES: /* <sys/systeminfo.h> get_num_modules() */
*retval = 1;
return 0;
break;
case IRIX_SGI_MODULE_INFO: { /* <sys/systeminfo.h> get_module_info() */
int module_num = (intptr_t)SCARG(uap, arg1);
struct irix_module_info_s *imip = SCARG(uap, arg2);
int mss = (intptr_t)SCARG(uap, arg3);
struct irix_module_info_s imi;
char *idx;
if (module_num != 0)
return EINVAL;
imi.serial_num = (u_int64_t)hostid;
imi.mod_num = 0;
(void)snprintf(imi.serial_str, IRIX_MAX_SERIAL_SIZE,
"0800%08x", (u_int32_t)hostid);
/* Convert to upper case */
for (idx = imi.serial_str; *idx; idx++)
if (*idx >= 'a' && *idx <= 'f')
*idx += ('A' - 'a');
/* Don't copyout irrelevant data on user request */
if (mss > sizeof(struct irix_module_info_s))
mss = sizeof(struct irix_module_info_s);
return copyout(&imi, imip, mss);
break;
}
case IRIX_SGI_RDNAME: { /* Read Processes' name */
struct proc *tp;
arg1 = SCARG(uap, arg1); /* PID of the process */
arg2 = SCARG(uap, arg2); /* Address of user buffer */
arg3 = SCARG(uap, arg3); /* Length of user buffer */
mutex_enter(proc_lock);
tp = proc_find((pid_t)(intptr_t)arg1);
if (tp == NULL ||
tp->p_psstr == NULL ||
tp->p_psstr->ps_argvstr == NULL ||
tp->p_psstr->ps_argvstr[0] == NULL) {
mutex_exit(proc_lock);
return 0;
}
mutex_exit(proc_lock);
/* XXX: Unlocked! */
*retval = (register_t)copyout(tp->p_psstr->ps_argvstr[0],
(void *)arg2, (size_t)arg3);
break;
}
case IRIX_SGI_TUNE: /* Tune system variables */
case IRIX_SGI_IDBG: /* Kernel debugging */
case IRIX_SGI_INVENT: /* Get system inventory */
case IRIX_SGI_SETLED: /* Turn on/off LEDs */
case IRIX_SGI_SETNVRAM: /* Sets a NVRAM variable value */
case IRIX_SGI_GETNVRAM: /* Gets a NVRAM variable value */
return EINVAL;
break;
case IRIX_SGI_ELFMAP: /* Maps an ELF image */
arg1 = SCARG(uap, arg1); /* file descriptor */
arg2 = SCARG(uap, arg2); /* ptr to ELF program header array */
arg3 = SCARG(uap, arg3); /* array's length */
return irix_syssgi_mapelf((intptr_t)arg1, (Elf_Phdr *)arg2,
(intptr_t)arg3, l, retval);
break;
case IRIX_SGI_USE_FP_BCOPY: /* bcopy and bzero can use FPU or not */
/*
* Our kernel does not use FPU, hence we do nothing.
*/
break;
case IRIX_SGI_TOSSTSAVE: /* Kill saved pregions */
/*
* Our kernel does not seem to save such "pregions",
* therefore we do not have to do anything.
*/
break;
case IRIX_SGI_SYSCONF: /* POSIX sysconf */
arg1 = SCARG(uap, arg1); /* system variable name */
return irix_syssgi_sysconf((intptr_t)arg1, l, retval);
break;
case IRIX_SGI_SATCTL: /* control audit stream */
case IRIX_SGI_RXEV_GET: /* Trusted IRIX call */
/* Undocumented (?) and unimplemented */
return 0;
break;
case IRIX_SGI_FDHI: /* getdtablehi(3): get higher open fd + 1 */
*retval = (register_t)(p->p_fd->fd_lastfile + 1);
return 0;
break;
default:
printf("Warning: call to unimplemented syssgi() command %d\n",
request);
return EINVAL;
break;
}
return 0;
}
static int
irix_syssgi_mapelf(int fd, Elf_Phdr *ph, int count, struct lwp *l, register_t *retval)
{
Elf_Phdr *kph;
Elf_Phdr *pht;
int error = 0;
int i,j;
int prot;
int flags;
u_long size;
Elf_Addr uaddr;
Elf_Addr reloc_offset;
file_t *fp;
struct exec_vmcmd_set vcset;
struct exec_vmcmd *base_vcp = NULL;
struct vnode *vp;
struct vm_map_entry *ret;
struct exec_vmcmd *vcp;
int need_relocation;
vcset.evs_cnt = 0;
vcset.evs_used = 0;
kph = (Elf_Phdr *)malloc(sizeof(Elf_Phdr) * count, M_TEMP, M_WAITOK);
error = copyin(ph, kph, sizeof(Elf_Phdr) * count);
if (error)
goto bad;
pht = kph;
need_relocation = 0;
for (i = 0; i < count; i++) {
/* Check that each ELF sections is loadable */
if (pht->p_type != PT_LOAD) {
error = ENOEXEC;
goto bad;
}
/*
* Check that the section load addresses are increasing
* with the section in the program header array. We do
* not support any other situation.
*/
if (pht->p_vaddr < kph->p_vaddr) {
#ifdef DEBUG_IRIX
printf("mapelf: unsupported psection order\n");
#endif
error = EINVAL;
goto bad;
}
/*
* Check that the default load addresses are free.
* If not, we will have to perform a relocation
*/
ret = uvm_map_findspace(&l->l_proc->p_vmspace->vm_map,
pht->p_vaddr, pht->p_memsz, (vaddr_t *)(void *)&uaddr,
NULL, 0, 0, UVM_FLAG_FIXED);
if (ret == NULL)
need_relocation = 1;
pht++;
}
/*
* Perform a relocation
*/
if (need_relocation) {
/*
* compute the size needed by the section union. This
* assumes that the section load addresses are increasing.
* (And also that the sections are not overlapping)
*/
pht--;
size = ELF_ROUND((pht->p_vaddr + pht->p_memsz), pht->p_align) -
ELF_TRUNC(kph->p_vaddr, kph->p_align);
/* Find a free place for the sections */
ret = uvm_map_findspace(&l->l_proc->p_vmspace->vm_map,
IRIX_MAPELF_RELOCATE, size, (vaddr_t *)(void *)&uaddr,
NULL, 0, kph->p_align, 0);
if (ret == NULL) {
error = ENOMEM;
goto bad;
}
/*
* Relocate the sections, all with the same offset.
*/
reloc_offset = uaddr - kph->p_vaddr;
pht = kph;
for (i = 0; i < count; i++) {
#ifdef DEBUG_IRIX
printf("mapelf: relocating section %d from %p to %p\n",
i, (void *)pht->p_vaddr,
(void *)(pht->p_vaddr + reloc_offset));
#endif
pht->p_vaddr += reloc_offset;
pht++;
}
}
/* Find the file's vnode */
fp = fd_getfile(fd);
if (fp == NULL) {
error = EBADF;
goto bad;
}
vp = fp->f_data;
error = vn_marktext(vp);
if (error)
goto bad_unuse;
/*
* Load the sections
*/
pht = kph;
for (i = 0; i < count; i++) {
#ifdef DEBUG_IRIX
printf("mapelf: loading section %d (len 0x%08lx) at %p\n",
i, (long)pht->p_memsz, (void *)pht->p_vaddr);
#endif
/* Build the vmcmds for loading the section */
kill_vmcmds(&vcset);
uaddr = pht->p_vaddr;
size = 0;
prot = 0;
flags = VMCMD_BASE;
ELFNAME(load_psection)(&vcset, vp, pht, &uaddr,
&size, &prot, flags);
/* Execute the vmcmds */
for (j = 0; j < vcset.evs_used && !error; j++) {
vcp = &vcset.evs_cmds[j];
if (vcp->ev_flags & VMCMD_RELATIVE) {
if (base_vcp == NULL)
panic("irix_syssgi_mapelf(): bad vmcmd base");
vcp->ev_addr += base_vcp->ev_addr;
}
IRIX_VM_SYNC(l->l_proc, error = (*vcp->ev_proc)(l, vcp));
if (error)
goto bad_unuse;
}
pht++;
}
*retval = (register_t)kph->p_vaddr;
bad_unuse:
fd_putfile(fd);
bad:
free(kph, M_TEMP);
return error;
}
static int
irix_syssgi_sysconf(int name, struct lwp *l, register_t *retval)
{
struct proc *p = l->l_proc;
int error = 0;
int mib[2], value;
size_t len = sizeof(value);
switch (name) {
case IRIX_SC_ARG_MAX:
mib[0] = CTL_KERN;
mib[1] = KERN_ARGMAX;
break;
case IRIX_SC_CHILD_MAX:
*retval = (register_t)p->p_rlimit[RLIMIT_NPROC].rlim_cur;
return 0;
break;
case IRIX_SC_CLK_TCK:
*retval = hz;
return 0;
break;
case IRIX_SC_NGROUPS_MAX:
mib[0] = CTL_KERN;
mib[1] = KERN_NGROUPS;
break;
case IRIX_SC_OPEN_MAX:
*retval = (register_t)p->p_rlimit[RLIMIT_NOFILE].rlim_cur;
return 0;
break;
case IRIX_SC_JOB_CONTROL:
mib[0] = CTL_KERN;
mib[1] = KERN_JOB_CONTROL;
break;
case IRIX_SC_SAVED_IDS:
mib[0] = CTL_KERN;
mib[1] = KERN_SAVED_IDS;
break;
case IRIX_SC_IP_SECOPTS:/* IP security options */
/* Trusted IRIX capabilities are unsupported */
case IRIX_SC_ACL: /* ACcess Lists */
case IRIX_SC_AUDIT: /* Audit */
case IRIX_SC_INF: /* Information labels */
case IRIX_SC_MAC: /* Mandatory Access Control */
case IRIX_SC_CAP: /* Capabilities */
*retval = 0;
return 0;
break;
case IRIX_SC_PAGESIZE:
mib[0] = CTL_HW;
mib[1] = HW_PAGESIZE;
break;
case IRIX_SC_PASS_MAX:
case IRIX_SC_VERSION:
default:
printf("Warning: syssgi(SYSCONF) unsupported variable %d\n",
name);
return EINVAL;
break;
}
/*
* calling into sysctl with superuser privs, but we don't mind
* 'cause we're only querying a value.
*/
error = old_sysctl(&mib[0], 2, &value, &len, NULL, 0, NULL);
if (error == 0)
*retval = value;
return (error);
}
static int
irix_syssgi_pathconf(char *path, int name, struct lwp *l, register_t *retval)
{
struct sys_pathconf_args cup;
int bname;
switch (name) {
case IRIX_PC_LINK_MAX:
case IRIX_PC_MAX_CANON:
case IRIX_PC_MAX_INPUT:
case IRIX_PC_NAME_MAX:
case IRIX_PC_PATH_MAX:
case IRIX_PC_PIPE_BUF:
case IRIX_PC_CHOWN_RESTRICTED:
case IRIX_PC_NO_TRUNC:
case IRIX_PC_VDISABLE:
case IRIX_PC_SYNC_IO:
bname = name;
break;
case IRIX_PC_FILESIZEBITS:
bname = _PC_FILESIZEBITS;
break;
case IRIX_PC_PRIO_IO:
case IRIX_PC_ASYNC_IO:
case IRIX_PC_ABI_ASYNC_IO:
case IRIX_PC_ABI_AIO_XFER_MAX:
default:
printf("Warning: unimplemented IRIX pathconf() command %d\n",
name);
*retval = 0;
return 0;
break;
}
SCARG(&cup, path) = path;
SCARG(&cup, name) = bname;
return sys_pathconf(l, &cup, retval);
}

View File

@ -1,425 +0,0 @@
/* $NetBSD: irix_syssgi.h,v 1.6 2008/04/28 20:23:42 martin Exp $ */
/*-
* Copyright (c) 2001-2002 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Emmanuel Dreyfus.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _IRIX_SYSSGI_H_
#define _IRIX_SYSSGI_H_
/* From IRIX's <sys/systeminfo.h> */
#define IRIX_MAX_SERIAL_SIZE 16
struct irix_module_info_s {
__uint64_t serial_num;
int mod_num;
char serial_str[IRIX_MAX_SERIAL_SIZE];
};
#define IRIX_MAPELF_RELOCATE 0x4000000
/* From IRIX's <sys/syssgi.h> */
#define IRIX_SGI_SYSID 1
#define IRIX_SGI_BUFINFO 2
#define IRIX_SGI_TUNE_SET 3
#define IRIX_SGI_TUNE IRIX_SGI_TUNE_SET
#define IRIX_SGI_IDBG 4
#define IRIX_SGI_INVENT 5
#define IRIX_SGI_RDNAME 6
#define IRIX_SGI_SETLED 7
#define IRIX_SGI_SETNVRAM 8
#define IRIX_SGI_GETNVRAM 9
#define IRIX_SGI_SETKOPT 10
#define IRIX_SGI_QUERY_FTIMER 12
#define IRIX_SGI_QUERY_CYCLECNTR 13
#define IRIX_SGI_SETSID 20
#define IRIX_SGI_SETPGID 21
#define IRIX_SGI_SYSCONF 22
#define IRIX_SGI_PATHCONF 24
#define IRIX_SGI_TITIMER 29
#define IRIX_SGI_READB 30
#define IRIX_SGI_WRITEB 31
#define IRIX_SGI_SETGROUPS 40
#define IRIX_SGI_GETGROUPS 41
#define IRIX_SGI_SETTIMEOFDAY 52
#define IRIX_SGI_SETTIMETRIM 53
#define IRIX_SGI_GETTIMETRIM 54
#define IRIX_SGI_SPROFIL 55
#define IRIX_SGI_RUSAGE 56
#define IRIX_SGI_SIGSTACK 57
#define IRIX_SGI_NETPROC 59
#define IRIX_SGI_SIGALTSTACK 60
#define IRIX_SGI_BDFLUSHCNT 61
#define IRIX_SGI_SSYNC 62
#define IRIX_SGI_NFSCNVT 63
#define IRIX_SGI_GETPGID 64
#define IRIX_SGI_GETSID 65
#define IRIX_SGI_IOPROBE 66
#define IRIX_SGI_CONFIG 67
#define IRIX_SGI_ELFMAP 68
#define IRIX_SGI_MCONFIG 69
#define IRIX_SGI_GETPLABEL 70
#define IRIX_SGI_SETPLABEL 71
#define IRIX_SGI_GETLABEL 72
#define IRIX_SGI_SETLABEL 73
#define IRIX_SGI_SATREAD 74
#define IRIX_SGI_SATWRITE 75
#define IRIX_SGI_SATCTL 76
#define IRIX_SGI_LOADATTR 77
#define IRIX_SGI_UNLOADATTR 78
#define IRIX_SGI_RECVLUMSG 79
#define IRIX_SGI_PLANGMOUNT 80
#define IRIX_SGI_GETPSOACL 81
#define IRIX_SGI_SETPSOACL 82
#define IRIX_SGI_CAP_GET 83
#define IRIX_SGI_CAP_SET 84
#define IRIX_SGI_PROC_ATTR_GET 85
#define IRIX_SGI_EAG_GETPROCATTR IRIX_SGI_PROC_ATTR_GET
#define IRIX_SGI_PROC_ATTR_SET 86
#define IRIX_SGI_EAG_SETPROCATTR IRIX_SGI_PROC_ATTR_SET
#define IRIX_SGI_REVOKE 87
#define IRIX_SGI_FREVOKE IRIX_SGI_REVOKE
#define IRIX_SGI_ACL_GET 88
#define IRIX_SGI_ACL_SET 89
#define IRIX_SGI_MAC_GET 90
#define IRIX_SGI_MAC_SET 91
#define IRIX_SGI_RXEV_GET 92
#define IRIX_SGI_SBE_GET_INFO 98
#define IRIX_SGI_SBE_CLR_INFO 99
#define IRIX_SGI_GET_EVCONF 102
#define IRIX_SGI_MPCWAROFF 103
#define IRIX_SGI_SET_AUTOPWRON 104
#define IRIX_SGI_SPIPE 105
#define IRIX_SGI_SYMTAB 106
#define IRIX_SGI_SET_FP_PRECISE 107
#define IRIX_SGI_TOSSTSAVE 108
#define IRIX_SGI_FDHI 109
#define IRIX_SGI_SET_CONFIG_SMM 110
#define IRIX_SGI_SET_FP_PRESERVE 111
#define IRIX_SGI_MINRSS 112
#define IRIX_SGI_GRIO 113
#define IRIX_SGI_XLV_SET_TAB 114
#define IRIX_SGI_XLV_GET_TAB 115
#define IRIX_SGI_GET_FP_PRECISE 116
#define IRIX_SGI_GET_CONFIG_SMM 117
#define IRIX_SGI_FP_IMPRECISE_SUPP 118
#define IRIX_SGI_CONFIG_NSMM_SUPP 119
#define IRIX_SGI_RT_TSTAMP_CREATE 122
#define IRIX_SGI_RT_TSTAMP_DELETE 123
#define IRIX_SGI_RT_TSTAMP_START 124
#define IRIX_SGI_RT_TSTAMP_STOP 125
#define IRIX_SGI_RT_TSTAMP_ADDR 126
#define IRIX_SGI_RT_TSTAMP_MASK 127
#define IRIX_SGI_RT_TSTAMP_EOB_MODE 128
#define IRIX_SGI_USE_FP_BCOPY 129
#define IRIX_SGI_GET_UST 130
#define IRIX_SGI_SPECULATIVE_EXEC 131
#define IRIX_SGI_XLV_NEXT_RQST 132
#define IRIX_SGI_XLV_ATTR_CURSOR 133
#define IRIX_SGI_XLV_ATTR_GET 134
#define IRIX_SGI_XLV_ATTR_SET 135
#define IRIX_SGI_BTOOLSIZE 136
#define IRIX_SGI_BTOOLGET 137
#define IRIX_SGI_BTOOLREINIT 138
#define IRIX_SGI_CREATE_UUID 139
#define IRIX_SGI_NOFPE 140
#define IRIX_SGI_OLD_SOFTFP 141
#define IRIX_SGI_FS_INUMBERS 142
#define IRIX_SGI_FS_BULKSTAT 143
#define IRIX_SGI_RT_TSTAMP_WAIT 144
#define IRIX_SGI_RT_TSTAMP_UPDATE 145
#define IRIX_SGI_PATH_TO_HANDLE 146
#define IRIX_SGI_PATH_TO_FSHANDLE 147
#define IRIX_SGI_FD_TO_HANDLE 148
#define IRIX_SGI_OPEN_BY_HANDLE 149
#define IRIX_SGI_READLINK_BY_HANDLE 150
#define IRIX_SGI_READ_DANGID 151
#define IRIX_SGI_CONST 152
#define IRIX_SGI_XFS_FSOPERATIONS 153
#define IRIX_SGI_SETASH 154
#define IRIX_SGI_GETASH 155
#define IRIX_SGI_SETPRID 156
#define IRIX_SGI_GETPRID 157
#define IRIX_SGI_SETSPINFO 158
#define IRIX_SGI_GETSPINFO 159
#define IRIX_SGI_SHAREII 160
#define IRIX_SGI_NEWARRAYSESS 161
#define IRIX_SGI_GETDFLTPRID 162
#define IRIX_SGI_SET_DISMISSED_EXC_CNT 163
#define IRIX_SGI_GET_DISMISSED_EXC_CNT 164
#define IRIX_SGI_CYCLECNTR_SIZE 165
#define IRIX_SGI_QUERY_FASTTIMER 166
#define IRIX_SGI_PIDSINASH 167
#define IRIX_SGI_ULI 168
#define IRIX_SGI_AUTOFS_SYS 170
#define IRIX_SGI_CACHEFS_SYS 171
#define IRIX_SGI_NFSNOTIFY 172
#define IRIX_SGI_LOCKDSYS 173
#define IRIX_SGI_EVENTCTR 174
#define IRIX_SGI_GETPRUSAGE 175
#define IRIX_SGI_PROCMASK_LOCATION 176
#define IRIX_SGI_CKPT_SYS 178
#define IRIX_SGI_GETGRPPID 179
#define IRIX_SGI_GETSESPID 180
#define IRIX_SGI_ENUMASHS 181
#define IRIX_SGI_SETASMACHID 182
#define IRIX_SGI_GETASMACHID 183
#define IRIX_SGI_GETARSESS 184
#define IRIX_SGI_JOINARRAYSESS 185
#define IRIX_SGI_DBA_CONFIG 187
#define IRIX_SGI_RELEASE_NAME 188
#define IRIX_SGI_SYNCH_CACHE_HANDLER 189
#define IRIX_SGI_SWASH_INIT 190
#define IRIX_SGI_NUM_MODULES 191
#define IRIX_SGI_MODULE_INFO 192
#define IRIX_SGI_GET_CONTEXT_NAME 193
#define IRIX_SGI_GET_CONTEXT_INFO 194
#define IRIX_SGI_PART_OPERATIONS 195
#define IRIX_SGI_EARLY_ADD_SWAP 197
#define IRIX_SGI_BRICK_INFO 198
#define IRIX_SGI_NUMA_MIGR_PAGE 200
#define IRIX_SGI_NUMA_MIGR_PAGE_ALT 201
#define IRIX_SGI_KAIO_USERINIT 202
#define IRIX_SGI_KAIO_READ 203
#define IRIX_SGI_KAIO_WRITE 204
#define IRIX_SGI_KAIO_SUSPEND 205
#define IRIX_SGI_DBA_GETSTATS 206
#define IRIX_SGI_IO_SHOW_AUX_INFO 207
#define IRIX_SGI_PMOCTL 208
#define IRIX_SGI_ALLOCSHARENA 209
#define IRIX_SGI_SETVPID 210
#define IRIX_SGI_GETVPID 211
#define IRIX_SGI_NUMA_TUNE 212
#define IRIX_SGI_ERROR_FORCE 214
#define IRIX_SGI_NUMA_STATS_GET 218
#define IRIX_SGI_DPIPE_FSPE_BIND 219
#define IRIX_SGI_DYIELD 220
#define IRIX_SGI_TUNE_GET 221
#define IRIX_SGI_CHPROJ 222
#define IRIX_SGI_LCHPROJ 223
#define IRIX_SGI_FCHPROJ 224
#define IRIX_SGI_ARSESS_CTL 225
#define IRIX_SGI_ARSESS_OP 226
#define IRIX_SGI_FETCHOP_SETUP 227
#define IRIX_SGI_FS_BULKSTAT_SINGLE 228
#define IRIX_SGI_FS_SWAPEXT 229
#define IRIX_SGI_WRITE_IP32_FLASH 230
#define IRIX_SGI_ROUTERSTATS_ENABLED 231
#define IRIX_SGI_DBA_CLRSTATS 232
#define IRIX_SGI_IPC_AUTORMID_SHM 233
#define IRIX_SGI_FORMAT_MODULE_NUM 234
#define IRIX_SGI_PARSE_MODULE_NUM 235
#define IRIX_SGI_IS_DEBUG_KERNEL 300
#define IRIX_SGI_IS_TRAPLOG_DEBUG_KERNEL 301
#define IRIX_SGI_POKE 320
#define IRIX_SGI_PEEK 321
#define IRIX_SGI_XLV_INDUCE_IO_ERROR 350
#define IRIX_SGI_XLV_UNINDUCE_IO_ERROR 351
#define IRIX_SGI_DKSC_INDUCE_IO_ERROR 352
#define IRIX_SGI_DKSC_UNINDUCE_IO_ERROR 353
#define IRIX_SGI_XFS_INJECT_ERROR 360
#define IRIX_SGI_XFS_CLEAR_ERROR 361
#define IRIX_SGI_XFS_CLEARALL_ERROR 362
#define IRIX_SGI_XFS_MAKE_SHARED_RO 363
#define IRIX_SGI_XFS_CLEAR_SHARED_RO 364
#define IRIX_SGI_FO_DUMP 400
#define IRIX_SGI_FO_SWITCH 401
#define IRIX_SGI_NOHANG 402
#define IRIX_SGI_UNFS 403
#define IRIX_SGI_ATTR_LIST_BY_HANDLE 404
#define IRIX_SGI_ATTR_MULTI_BY_HANDLE 405
#define IRIX_SGI_FSSETDM_BY_HANDLE 406
#define IRIX_SGI_FO_TRESSPASS 407
#define IRIX_SGI_SCSI_CTLR_START_NUM 408
#define IRIX_SGI_ACCTCTL 600
#define IRIX_SGI_PHYSP 1011
#define IRIX_SGI_KTHREAD 1012
#define IRIX_SGI_FLUSH_ICACHE 1015
#define IRIX_SGI_DEBUGLPAGE 1030
#define IRIX_SGI_MAPLPAGE 1031
#define IRIX_SGI_MUTEX_TEST 1040
#define IRIX_SGI_MUTEX_TEST_INIT 1041
#define IRIX_SGI_MUTEX_TESTER_INIT 1042
#define IRIX_SGI_CREATE_MISER_POOL 1043
#define IRIX_SGI_CREATE_MISER_JOB 1044
#define IRIX_SGI_MISER_CRITICAL 1045
#define IRIX_SGI_CONTEXT_SWITCH 1046
#define IRIX_SGI_MRLOCK_TEST_INIT 1047
#define IRIX_SGI_MRLOCK_TEST_RLOCK 1048
#define IRIX_SGI_KMEM_TEST 1051
#define IRIX_SGI_SHAKE_ZONES 1052
#define IRIX_SGI_UNICENTER 1053
#define IRIX_SGI_UNSUPPORTED_MAP_RESERVED_RANGE 1054
#define IRIX_SGI_CELL 1060
#define IRIX_SGI_NFS_UNMNT 1061
#define IRIX_SGI_NUMA_MIGR_INT_VADDR 1100
#define IRIX_SGI_NUMA_MIGR_INT_PFN 1101
#define IRIX_SGI_NUMA_PAGEMIGR_TEST 1102
#define IRIX_SGI_NUMA_TESTS 1103
#define IRIX_SGI_NUMA_RESERVED 1104
#define IRIX_SGI_MEMPROF_START 1105
#define IRIX_SGI_MEMPROF_GET 1106
#define IRIX_SGI_MEMPROF_CLEARALL 1107
#define IRIX_SGI_MEMPROF_STOP 1108
#define IRIX_SGI_HW_CPU_CONFREG 1200
#define IRIX_SGI_UPANIC_SET 1201
#define IRIX_SGI_UPANIC 1202
#define IRIX_SGI_GETJLIMIT 1210
#define IRIX_SGI_SETJLIMIT 1211
#define IRIX_SGI_GETJUSAGE 1212
#define IRIX_SGI_JL_UNUSED1 1213
#define IRIX_SGI_GETJID 1214
#define IRIX_SGI_KILLJOB 1215
#define IRIX_SGI_MAKENEWJOB 1216
#define IRIX_SGI_GETJOBPID 1217
#define IRIX_SGI_JOINJOB 1218
#define IRIX_SGI_SETWAITJOBPID 1219
#define IRIX_SGI_WAITJOB 1220
#define IRIX_SGI_IP30MISC 1250
/* From IRIX's <sys/unistd.h> */
#define IRIX_SC_ARG_MAX 1
#define IRIX_SC_CHILD_MAX 2
#define IRIX_SC_CLK_TCK 3
#define IRIX_SC_NGROUPS_MAX 4
#define IRIX_SC_OPEN_MAX 5
#define IRIX_SC_JOB_CONTROL 6
#define IRIX_SC_SAVED_IDS 7
#define IRIX_SC_VERSION 8
#define IRIX_SC_PASS_MAX 9
#define IRIX_SC_LOGNAME_MAX 10
#define IRIX_SC_PAGESIZE 11
#define IRIX_SC_PAGE_SIZE IRIX_SC_PAGESIZE
#define IRIX_SC_XOPEN_VERSION 12
#define IRIX_SC_NACLS_MAX 13
#define IRIX_SC_NPROC_CONF 14
#define IRIX_SC_NPROC_ONLN 15
#define IRIX_SC_STREAM_MAX 16
#define IRIX_SC_TZNAME_MAX 17
#define IRIX_SC_RTSIG_MAX 20
#define IRIX_SC_SIGQUEUE_MAX 21
#define IRIX_SC_REALTIME_SIGNALS 23
#define IRIX_SC_PRIORITIZED_IO 24
#define IRIX_SC_ACL 25
#define IRIX_SC_AUDIT 26
#define IRIX_SC_INF 27
#define IRIX_SC_MAC 28
#define IRIX_SC_CAP 29
#define IRIX_SC_IP_SECOPTS 30
#define IRIX_SC_KERN_POINTERS 31
#define IRIX_SC_DELAYTIMER_MAX 32
#define IRIX_SC_MQ_OPEN_MAX 33
#define IRIX_SC_MQ_PRIO_MAX 34
#define IRIX_SC_SEM_NSEMS_MAX 35
#define IRIX_SC_SEM_VALUE_MAX 36
#define IRIX_SC_TIMER_MAX 37
#define IRIX_SC_FSYNC 38
#define IRIX_SC_MAPPED_FILES 39
#define IRIX_SC_MEMLOCK 40
#define IRIX_SC_MEMLOCK_RANGE 41
#define IRIX_SC_MEMORY_PROTECTION 42
#define IRIX_SC_MESSAGE_PASSING 43
#define IRIX_SC_PRIORITYIRIX_SCHEDULING 44
#define IRIX_SC_SEMAPHORES 45
#define IRIX_SC_SHARED_MEMORY_OBJECTS 46
#define IRIX_SC_SYNCHRONIZED_IO 47
#define IRIX_SC_TIMERS 48
#define IRIX_SC_ASYNCHRONOUS_IO 64
#define IRIX_SC_ABI_ASYNCHRONOUS_IO 65
#define IRIX_SC_AIO_LISTIO_MAX 66
#define IRIX_SC_AIO_MAX 67
#define IRIX_SC_AIO_PRIO_DELTA_MAX 68
#define IRIX_SC_XOPEN_SHM 75
#define IRIX_SC_XOPEN_CRYPT 76
#define IRIX_SC_BC_BASE_MAX 77
#define IRIX_SC_BC_DIM_MAX 78
#define IRIX_SC_BCIRIX_SCALE_MAX 79
#define IRIX_SC_BC_STRING_MAX 80
#define IRIX_SC_COLL_WEIGHTS_MAX 81
#define IRIX_SC_EXPR_NEST_MAX 82
#define IRIX_SC_LINE_MAX 83
#define IRIX_SC_RE_DUP_MAX 84
#define IRIX_SC_2_C_BIND 85
#define IRIX_SC_2_C_DEV 86
#define IRIX_SC_2_C_VERSION 87
#define IRIX_SC_2_FORT_DEV 88
#define IRIX_SC_2_FORT_RUN 89
#define IRIX_SC_2_LOCALEDEF 90
#define IRIX_SC_2_SW_DEV 91
#define IRIX_SC_2_UPE 92
#define IRIX_SC_2_VERSION 93
#define IRIX_SC_2_CHAR_TERM 94
#define IRIX_SC_XOPEN_ENH_I18N 95
#define IRIX_SC_IOV_MAX 96
#define IRIX_SC_ATEXIT_MAX 97
#define IRIX_SC_XOPEN_UNIX 98
#define IRIX_SC_XOPEN_XCU_VERSION 99
#define IRIX_SC_GETGR_R_SIZE_MAX 100
#define IRIX_SC_GETPW_R_SIZE_MAX 101
#define IRIX_SC_LOGIN_NAME_MAX 102
#define IRIX_SC_THREAD_DESTRUCTOR_ITERATIONS 103
#define IRIX_SC_THREAD_KEYS_MAX 104
#define IRIX_SC_THREAD_STACK_MIN 105
#define IRIX_SC_THREAD_THREADS_MAX 106
#define IRIX_SC_TTY_NAME_MAX 107
#define IRIX_SC_THREADS 108
#define IRIX_SC_THREAD_ATTR_STACKADDR 109
#define IRIX_SC_THREAD_ATTR_STACKSIZE 110
#define IRIX_SC_THREAD_PRIORITYIRIX_SCHEDULING 111
#define IRIX_SC_THREAD_PRIO_INHERIT 112
#define IRIX_SC_THREAD_PRIO_PROTECT 113
#define IRIX_SC_THREAD_PROCESS_SHARED 114
#define IRIX_SC_THREAD_SAFE_FUNCTIONS 115
#define IRIX_SC_KERN_SIM 116
#define IRIX_SC_MMAP_FIXED_ALIGNMENT 117
#define IRIX_SC_SOFTPOWER 118
#define IRIX_SC_XBS5_ILP32_OFF32 119
#define IRIX_SC_XBS5_ILP32_OFFBIG 120
#define IRIX_SC_XBS5_LP64_OFF64 121
#define IRIX_SC_XBS5_LPBIG_OFFBIG 122
#define IRIX_SC_XOPEN_LEGACY 123
#define IRIX_SC_XOPEN_REALTIME 124
/* From IRIX's <sys/unistd.h> */
#define IRIX_PC_LINK_MAX 1
#define IRIX_PC_MAX_CANON 2
#define IRIX_PC_MAX_INPUT 3
#define IRIX_PC_NAME_MAX 4
#define IRIX_PC_PATH_MAX 5
#define IRIX_PC_PIPE_BUF 6
#define IRIX_PC_CHOWN_RESTRICTED 7
#define IRIX_PC_NO_TRUNC 8
#define IRIX_PC_VDISABLE 9
#define IRIX_PC_SYNC_IO 10
#define IRIX_PC_PRIO_IO 11
#define IRIX_PC_ASYNC_IO 64
#define IRIX_PC_ABI_ASYNC_IO 65
#define IRIX_PC_ABI_AIO_XFER_MAX 66
#define IRIX_PC_FILESIZEBITS 67
#endif /* _IRIX_TYPES_H_ */

View File

@ -1,167 +0,0 @@
/* $NetBSD: irix_systeminfo.c,v 1.16 2008/04/28 20:23:42 martin Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Emmanuel Dreyfus.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: irix_systeminfo.c,v 1.16 2008/04/28 20:23:42 martin Exp $");
#include <sys/types.h>
#include <sys/signal.h>
#include <sys/param.h>
#include <sys/mount.h>
#include <sys/kernel.h>
#include <sys/proc.h>
#include <sys/systm.h>
#include <sys/sysctl.h>
#include <sys/syscallargs.h>
#include <compat/common/compat_util.h>
#include <compat/svr4/svr4_systeminfo.h>
#include <compat/svr4/svr4_types.h>
#include <compat/svr4/svr4_signal.h>
#include <compat/svr4/svr4_ucontext.h>
#include <compat/svr4/svr4_lwp.h>
#include <compat/svr4/svr4_syscallargs.h>
#include <compat/irix/irix_types.h>
#include <compat/irix/irix_signal.h>
#include <compat/irix/irix_sysctl.h>
#include <compat/irix/irix_syscallargs.h>
char irix_si_vendor[128] = "Silicon Graphics, Inc.";
char irix_si_os_provider[128] = "Silicon Graphics, Inc.";
char irix_si_os_name[128] = "IRIX";
char irix_si_hw_name[128] = "IP22"; /* XXX */
char irix_si_osrel_maj[128] = "6";
char irix_si_osrel_min[128] = "5";
char irix_si_osrel_patch[128] = "0";
char irix_si_processors[128] = "R5000 1.0"; /* XXX */
char irix_si_version[128] = "04131232";
#define BUF_SIZE 16
int
irix_sys_systeminfo(struct lwp *l, const struct irix_sys_systeminfo_args *uap, register_t *retval)
{
/* {
syscallarg(int) what;
syscallarg(char *) buf;
syscallarg(long) len;
} */
const char *str = NULL;
char strbuf[BUF_SIZE + 1];
int error = 0;
size_t len = 0;
char buf[256];
u_int rlen = SCARG(uap, len);
switch (SCARG(uap, what)) {
case SVR4_MIPS_SI_VENDOR:
str = irix_si_vendor;
break;
case SVR4_MIPS_SI_OS_PROVIDER:
str = irix_si_os_provider;
break;
case SVR4_MIPS_SI_OS_NAME:
str = irix_si_os_name;
break;
case SVR4_MIPS_SI_HW_NAME:
str = irix_si_hw_name;
break;
case SVR4_MIPS_SI_OSREL_MAJ:
str = irix_si_osrel_maj;
break;
case SVR4_MIPS_SI_OSREL_MIN:
str = irix_si_osrel_min;
break;
case SVR4_MIPS_SI_OSREL_PATCH:
str = irix_si_osrel_patch;
break;
case SVR4_MIPS_SI_PROCESSORS:
str = irix_si_processors;
break;
case SVR4_MIPS_SI_NUM_PROCESSORS:
case SVR4_MIPS_SI_AVAIL_PROCESSORS: {
snprintf(strbuf, BUF_SIZE, "%d", ncpu);
str = strbuf;
break;
}
case SVR4_SI_HW_SERIAL:
snprintf(strbuf, BUF_SIZE, "%d", (int32_t)hostid);
str = strbuf;
break;
case SVR4_MIPS_SI_HOSTID:
snprintf(strbuf, BUF_SIZE, "%08x", (int32_t)hostid);
str = strbuf;
break;
case SVR4_MIPS_SI_SERIAL: /* Unimplemented yet */
default:
return svr4_sys_systeminfo(l, (const void *)uap, retval);
break;
}
/*
* This duplicates some code in
* svr4_sys_systeminfo().
* Ideally, it should be merged.
*/
if (str) {
len = strlen(str) + 1;
if (len > rlen)
len = rlen;
if (SCARG(uap, buf)) {
error = copyout(str, SCARG(uap, buf), len);
if (error)
return error;
/* make sure we are NULL terminated */
buf[0] = '\0';
error = copyout(buf, &(SCARG(uap, buf)[len - 1]), 1);
}
else
error = 0;
}
*retval = len;
return error;
}

View File

@ -1,191 +0,0 @@
/* $NetBSD: irix_types.h,v 1.19 2009/12/14 00:47:10 matt Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Emmanuel Dreyfus.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _IRIX_TYPES_H_
#define _IRIX_TYPES_H_
#include <sys/types.h>
#include <compat/svr4/svr4_types.h>
#include <compat/svr4/svr4_signal.h>
/* From IRIX's <limits.h> */
#define IRIX_PATH_MAX 1024
#define IRIX_NAME_MAX 255
/* From IRIX's <sys/signal.h> */
typedef struct {
__uint32_t bits[4];
} irix_sigset_t;
/* From IRIX's <sys/types.h> */
typedef __int32_t irix_app32_int_t;
typedef __uint32_t irix_app32_ulong_t;
typedef __int32_t irix_app32_long_t;
typedef __uint64_t irix_app32_ulong_long_t;
typedef __int64_t irix_app32_long_long_t;
typedef __uint32_t irix_ino_t;
typedef __int32_t irix_off_t;
typedef __uint32_t irix_app32_ptr_t;
typedef __uint64_t irix_k_sigset_t;
#if _MIPS_SZLONG == 32
typedef unsigned long irix_mode_t;
typedef unsigned long irix_dev_t;
typedef long irix_uid_t;
typedef long irix_gid_t;
typedef unsigned long irix_nlink_t;
typedef long irix_pid_t;
typedef long irix_time_t;
typedef unsigned long irix_size_t;
#endif
#if _MIPS_SZLONG == 64
typedef __uint32_t irix_dev_t;
typedef __uint32_t irix_mode_t;
typedef __int32_t irix_uid_t;
typedef __int32_t irix_gid_t;
typedef __uint32_t irix_nlink_t;
typedef __int32_t irix_pid_t;
typedef __int32_t irix_time_t;
typedef __uint32_t irix_size_t;
#endif
typedef __int32_t irix_blkcnt_t;
typedef __uint64_t irix_ino64_t;
typedef __int64_t irix_off64_t;
typedef __int64_t irix_blkcnt64_t;
/* From IRIX's <sys/ktypes.h> */
typedef irix_app32_long_long_t irix_irix5_n32_off_t;
typedef irix_app32_long_t irix_irix5_uid_t;
typedef irix_app32_long_t irix_irix5_clock_t;
typedef irix_app32_long_t irix_irix5_pid_t;
/* From IRIX's <sys/ktime.h> */
typedef irix_app32_long_t irix_irix5_time_t;
typedef struct irix_irix5_timespec {
irix_irix5_time_t tv_sec;
irix_app32_long_t tv_nsec;
} irix_irix5_timespec_t;
/* From IRIX's <sys/timespec.h> */
typedef struct irix___timespec {
irix_time_t tv_sec;
long tv_nsec;
} irix_timespec_t;
/* From IRIX's <sys/stat.h> */
#define IRIX__R3_STAT_VER 1
#define IRIX__STAT_VER 2
#define IRIX__STAT64_VER 3
struct irix_stat {
irix_dev_t ist_dev;
__uint32_t ist_pad1[3];
irix_ino_t ist_ino;
irix_mode_t ist_mode;
irix_nlink_t ist_nlink;
irix_uid_t ist_uid;
irix_gid_t ist_gid;
irix_dev_t ist_rdev;
__uint32_t ist_pad2[2];
irix_off_t ist_size;
__uint32_t ist_pad3;
irix_timespec_t ist_atim;
irix_timespec_t ist_mtim;
irix_timespec_t ist_ctim;
__int32_t ist_blksize;
irix_blkcnt_t ist_blocks;
char ist_fstype[16];
__int32_t ist_projid;
__uint32_t ist_pad4[7];
};
struct irix_stat64 {
irix_dev_t ist_dev;
__uint32_t ist_pad1[3];
irix_ino64_t ist_ino;
irix_mode_t ist_mode;
irix_nlink_t ist_nlink;
irix_uid_t ist_uid;
irix_gid_t ist_gid;
irix_dev_t ist_rdev;
__uint32_t ist_pad2[2];
irix_off64_t ist_size;
__uint32_t ist_pad3;
irix_timespec_t ist_atim;
irix_timespec_t ist_mtim;
irix_timespec_t ist_ctim;
__int32_t ist_blksize;
irix_blkcnt64_t ist_blocks;
char ist_fstype[16];
__int32_t ist_projid;
__uint32_t ist_pad4[7];
};
/* From IRIX's <sys/mount.h> */
typedef struct irix_mountid {
unsigned int ival[4];
} irix_mountid_t;
/* From IRIX's <sys/dirent.h> */
typedef struct irix_dirent {
irix_ino_t d_ino;
irix_off_t d_off;
unsigned short d_reclen;
char d_name[IRIX_NAME_MAX + 1];
} irix_dirent_t;
typedef struct irix_dirent64 {
irix_ino64_t d_ino;
irix_off64_t d_off;
unsigned short d_reclen;
char d_name[IRIX_NAME_MAX + 1];
} irix_dirent64_t;
/* From IRIX's <sys/utsname.h> */
#define IRIX_SYS_NMLN 257
struct irix_utsname {
char sysname[IRIX_SYS_NMLN];
char nodename[IRIX_SYS_NMLN];
char release[IRIX_SYS_NMLN];
char version[IRIX_SYS_NMLN];
char machine[IRIX_SYS_NMLN];
char m_type[IRIX_SYS_NMLN];
char base_rel[IRIX_SYS_NMLN];
char reserve5[IRIX_SYS_NMLN];
char reserve4[IRIX_SYS_NMLN];
char reserve3[IRIX_SYS_NMLN];
char reserve2[IRIX_SYS_NMLN];
char reserve1[IRIX_SYS_NMLN];
char reserve0[IRIX_SYS_NMLN];
};
#endif /* _IRIX_TYPES_H_ */

View File

@ -1,717 +0,0 @@
/* $NetBSD: irix_usema.c,v 1.34 2010/06/24 13:03:06 hannken Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Emmanuel Dreyfus.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: irix_usema.c,v 1.34 2010/06/24 13:03:06 hannken Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/select.h>
#include <sys/proc.h>
#include <sys/errno.h>
#include <sys/ioctl.h>
#include <sys/rwlock.h>
#include <sys/device.h>
#include <sys/vnode.h>
#include <sys/vnode_if.h>
#include <sys/mount.h>
#include <sys/file.h>
#include <sys/filedesc.h>
#include <sys/malloc.h>
#include <sys/poll.h>
#include <sys/queue.h>
#include <sys/conf.h>
#include <miscfs/genfs/genfs.h>
#include <ufs/ufs/inode.h>
#include <ufs/ufs/dir.h>
#include <ufs/ufs/dinode.h>
#include <ufs/ufs/ufs_extern.h>
#include <compat/irix/irix_types.h>
#include <compat/irix/irix_signal.h>
#include <compat/irix/irix_usema.h>
#include <compat/irix/irix_ioctl.h>
#include <compat/irix/irix_syscallargs.h>
const struct cdevsw irix_usema_cdevsw = {
nullopen, nullclose, noread, nowrite,
noioctl, nostop, notty, nopoll, nommap, nokqfilter,
};
/*
* semaphore list, and operations on the list
*/
static LIST_HEAD(irix_usema_reclist, irix_usema_rec) irix_usema_reclist;
static krwlock_t irix_usema_reclist_lock;
static struct irix_usema_rec *iur_lookup_by_vn(struct vnode *);
static struct irix_usema_rec *iur_lookup_by_sem(struct irix_semaphore *);
static struct irix_usema_rec *iur_insert
(struct irix_semaphore *, struct vnode *, struct proc *);
static void iur_remove(struct irix_usema_rec *);
static struct irix_waiting_proc_rec *iur_proc_queue
(struct irix_usema_rec *, struct proc *);
static void iur_proc_dequeue
(struct irix_usema_rec *, struct irix_waiting_proc_rec *);
static void iur_proc_release
(struct irix_usema_rec *, struct irix_waiting_proc_rec *);
static int iur_proc_isreleased(struct irix_usema_rec *, struct proc *);
static struct irix_waiting_proc_rec *iur_proc_getfirst
(struct irix_usema_rec *);
/*
* In order to define a custom vnode operation vector for the usemaclone
* driver, we need to define a dummy filesystem, featuring just a null
* init function and the vnode operation vector. This is defined by
* irix_usema_dummy_vfsops, and registered to the kernel using vfs_attach
* at driver attach time, in irix_usemaattach().
*/
struct vfsops irix_usema_dummy_vfsops = {
"usema_dummy", 0,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, irix_usema_dummy_vfs_init, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL,
irix_usema_vnodeopv_descs,
};
void irix_usema_dummy_vfs_init(void) { return; } /* Do nothing */
const struct vnodeopv_desc * const irix_usema_vnodeopv_descs[] = {
&irix_usema_opv_desc,
NULL,
};
const struct vnodeopv_desc irix_usema_opv_desc =
{ &irix_usema_vnodeop_p, irix_usema_vnodeop_entries };
int (**irix_usema_vnodeop_p)(void *);
/*
* Vnode operations on the usemaclone device
*/
const struct vnodeopv_entry_desc irix_usema_vnodeop_entries[] = {
{ &vop_default_desc, vn_default_error },
{ &vop_lookup_desc, genfs_nullop },
{ &vop_open_desc, genfs_nullop },
{ &vop_close_desc, irix_usema_close },
{ &vop_access_desc, irix_usema_access },
{ &vop_getattr_desc, irix_usema_getattr },
{ &vop_setattr_desc, irix_usema_setattr },
{ &vop_ioctl_desc, irix_usema_ioctl },
{ &vop_fcntl_desc, irix_usema_fcntl },
{ &vop_poll_desc, irix_usema_poll },
{ &vop_abortop_desc, genfs_abortop },
{ &vop_lock_desc, genfs_lock },
{ &vop_unlock_desc, genfs_unlock },
{ &vop_islocked_desc, genfs_islocked },
{ &vop_advlock_desc, genfs_nullop },
{ &vop_fsync_desc, genfs_nullop },
{ &vop_reclaim_desc, genfs_nullop },
{ &vop_revoke_desc, genfs_revoke },
{ &vop_inactive_desc, irix_usema_inactive },
{ NULL, NULL},
};
struct irix_usema_softc {
struct device irix_usema_dev;
};
/*
* Initialize the usema driver: prepare the chained lists
* and attach the dummy filesystem we need to use custom vnode operations.
*/
void
irix_usemaattach(struct device *parent, struct device *self, void *aux)
{
int error;
rw_init(&irix_usema_reclist_lock);
LIST_INIT(&irix_usema_reclist);
if ((error = vfs_attach(&irix_usema_dummy_vfsops)) != 0)
panic("irix_usemaattach: vfs_attach() failed");
return;
}
/*
* vnode operations on the device
*/
int
irix_usema_ioctl(void *v)
{
struct vop_ioctl_args /* {
struct vnode *a_vp;
u_long a_command;
void * a_data;
int a_fflag;
kauth_cred_t a_cred;
} */ *ap = v;
u_long cmd = ap->a_command;
struct irix_ioctl_usrdata *iiu = ap->a_data;
struct vnode *vp = ap->a_vp;
struct irix_usema_rec *iur;
struct irix_waiting_proc_rec *iwpr;
void *data;
register_t *retval;
int error;
/*
* Some ioctl commands need to set the ioctl return value. In
* irix_sys_ioctl(), we copy the return value address and the
* original data argument to a struct irix_ioctl_usrdata.
* The address of this structure is passed as the data argument
* to the vnode layer. We therefore need to read this structure
* to get the real data argument and the retval address.
*/
data = iiu->iiu_data;
retval = iiu->iiu_retval;
#ifdef DEBUG_IRIX
printf("irix_usema_ioctl(): vp = %p, cmd = %lx, data = %p\n",
vp, cmd, data);
#endif
switch (cmd) {
case IRIX_UIOCABLOCKQ: /* semaphore has been blocked */
if ((iur = iur_lookup_by_vn(vp)) == NULL)
return EBADF;
iwpr = iur_proc_queue(iur, curlwp->l_proc);
break;
case IRIX_UIOCAUNBLOCKQ: /* semaphore has been unblocked */
if ((iur = iur_lookup_by_vn(vp)) == NULL)
return EBADF;
if ((iwpr = iur_proc_getfirst(iur)) != NULL) {
iur_proc_release(iur, iwpr);
rw_enter(&iur->iur_lock, RW_READER);
selnotify(&iur->iur_si, 0, 0);
rw_exit(&iur->iur_lock);
}
break;
case IRIX_UIOCGETCOUNT: /* get semaphore value */
if ((iur = iur_lookup_by_vn(vp)) == NULL)
return EBADF;
*retval = -iur->iur_waiting_count;
break;
case IRIX_UIOCIDADDR: { /* register address of sem. owner field */
struct irix_usema_idaddr iui;
struct irix_semaphore *isp;
if ((error = copyin(data, &iui, sizeof(iui))) != 0)
return error;
/*
* iui.iui_oidp points to the is_oid field of struct
* irix_semaphore. We want the structre address itself.
*/
isp = NULL;
isp = (struct irix_semaphore *)((u_long)(isp) -
(u_long)(&isp->is_oid) + (u_long)iui.iui_oidp);
if ((iur_insert(isp, vp, curlwp->l_proc)) == NULL)
return EFAULT;
break;
}
default:
printf("Warning: unimplemented IRIX usema ioctl command %ld\n",
(cmd & 0xff));
break;
}
return 0;
}
int
irix_usema_poll(void *v)
{
struct vop_poll_args /* {
struct vnode *a_vp;
int a_events;
} */ *ap = v;
int events = ap->a_events;
struct vnode *vp = ap->a_vp;
struct irix_usema_rec *iur;
int check = POLLIN|POLLRDNORM|POLLRDBAND|POLLPRI;
#ifdef DEBUG_IRIX
printf("irix_usema_poll() vn = %p, events = 0x%x\n", vp, events);
#endif
if ((events & check) == 0)
return 0;
if ((iur = iur_lookup_by_vn(vp)) == NULL)
return 0;
rw_enter(&iur->iur_lock, RW_READER);
if (iur_proc_isreleased(iur, curlwp->l_proc) == 0) {
selrecord(curlwp, &iur->iur_si);
rw_exit(&iur->iur_lock);
return 0;
}
rw_exit(&iur->iur_lock);
return (events & check);
}
int
irix_usema_close(void *v)
{
struct vop_close_args /* {
struct vnode *a_vp;
int a_fflag;
kauth_cred_t a_cred;
} */ *ap = v;
struct vnode *vp = ap->a_vp;
struct vnode *rvp;
struct irix_usema_rec *iur;
int error;
#ifdef DEBUG_IRIX
printf("irix_usema_close() vn = %p\n", vp);
#endif
mutex_enter(&vp->v_interlock);
/* vp is a vnode duplicated from rvp. eventually also close rvp */
rvp = (struct vnode *)(vp->v_data);
vrele(rvp); /* for vref() in irix_sys_open() */
vp->v_data = NULL;
if (ap->a_fflag & FWRITE)
rvp->v_writecount--;
vn_lock(rvp, LK_EXCLUSIVE | LK_RETRY);
error = VOP_CLOSE(rvp, ap->a_fflag, ap->a_cred);
vput(rvp);
if ((iur = iur_lookup_by_vn(vp)) != NULL)
iur_remove(iur);
mutex_exit(&vp->v_interlock);
return error;
}
/*
* Try to apply setattr to the original vnode, not the duplicated one,
* but still return 0 in case of failure (IRIX libc rely on this).
*/
int
irix_usema_setattr(void *v)
{
struct vop_setattr_args /* {
struct vnode *a_vp;
struct vattr *a_vap;
kauth_cred_t a_cred;
} */ *ap = v;
struct vnode *vp = (struct vnode *)(ap->a_vp->v_data);
int error;
#ifdef DEBUG_IRIX
printf("irix_usema_setattr()\n");
#endif
error = VOP_SETATTR(vp, ap->a_vap, ap->a_cred);
/* Silently ignore any error */
return 0;
}
int
irix_usema_inactive(void *v)
{
struct vop_inactive_args /* {
struct vnode *a_vp;
} */ *ap = v;
VOP_UNLOCK(ap->a_vp);
vrecycle(ap->a_vp, NULL, curlwp);
return 0;
}
/*
* For fcntl, access and getattr vnode operations, we want to do the
* operation on the original vnode, not the duplicated one.
*/
#define ___CONCAT(x,y) __CONCAT(x,y)
#define __CONCAT3(x,y,z) ___CONCAT(__CONCAT(x,y),z)
#define IRIX_USEMA_VNOP_WRAP(op) \
int \
__CONCAT(irix_usema_,op)(v) \
void *v; \
{ \
struct __CONCAT3(vop_,op,_args) *ap = v; \
struct vnode *vp = (struct vnode *)(ap->a_vp->v_data); \
struct __CONCAT3(vop_,op,_args) a; \
\
(void)memcpy(&a, ap, sizeof(a)); \
a.a_vp = vp; \
\
return VCALL(vp,VOFFSET(__CONCAT(vop_,op)),&a); \
}
IRIX_USEMA_VNOP_WRAP(access)
IRIX_USEMA_VNOP_WRAP(getattr)
IRIX_USEMA_VNOP_WRAP(fcntl)
/*
* The usync_ctnl system call is not part of the usema driver,
* but it is closely related to it.
*/
int
irix_sys_usync_cntl(struct lwp *l, const struct irix_sys_usync_cntl_args *uap, register_t *retval)
{
/* {
syscallarg(int) cmd;
syscallarg(void *) arg;
} */
struct proc *p = l->l_proc;
int error;
struct irix_usync_arg iua;
struct irix_usema_rec *iur;
struct irix_waiting_proc_rec *iwpr;
switch (SCARG(uap, cmd)) {
case IRIX_USYNC_BLOCK:
if ((error = copyin(SCARG(uap, arg), &iua, sizeof(iua))) != 0)
return error;
if ((iur = iur_insert(iua.iua_sem, NULL, p)) == NULL)
return EFAULT;
iwpr = iur_proc_queue(iur, p);
(void)tsleep(iwpr, PZERO, "irix_usema", 0);
break;
case IRIX_USYNC_INTR_BLOCK:
if ((error = copyin(SCARG(uap, arg), &iua, sizeof(iua))) != 0)
return error;
if ((iur = iur_insert(iua.iua_sem, NULL, p)) == NULL)
return EFAULT;
iwpr = iur_proc_queue(iur, p);
(void)tsleep(iwpr, PZERO|PCATCH, "irix_usema", 0);
break;
case IRIX_USYNC_UNBLOCK_ALL:
if ((error = copyin(SCARG(uap, arg), &iua, sizeof(iua))) != 0)
return error;
if ((iur = iur_lookup_by_sem(iua.iua_sem)) == 0)
return EINVAL;
rw_enter(&iur->iur_lock, RW_READER);
TAILQ_FOREACH(iwpr, &iur->iur_waiting_p, iwpr_list) {
wakeup((void *)iwpr);
iur_proc_dequeue(iur, iwpr);
}
iur_remove(iur);
rw_exit(&iur->iur_lock);
break;
case IRIX_USYNC_UNBLOCK:
if ((error = copyin(SCARG(uap, arg), &iua, sizeof(iua))) != 0)
return error;
if ((iur = iur_lookup_by_sem(iua.iua_sem)) == 0)
return EINVAL;
if ((iwpr = iur_proc_getfirst(iur)) != NULL) {
wakeup((void *)iwpr);
iur_proc_dequeue(iur, iwpr);
}
if ((iwpr = iur_proc_getfirst(iur)) == NULL)
iur_remove(iur);
break;
case IRIX_USYNC_GET_STATE:
if ((error = copyin(SCARG(uap, arg), &iua, sizeof(iua))) != 0)
return error;
if ((iur = iur_lookup_by_sem(iua.iua_sem)) == NULL)
return 0; /* Not blocked, return 0 */
*retval = -iur->iur_waiting_count;
break;
default:
printf("Warning: unimplemented IRIX usync_cntl command %d\n",
SCARG(uap, cmd));
return EINVAL;
}
return 0;
}
/* Operations on irix_usema_reclist */
static struct irix_usema_rec *
iur_lookup_by_vn(struct vnode *vp)
{
struct irix_usema_rec *iur;
rw_enter(&irix_usema_reclist_lock, RW_READER);
LIST_FOREACH(iur, &irix_usema_reclist, iur_list)
if (iur->iur_vn == vp)
break;
rw_exit(&irix_usema_reclist_lock);
return iur;
}
static struct irix_usema_rec *
iur_lookup_by_sem(struct irix_semaphore *sem)
{
struct irix_usema_rec *iur;
struct irix_semaphore is;
int error;
if ((error = copyin(sem, &is, sizeof(is))) != 0)
return NULL;
rw_enter(&irix_usema_reclist_lock, RW_READER);
LIST_FOREACH(iur, &irix_usema_reclist, iur_list)
if (iur->iur_sem == sem && iur->iur_shid == is.is_shid)
break;
rw_exit(&irix_usema_reclist_lock);
return iur;
}
static struct irix_usema_rec *
iur_insert(struct irix_semaphore *sem, struct vnode *vp, struct proc *p)
{
struct irix_usema_rec *iur;
struct irix_semaphore is;
int error;
if ((iur = iur_lookup_by_sem(sem)) != NULL)
return iur;
if ((error = copyin(sem, &is, sizeof(is))) != 0)
return NULL;
iur = malloc(sizeof(struct irix_usema_rec), M_DEVBUF, M_WAITOK);
iur->iur_sem = sem;
iur->iur_vn = vp;
iur->iur_shid = is.is_shid;
iur->iur_p = p;
iur->iur_waiting_count = 0;
rw_init(&iur->iur_lock);
selinit(&iur->iur_si);
TAILQ_INIT(&iur->iur_waiting_p);
TAILQ_INIT(&iur->iur_released_p);
rw_enter(&irix_usema_reclist_lock, RW_WRITER);
LIST_INSERT_HEAD(&irix_usema_reclist, iur, iur_list);
rw_exit(&irix_usema_reclist_lock);
return iur;
}
static void
iur_remove(struct irix_usema_rec *iur)
{
struct irix_waiting_proc_rec *iwpr;
rw_enter(&iur->iur_lock, RW_WRITER);
waiting_restart:
TAILQ_FOREACH(iwpr, &iur->iur_waiting_p, iwpr_list) {
TAILQ_REMOVE(&iur->iur_waiting_p, iwpr, iwpr_list);
free(iwpr, M_DEVBUF);
/* iwpr is now invalid, restart */
goto waiting_restart;
}
released_restart:
TAILQ_FOREACH(iwpr, &iur->iur_released_p, iwpr_list) {
TAILQ_REMOVE(&iur->iur_released_p, iwpr, iwpr_list);
free(iwpr, M_DEVBUF);
/* iwpr is now invalid, restart */
goto released_restart;
}
rw_enter(&irix_usema_reclist_lock, RW_WRITER);
LIST_REMOVE(iur, iur_list);
rw_exit(&irix_usema_reclist_lock);
seldestroy(&iur->iur_si);
rw_exit(&iur->iur_lock);
rw_destroy(&iur->iur_lock);
free(iur, M_DEVBUF);
return;
}
static struct irix_waiting_proc_rec *
iur_proc_queue(struct irix_usema_rec *iur, struct proc *p)
{
struct irix_waiting_proc_rec *iwpr;
/* Do we have this iwpr on the released list? If we do, reuse it */
rw_enter(&iur->iur_lock, RW_WRITER);
TAILQ_FOREACH(iwpr, &iur->iur_released_p, iwpr_list) {
if (iwpr->iwpr_p == p) {
TAILQ_REMOVE(&iur->iur_released_p, iwpr, iwpr_list);
goto got_iwpr;
}
}
/* Otherwise, create a new one */
iwpr = malloc(sizeof(struct irix_waiting_proc_rec), M_DEVBUF, M_WAITOK);
iwpr->iwpr_p = p;
got_iwpr:
TAILQ_INSERT_TAIL(&iur->iur_waiting_p, iwpr, iwpr_list);
iur->iur_waiting_count++;
rw_exit(&iur->iur_lock);
return iwpr;
}
static void
iur_proc_dequeue(struct irix_usema_rec *iur, struct irix_waiting_proc_rec *iwpr)
{
rw_enter(&iur->iur_lock, RW_WRITER);
iur->iur_waiting_count--;
TAILQ_REMOVE(&iur->iur_waiting_p, iwpr, iwpr_list);
rw_exit(&iur->iur_lock);
free(iwpr, M_DEVBUF);
return;
}
static void
iur_proc_release(struct irix_usema_rec *iur, struct irix_waiting_proc_rec *iwpr)
{
rw_enter(&iur->iur_lock, RW_WRITER);
iur->iur_waiting_count--;
TAILQ_REMOVE(&iur->iur_waiting_p, iwpr, iwpr_list);
TAILQ_INSERT_TAIL(&iur->iur_released_p, iwpr, iwpr_list);
rw_exit(&iur->iur_lock);
return;
}
/* Should be called with iur_lock RW_READER held */
static int
iur_proc_isreleased(struct irix_usema_rec *iur, struct proc *p)
{
struct irix_waiting_proc_rec *iwpr;
int res = 0;
TAILQ_FOREACH(iwpr, &iur->iur_released_p, iwpr_list) {
if (iwpr->iwpr_p == p) {
res = 1;
break;
}
}
return res;
}
static struct irix_waiting_proc_rec *
iur_proc_getfirst(struct irix_usema_rec *iur)
{
struct irix_waiting_proc_rec *iwpr;
rw_enter(&iur->iur_lock, RW_READER);
iwpr = TAILQ_FIRST(&iur->iur_waiting_p);
rw_exit(&iur->iur_lock);
return iwpr;
}
/*
* Cleanup irix_usema_usync_cntl() allocations
* if new_p is NULL, free any structure allocated for process p
* otherwise change ownership of structure allocated for process p to new_p
*/
void
irix_usema_exit_cleanup(struct proc *p, struct proc *new_p)
{
struct irix_usema_rec *iur;
#ifdef DEBUG_IRIX
printf("irix_usema_exit_cleanup(): p = %p, new_p = %p\n", p, new_p);
#endif
remove_restart:
rw_enter(&irix_usema_reclist_lock, RW_WRITER);
LIST_FOREACH(iur, &irix_usema_reclist, iur_list) {
if (iur->iur_p != p)
continue;
if (new_p == NULL) {
/*
* Release the lock now since iur_remove() needs to
* acquire an exclusive lock.
*/
rw_exit(&irix_usema_reclist_lock);
iur_remove(iur);
/*
* iur is now invalid and we lost the lock, restart
*/
goto remove_restart;
} else {
iur->iur_p = new_p;
}
}
rw_exit(&irix_usema_reclist_lock);
return;
}
#ifdef DEBUG_IRIX
/*
* This dumps all in-kernel information about processes waiting for
* semaphores and process that have been released by an operation
* on a semaphore.
*/
void
irix_usema_debug(void)
{
struct irix_usema_rec *iur;
struct irix_waiting_proc_rec *iwpr;
LIST_FOREACH(iur, &irix_usema_reclist, iur_list) {
printf("iur %p\n", iur);
printf(" iur->iur_vn = %p\n", iur->iur_vn);
printf(" iur->iur_sem = %p\n", iur->iur_sem);
printf(" iur->iur_shid = 0x%08x\n", iur->iur_shid);
printf(" iur->iur_p = %p\n", iur->iur_p);
printf(" iur->iur_waiting_count = %d\n",
iur->iur_waiting_count);
printf(" Waiting processes\n");
TAILQ_FOREACH(iwpr, &iur->iur_waiting_p, iwpr_list) {
printf(" iwpr %p: iwpr->iwpr_p = %p (pid %d)\n",
iwpr, iwpr->iwpr_p, iwpr->iwpr_p->p_pid);
}
printf(" Released processes\n");
TAILQ_FOREACH(iwpr, &iur->iur_released_p, iwpr_list) {
printf(" iwpr %p: iwpr->iwpr_p = %p (pid %d)\n",
iwpr, iwpr->iwpr_p, iwpr->iwpr_p->p_pid);
}
}
}
#endif /* DEBUG_IRIX */

View File

@ -1,182 +0,0 @@
/* $NetBSD: irix_usema.h,v 1.14 2008/05/10 12:57:18 tnn Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Emmanuel Dreyfus.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _IRIX_USEMA_H_
#define _IRIX_USEMA_H_
#include <sys/param.h>
#include <sys/device.h>
#include <sys/rwlock.h>
#include <sys/queue.h>
#include <sys/vnode.h>
#include <compat/irix/irix_types.h>
#include <compat/irix/irix_exec.h>
extern struct vfsops irix_usema_dummy_vfsops;
void irix_usema_dummy_vfs_init(void);
extern const struct vnodeopv_desc * const irix_usema_vnodeopv_descs[];
extern const struct vnodeopv_desc irix_usema_opv_desc;
extern int (**irix_usema_vnodeop_p)(void *);
extern const struct vnodeopv_entry_desc irix_usema_vnodeop_entries[];
void irix_usemaattach(struct device *, struct device *, void *);
int irix_usema_close(void *);
int irix_usema_access(void *);
int irix_usema_getattr(void *);
int irix_usema_setattr(void *);
int irix_usema_fcntl(void *);
int irix_usema_ioctl(void *);
int irix_usema_poll(void *);
int irix_usema_inactive(void *);
void irix_usema_exit_cleanup(struct proc *, struct proc *);
#ifdef DEBUG_IRIX
void irix_usema_debug(void);
#endif
#define IRIX_USEMADEV_MINOR 1
#define IRIX_USEMACLNDEV_MINOR 0
/* Semaphore internal structure: undocumented in IRIX */
struct irix_semaphore {
int is_val; /* Sempahore value */
int is_uk1; /* unknown, usually small integer < 3000 */
int is_uk2; /* metric, debug or history pointer ? */
int is_uk3; /* unknown, usually equal to 0 */
int is_uk4; /* unknown, usually equal to 0 */
int is_shid; /* unique ID for the shared arena ? */
int is_oid; /* owner id? usually equal to -1 */
int is_uk7; /* unknown, usually equal to -1 */
int is_uk8; /* unknown, usually equal to 0 */
int is_uk9; /* unknown, usually equal to 0 */
int is_uk10; /* semaphore page base address ? */
int is_uk12; /* unknown, usually equal to 0 */
int is_uk13; /* metric, debug or history pointer ? */
int is_uk14; /* padding? */
};
struct irix_usema_idaddr {
int iui_uk1; /* unknown, usually equal to 0 */
int *iui_oidp; /* pointer to is_oid field in struct irix_semaphore */
};
/* waiting processes list */
struct irix_waiting_proc_rec {
TAILQ_ENTRY(irix_waiting_proc_rec) iwpr_list;
struct proc *iwpr_p;
};
/* semaphore list, their vnode counterparts, and waiting processes lists */
struct irix_usema_rec {
LIST_ENTRY(irix_usema_rec) iur_list;
struct vnode *iur_vn;
struct irix_semaphore *iur_sem;
int iur_shid;
struct proc *iur_p;
struct selinfo iur_si;
int iur_waiting_count;
TAILQ_HEAD(iur_waiting_p, irix_waiting_proc_rec) iur_waiting_p;
TAILQ_HEAD(iur_released_p, irix_waiting_proc_rec) iur_released_p;
krwlock_t iur_lock; /* lock for both lists */
};
/* From IRIX's <sys/usioctl.h> */
#define IRIX_USEMADEV "/dev/usema"
#define IRIX_USEMACLNDEV "/dev/usemaclone"
#define IRIX_UIOC ('u' << 16 | 's' << 8)
#define IRIX_UIOC_MASK 0x00ffff00
#define IRIX_UIOCATTACHSEMA (IRIX_UIOC|2)
#define IRIX_UIOCBLOCK (IRIX_UIOC|3)
#define IRIX_UIOCABLOCK (IRIX_UIOC|4)
#define IRIX_UIOCNOIBLOCK (IRIX_UIOC|5)
#define IRIX_UIOCUNBLOCK (IRIX_UIOC|6)
#define IRIX_UIOCAUNBLOCK (IRIX_UIOC|7)
#define IRIX_UIOCINIT (IRIX_UIOC|8)
#define IRIX_UIOCGETSEMASTATE (IRIX_UIOC|9)
#define IRIX_UIOCABLOCKPID (IRIX_UIOC|10)
#define IRIX_UIOCADDPID (IRIX_UIOC|11)
#define IRIX_UIOCABLOCKQ (IRIX_UIOC|12)
#define IRIX_UIOCAUNBLOCKQ (IRIX_UIOC|13)
#define IRIX_UIOCIDADDR (IRIX_UIOC|14)
#define IRIX_UIOCSETSEMASTATE (IRIX_UIOC|15)
#define IRIX_UIOCGETCOUNT (IRIX_UIOC|16)
struct irix_usattach_s {
irix_dev_t us_dev;
void *us_handle;
};
typedef struct irix_usattach_s irix_usattach_t;
struct irix_irix5_usattach_s {
__uint32_t us_dev;
__uint32_t us_handle;
};
typedef struct irix_irix5_usattach_s irix_irix5_usattach_t;
struct irix_ussemastate_s {
int ntid;
int nprepost;
int nfilled;
int nthread;
struct irix_ussematidstate_s {
pid_t pid;
int tid;
int count;
} *tidinfo;
};
typedef struct irix_ussemastate_s irix_ussemastate_t;
typedef struct irix_ussematidstate_s irix_ussematidstate_t;
/* usync_fcntl() commands, undocumented in IRIX */
#define IRIX_USYNC_BLOCK 1
#define IRIX_USYNC_INTR_BLOCK 2
#define IRIX_USYNC_UNBLOCK_ALL 3
#define IRIX_USYNC_UNBLOCK 4
#define IRIX_USYNC_NOTIFY_REGISTER 5
#define IRIX_USYNC_NOTIFY 6
#define IRIX_USYNC_NOTIFY_DELETE 7
#define IRIX_USYNC_NOTIFY_CLEAR 8
#define IRIX_USYNC_GET_STATE 11
struct irix_usync_arg {
int iua_uk0; /* unknown, usually small integer around 1000 */
int iua_uk1; /* unknown, usually pointer to code in libc */
int iua_uk2; /* unknown, usually null */
struct irix_semaphore *iua_sem; /* semaphore address */
};
#endif /* _IRIX_USEMA_H_ */

View File

@ -1,13 +0,0 @@
# $NetBSD: syscalls.conf,v 1.4 2002/11/01 19:29:21 jdolecek Exp $
sysnames="irix_syscalls.c"
sysnumhdr="irix_syscall.h"
syssw="irix_sysent.c"
sysarghdr="irix_syscallargs.h"
compatopts=""
libcompatopts=""
switchname="irix_sysent"
namesname="irix_syscallnames"
constprefix="IRIX_SYS_"
nsysent=256

View File

@ -1,396 +0,0 @@
$NetBSD: syscalls.master,v 1.54 2009/01/13 22:27:43 pooka Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
; NetBSD COMPAT_IRIX 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 names and switch definition files only.
#if defined(_KERNEL_OPT)
#include "opt_ntp.h"
#include "opt_sysv.h"
#include "opt_compat_43.h"
#endif
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/signal.h>
#include <sys/mount.h>
#include <sys/poll.h>
#include <sys/ioctl_compat.h>
#include <sys/syscallargs.h>
#include <compat/svr4/svr4_types.h>
#include <compat/svr4/svr4_signal.h>
#include <compat/svr4/svr4_ucontext.h>
#include <compat/svr4/svr4_lwp.h>
#include <compat/svr4/svr4_statvfs.h>
#include <compat/svr4/svr4_syscallargs.h>
#include <compat/irix/irix_types.h>
#include <compat/irix/irix_signal.h>
#include <compat/irix/irix_syscallargs.h>
%%
0 NOARGS { int|sys||nosys(void); } syscall
1 NOARGS { int|sys||exit(int rval); }
2 NOARGS { int|sys||fork(void); }
3 NOARGS { int|sys||read(int fd, char *buf, u_int nbyte); }
4 NOARGS { int|sys||write(int fd, char *buf, u_int nbyte); }
5 STD { int|irix_sys||open(const char *path, int flags, \
int mode); }
6 NOARGS { int|sys||close(int fd); }
7 OBSOL wait
8 NOARGS { int|svr4_sys||creat(const char *path, int mode); }
9 NOARGS { int|sys||link(char *path, char *link); }
10 NOARGS { int|sys||unlink(char *path); }
11 NOARGS { int|svr4_sys||execv(const char *path, char **argp); }
12 NOARGS { int|sys||chdir(char *path); }
13 NOARGS { int|svr4_sys||time(svr4_time_t *t); }
14 OBSOL mknod
15 NOARGS { int|sys||chmod(char *path, int mode); }
16 NOARGS { int|sys||__posix_chown(char *path, int uid, \
int gid); } chown
17 STD { int|irix_sys||break(void *nsize); }
18 OBSOL stat
19 NOARGS { long|compat_43_sys||lseek(int fd, long offset, \
int whence); }
20 NOARGS { pid_t|sys||getpid(void); }
21 UNIMPL old_mount
22 UNIMPL System V umount
23 NOARGS { int|sys||setuid(uid_t uid); }
24 NOARGS { uid_t|sys||getuid_with_euid(void); }
25 UNIMPL stime
26 UNIMPL ptrace
27 NOARGS { int|svr4_sys||alarm(unsigned sec); }
28 NOARGS { int|svr4_sys||fstat(int fd, struct svr4_stat *sb); }
29 NOARGS { int|svr4_sys||pause(void); }
30 NOARGS { int|svr4_sys||utime(const char *path, \
struct svr4_utimbuf *ubuf); }
31 UNIMPL was stty
32 UNIMPL was gtty
33 NOARGS { int|svr4_sys||access(const char *path, int flags); }
34 NOARGS { int|svr4_sys||nice(int prio); }
35 UNIMPL statfs
36 NOARGS { int|sys||sync(void); }
37 NOARGS { int|svr4_sys||kill(int pid, int signum); }
38 UNIMPL fstatfs
39 NOARGS { int|svr4_sys||pgrpsys(int cmd, int pid, int pgid); }
40 STD { ptrdiff_t|irix_sys||syssgi(int request, void *arg1, \
void *arg2, void *arg3, void *arg4, void *arg5); }
41 NOARGS { int|sys||dup(u_int fd); }
42 NOARGS { int|sys||pipe(void); }
43 NOARGS { int|svr4_sys||times(struct tms *tp); }
44 UNIMPL profil
45 UNIMPL plock
46 NOARGS { int|sys||setgid(gid_t gid); }
47 NOARGS { gid_t|sys||getgid_with_egid(void); }
48 OBSOL ssig
#ifdef SYSVMSG
49 NOARGS { int|svr4_sys||msgsys(int what, int a2, int a3, \
int a4, int a5); }
#else
49 UNIMPL msgsys
#endif
50 UNIMPL sysmips
51 UNIMPL acct
#ifdef SYSVSHM
52 STD { int|irix_sys||shmsys(int what, int a2, int a3, \
int a4); }
#else
52 UNIMPL shmsys
#endif
#ifdef SYSVSEM
53 NOARGS { int|svr4_sys||semsys(int what, int a2, int a3, \
int a4, int a5); }
#else
53 UNIMPL semsys
#endif
54 STD { int|irix_sys||ioctl(int fd, u_long com, \
void *data); }
55 UNIMPL uadmin
56 STD { int|irix_sys||sysmp(int cmd, void *arg1, void *arg2, \
void *arg3, void *arg4); }
57 STD { int|irix_sys||utssys(void *a1, void *a2, int sel, \
void *a3); }
58 UNIMPL
59 NOARGS { int|svr4_sys||execve(const char *path, char **argp, \
char **envp); }
60 NOARGS { int|sys||umask(int newmask); }
61 NOARGS { int|sys||chroot(char *path); }
62 STD { int|irix_sys||fcntl(int fd, int cmd, char *arg); }
63 NOARGS { long|svr4_sys||ulimit(int cmd, long newlimit); }
64 UNIMPL reserved for unix/pc
65 UNIMPL reserved for unix/pc
66 UNIMPL reserved for unix/pc
67 UNIMPL reserved for unix/pc
68 UNIMPL reserved for unix/pc
69 UNIMPL reserved for unix/pc
70 OBSOL advfs
71 OBSOL unadvfs
72 OBSOL rmount
73 OBSOL rumount
74 OBSOL rfstart
75 STD { int|irix_sys||getrlimit64(int resource, \
struct irix_rlimit64 *rlp); }
76 STD { int|irix_sys||setrlimit64(int resource, \
const struct irix_rlimit64 *rlp); }
77 NOARGS { int|compat_50_sys||nanosleep(const struct timespec50 *rqtp, \
struct timespec50 *rmtp); }
78 STD { irix_off64_t|irix_sys||lseek64(int fd, int pad1, \
irix_off64_t offset, int whence, \
int pad2, int pad3, int pad4); }
79 NOARGS { int|sys||rmdir(char *path); }
80 NOARGS { int|sys||mkdir(char *path, int mode); }
81 STD { int|irix_sys||getdents(int fildes, \
irix_dirent_t *buf, int nbytes); }
82 STD { long|irix_sys||sginap (long ticks); }
83 UNIMPL sgikopt
84 UNIMPL sysfs
85 NOARGS { int|svr4_sys||getmsg(int fd, struct svr4_strbuf *ctl, \
struct svr4_strbuf *dat, int *flags); }
86 NOARGS { int|svr4_sys||putmsg(int fd, struct svr4_strbuf *ctl, \
struct svr4_strbuf *dat, int flags); }
87 NOARGS { int|sys||poll(struct pollfd *fds, u_int nfds, \
int timeout); }
88 STD { int|irix_sys||sigreturn(struct irix_sigcontext *scp, \
struct irix_ucontext *ucp, int signo); }
89 NOARGS { int|compat_43_sys||accept(int s, \
struct sockaddr *name, int *anamelen); }
90 NOARGS { int|sys||bind(int s, const struct sockaddr *name, \
int namelen); }
91 NOARGS { int|sys||connect(int s, const struct sockaddr *name, \
int namelen); }
92 NOARGS { int32_t|compat_43_sys||gethostid(void); }
93 NOARGS { int|compat_43_sys||getpeername(int fdes, \
struct sockaddr *asa, int *alen); }
94 NOARGS { int|compat_43_sys||getsockname(int fdes, \
struct sockaddr *asa, int *alen); }
95 NOARGS { int|sys||getsockopt(int s, int level, int name, \
void *val, int *avalsize); }
96 NOARGS { int|sys||listen(int s, int backlog); }
97 NOARGS { int|compat_43_sys||recv(int s, void *buf, int len, \
int flags); }
98 NOARGS { ssize_t|compat_43_sys||recvfrom(int s, void *buf, \
size_t len, int flags, struct sockaddr *from, \
int *fromlenaddr); }
99 NOARGS { ssize_t|compat_43_sys||recvmsg(int s, \
struct msghdr *msg, int flags); }
100 NOARGS { int|compat_50_sys||select(int nd, fd_set *in, fd_set *ou, \
fd_set *ex, struct timeval50 *tv); }
101 NOARGS { int|compat_43_sys||send(int s, void *buf, int len, \
int flags); }
102 NOARGS { ssize_t|compat_43_sys||sendmsg(int s, \
const struct msghdr *msg, int flags); }
103 NOARGS { ssize_t|sys||sendto(int s, const void *buf, \
size_t len, int flags, const struct sockaddr *to, \
int tolen); }
104 NOARGS { int|compat_43_sys||sethostid(int32_t hostid); }
105 NOARGS { int|sys||setsockopt(int s, int level, int name, \
const void *val, int valsize); }
106 NOARGS { int|sys||shutdown(int s, int how); }
107 NOARGS { int|svr4_sys||socket(int domain, int type, \
int protocol); }
108 NOARGS { int|compat_43_sys||gethostname(char *hostname, \
u_int len); }
109 NOARGS { int|compat_43_sys||sethostname(const char *hostname, \
u_int len); }
110 NOARGS { int|compat_09_sys||getdomainname(char *domainname, \
int len); }
111 NOARGS { int|compat_09_sys||setdomainname(char *domainname, \
int len); }
112 NOARGS { int|sys||truncate(const char *path, long length); }
113 NOARGS { int|sys||ftruncate(int fd, long length); }
114 NOARGS { int|sys||rename(const char *from, const char *to); }
115 NOARGS { int|sys||symlink(const char *path, \
const char *link); }
116 NOARGS { int|sys||readlink(const char *path, char *buf, \
size_t count); }
117 UNIMPL lstat
118 UNIMPL
119 UNIMPL nfs_svc
120 UNIMPL nfs_getfh
121 UNIMPL async_daemon
122 UNIMPL exportfs
123 NOARGS { int|sys||setregid(gid_t rgid, gid_t egid); }
124 NOARGS { int|sys||setreuid(uid_t ruid, uid_t euid); }
125 NOARGS { int|compat_50_sys||getitimer(u_int which, \
struct itimerval *itv); }
126 NOARGS { int|compat_50_sys||setitimer(u_int which, \
struct itimerval *itv, struct itimerval *oitv); }
127 NOARGS { int|compat_50_sys||adjtime(struct timeval50 *delta, \
struct timeval50 *olddelta); }
128 NOARGS { int|svr4_sys||gettimeofday(struct timeval50 *tp); }
129 STD { irix_pid_t|irix_sys||sproc(void *entry, \
unsigned int inh, void *arg); }
130 STD { ptrdiff_t|irix_sys||prctl(unsigned int option, \
void *arg1); }
131 STD { int|irix_sys||procblk(int cmd, pid_t pid, int count); }
132 STD { irix_pid_t|irix_sys||sprocsp(void *entry, \
unsigned int inh, void *arg, void *sp, \
irix_size_t len); }
133 UNIMPL sgigsc
134 STD { void *|irix_sys||mmap(void *addr, irix_size_t len, \
int prot, int flags, int fd, irix_off_t pos); }
135 STD { int|irix_sys||munmap(void *addr, int len); }
136 STD { int|irix_sys||mprotect(void *addr, \
int len, int prot); }
137 NOARGS { int|sys|13|msync(void *addr, \
size_t len, int flags); }
138 UNIMPL madvise
139 UNIMPL pagelock
140 UNIMPL getpagesize
141 UNIMPL quotactl
142 UNIMPL
143 NOARGS { int|sys||getpgrp(void); }
144 STD { int|irix_sys||setpgrp(int pid, int pgid); }
145 UNIMPL vhangup
146 NOARGS { int|sys||fsync(int fd); }
147 NOARGS { int|sys||fchdir(int fd); }
148 STD { int|irix_sys||getrlimit(int resource, \
struct irix_rlimit *rlp); }
149 STD { int|irix_sys||setrlimit(int resource, \
const struct irix_rlimit *rlp); }
150 UNIMPL cacheflush
151 UNIMPL cachectl
152 NOARGS { int|sys||__posix_fchown(int fd, int uid, int gid); } \
fchown
153 NOARGS { int|sys||fchmod(int fd, int mode); }
154 UNIMPL wait3
155 UNIMPL socketpair
156 STD { long|irix_sys||systeminfo(int what, char *buf, \
long len); }
157 STD { int|irix_sys||uname(struct irix_utsname *name); }
158 STD { int|irix_sys||xstat(const int version, \
const char *path, struct stat *buf); }
159 STD { int|irix_sys||lxstat(const int version, \
const char *path, struct stat *buf); }
160 STD { int|irix_sys||fxstat(const int version, \
const int fd, struct stat *buf); }
161 UNIMPL xmknod
162 STD { int|irix_sys||sigaction(int signum, \
const struct svr4_sigaction *nsa, \
struct svr4_sigaction *osa, void *sigtramp); }
163 NOARGS { int|svr4_sys||sigpending(int what, \
svr4_sigset_t *set); }
164 STD { int|irix_sys||sigprocmask(int how, \
const irix_sigset_t *set, \
irix_sigset_t *oset); }
165 NOARGS { int|svr4_sys||sigsuspend( \
const svr4_sigset_t *set); }
166 UNIMPL sigpoll_sys
167 STD { int|irix_sys||swapctl(int cmd, void *arg); }
168 STD { int|irix_sys||getcontext(irix_ucontext_t *ucp); }
169 STD { int|irix_sys||setcontext(const irix_ucontext_t *ucp); }
170 STD { int|irix_sys||waitsys(int type, int pid, \
struct irix_irix5_siginfo *info, int options, \
struct rusage *ru); }
171 UNIMPL sigstack
172 UNIMPL sigaltstack
173 UNIMPL sigsendset
174 NOARGS { int|svr4_sys||statvfs(const char *path, \
struct svr4_statvfs *fs); }
175 NOARGS { int|svr4_sys||fstatvfs(int fd, \
struct svr4_statvfs *fs); }
176 UNIMPL getpmsg
177 UNIMPL putpmsg
178 UNIMPL lchown
179 UNIMPL priocntl
180 UNIMPL sigqueue
181 NOARGS { ssize_t|sys||readv(int fd, \
const struct iovec *iovp, int iovcnt); }
182 NOARGS { ssize_t|sys||writev(int fd, \
const struct iovec *iovp, int iovcnt); }
183 NOARGS { int|sys||truncate(const char *path, int pad, \
off_t length); } truncate64
184 NOARGS { int|sys||ftruncate(int fd, int pad, off_t length); } \
ftruncate64
185 STD { void *|irix_sys||mmap64(void *addr, irix_size_t len, \
int prot, int flags, int fd, int pad1, \
irix_off_t pos); }
186 UNIMPL dmi
187 NOARGS { ssize_t|svr4_sys||pread(int fd, void *buf, \
size_t nbyte, svr4_off_t off); }
188 NOARGS { ssize_t|svr4_sys||pwrite(int fd, const void *buf, \
size_t nbyte, svr4_off_t off); }
189 UNIMPL fdatasync
190 UNIMPL sgifastpath
191 UNIMPL attr_get
192 UNIMPL attr_getf
193 UNIMPL attr_set
194 UNIMPL attr_setf
195 UNIMPL attr_remove
196 UNIMPL attr_removef
197 UNIMPL attr_list
198 UNIMPL attr_listf
199 UNIMPL attr_multi
200 UNIMPL attr_multif
201 UNIMPL statvfs64
202 UNIMPL fstatvfs64
203 STD { int|irix_sys||getmountid(const char *path, \
irix_mountid_t *buf); }
204 UNIMPL nsproc
205 STD { int|irix_sys||getdents64(int fildes, \
irix_dirent64_t *buf, int nbytes); }
206 UNIMPL afs_syscall
207 STD { int|irix_sys||ngetdents(int fildes, \
irix_dirent_t *buf, unsigned short nbyte, \
int *eof); }
208 STD { int|irix_sys||ngetdents64(int fildes, \
irix_dirent64_t *buf, unsigned short nbyte, \
int *eof); }
209 UNIMPL sgi_sesmgr
210 STD { irix_pid_t|irix_sys||pidsprocsp(void *entry, \
unsigned int inh, void *arg, void *sp, \
irix_size_t len, irix_pid_t pid); }
211 UNIMPL rexec
212 UNIMPL timer_create
213 UNIMPL timer_delete
214 UNIMPL timer_settime
215 UNIMPL timer_gettime
216 UNIMPL timer_setoverrun
217 UNIMPL sched_rr_get_interval
218 UNIMPL sched_yield
219 UNIMPL sched_getscheduler
220 UNIMPL sched_setscheduler
221 UNIMPL sched_getparam
222 UNIMPL sched_setparam
223 STD { int|irix_sys||usync_cntl(int cmd, void *arg); }
224 UNIMPL psema_cntl
225 UNIMPL restartreturn
226 UNIMPL sysget
227 UNIMPL xpg4_recvmsg
228 UNIMPL umfscall
229 UNIMPL nsproctid
230 UNIMPL rexec_complete
231 UNIMPL xpg4_sigaltstack
232 UNIMPL xpg4_sigaltstack
233 UNIMPL xpg4_setregid
234 UNIMPL linkfollow
235 UNIMPL utimets

View File

@ -1,4 +1,4 @@
# $NetBSD: files,v 1.1008 2011/04/26 15:51:31 joerg Exp $
# $NetBSD: files,v 1.1009 2011/04/26 16:36:42 joerg Exp $
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
version 20100430
@ -138,7 +138,6 @@ defflag opt_compat_netbsd.h COMPAT_09: COMPAT_10, COMPAT_NETBSD
defflag COMPAT_OSSAUDIO
defflag COMPAT_FREEBSD: COMPAT_30
defflag COMPAT_IBCS2
defflag COMPAT_IRIX
defflag COMPAT_LINUX: COMPAT_16
defflag COMPAT_LINUX32 : COMPAT_LINUX
defflag COMPAT_OSF1
@ -1300,8 +1299,6 @@ defpseudodev etherip: ifnet, ether, arp
defpseudo sequencer
defpseudo clockctl
defpseudo irix_kmem
defpseudo irix_usema
#
# Accept filters. XXX should use another registration/initialization method.

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_exec.c,v 1.313 2011/03/14 20:12:40 jakllsch Exp $ */
/* $NetBSD: kern_exec.c,v 1.314 2011/04/26 16:36:42 joerg Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -59,7 +59,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.313 2011/03/14 20:12:40 jakllsch Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.314 2011/04/26 16:36:42 joerg Exp $");
#include "opt_ktrace.h"
#include "opt_modular.h"
@ -486,7 +486,6 @@ exec_autoload(void)
"compat_aoutm68k",
"compat_freebsd",
"compat_ibcs2",
"compat_irix",
"compat_linux",
"compat_linux32",
"compat_netbsd32",

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_fork.c,v 1.181 2011/04/24 20:17:53 rmind Exp $ */
/* $NetBSD: kern_fork.c,v 1.182 2011/04/26 16:36:42 joerg Exp $ */
/*-
* Copyright (c) 1999, 2001, 2004, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_fork.c,v 1.181 2011/04/24 20:17:53 rmind Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_fork.c,v 1.182 2011/04/26 16:36:42 joerg Exp $");
#include "opt_ktrace.h"
@ -360,9 +360,9 @@ fork1(struct lwp *l1, int flags, int exitsig, void *stack, size_t stacksize,
/*
* p_limit (rlimit stuff) is usually copy-on-write, so we just need
* to bump pl_refcnt.
* However in some cases (see compat irix, and plausibly from clone)
* the parent and child share limits - in which case nothing else
* must have a copy of the limits (PL_SHAREMOD is set).
* However in some cases like clone the parent and child
* share limits - in which case nothing else must have a copy
* of the limits (PL_SHAREMOD is set).
*/
if (__predict_false(flags & FORK_SHARELIMIT))
lim_privatise(p1, 1);

View File

@ -1,23 +0,0 @@
# $NetBSD: Makefile,v 1.2 2008/12/08 12:56:00 njoly Exp $
.include "../Makefile.inc"
.include "../Makefile.assym"
KMOD= compat_irix
CPPFLAGS+= -DSYSVSHM -DSYSVSEM -DSYSVMSG -DCOMPAT_IRIX -DEXEC_ELF32
.PATH: ${S}/arch/mips/mips
SRCS+= irix_syscall.c
.PATH: ${S}/compat/irix
SRCS+= irix_dirent.c irix_errno.c irix_exec.c
SRCS+= irix_exec_elf32.c irix_fcntl.c irix_ioctl.c
SRCS+= irix_kmem.c irix_mman.c irix_misc.c
SRCS+= irix_mod.c irix_mount.c irix_prctl.c
SRCS+= irix_resource.c irix_signal.c irix_stat.c
SRCS+= irix_swap.c irix_syscalls.c irix_sysctl.c
SRCS+= irix_sysent.c irix_syssgi.c irix_sysmp.c
SRCS+= irix_systeminfo.c irix_usema.c
.include <bsd.kmodule.mk>

View File

@ -1,4 +1,4 @@
/* $NetBSD: sysctl.h,v 1.193 2011/04/26 15:51:32 joerg Exp $ */
/* $NetBSD: sysctl.h,v 1.194 2011/04/26 16:36:43 joerg Exp $ */
/*
* Copyright (c) 1989, 1993
@ -1003,14 +1003,12 @@ struct evcnt_sysctl {
* Subsequent levels are specified in the emulations themselves.
*/
#define EMUL_LINUX 1
#define EMUL_IRIX 2
#define EMUL_LINUX32 5
#define EMUL_MAXID 6
#define CTL_EMUL_NAMES { \
{ 0, 0 }, \
{ "linux", CTLTYPE_NODE }, \
{ "irix", CTLTYPE_NODE }, \
{ "linux32", CTLTYPE_NODE }, \
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: setemul.c,v 1.27 2011/04/26 15:51:32 joerg Exp $ */
/* $NetBSD: setemul.c,v 1.28 2011/04/26 16:36:43 joerg Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -62,7 +62,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: setemul.c,v 1.27 2011/04/26 15:51:32 joerg Exp $");
__RCSID("$NetBSD: setemul.c,v 1.28 2011/04/26 16:36:43 joerg Exp $");
#endif /* not lint */
#include <sys/param.h>
@ -84,7 +84,6 @@ __RCSID("$NetBSD: setemul.c,v 1.27 2011/04/26 15:51:32 joerg Exp $");
#include "../../sys/compat/netbsd32/netbsd32_syscall.h"
#include "../../sys/compat/freebsd/freebsd_syscall.h"
#include "../../sys/compat/ibcs2/ibcs2_syscall.h"
#include "../../sys/compat/irix/irix_syscall.h"
#include "../../sys/compat/linux/linux_syscall.h"
#include "../../sys/compat/linux32/linux32_syscall.h"
#include "../../sys/compat/osf1/osf1_syscall.h"
@ -103,7 +102,6 @@ __RCSID("$NetBSD: setemul.c,v 1.27 2011/04/26 15:51:32 joerg Exp $");
#include "../../sys/compat/netbsd32/netbsd32_syscalls.c"
#include "../../sys/compat/freebsd/freebsd_syscalls.c"
#include "../../sys/compat/ibcs2/ibcs2_syscalls.c"
#include "../../sys/compat/irix/irix_syscalls.c"
#include "../../sys/compat/linux/linux_syscalls.c"
#include "../../sys/compat/linux32/linux32_syscalls.c"
#include "../../sys/compat/osf1/osf1_syscalls.c"
@ -118,7 +116,6 @@ __RCSID("$NetBSD: setemul.c,v 1.27 2011/04/26 15:51:32 joerg Exp $");
#include "../../sys/compat/svr4/svr4_errno.c"
#include "../../sys/compat/ibcs2/ibcs2_errno.c"
#include "../../sys/compat/irix/irix_errno.c"
#include "../../sys/compat/osf1/osf1_errno.c"
#include "../../sys/compat/linux/common/linux_errno.c"
#undef KTRACE
@ -126,7 +123,6 @@ __RCSID("$NetBSD: setemul.c,v 1.27 2011/04/26 15:51:32 joerg Exp $");
#define SIGRTMIN 33 /* XXX */
#include "../../sys/compat/svr4/svr4_signo.c"
#include "../../sys/compat/ibcs2/ibcs2_signo.c"
/* irix uses svr4 */
#include "../../sys/compat/osf1/osf1_signo.c"
#include "../../sys/compat/linux/common/linux_signo.c"
@ -150,14 +146,6 @@ const struct emulation emulations[] = {
native_to_ibcs2_errno, NELEM(native_to_ibcs2_errno),
ibcs2_to_native_signo, NSIG, 0 },
{ "irix o32", irix_syscallnames, IRIX_SYS_MAXSYSCALL,
native_to_irix_errno, NELEM(native_to_irix_errno),
svr4_to_native_signo, NSIG, 0 },
{ "irix n32", irix_syscallnames, IRIX_SYS_MAXSYSCALL,
native_to_irix_errno, NELEM(native_to_irix_errno),
svr4_to_native_signo, NSIG, 0 },
{ "linux", linux_syscallnames, LINUX_SYS_MAXSYSCALL,
native_to_linux_errno, NELEM(native_to_linux_errno),
linux_to_native_signo, NSIG, 0 },