Remove compat_osf1, discussed on tech-kern@.

This commit is contained in:
maxv 2019-03-25 19:24:29 +00:00
parent 5abaa90610
commit ba0aa175c4
56 changed files with 42 additions and 10998 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: mi,v 1.1640 2019/03/17 00:35:09 tnn Exp $
# $NetBSD: mi,v 1.1641 2019/03/25 19:24:29 maxv Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@ -2448,7 +2448,7 @@
./usr/share/man/cat8/compat_ibcs2.0 man-obsolete obsolete
./usr/share/man/cat8/compat_linux.0 man-sys-catman .cat
./usr/share/man/cat8/compat_netbsd32.0 man-sys-catman .cat
./usr/share/man/cat8/compat_osf1.0 man-sys-catman .cat
./usr/share/man/cat8/compat_osf1.0 man-obsolete obsolete
./usr/share/man/cat8/compat_pecoff.0 man-obsolete obsolete
./usr/share/man/cat8/compat_sco.0 man-obsolete obsolete
./usr/share/man/cat8/compat_solaris.0 man-obsolete obsolete
@ -5467,7 +5467,7 @@
./usr/share/man/html8/compat_ibcs2.html man-obsolete obsolete
./usr/share/man/html8/compat_linux.html man-sys-htmlman html
./usr/share/man/html8/compat_netbsd32.html man-sys-htmlman html
./usr/share/man/html8/compat_osf1.html man-sys-htmlman html
./usr/share/man/html8/compat_osf1.html man-obsolete obsolete
./usr/share/man/html8/compat_pecoff.html man-obsolete obsolete
./usr/share/man/html8/compat_sco.html man-obsolete obsolete
./usr/share/man/html8/compat_solaris.html man-obsolete obsolete
@ -8539,7 +8539,7 @@
./usr/share/man/man8/compat_ibcs2.8 man-obsolete obsolete
./usr/share/man/man8/compat_linux.8 man-sys-man .man
./usr/share/man/man8/compat_netbsd32.8 man-sys-man .man
./usr/share/man/man8/compat_osf1.8 man-sys-man .man
./usr/share/man/man8/compat_osf1.8 man-obsolete obsolete
./usr/share/man/man8/compat_pecoff.8 man-obsolete obsolete
./usr/share/man/man8/compat_sco.8 man-obsolete obsolete
./usr/share/man/man8/compat_solaris.8 man-obsolete obsolete

View File

@ -1,4 +1,4 @@
.\" $NetBSD: options.4,v 1.497 2018/12/29 11:30:11 maxv Exp $
.\" $NetBSD: options.4,v 1.498 2019/03/25 19:24:30 maxv Exp $
.\"
.\" Copyright (c) 1996
.\" Perry E. Metzger. All rights reserved.
@ -30,7 +30,7 @@
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\"
.Dd December 29, 2018
.Dd March 25, 2019
.Dt OPTIONS 4
.Os
.Sh NAME
@ -440,13 +440,6 @@ compatibility with
.Fx
applications built for the same architecture.
At the moment this is limited to the i386 port.
.It Cd options COMPAT_OSF1
On those architectures that support it, this enables binary
compatibility with Digital
.Ux
(formerly OSF/1)
applications built for the same architecture.
This is currently limited to the alpha port.
.It Cd options COMPAT_NOMID
Enable compatibility with
.Xr a.out 5

View File

@ -1,4 +1,4 @@
.\" $NetBSD: hier.7,v 1.135 2018/12/29 11:30:11 maxv Exp $
.\" $NetBSD: hier.7,v 1.136 2019/03/25 19:24:30 maxv Exp $
.\"
.\" Copyright (c) 1990, 1993, 1994
.\" The Regents of the University of California. All rights reserved.
@ -29,7 +29,7 @@
.\"
.\" @(#)hier.7 8.5 (Berkeley) 6/1/94
.\"
.Dd December 29, 2018
.Dd March 25, 2019
.Dt HIER 7
.Os
.Sh NAME
@ -893,10 +893,6 @@ Support for 4KB page 68000 binaries.
Support for
.Nx
32-bit binaries on 64 bit platforms with compatible CPU families.
.It Pa osf1/
Support for Digital
.Ux
(formerly OSF/1) binaries.
.It Pa ossaudio/
Support for OSS audio.
.It Pa sunos/

View File

@ -1,4 +1,4 @@
.\" $NetBSD: symlink.7,v 1.28 2018/12/29 11:33:00 maxv Exp $
.\" $NetBSD: symlink.7,v 1.29 2019/03/25 19:24:30 maxv Exp $
.\"
.\" Copyright (c) 1992, 1993, 1994
.\" The Regents of the University of California. All rights reserved.
@ -29,7 +29,7 @@
.\"
.\" @(#)symlink.7 8.3 (Berkeley) 3/31/94
.\"
.Dd December 29, 2018
.Dd March 25, 2019
.Dt SYMLINK 7
.Os
.Sh NAME
@ -569,7 +569,6 @@ Other valid emulations are:
.Dv linux32 ,
.Dv m68k4k ,
.Dv netbsd32 ,
.Dv osf1 ,
.Dv sunos ,
.Dv sunos32 ,
.Dv ultrix ,

View File

@ -1,9 +1,9 @@
# $NetBSD: Makefile,v 1.107 2018/12/29 11:30:11 maxv Exp $
# $NetBSD: Makefile,v 1.108 2019/03/25 19:24:30 maxv Exp $
# from: @(#)Makefile 8.1 (Berkeley) 6/5/93
MAN= MAKEDEV.8 MAKEDEV.local.8 afterboot.8 boot.8 compat_30.8 \
compat_freebsd.8 compat_linux.8 \
compat_netbsd32.8 compat_osf1.8 compat_sunos.8 \
compat_netbsd32.8 compat_sunos.8 \
compat_ultrix.8 diskless.8 hpcboot.8 \
intro.8 nis.8 pam.8 rc.8 rc.subr.8 rescue.8 \
sysinst.8 veriexec.8 \

View File

@ -1,123 +0,0 @@
.\" $NetBSD: compat_osf1.8,v 1.12 2008/04/30 13:10:57 martin Exp $
.\"
.\" Copyright (c) 1999 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" This code is derived from software contributed to The NetBSD Foundation
.\" by Roland C. Dowdeswell.
.\"
.\" 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.
.\"
.Dd November 4, 1999
.Dt COMPAT_OSF1 8
.Os
.Sh NAME
.Nm compat_osf1
.Nd setup procedure for running OSF/1 binaries
.Sh DESCRIPTION
.Nx
supports running OSF/1 (a.k.a Digital Unix, a.k.a. Tru64) binaries on
.Nx Ns Tn /alpha
systems.
Most programs should work, including the ones that use the shared object
libraries.
Programs that make direct MACH system calls will not work.
The OSF/1 compatibility feature is active for kernels compiled with the
.Dv COMPAT_OSF1
option enabled (see
.Xr options 4 ) .
.Pp
To run dynamically linked programs, you will need the OSF/1 shared libraries,
runtime linker, and certain configuration files found in /etc.
These are installed in a
.Dq shadow root
directory called
.Pa /emul/osf1 .
Any file operations done by OSF/1 programs run under
.Nx
will look in this directory first, and fall back to the file system proper.
So, if an OSF/1 program opens
.Pa /etc/svc.conf ,
.Nx
will first try to open
.Pa /emul/osf1/etc/svc.conf ,
and if that file does not exist it will then try
.Pa /etc/svc.conf .
Shared libraries and configuration specific to OSF/1 should be installed
in the shadow tree.
.Ss Setting up /emul/osf1
The simple technique is to install pkgsrc/emulators/osf1_lib.
(You may
also want to install pkgsrc/www/navigator and/or pkgsrc/www/communicator.)
.Pp
Alternatively, if you have access to an OSF/1 machine and if the licensing
details permit, you can copy the contents of:
.Bl -item -compact -offset indent
.It
.Pa /shlib
.It
.Pa /usr/shlib
.It
.Pa /etc/sia
.It
.Pa /usr/lib/X11/locale
.El
.Pp
(The latter is required to run Netscape Navigator or Communicator.)
.Pp
Also copy
.Bl -item -compact -offset indent
.It
.Pa /etc/svc.conf
.It
.Pa /usr/ccs/lib/cmplrs/otabase/libots.so
.It
.Pa /sbin/loader
.El
.Pp
Or, simply NFS mount the appropriate directories under
.Pa /emul/osf1 .
.Sh SEE ALSO
.Xr config 1 ,
.Xr options 4
.Sh BUGS
Your
.Xr hostname 1
.Em must
contain a dot
.Em or
your
.Xr resolv.conf 5
must contain a
.Li search
line.
Without one of those, the OSF/1 resolver will die and no hostname
resolution will be possible.
.Pp
Certain values in
.Pa /emul/osf1/etc/svc.conf
can cause programs to fail with
.Dq Bad system call .
.Pp
Pathnames pointed to by symbolic links are not looked up in the
shadow root when running an OSF/1 executable.
This is not consistent.

View File

@ -1,4 +1,4 @@
/* $NetBSD: compat_16_machdep.c,v 1.21 2017/03/16 16:13:20 chs Exp $ */
/* $NetBSD: compat_16_machdep.c,v 1.22 2019/03/25 19:24:30 maxv Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@ -63,7 +63,6 @@
#include "opt_multiprocessor.h"
#include "opt_dec_3000_300.h"
#include "opt_dec_3000_500.h"
#include "opt_compat_osf1.h"
#include "opt_compat_netbsd.h"
#include "opt_execfmt.h"
#endif /* _KERNEL_OPT */
@ -78,7 +77,7 @@
#include <sys/syscall.h>
#include <sys/syscallargs.h>
#if defined(COMPAT_13) || defined(COMPAT_OSF1)
#if defined(COMPAT_13)
#include <compat/sys/signal.h>
#include <compat/sys/signalvar.h>
#endif
@ -86,7 +85,7 @@
#include <machine/cpu.h>
#include <machine/reg.h>
__KERNEL_RCSID(0, "$NetBSD: compat_16_machdep.c,v 1.21 2017/03/16 16:13:20 chs Exp $");
__KERNEL_RCSID(0, "$NetBSD: compat_16_machdep.c,v 1.22 2019/03/25 19:24:30 maxv Exp $");
#ifdef DEBUG
@ -146,7 +145,7 @@ sendsig_sigcontext(const ksiginfo_t *ksi, const sigset_t *mask)
/* Save signal mask. */
frame.sf_sc.sc_mask = *mask;
#if defined(COMPAT_13) || defined(COMPAT_OSF1)
#if defined(COMPAT_13)
/*
* XXX We always have to save an old style signal mask because
* XXX we might be delivering a signal to a process which will
@ -231,7 +230,7 @@ sendsig_sigcontext(const ksiginfo_t *ksi, const sigset_t *mask)
#endif
}
#ifdef COMPAT_16 /* not needed if COMPAT_OSF1 only */
#ifdef COMPAT_16
/*
* System call to cleanup state after a signal
* has been taken. Reset signal mask and

View File

@ -1,4 +1,4 @@
/* $NetBSD: fp_complete.c,v 1.22 2017/12/31 11:43:42 martin Exp $ */
/* $NetBSD: fp_complete.c,v 1.23 2019/03/25 19:24:30 maxv Exp $ */
/*-
* Copyright (c) 2001 Ross Harvey
@ -35,9 +35,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: fp_complete.c,v 1.22 2017/12/31 11:43:42 martin Exp $");
#include "opt_compat_osf1.h"
__KERNEL_RCSID(0, "$NetBSD: fp_complete.c,v 1.23 2019/03/25 19:24:30 maxv Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -45,10 +43,6 @@ __KERNEL_RCSID(0, "$NetBSD: fp_complete.c,v 1.22 2017/12/31 11:43:42 martin Exp
#include <sys/atomic.h>
#include <sys/evcnt.h>
#ifdef COMPAT_OSF1
#include <compat/osf1/osf1_exec.h>
#endif
#include <machine/cpu.h>
#include <machine/fpu.h>
#include <machine/reg.h>
@ -658,12 +652,6 @@ alpha_fp_complete(u_long a0, u_long a1, struct lwp *l, uint64_t *ucode)
* interpret this one instruction in SW. If a SIGFPE is not required, back up
* the PC until just after this instruction and restart. This will execute all
* trap shadow instructions between the trigger pc and the trap pc twice.
*
* If a SIGFPE is generated from the OSF1 emulation, back up one more
* instruction to the trigger pc itself. Native binaries don't because it
* is non-portable and completely defeats the intended purpose of IEEE
* traps -- for example, to count the number of exponent wraps for a later
* correction.
*/
trigger_pc = 0;
win_begin = pc;
@ -712,10 +700,6 @@ alpha_fp_complete(u_long a0, u_long a1, struct lwp *l, uint64_t *ucode)
done:
if (sig) {
usertrap_pc = trigger_pc + 1;
#ifdef COMPAT_OSF1
if (l->l_proc->p_emul == &emul_osf1)
usertrap_pc = trigger_pc;
#endif
l->l_md.md_tf->tf_regs[FRAME_PC] = (unsigned long)usertrap_pc;
return sig;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.352 2018/11/27 14:09:53 maxv Exp $ */
/* $NetBSD: machdep.c,v 1.353 2019/03/25 19:24:30 maxv Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@ -63,12 +63,11 @@
#include "opt_multiprocessor.h"
#include "opt_dec_3000_300.h"
#include "opt_dec_3000_500.h"
#include "opt_compat_osf1.h"
#include "opt_execfmt.h"
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.352 2018/11/27 14:09:53 maxv Exp $");
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.353 2019/03/25 19:24:30 maxv Exp $");
#include <sys/param.h>
#include <sys/systm.h>

View File

@ -1,83 +0,0 @@
/* $NetBSD: osf1_sigcode.s,v 1.3 2002/07/01 03:10:02 thorpej Exp $ */
/*
* Copyright (c) 1999 Christopher G. Demetriou. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Christopher G. Demetriou
* for the NetBSD Project.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include <machine/asm.h>
#include <compat/osf1/osf1_syscall.h>
__KERNEL_RCSID(0, "$NetBSD: osf1_sigcode.s,v 1.3 2002/07/01 03:10:02 thorpej Exp $");
/*
* OSF/1 signal trampoline code.
*/
#define OSF1_SYSCALLNUM(name) \
___CONCAT(OSF1_SYS_,name)
#define OSF1_CALLSYS_NOERROR(name) \
ldiq v0, OSF1_SYSCALLNUM(name); \
call_pal PAL_OSF1_callsys
NESTED_NOPROFILE(osf1_sigcode,0,0,ra,0,0)
mov sp, a0
OSF1_CALLSYS_NOERROR(sigreturn)
mov v0, a0
OSF1_CALLSYS_NOERROR(exit)
XNESTED(osf1_esigcode,0)
END(osf1_sigcode)

View File

@ -1,310 +0,0 @@
/* $NetBSD: osf1_syscall.c,v 1.35 2015/03/07 18:51:44 christos Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
* NASA Ames Research Center, and by Charles M. Hannum.
*
* 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.
*/
/*
* Copyright (c) 1999 Christopher G. Demetriou. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Christopher G. Demetriou
* for the NetBSD Project.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: osf1_syscall.c,v 1.35 2015/03/07 18:51:44 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/proc.h>
#include <sys/signal.h>
#include <sys/syscall.h>
#include <sys/syscallvar.h>
#include <machine/cpu.h>
#include <machine/reg.h>
#include <machine/alpha.h>
#include <machine/userret.h>
#include <compat/osf1/osf1.h>
#include <compat/osf1/osf1_cvt.h>
#include <compat/osf1/osf1_syscall.h>
void osf1_syscall_intern(struct proc *);
void osf1_syscall_plain(struct lwp *, uint64_t, struct trapframe *);
void osf1_syscall_fancy(struct lwp *, uint64_t, struct trapframe *);
void
osf1_syscall_intern(struct proc *p)
{
if (trace_is_enabled(p))
p->p_md.md_syscall = osf1_syscall_fancy;
else
p->p_md.md_syscall = osf1_syscall_plain;
}
/*
* Process a system call.
*
* System calls are strange beasts. They are passed the syscall number
* in v0, and the arguments in the registers (as normal). They return
* an error flag in a3 (if a3 != 0 on return, the syscall had an error),
* and the return value (if any) in v0.
*
* The assembly stub takes care of moving the call number into a register
* we can get to, and moves all of the argument registers into their places
* in the trap frame. On return, it restores the callee-saved registers,
* a3, and v0 from the frame before returning to the user process.
*/
void
osf1_syscall_plain(struct lwp *l, uint64_t code, struct trapframe *framep)
{
const struct sysent *callp;
int error;
uint64_t rval[2];
uint64_t *args, copyargs[10]; /* XXX */
u_int hidden, nargs;
struct proc *p = l->l_proc;
LWP_CACHE_CREDS(l, p);
curcpu()->ci_data.cpu_nsyscall++;
l->l_md.md_tf = framep;
callp = p->p_emul->e_sysent;
switch (code) {
case OSF1_SYS_syscall:
/* OSF/1 syscall() */
code = framep->tf_regs[FRAME_A0];
hidden = 1;
break;
default:
hidden = 0;
break;
}
code &= (OSF1_SYS_NSYSENT - 1);
callp += code;
nargs = callp->sy_narg + hidden;
switch (nargs) {
default:
error = copyin((void *)alpha_pal_rdusp(), &copyargs[6],
(nargs - 6) * sizeof(uint64_t));
if (error)
goto bad;
case 6:
copyargs[5] = framep->tf_regs[FRAME_A5];
case 5:
copyargs[4] = framep->tf_regs[FRAME_A4];
case 4:
copyargs[3] = framep->tf_regs[FRAME_A3];
copyargs[2] = framep->tf_regs[FRAME_A2];
copyargs[1] = framep->tf_regs[FRAME_A1];
copyargs[0] = framep->tf_regs[FRAME_A0];
args = copyargs;
break;
case 3:
case 2:
case 1:
case 0:
args = &framep->tf_regs[FRAME_A0];
break;
}
args += hidden;
rval[0] = 0;
rval[1] = 0;
error = sy_call(callp, l, args, rval);
switch (error) {
case 0:
framep->tf_regs[FRAME_V0] = rval[0];
framep->tf_regs[FRAME_A4] = rval[1];
framep->tf_regs[FRAME_A3] = 0;
break;
case ERESTART:
framep->tf_regs[FRAME_PC] -= 4;
break;
case EJUSTRETURN:
break;
default:
bad:
error = native_to_osf1_errno[error];
framep->tf_regs[FRAME_V0] = error;
framep->tf_regs[FRAME_A3] = 1;
break;
}
userret(l);
}
void
osf1_syscall_fancy(struct lwp *l, uint64_t code, struct trapframe *framep)
{
const struct sysent *callp;
int error;
uint64_t rval[2];
uint64_t *args, copyargs[10];
u_int hidden, nargs;
struct proc *p = l->l_proc;
LWP_CACHE_CREDS(l, p);
curcpu()->ci_data.cpu_nsyscall++;
l->l_md.md_tf = framep;
callp = p->p_emul->e_sysent;
switch (code) {
case OSF1_SYS_syscall:
/* OSF/1 syscall() */
code = framep->tf_regs[FRAME_A0];
hidden = 1;
break;
default:
hidden = 0;
break;
}
code &= (OSF1_SYS_NSYSENT - 1);
callp += code;
nargs = callp->sy_narg + hidden;
switch (nargs) {
default:
error = copyin((void *)alpha_pal_rdusp(), &copyargs[6],
(nargs - 6) * sizeof(uint64_t));
if (error) {
args = copyargs;
goto bad;
}
case 6:
copyargs[5] = framep->tf_regs[FRAME_A5];
case 5:
copyargs[4] = framep->tf_regs[FRAME_A4];
case 4:
copyargs[3] = framep->tf_regs[FRAME_A3];
copyargs[2] = framep->tf_regs[FRAME_A2];
copyargs[1] = framep->tf_regs[FRAME_A1];
copyargs[0] = framep->tf_regs[FRAME_A0];
args = copyargs;
break;
case 3:
case 2:
case 1:
case 0:
args = &framep->tf_regs[FRAME_A0];
break;
}
args += hidden;
if ((error = trace_enter(code, callp, args)) != 0)
goto out;
rval[0] = 0;
rval[1] = 0;
error = sy_call(callp, l, args, rval);
out:
switch (error) {
case 0:
framep->tf_regs[FRAME_V0] = rval[0];
framep->tf_regs[FRAME_A4] = rval[1];
framep->tf_regs[FRAME_A3] = 0;
break;
case ERESTART:
framep->tf_regs[FRAME_PC] -= 4;
break;
case EJUSTRETURN:
break;
default:
bad:
error = native_to_osf1_errno[error];
framep->tf_regs[FRAME_V0] = error;
framep->tf_regs[FRAME_A3] = 1;
break;
}
trace_exit(code, callp, args, rval, error);
userret(l);
}

View File

@ -1,4 +1,4 @@
# $NetBSD: GENERIC,v 1.390 2019/03/16 08:03:03 maxv Exp $
# $NetBSD: GENERIC,v 1.391 2019/03/25 19:24:30 maxv Exp $
#
# This machine description file is used to generate the default NetBSD
# kernel.
@ -19,7 +19,7 @@ include "arch/alpha/conf/std.alpha"
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
ident "GENERIC-$Revision: 1.390 $"
ident "GENERIC-$Revision: 1.391 $"
maxusers 32
@ -129,9 +129,6 @@ options PPP_FILTER # Active filter support for PPP (requires bpf)
# Binary compatibility with previous versions of NetBSD.
include "conf/compat_netbsd09.config"
# OSF/1 binary compatibility
#options COMPAT_OSF1
# Linux binary compatibility
options COMPAT_LINUX

View File

@ -1,4 +1,4 @@
# $NetBSD: files.alpha,v 1.189 2018/02/22 07:30:43 mrg Exp $
# $NetBSD: files.alpha,v 1.190 2019/03/25 19:24:30 maxv Exp $
#
# alpha-specific configuration info
@ -422,13 +422,8 @@ file arch/alpha/alpha/db_trace.c ddb
file arch/alpha/alpha/kgdb_machdep.c kgdb
# Binary compatibility with previous NetBSD releases (COMPAT_XX)
file arch/alpha/alpha/compat_13_machdep.c compat_13 | compat_osf1
file arch/alpha/alpha/compat_16_machdep.c compat_16 | compat_osf1
# OSF/1 Binary Compatibility (COMPAT_OSF1)
include "compat/osf1/files.osf1"
file arch/alpha/alpha/osf1_sigcode.s compat_osf1
file arch/alpha/alpha/osf1_syscall.c compat_osf1
file arch/alpha/alpha/compat_13_machdep.c compat_13
file arch/alpha/alpha/compat_16_machdep.c compat_16
# Linux Binary Compatibility (COMPAT_LINUX)
include "compat/linux/files.linux"

View File

@ -1,4 +1,4 @@
/* $NetBSD: frame.h,v 1.9 2012/02/06 02:14:13 matt Exp $ */
/* $NetBSD: frame.h,v 1.10 2019/03/25 19:24:30 maxv Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
@ -92,7 +92,7 @@ struct trapframe {
unsigned long tf_regs[FRAME_SIZE]; /* See above */
};
#if (defined(COMPAT_16) || defined(COMPAT_OSF1)) && defined(_KERNEL)
#if defined(COMPAT_16) && defined(_KERNEL)
struct sigframe_sigcontext {
/* ra address of trampoline */
/* a0 signum for handler */
@ -115,7 +115,7 @@ struct sigframe_siginfo {
void *getframe(const struct lwp *, int, int *);
void buildcontext(struct lwp *, const void *, const void *, const void *);
void sendsig_siginfo(const ksiginfo_t *, const sigset_t *);
#if defined(COMPAT_16) || defined(COMPAT_OSF1)
#if defined(COMPAT_16)
void sendsig_sigcontext(const ksiginfo_t *, const sigset_t *);
#endif
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: signal.h,v 1.16 2012/02/06 02:14:13 matt Exp $ */
/* $NetBSD: signal.h,v 1.17 2019/03/25 19:24:30 maxv Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
@ -36,7 +36,6 @@ typedef long sig_atomic_t;
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
#include "opt_compat_osf1.h"
#endif
/*
@ -49,7 +48,7 @@ typedef long sig_atomic_t;
* Note that sc_regs[] and sc_fpregs[]+sc_fpcr are inline
* representations of 'struct reg' and 'struct fpreg', respectively.
*/
#if defined(_KERNEL) && (defined(COMPAT_13) || defined(COMPAT_OSF1))
#if defined(_KERNEL) && defined(COMPAT_13)
struct sigcontext13 {
long sc_onstack; /* sigstack state to restore */
long sc_mask; /* signal mask to restore (old style) */
@ -64,9 +63,9 @@ struct sigcontext13 {
long sc_reserved[2]; /* XXX */
long sc_xxx[8]; /* XXX */
};
#endif /* _KERNEL && (COMPAT_13 || COMPAT_OSF1) */
#endif /* _KERNEL && COMPAT_13 */
#if defined(_LIBC) || (defined(_KERNEL) && (defined(COMPAT_16) || defined(COMPAT_OSF1)))
#if defined(_LIBC) || (defined(_KERNEL) && defined(COMPAT_16))
struct sigcontext {
long sc_onstack; /* sigstack state to restore */
long __sc_mask13; /* signal mask to restore (old style) */

View File

@ -1,6 +1,6 @@
# $NetBSD: Makefile,v 1.6 2018/12/29 11:30:12 maxv Exp $
# $NetBSD: Makefile,v 1.7 2019/03/25 19:24:30 maxv Exp $
#SUBDIR= common freebsd hpux linux m68k4k osf1 ossaudio sunos \
#SUBDIR= common freebsd hpux linux m68k4k ossaudio sunos \
# ultrix netbsd32 sunos32
#INCSDIR= /usr/include/compat

View File

@ -1,6 +1,6 @@
# $NetBSD: Makefile.syscall,v 1.3 2018/12/29 11:30:12 maxv Exp $
# $NetBSD: Makefile.syscall,v 1.4 2019/03/25 19:24:30 maxv Exp $
SUBDIR = aoutm68k freebsd linux linux32 netbsd32
SUBDIR += osf1 sunos sunos32 ultrix
SUBDIR += sunos sunos32 ultrix
.include <bsd.subdir.mk>

View File

@ -1,5 +0,0 @@
# $NetBSD: Makefile,v 1.7 2014/01/14 18:51:25 christos Exp $
SYSCALL_PREFIX=osf1
.include <bsd.syscall.mk>

View File

@ -1,54 +0,0 @@
$NetBSD: README.dynamic,v 1.3 1999/04/27 16:08:40 cgd Exp $
Dynamically linked programs are supported by NetBSD's Digital UNIX
(formerly DEC OSF/1) emulation. The OSF/1 dynamic linker scheme is
described in fair detail in:
%A Larry W. Allen
%A Harminder G. Singh
%A Kevin G. Wallace
%A Melanie B. Weaver
%T Program Loading in OSF/1
%P 145-160
%I USENIX
%B USENIX Conference Proceedings
%D January 21-25, 1991
%C Dallas, TX
%W Open Software Foundation
Additionally, the object file formats in use are described in the
Digital UNIX _Assembly Language Programmer's Guide_ which can be
found (among other places) on a version-specific page off of:
http://www.unix.digital.com/faqs/publications/pub_page/doc_list.html
Finally, the actual representation of Auxiliary Vectors came from information
in the Digital UNIX auxv.h header file.
There are at least two potential issues with the implementation as it
currently exists:
1. exec_with_loader() is not emulated.
Most uses of dynamically linked programs come through execve()
and use the default loader (/sbin/loader). In Digital UNIX
(and OSF/1) you can also force a specific loader to always be
invoked to load an executable by using the exec_with_loader()
system call. Few, if any, programs use this feature.
2. It is not immediately obvious that the right values are used for
text and data locations when invoking a dynamically linked executable.
The text and data sections, and the break, are set up as if
/sbin/loader itself had been executed. It's not clear that this
is correct, but /sbin/loader seems to expect that at least the
break will be set up this way.
This has certain implications for the way mmap() behaves. See
the comment in the osf1_mmap() function in osf1_misc.c.
3. The stack location is used is the normal NetBSD/alpha stack location.
No attempt is made to put the stack in the place where
Digital UNIX would normally put it. This may confuse some
programs.

View File

@ -1,74 +0,0 @@
$NetBSD: README.mach-traps,v 1.3 2001/06/04 20:06:41 nathanw Exp $
Some Alpha AXP OSF/1 binaries directly use the facilities provided by
the Mach kernel that is the basis for OSF/1. These include (but are
surely not limited to) 'dd', 'ps', and 'w'.
Invariably, the symptom that these binaries display is that they crash
with an "unimplemented system call" trap (SIGSYS signal) for a syscall
that has a negative number. In general, binaries that use the Mach
syscalls appear to invoke task_self() as their first syscall.
Note that system call numbers are now range-bounded by masking off the
high bits, so negative system call numbers will appear in the high
end of the system call number range, thanks to the wonders of two's
compliment arithmetic. System call -10, for example, will appear as
"CALL [502]" in kdump output.
The name, number, and number of arguments for each Mach syscall is
given below; this information was gleaned by looking through the OSF/1
libmach.a's object files with dbx, then double-checked against the
contents of OSF/1's <mach/syscall_sw.h>.
These calls would be very difficult to implement properly in the
OSF/1 emulation code; by its very nature, NetBSD is not Mach, and we
don't and can't provide the underlying facilities that it does.
-- cgd
trap name number nargs notes
---- ---- ------ ----- -----
task_self -10 0
thread_reply -11 0
task_notify -12 0
thread_self -13 0
msg_send_old -14 3
msg_receive_old -15 3
msg_rpc_old -16 5
msg_send_trap -20 4
msg_receive_trap -21 5
msg_rpc_trap -22 6
lw_wire -30 3
lw_unwire -31 1
nxm_task_init -33 2
nxm_sched_thread -34 1
nxm_idle -35 1
nxm_wakeup_idle -36 1
nxm_set_pthid -37 2
nxm_thread_kill -38 2
nxm_thread_block -39 1
nxm_thread_wakeup -40 1
inode_swap_preference -40 3 old call?
init_process -41 0
map_fd -43 5
nxm_resched -44 2
htg_unix_syscall -52 3
host_self -55 1
host_priv_self -56 1
swtch_pri -59 1
swtch -60 0
thread_switch -61 3
semop_fast -62 4
mach_sctimes_0 -70 0 only if MACH_SCTIMES defined
mach_sctimes_1 -71 1 only if MACH_SCTIMES defined
mach_sctimes_2 -72 2 only if MACH_SCTIMES defined
mach_sctimes_3 -73 3 only if MACH_SCTIMES defined
mach_sctimes_4 -74 4 only if MACH_SCTIMES defined
mach_sctimes_5 -75 5 only if MACH_SCTIMES defined
mach_sctimes_6 -76 6 only if MACH_SCTIMES defined
mach_sctimes_7 -77 0 only if MACH_SCTIMES defined
mach_sctimes_8 -78 6 only if MACH_SCTIMES defined
mach_sctimes_9 -79 1 only if MACH_SCTIMES defined
mach_sctimes_10 -80 2 only if MACH_SCTIMES defined
mach_sctimes_11 -81 2 only if MACH_SCTIMES defined
mach_sctimes_port_alloc_dealloc -82 1 only if MACH_SCTIMES defined

View File

@ -1,163 +0,0 @@
$NetBSD: README.syscalls,v 1.3 2000/03/13 23:52:35 soren Exp $
XXX this file should be gutted. functions' comments should go with
XXX the functions. Further, this file is ... very out of date.
Once the new syscall argument-handling method was implemented, most
OSF/1 syscalls boiled down to their NetBSD equivalents. The
differences are detailed in this file.
Note that some OSF/1 syscalls, including some of those that map
directly to equivalent NetBSD syscalls, are not implemented; they
were not needed, so the effort to implement and check them was not
expended.
Finally, there are some OSF/1 syscalls which were left unimplemented,
but which seem strange enough to merit a bit more explanation.
OSF/1 compatibility is helped by the fact that the sigcontext
structure was created for NetBSD/Alpha to be the same as the OSF/1
sigcontext structure. Because of this, only one sendsig() function is
needed, and then the NetBSD sigreturn() function can be used for OSF/1
sigreturn(), as well.
The system calls are split out among the three files:
osf1_ioctl.c
osf1_misc.c
osf1_mount.c
as follows:
osf1_ioctl.c contains all osf1_ioctl() handling code.
osf1_mount.c contains all code dealing with mounting and
unmounting file systems, and with mount points in
general (e.g. osf1_getfsstat()).
osf1_misc.c contains the rest of the emulation functions.
The emulation functions as follows:
osf1_mknod()
dev_t's are different between OSF/1 and NetBSD. In OSF/1 a
dev_t has 12 bits of major number and 20 bits of minor number.
Under NetBSD, it's 24 bits of major, 8 bits of minor (but the
top 16 bits of the major number are unused, and may be
rearranged later). In any case, it was decided that the
primary use for OSF/1 binaries would be to complement native
NetBSD binaries, so file system dev_t's are assumed to be in
the NetBSD format, and osf1_mknod() translates from the OSF/1
format to the NetBSD format.
osf1_getfsstat()
The statfs structure is different between NetBSD and OSF/1,
and the way file system types are denoted is different, as
well. This routine is the same as getfsstat(), except it
converts the statfs structures before returning them to the
OSF/1 process.
osf1_lseek()
To compensate for quad alignment on 32-bit machines, the
NetBSD lseek() needs an extra argument of padding, before the
off_t 'offset' argument. This wrapper inserts the padding,
and calls the NetBSD routine.
osf1_mount()
The file system type specification and the way you specify
mount options differs substantially between NetBSD and OSF/1.
This routine (and its callees) fakes up NetBSD arguments, and
calls the NetBSD routine.
osf1_unmount()
Probably not necessary, but safe; translates flags, in case
the NetBSD unmount flags ever change.
osf1_exec_with_loader() [UNIMPLEMENTED]
From the description in the OSF/1 manual page, this executes a
file with a named loader, or "/sbin/loader" if none is named.
It appears to be used in some way, when executing dynamically
linked binaries, but is _not_ called directly from user space
in the normal case. The interface by which it passes the name
of the file to be executed, its arguments, etc., to the loader
is unspecified, and, from experimental evidence, doesn't seem
to be the normal UN*X argument-passing convention (i.e.
argc/argv). For proper dynamically linked binary support,
this function will probably have to be implemented, but it's
unclear how that can be done (short of disassembling a lot of
code).
osf1_open()
Translates OSF/1 flags to NetBSD flags.
osf1_ioctl()
Screens out ioctl requests that aren't known to work, and
translates those that differ between NetBSD and OSF/1.
osf1_reboot()
Translates OSF/1 flags to NetBSD flags.
osf1_stat()
The stat structure differs between NetBSD and OSF/1, both in
terms of field sizes, and in the dev_t representation.
This does a NetBSD stat(), translates the results, and returns
them to the OSF/1 process.
osf1_lstat()
Same as osf1_stat(), but for lstat().
osf1_mmap()
The NetBSD version needs 4 bytes of padding before the off_t
'pos' argument, and also uses different flags than the OSF/1
version. This wrapper translates the flags and deals with the
argument struct padding differences, then calls the NetBSD
routine.
osf1_fstat()
Same as osf1_stat(), but for fstat().
osf1_fcntl()
Translates OSF/1 fcntl() requests into their NetBSD
counterparts, then calls the NetBSD fcntl() to do the
operations.
osf1_socket()
Makes sure that the socket type is valid for NetBSD, and if
so, calls NetBSD's socket().
osf1_sendto()
Makes sure that the 'flags' argument doesn't use flags that
NetBSD can't handle, and calls NetBSD's sendto().
osf1_getrlimit()
Makes sure that the 'which' selector is one that NetBSD can
deal with, and calls NetBSD's getrlimit().
osf1_setrlimit()
Same as osf1_getrlimit(), but for setrlimit().
osf1_sigaction()
Deals with the differences in the NetBSD and OSF/1 sigaction
structures, and calls NetBSD's sigaction with the appropriate
arguments. If the call requests that the old sigaction be
passed back, osf1_sigaction() translates it back to the OSF/1
form, and returns it appropriately.
osf1_statfs()
Does that statfs() on the given pathname, then translates the
NetBSD statfs structure into the one that OSF/1 uses and
returns it. Makes a best effort on the mount type, because
there's not a one-to-one mapping between NetBSD and OSF/1
mount types.
osf1_fstatfs()
Same as osf1_statfs(), but for fstatfs().
osf1_usleep_thread()
This function is how sleep() and usleep() (and possibly other
functions) are implemented in OSF/1. Its usage was discovered
by disassembling the library routines that use it. It takes
two pointers to timeval structures as arguments. The first
contains the amount of time (in seconds and microseconds) to
sleep. If the second pointer is non-null, if the process
wakes up early, the amount of time "unslept" is returned. If
the process doesn't wake up early, zero is returned.
osf1_setsysinfo()
A null-op; used early on, but nothing cares that it actually
does anything.

View File

@ -1,38 +0,0 @@
# $NetBSD: files.osf1,v 1.22 2019/03/24 16:24:19 maxv Exp $
#
# Config file description for machine-independent OSF/1 compat code.
# Included by ports that need it.
# ports should define any machine-specific files they need in their
# own file lists.
# XXX COMPAT_OSF1 requires ECOFF
define compat_osf1
# syscall table-related files
file compat/osf1/osf1_syscalls.c compat_osf1
file compat/osf1/osf1_sysent.c compat_osf1
# OSF/1 <-> NetBSD structure, flag, and value conversion files
file compat/osf1/osf1_cvt.c compat_osf1
file compat/osf1/osf1_errno.c compat_osf1
file compat/osf1/osf1_signo.c compat_osf1
# functionality emulation files
file compat/osf1/osf1_descrip.c compat_osf1
file compat/osf1/osf1_exec.c compat_osf1
file compat/osf1/osf1_exec_ecoff.c compat_osf1 & exec_ecoff
file compat/osf1/osf1_file.c compat_osf1
file compat/osf1/osf1_generic.c compat_osf1
file compat/osf1/osf1_ioctl.c compat_osf1
file compat/osf1/osf1_misc.c compat_osf1
file compat/osf1/osf1_mmap.c compat_osf1
file compat/osf1/osf1_mod.c compat_osf1
file compat/osf1/osf1_mount.c compat_osf1
file compat/osf1/osf1_prot.c compat_osf1
file compat/osf1/osf1_resource.c compat_osf1
file compat/osf1/osf1_signal.c compat_osf1
file compat/osf1/osf1_socket.c compat_osf1
file compat/osf1/osf1_sysv_ipc.c compat_osf1
file compat/osf1/osf1_time.c compat_osf1

View File

@ -1,656 +0,0 @@
/* $NetBSD: osf1.h,v 1.27 2005/12/11 12:20:23 christos Exp $ */
/*
* Copyright (c) 1999 Christopher G. Demetriou. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Christopher G. Demetriou
* for the NetBSD Project.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _COMPAT_OSF1_OSF1_H_
#define _COMPAT_OSF1_OSF1_H_
/*
* Collected OSF/1 definitions and structures, sorted by OSF/1 header.
* Error numbers (errno.h) aren't here, since they're likely to change
* (additions) more often.
*
* This file is up to date as of Digital UNIX V4.0.
*/
#include <sys/types.h>
#include <compat/osf1/osf1_errno.h>
#include <compat/osf1/osf1_signal.h>
/*
* type and structure definitions used by other structures
*/
typedef int16_t osf1_short;
typedef int32_t osf1_int;
typedef int64_t osf1_long;
typedef u_int32_t osf1_u_int;
typedef int32_t osf1_dev_t;
typedef u_int32_t osf1_ino_t;
typedef u_int32_t osf1_mode_t;
typedef u_int16_t osf1_nlink_t;
typedef u_int32_t osf1_uid_t;
typedef u_int32_t osf1_gid_t;
typedef u_int64_t osf1_off_t;
typedef int32_t osf1_time_t;
typedef u_int32_t osf1_uint_t;
typedef u_int64_t osf1_sigset_t;
typedef u_int64_t osf1_size_t;
typedef u_int64_t osf1_fsid_t;
typedef u_int64_t osf1_rlim_t;
typedef void *osf1_data_ptr; /* XXX hard to fix size */
typedef void *osf1_fcn_ptr; /* XXX hard to fix size, bogus */
typedef osf1_int osf1_key_t;
typedef osf1_int osf1_pid_t;
typedef u_int64_t osf1_blksize_t;
typedef u_int64_t osf1_blkcnt_t;
struct osf1_timeval { /* time.h */
osf1_time_t tv_sec;
osf1_int tv_usec;
};
/* access.h */
#define OSF1_F_OK 0 /* pseudo-flag */
#define OSF1_X_OK 0x01
#define OSF1_W_OK 0x02
#define OSF1_R_OK 0x04
/* auxv.h */
union osf1_auxv_data {
osf1_long a_val;
osf1_data_ptr a_ptr;
osf1_fcn_ptr a_fcn;
};
struct osf1_auxv {
osf1_int a_type;
union osf1_auxv_data a_un;
};
/* auxv entry types */
#define OSF1_AT_NULL 0
#define OSF1_AT_IGNORE 1
#define OSF1_AT_EXECFD 2
#define OSF1_AT_PHDR 3
#define OSF1_AT_PHENT 4
#define OSF1_AT_PHNUM 5
#define OSF1_AT_PAGESZ 6
#define OSF1_AT_BASE 7
#define OSF1_AT_FLAGS 8
#define OSF1_AT_ENTRY 9
#define OSF1_AT_EXEC_FILENAME 1001
#define OSF1_AT_EXEC_LOADER_FILENAME 1002
#define OSF1_AT_EXEC_LOADER_FLAGS 1003
/* exec.h/ldr_exec.h */
#define OSF1_LDR_EXEC_DEFAULT_LOADER "/sbin/loader"
/* exec_with_loader()/OSF1_AT_EXEC_LOADER_FLAGS flags regions */
#define OSF1_LDR_EXEC_SYSTEM_MASK 0xffff0000
#define OSF1_LDR_EXEC_USER_MASK 0xffff0000
/* OSF1_AT_EXEC_LOADER_FLAGS flags */
#define OSF1_LDR_EXEC_NOPRIVS_F 0x10000000
#define OSF1_LDR_EXEC_PTRACE_F 0x20000000
#define OSF1_LDR_EXEC_SETGID_F 0x40000000
#define OSF1_LDR_EXEC_SETUID_F 0x80000000
/* fcntl.h */
/* fcntl ops */
#define OSF1_F_DUPFD 0
#define OSF1_F_GETFD 1 /* uses flags, see below */
#define OSF1_F_SETFD 2 /* uses flags, see below */
#define OSF1_F_GETFL 3 /* uses flags, see below */
#define OSF1_F_SETFL 4 /* uses flags, see below */
#define OSF1_F_GETOWN 5
#define OSF1_F_SETOWN 6
#define OSF1_F_GETLK 7 /* uses osf1_flock, see below */
#define OSF1_F_SETLK 8 /* uses osf1_flock, see below */
#define OSF1_F_SETLKW 9 /* uses osf1_flock, see below */
#define OSF1_F_RGETLK 10 /* [lock mgr op] */
#define OSF1_F_RSETLK 11 /* [lock mgr op] */
#define OSF1_F_CNVT 12 /* [lock mgr op] */
#define OSF1_F_RSETLKW 13 /* [lock mgr op] */
#define OSF1_F_PURGEFS 14 /* [lock mgr op] */
#define OSF1_F_PURGENFS 15 /* [DECsafe op] */
/* fcntl GETFD/SETFD flags */
#define OSF1_FD_CLOEXEC 1
/* fcntl GETFL/SETFL flags, in addition to the O_* flags below */
#define OSF1_FASYNC 0x00000040
/* struct osf1_flock, for GETLK/SETLK/SETLKW */
struct osf1_flock {
osf1_short l_type;
osf1_short l_whence;
osf1_off_t l_start;
osf1_off_t l_len;
osf1_pid_t l_pid;
};
/* GETLK/SETLK/SETLKW locking types */
#define OSF1_F_RDLCK 1
#define OSF1_F_WRLCK 2
#define OSF1_F_UNLCK 8
/* open flags */
#define OSF1_O_RDONLY 0x00000000
#define OSF1_O_WRONLY 0x00000001
#define OSF1_O_RDWR 0x00000002
#define OSF1_O_ACCMODE 0x00000003 /* mask of RD and WR bits */
#define OSF1_O_NONBLOCK 0x00000004
#define OSF1_O_APPEND 0x00000008
/* no 0x00000010 */
#define OSF1_O_DEFER 0x00000020
/* no 0x00000040 */
/* no 0x00000080 */
/* no 0x00000100 */
#define OSF1_O_CREAT 0x00000200
#define OSF1_O_TRUNC 0x00000400
#define OSF1_O_EXCL 0x00000800
#define OSF1_O_NOCTTY 0x00001000
#define OSF1_O_SYNC 0x00004000
#define OSF1_O_NDELAY 0x00008000
#define OSF1_O_DRD 0x00008000 /* == O_NDELAY, DON'T USE */
/* no 0x00010000 */
/* no 0x00020000 */
/* no 0x00040000 */
#define OSF1_O_DSYNC 0x00080000
#define OSF1_O_RSYNC 0x00100000
/* no 0x00200000+ */
/* ioctl.h */
#define OSF1_IOCPARM_MASK 0x1fff
#define OSF1_IOCPARM_LEN(x) (((x) >> 16) & OSF1_IOCPARM_MASK)
#define OSF1_IOCGROUP(x) (((x) >> 8) & 0xff)
#define OSF1_IOCCMD(x) ((x) & 0xff)
#define OSF1_IOCPARM_MAX 8192
#define OSF1_IOC_VOID 0x20000000
#define OSF1_IOC_OUT 0x40000000
#define OSF1_IOC_IN 0x80000000
#define OSF1_IOC_INOUT (OSF1_IOC_IN|OSF1_IOC_OUT)
#define OSF1_IOC_DIRMASK 0xe0000000
/* mman.h */
/* protection mask */
#define OSF1_PROT_NONE 0 /* pseudo-flag */
#define OSF1_PROT_READ 0x0001
#define OSF1_PROT_WRITE 0x0002
#define OSF1_PROT_EXEC 0x0004
/* mmap flags */
#define OSF1_MAP_SHARED 0x0001
#define OSF1_MAP_PRIVATE 0x0002
#define OSF1_MAP_FILE 0 /* pseudo-flag */
#define OSF1_MAP_ANON 0x0010
#define OSF1_MAP_TYPE 0x00f0
#define OSF1_MAP_FIXED 0x0100
#define OSF1_MAP_VARIABLE 0 /* pseudo-flag */
#define OSF1_MAP_HASSEMAPHORE 0x0200
#define OSF1_MAP_INHERIT 0x0400
#define OSF1_MAP_UNALIGNED 0x0800
/* madvise operations */
#define OSF1_MADV_NORMAL 0
#define OSF1_MADV_RANDOM 1
#define OSF1_MADV_SEQUENTIAL 2
#define OSF1_MADV_WILLNEED 3
#define OSF1_MADV_DONTNEED_COMPAT 4
#define OSF1_MADV_SPACEAVAIL 5
#define OSF1_MADV_DONTNEED 6
/* mount.h */
/* file system type numbers */
#define OSF1_MOUNT_NONE 0
#define OSF1_MOUNT_UFS 1
#define OSF1_MOUNT_NFS 2
#define OSF1_MOUNT_MFS 3
#define OSF1_MOUNT_PC 4
#define OSF1_MOUNT_S5FS 5
#define OSF1_MOUNT_CDFS 6
#define OSF1_MOUNT_DFS 7
#define OSF1_MOUNT_EFS 8
#define OSF1_MOUNT_PROCFS 9
#define OSF1_MOUNT_MSFS 10
#define OSF1_MOUNT_FFM 11
#define OSF1_MOUNT_FDFS 12
#define OSF1_MOUNT_ADDON 13
#define OSF1_MOUNT_NFS3 14
#define OSF1_MNAMELEN 90
/* MFS mount argument structure */
struct osf1_mfs_args {
osf1_data_ptr name;
osf1_data_ptr base;
osf1_u_int size;
};
/* NFS mount argument structure */
struct osf1_nfs_args {
osf1_data_ptr addr;
osf1_data_ptr fh;
osf1_int flags;
osf1_int wsize;
osf1_int rsize;
osf1_int timeo;
osf1_int retrans;
osf1_data_ptr hostname;
osf1_int acregmin;
osf1_int acregmax;
osf1_int acdirmin;
osf1_int acdirmax;
osf1_data_ptr netname;
osf1_data_ptr pathconf;
};
/* NFS mount argument structure flags */
#define OSF1_NFSMNT_SOFT 0x00000001
#define OSF1_NFSMNT_WSIZE 0x00000002
#define OSF1_NFSMNT_RSIZE 0x00000004
#define OSF1_NFSMNT_TIMEO 0x00000008
#define OSF1_NFSMNT_RETRANS 0x00000010
#define OSF1_NFSMNT_HOSTNAME 0x00000020
#define OSF1_NFSMNT_INT 0x00000040
#define OSF1_NFSMNT_NOCONN 0x00000080
#define OSF1_NFSMNT_NOAC 0x00000100
#define OSF1_NFSMNT_ACREGMIN 0x00000200
#define OSF1_NFSMNT_ACREGMAX 0x00000400
#define OSF1_NFSMNT_ACDIRMIN 0x00000800
#define OSF1_NFSMNT_ACDIRMAX 0x00001000
#define OSF1_NFSMNT_NOCTO 0x00002000
#define OSF1_NFSMNT_POSIX 0x00004000
#define OSF1_NFSMNT_AUTO 0x00008000
#define OSF1_NFSMNT_SEC 0x00010000
#define OSF1_NFSMNT_TCP 0x00020000
#define OSF1_NFSMNT_PROPLIST 0x00040000
/* no 0x00080000+ */
/* union of all mount argument structures */
union osf1_mount_info {
struct osf1_mfs_args mfs_args;
struct osf1_nfs_args nfs_args;
char pad[80];
};
/* statfs structure */
struct osf1_statfs {
osf1_short f_type;
osf1_short f_flags;
osf1_int f_fsize;
osf1_int f_bsize;
osf1_int f_blocks;
osf1_int f_bfree;
osf1_int f_bavail;
osf1_int f_files;
osf1_int f_ffree;
osf1_fsid_t f_fsid;
osf1_int f_spare[9];
char f_mntonname[OSF1_MNAMELEN];
char f_mntfromname[OSF1_MNAMELEN];
union osf1_mount_info mount_info;
};
/* reboot.h */
/* reboot flags */
#define OSF1_RB_AUTOBOOT 0 /* pseudo-flag */
#define OSF1_RB_ASKNAME 0x0001
#define OSF1_RB_SINGLE 0x0002
#define OSF1_RB_NOSYNC 0x0004
#define OSF1_RB_KDB 0x0004 /* == RB_NOSYNC; boot only? */
#define OSF1_RB_HALT 0x0008
#define OSF1_RB_INITNAME 0x0010
#define OSF1_RB_DFLTROOT 0x0020
#define OSF1_RB_ALTBOOT 0x0040
#define OSF1_RB_UNIPROC 0x0080
#define OSF1_RB_PARAM 0x0100
#define OSF1_RB_DUMP 0x0200
/* resource.h */
#define OSF1_RUSAGE_THREAD 1
#define OSF1_RUSAGE_SELF 0
#define OSF1_RUSAGE_CHILDREN -1
struct osf1_rusage {
struct osf1_timeval ru_utime;
struct osf1_timeval ru_stime;
osf1_long ru_maxrss;
osf1_long ru_ixrss;
osf1_long ru_idrss;
osf1_long ru_isrss;
osf1_long ru_minflt;
osf1_long ru_majflt;
osf1_long ru_nswap;
osf1_long ru_inblock;
osf1_long ru_oublock;
osf1_long ru_msgsnd;
osf1_long ru_msgrcv;
osf1_long ru_nsignals;
osf1_long ru_nvcsw;
osf1_long ru_nivcsw;
};
#define OSF1_RLIMIT_CPU 0
#define OSF1_RLIMIT_FSIZE 1
#define OSF1_RLIMIT_DATA 2
#define OSF1_RLIMIT_STACK 3
#define OSF1_RLIMIT_CORE 4
#define OSF1_RLIMIT_RSS 5
#define OSF1_RLIMIT_NOFILE 6
#define OSF1_RLIMIT_AS 7
#define OSF1_RLIM_INFINITY 0x7fffffffffffffffL
struct osf1_rlimit {
rlim_t rlim_cur;
rlim_t rlim_max;
};
/* seek.h */
#define OSF1_SEEK_SET 0
#define OSF1_SEEK_CUR 1
#define OSF1_SEEK_END 2
/* signal.h (some in machine/signal.h) */
struct osf1_sigaction {
osf1_fcn_ptr osf1_sa_handler;
osf1_sigset_t osf1_sa_mask;
osf1_int osf1_sa_flags;
osf1_int osf1_sa_signo;
};
/* actually from sysmisc.h */
struct osf1_sigaltstack {
osf1_data_ptr ss_sp;
osf1_int ss_flags;
osf1_size_t ss_size;
};
/* sigaction flags */
#define OSF1_SA_ONSTACK 0x00000001
#define OSF1_SA_RESTART 0x00000002
#define OSF1_SA_NOCLDSTOP 0x00000004
#define OSF1_SA_NODEFER 0x00000008
#define OSF1_SA_RESETHAND 0x00000010
#define OSF1_SA_NOCLDWAIT 0x00000020
#define OSF1_SA_SIGINFO 0x00000040
/* sigaltstack flags */
#define OSF1_SS_ONSTACK 0x00000001
#define OSF1_SS_DISABLE 0x00000002
#define OSF1_SS_NOMASK 0x00000004
#define OSF1_SS_UCONTEXT 0x00000008
/* signal set manipulation macros */
#define osf1_sigmask(n) ((osf1_sigset_t)1 << ((n) - 1))
#define osf1_sigemptyset(s) (*(s) = (osf1_sigset_t)0)
#define osf1_sigismember(s, n) (*(s) & osf1_sigmask(n))
#define osf1_sigaddset(s, n) (*(s) |= osf1_sigmask(n))
/* socket.h */
struct osf1_msghdr {
osf1_data_ptr msg_name;
osf1_u_int msg_namelen;
osf1_data_ptr msg_iov; /* struct osf1_iovec_xopen * */
osf1_u_int msg_iovlen;
osf1_data_ptr msg_control;
osf1_u_int msg_controllen;
osf1_int msg_flags;
};
struct osf1_msghdr_xopen {
osf1_data_ptr msg_name;
osf1_size_t msg_namelen;
osf1_data_ptr msg_iov; /* struct osf1_iovec_xopen * */
osf1_int msg_iovlen;
osf1_data_ptr msg_control;
osf1_size_t msg_controllen;
osf1_int msg_flags;
};
/* max message iov len */
#define OSF1_MSG_MAXIOVLEN 16
/* send/recv-family message flags */
#define OSF1_MSG_OOB 0x0001
#define OSF1_MSG_PEEK 0x0002
#define OSF1_MSG_DONTROUTE 0x0004
#define OSF1_MSG_EOR 0x0008
#define OSF1_MSG_TRUNC 0x0010
#define OSF1_MSG_CTRUNC 0x0020
#define OSF1_MSG_WAITALL 0x0040
/* stat.h */
struct osf1_stat {
osf1_dev_t st_dev;
osf1_ino_t st_ino;
osf1_mode_t st_mode;
osf1_nlink_t st_nlink;
osf1_uid_t st_uid;
osf1_gid_t st_gid;
osf1_dev_t st_rdev;
osf1_off_t st_size;
osf1_time_t st_atime_sec;
osf1_int st_spare1;
osf1_time_t st_mtime_sec;
osf1_int st_spare2;
osf1_time_t st_ctime_sec;
osf1_int st_spare3;
osf1_uint_t st_blksize;
osf1_int st_blocks;
osf1_uint_t st_flags;
osf1_uint_t st_gen;
};
struct osf1_stat2 {
osf1_dev_t st_dev;
osf1_int st_dead1; /* was st_ino */
osf1_mode_t st_mode;
osf1_nlink_t st_nlink;
osf1_short st_dead2; /* something to do with nlink? */
osf1_uid_t st_uid;
osf1_gid_t st_gid;
osf1_dev_t st_rdev;
osf1_dev_t st_rdev2;
osf1_off_t st_size;
osf1_time_t st_dead3;
osf1_int st_uatime;
osf1_time_t st_dead4;
osf1_int st_umtime;
osf1_time_t st_dead5;
osf1_int st_uctime;
osf1_int st_dead6;
osf1_int st_dead7;
osf1_uint_t st_flags;
osf1_uint_t st_generation;
osf1_long st_unused1[4];
osf1_ino_t st_ino;
osf1_int st_unused;
osf1_time_t st_atime_sec;
osf1_int st_unused2;
osf1_time_t st_mtime_sec;
osf1_int st_unused3;
osf1_time_t st_ctime_sec;
osf1_int st_unused4;
osf1_blksize_t st_blocksize;
osf1_blkcnt_t st_blocks;
};
/* systeminfo.h */
#define OSF1_SI_SYSNAME 1
#define OSF1_SI_HOSTNAME 2
#define OSF1_SI_RELEASE 3
#define OSF1_SI_VERSION 4
#define OSF1_SI_MACHINE 5
#define OSF1_SI_ARCHITECTURE 6
#define OSF1_SI_HW_SERIAL 7
#define OSF1_SI_HW_PROVIDER 8
#define OSF1_SI_SRPC_DOMAIN 9
#define OSF1_SI_SET_HOSTNAME 258
#define OSF1_SI_SET_SYSNAME 259
#define OSF1_SI_SET_SRPC_DOMAIN 265
/* time.h */
struct osf1_itimerval {
struct osf1_timeval it_interval;
struct osf1_timeval it_value;
};
#define OSF1_ITIMER_REAL 0
#define OSF1_ITIMER_VIRTUAL 1
#define OSF1_ITIMER_PROF 2
struct osf1_timezone {
osf1_int tz_minuteswest;
osf1_int tz_dsttime;
};
/* types.h */
#define osf1_major(x) ((((dev_t)(x)) >> 20) & 0x00000fff)
#define osf1_minor(x) ((((dev_t)(x)) >> 0) & 0x000fffff)
#define osf1_makedev(x,y) ((((dev_t)(x)) << 20) | ((dev_t)(y)))
/* uio.h */
struct osf1_iovec {
osf1_data_ptr iov_base;
osf1_int iov_len;
};
struct osf1_iovec_xopen {
osf1_data_ptr iov_base;
osf1_size_t iov_len;
};
/* unistd.h (user-land header) */
#define OSF1__PC_CHOWN_RESTRICTED 10
#define OSF1__PC_LINK_MAX 11
#define OSF1__PC_MAX_CANON 12
#define OSF1__PC_MAX_INPUT 13
#define OSF1__PC_NAME_MAX 14
#define OSF1__PC_NO_TRUNC 15
#define OSF1__PC_PATH_MAX 16
#define OSF1__PC_PIPE_BUF 17
#define OSF1__PC_VDISABLE 18
/* utsname.h */
#define OSF1__SYS_NMLN 32
struct osf1_utsname {
char sysname[OSF1__SYS_NMLN];
char nodename[OSF1__SYS_NMLN];
char release[OSF1__SYS_NMLN];
char version[OSF1__SYS_NMLN];
char machine[OSF1__SYS_NMLN];
};
/* wait.h */
/* wait3() and wait4() options. */
#define OSF1_WNOHANG 0x01
#define OSF1_WUNTRACED 0x02
/* XXX should have status word bits */
/* for set/get sysinfo */
struct osf1_cpu_info {
int current_cpu;
int cpus_in_box;
int cpu_type;
int ncpus;
u_int64_t cpus_present;
u_int64_t cpus_running;
u_int64_t cpu_binding;
u_int64_t cpu_ex_binding;
int mhz;
int unused[3];
};
#define OSF_SET_IEEE_FP_CONTROL 14
#define OSF_GET_MAX_UPROCS 2
#define OSF_GET_PHYSMEM 19
#define OSF_GET_MAX_CPU 30
#define OSF_GET_IEEE_FP_CONTROL 45
#define OSF_GET_CPUS_IN_BOX 55
#define OSF_GET_CPU_INFO 59
#define OSF_GET_PROC_TYPE 60
#define OSF_GET_HWRPB 101
#define OSF_GET_PLATFORM_NAME 103
#endif /* _COMPAT_OSF1_OSF1_H_ */

View File

@ -1,629 +0,0 @@
/* $NetBSD: osf1_cvt.c,v 1.28 2013/11/04 16:52:08 christos Exp $ */
/*
* Copyright (c) 1999 Christopher G. Demetriou. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Christopher G. Demetriou
* for the NetBSD Project.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: osf1_cvt.c,v 1.28 2013/11/04 16:52:08 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/namei.h>
#include <sys/proc.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <sys/filedesc.h>
#include <sys/kernel.h>
#include <sys/mman.h>
#include <sys/mount.h>
#include <sys/signal.h>
#include <sys/signalvar.h>
#include <sys/reboot.h>
#include <sys/syscallargs.h>
#include <sys/exec.h>
#include <sys/vnode.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/resource.h>
#include <sys/resourcevar.h>
#include <sys/wait.h>
#include <uvm/uvm.h> /* XXX see mmap emulation */
#include <nfs/rpcv2.h>
#include <nfs/nfsproto.h>
#include <nfs/nfs.h>
#include <nfs/nfsmount.h>
#include <compat/osf1/osf1.h>
#include <compat/common/compat_util.h>
#include <compat/osf1/osf1_cvt.h>
const struct emul_flags_xtab osf1_access_flags_xtab[] = {
#if 0 /* pseudo-flag */
{ OSF1_F_OK, OSF1_F_OK, F_OK },
#endif
{ OSF1_X_OK, OSF1_X_OK, X_OK },
{ OSF1_W_OK, OSF1_W_OK, W_OK },
{ OSF1_R_OK, OSF1_R_OK, R_OK },
{ 0 }
};
const struct emul_flags_xtab osf1_fcntl_getsetfd_flags_rxtab[] = {
{ FD_CLOEXEC, FD_CLOEXEC, OSF1_FD_CLOEXEC },
{ 0 }
};
const struct emul_flags_xtab osf1_fcntl_getsetfd_flags_xtab[] = {
{ OSF1_FD_CLOEXEC, OSF1_FD_CLOEXEC, FD_CLOEXEC },
{ 0 }
};
/* flags specific to GETFL/SETFL; also uses open rxtab */
const struct emul_flags_xtab osf1_fcntl_getsetfl_flags_rxtab[] = {
{ FASYNC, FASYNC, OSF1_FASYNC },
{ 0 }
};
/* flags specific to GETFL/SETFL; also uses open xtab */
const struct emul_flags_xtab osf1_fcntl_getsetfl_flags_xtab[] = {
{ OSF1_FASYNC, OSF1_FASYNC, FASYNC },
{ 0 }
};
const struct emul_flags_xtab osf1_mmap_flags_xtab[] = {
{ OSF1_MAP_SHARED, OSF1_MAP_SHARED, MAP_SHARED },
{ OSF1_MAP_PRIVATE, OSF1_MAP_PRIVATE, MAP_PRIVATE },
{ OSF1_MAP_TYPE, OSF1_MAP_FILE, MAP_FILE },
{ OSF1_MAP_TYPE, OSF1_MAP_ANON, MAP_ANON },
{ OSF1_MAP_FIXED, OSF1_MAP_FIXED, MAP_FIXED },
#if 0 /* pseudo-flag, and the default */
{ OSF1_MAP_VARIABLE, OSF1_MAP_VARIABLE, 0 },
#endif
{ OSF1_MAP_HASSEMAPHORE, OSF1_MAP_HASSEMAPHORE, MAP_HASSEMAPHORE },
{ OSF1_MAP_INHERIT, OSF1_MAP_INHERIT, MAP_INHERIT },
#if 0 /* no equivalent +++ */
{ OSF1_MAP_UNALIGNED, OSF1_MAP_UNALIGNED, ??? },
#endif
{ 0 }
};
const struct emul_flags_xtab osf1_mmap_prot_xtab[] = {
#if 0 /* pseudo-flag */
{ OSF1_PROT_NONE, OSF1_PROT_NONE, PROT_NONE },
#endif
{ OSF1_PROT_READ, OSF1_PROT_READ, PROT_READ },
{ OSF1_PROT_WRITE, OSF1_PROT_WRITE, PROT_READ|PROT_WRITE },
{ OSF1_PROT_EXEC, OSF1_PROT_EXEC, PROT_READ|PROT_EXEC },
{ 0 }
};
const struct emul_flags_xtab osf1_nfs_mount_flags_xtab[] = {
{ OSF1_NFSMNT_SOFT, OSF1_NFSMNT_SOFT, NFSMNT_SOFT, },
{ OSF1_NFSMNT_WSIZE, OSF1_NFSMNT_WSIZE, NFSMNT_WSIZE, },
{ OSF1_NFSMNT_RSIZE, OSF1_NFSMNT_RSIZE, NFSMNT_RSIZE, },
{ OSF1_NFSMNT_TIMEO, OSF1_NFSMNT_TIMEO, NFSMNT_TIMEO, },
{ OSF1_NFSMNT_RETRANS, OSF1_NFSMNT_RETRANS, NFSMNT_RETRANS, },
#if 0 /* no equivalent; needs special handling, see below */
{ OSF1_NFSMNT_HOSTNAME, OSF1_NFSMNT_HOSTNAME, ???, },
#endif
{ OSF1_NFSMNT_INT, OSF1_NFSMNT_INT, NFSMNT_INT, },
{ OSF1_NFSMNT_NOCONN, OSF1_NFSMNT_NOCONN, NFSMNT_NOCONN, },
#if 0 /* no equivalents */
{ OSF1_NFSMNT_NOAC, OSF1_NFSMNT_NOAC, ???, },
{ OSF1_NFSMNT_ACREGMIN, OSF1_NFSMNT_ACREGMIN, ???, },
{ OSF1_NFSMNT_ACREGMAX, OSF1_NFSMNT_ACREGMAX, ???, },
{ OSF1_NFSMNT_ACDIRMIN, OSF1_NFSMNT_ACDIRMIN, ???, },
{ OSF1_NFSMNT_ACDIRMAX, OSF1_NFSMNT_ACDIRMAX, ???, },
{ OSF1_NFSMNT_NOCTO, OSF1_NFSMNT_NOCTO, ???, },
{ OSF1_NFSMNT_POSIX, OSF1_NFSMNT_POSIX, ???, },
{ OSF1_NFSMNT_AUTO, OSF1_NFSMNT_AUTO, ???, },
{ OSF1_NFSMNT_SEC, OSF1_NFSMNT_SEC, ???, },
{ OSF1_NFSMNT_TCP, OSF1_NFSMNT_TCP, ???, },
{ OSF1_NFSMNT_PROPLIST, OSF1_NFSMNT_PROPLIST, ???, },
#endif
{ 0 }
};
const struct emul_flags_xtab osf1_open_flags_rxtab[] = {
{ O_ACCMODE, O_RDONLY, OSF1_O_RDONLY },
{ O_ACCMODE, O_WRONLY, OSF1_O_WRONLY },
{ O_ACCMODE, O_RDWR, OSF1_O_RDWR },
{ O_NONBLOCK, O_NONBLOCK, OSF1_O_NONBLOCK },
{ O_APPEND, O_APPEND, OSF1_O_APPEND },
#if 0 /* no equivalent +++ */
{ ???, ???, O_DEFER },
#endif
{ O_CREAT, O_CREAT, OSF1_O_CREAT },
{ O_TRUNC, O_TRUNC, OSF1_O_TRUNC },
{ O_EXCL, O_EXCL, OSF1_O_EXCL },
{ O_NOCTTY, O_NOCTTY, OSF1_O_NOCTTY },
{ O_SYNC, O_SYNC, OSF1_O_SYNC },
{ O_NDELAY, O_NDELAY, OSF1_O_NDELAY },
#if 0 /* no equivalent, also same value as O_NDELAY! */
{ ???, ???, O_DRD },
#endif
{ O_DSYNC, O_DSYNC, OSF1_O_DSYNC },
{ O_RSYNC, O_RSYNC, OSF1_O_RSYNC },
{ 0 }
};
const struct emul_flags_xtab osf1_open_flags_xtab[] = {
{ OSF1_O_ACCMODE, OSF1_O_RDONLY, O_RDONLY },
{ OSF1_O_ACCMODE, OSF1_O_WRONLY, O_WRONLY },
{ OSF1_O_ACCMODE, OSF1_O_RDWR, O_RDWR },
{ OSF1_O_NONBLOCK, OSF1_O_NONBLOCK, O_NONBLOCK },
{ OSF1_O_APPEND, OSF1_O_APPEND, O_APPEND },
#if 0 /* no equivalent +++ */
{ OSF1_O_DEFER, OSF1_O_DEFER, ??? },
#endif
{ OSF1_O_CREAT, OSF1_O_CREAT, O_CREAT },
{ OSF1_O_TRUNC, OSF1_O_TRUNC, O_TRUNC },
{ OSF1_O_EXCL, OSF1_O_EXCL, O_EXCL },
{ OSF1_O_NOCTTY, OSF1_O_NOCTTY, O_NOCTTY },
{ OSF1_O_SYNC, OSF1_O_SYNC, O_SYNC },
{ OSF1_O_NDELAY, OSF1_O_NDELAY, O_NDELAY },
#if 0 /* no equivalent, also same value as O_NDELAY! */
{ OSF1_O_DRD, OSF1_O_DRD, ??? },
#endif
{ OSF1_O_DSYNC, OSF1_O_DSYNC, O_DSYNC },
{ OSF1_O_RSYNC, OSF1_O_RSYNC, O_RSYNC },
{ 0 }
};
const struct emul_flags_xtab osf1_reboot_opt_xtab[] = {
#if 0 /* pseudo-flag */
{ OSF1_RB_AUTOBOOT, OSF1_RB_AUTOBOOT, RB_AUTOBOOT },
#endif
{ OSF1_RB_ASKNAME, OSF1_RB_ASKNAME, RB_ASKNAME },
{ OSF1_RB_SINGLE, OSF1_RB_SINGLE, RB_SINGLE },
{ OSF1_RB_NOSYNC, OSF1_RB_NOSYNC, RB_NOSYNC },
#if 0 /* same value as O_NDELAY, only used at boot time? */
{ OSF1_RB_KDB, OSF1_RB_KDB, RB_KDB },
#endif
{ OSF1_RB_HALT, OSF1_RB_HALT, RB_HALT },
{ OSF1_RB_INITNAME, OSF1_RB_INITNAME, RB_INITNAME },
#if 0 /* no equivalents +++ */
{ OSF1_RB_DFLTROOT, OSF1_RB_DFLTROOT, ??? },
{ OSF1_RB_ALTBOOT, OSF1_RB_ALTBOOT, ??? },
{ OSF1_RB_UNIPROC, OSF1_RB_UNIPROC, ??? },
{ OSF1_RB_PARAM, OSF1_RB_PARAM, ??? },
#endif
{ OSF1_RB_DUMP, OSF1_RB_DUMP, RB_DUMP },
{ 0 }
};
const struct emul_flags_xtab osf1_sendrecv_msg_flags_xtab[] = {
{ OSF1_MSG_OOB, OSF1_MSG_OOB, MSG_OOB },
{ OSF1_MSG_PEEK, OSF1_MSG_PEEK, MSG_PEEK },
{ OSF1_MSG_DONTROUTE, OSF1_MSG_DONTROUTE, MSG_DONTROUTE },
{ OSF1_MSG_EOR, OSF1_MSG_EOR, MSG_EOR },
{ OSF1_MSG_TRUNC, OSF1_MSG_TRUNC, MSG_TRUNC },
{ OSF1_MSG_CTRUNC, OSF1_MSG_CTRUNC, MSG_CTRUNC },
{ OSF1_MSG_WAITALL, OSF1_MSG_WAITALL, MSG_WAITALL },
{ 0 }
};
const struct emul_flags_xtab osf1_sigaction_flags_rxtab[] = {
{ SA_ONSTACK, SA_ONSTACK, OSF1_SA_ONSTACK },
{ SA_RESTART, SA_RESTART, OSF1_SA_RESTART },
{ SA_NOCLDSTOP, SA_NOCLDSTOP, OSF1_SA_NOCLDSTOP },
{ SA_NODEFER, SA_NODEFER, OSF1_SA_NODEFER },
{ SA_RESETHAND, SA_RESETHAND, OSF1_SA_RESETHAND },
{ SA_NOCLDWAIT, SA_NOCLDWAIT, OSF1_SA_NOCLDWAIT },
#if 0 /* XXX not yet */
{ SA_SIGINFO, SA_SIGINFO, OSF1_SA_SIGINFO },
#endif
{ 0 },
};
const struct emul_flags_xtab osf1_sigaction_flags_xtab[] = {
{ OSF1_SA_ONSTACK, OSF1_SA_ONSTACK, SA_ONSTACK },
{ OSF1_SA_RESTART, OSF1_SA_RESTART, SA_RESTART },
{ OSF1_SA_NOCLDSTOP, OSF1_SA_NOCLDSTOP, SA_NOCLDSTOP },
{ OSF1_SA_NODEFER, OSF1_SA_NODEFER, SA_NODEFER },
{ OSF1_SA_RESETHAND, OSF1_SA_RESETHAND, SA_RESETHAND },
{ OSF1_SA_NOCLDWAIT, OSF1_SA_NOCLDWAIT, SA_NOCLDWAIT },
#if 0 /* XXX not yet */
{ OSF1_SA_SIGINFO, OSF1_SA_SIGINFO, SA_SIGINFO },
#endif
{ 0 },
};
const struct emul_flags_xtab osf1_wait_options_xtab[] = {
{ OSF1_WNOHANG, OSF1_WNOHANG, WNOHANG },
{ OSF1_WUNTRACED, OSF1_WUNTRACED, WUNTRACED },
{ 0 }
};
void
osf1_cvt_flock_from_native(const struct flock *nf, struct osf1_flock *of)
{
memset(of, 0, sizeof(*of));
of->l_start = nf->l_start;
of->l_len = nf->l_len;
of->l_pid = nf->l_pid;
switch (nf->l_type) {
case F_RDLCK:
of->l_type = OSF1_F_RDLCK;
break;
case F_WRLCK:
of->l_type = OSF1_F_WRLCK;
break;
case F_UNLCK:
of->l_type = OSF1_F_UNLCK;
break;
}
switch (nf->l_whence) {
case SEEK_SET:
of->l_whence = OSF1_SEEK_SET;
break;
case SEEK_CUR:
of->l_whence = OSF1_SEEK_CUR;
break;
case SEEK_END:
of->l_whence = OSF1_SEEK_END;
break;
}
}
int
osf1_cvt_flock_to_native(const struct osf1_flock *of, struct flock *nf)
{
memset(nf, 0, sizeof(*nf));
nf->l_start = of->l_start;
nf->l_len = of->l_len;
nf->l_pid = of->l_pid;
switch (of->l_type) {
case OSF1_F_RDLCK:
nf->l_type = F_RDLCK;
break;
case OSF1_F_WRLCK:
nf->l_type = F_WRLCK;
break;
case OSF1_F_UNLCK:
nf->l_type = F_UNLCK;
break;
default:
return (EINVAL);
}
switch (of->l_whence) {
case OSF1_SEEK_SET:
nf->l_whence = SEEK_SET;
break;
case OSF1_SEEK_CUR:
nf->l_whence = SEEK_CUR;
break;
case OSF1_SEEK_END:
nf->l_whence = SEEK_END;
break;
default:
return (EINVAL);
}
return (0);
}
int
osf1_cvt_msghdr_xopen_to_native(const struct osf1_msghdr_xopen *omh, struct msghdr *bmh)
{
unsigned long leftovers;
memset(bmh, 0, sizeof(*bmh));
bmh->msg_name = omh->msg_name; /* XXX sockaddr translation */
bmh->msg_namelen = omh->msg_namelen;
bmh->msg_iov = NULL; /* iovec xlation separate */
bmh->msg_iovlen = omh->msg_iovlen;
/* XXX we don't translate control messages (yet) */
if (bmh->msg_control != NULL || bmh->msg_controllen != 0)
{
printf("osf1_cvt_msghdr_xopen_to_native: control\n");
return (EINVAL);
}
/* translate flags */
bmh->msg_flags = emul_flags_translate(osf1_sendrecv_msg_flags_xtab,
omh->msg_flags, &leftovers);
if (leftovers != 0)
{
printf("osf1_cvt_msghdr_xopen_to_native: leftovers 0x%lx\n", leftovers);
return (EINVAL);
}
return (0);
}
int
osf1_cvt_pathconf_name_to_native(int oname, int *bnamep)
{
int error;
error = 0;
switch (oname) {
case OSF1__PC_CHOWN_RESTRICTED:
*bnamep = _PC_CHOWN_RESTRICTED;
break;
case OSF1__PC_LINK_MAX:
*bnamep = _PC_LINK_MAX;
break;
case OSF1__PC_MAX_CANON:
*bnamep = _PC_MAX_CANON;
break;
case OSF1__PC_MAX_INPUT:
*bnamep = _PC_MAX_INPUT;
break;
case OSF1__PC_NAME_MAX:
*bnamep = _PC_NAME_MAX;
break;
case OSF1__PC_NO_TRUNC:
*bnamep = _PC_NO_TRUNC;
break;
case OSF1__PC_PATH_MAX:
*bnamep = _PC_PATH_MAX;
break;
case OSF1__PC_PIPE_BUF:
*bnamep = _PC_PIPE_BUF;
break;
case OSF1__PC_VDISABLE:
*bnamep = _PC_VDISABLE;
break;
default:
error = EINVAL;
break;
}
return (error);
}
/*
* Convert from as rusage structure to an osf1 rusage structure.
*/
void
osf1_cvt_rusage_from_native(const struct rusage *ru, struct osf1_rusage *oru)
{
oru->ru_utime.tv_sec = ru->ru_utime.tv_sec;
oru->ru_utime.tv_usec = ru->ru_utime.tv_usec;
oru->ru_stime.tv_sec = ru->ru_stime.tv_sec;
oru->ru_stime.tv_usec = ru->ru_stime.tv_usec;
oru->ru_maxrss = ru->ru_maxrss;
oru->ru_ixrss = ru->ru_ixrss;
oru->ru_idrss = ru->ru_idrss;
oru->ru_isrss = ru->ru_isrss;
oru->ru_minflt = ru->ru_minflt;
oru->ru_majflt = ru->ru_majflt;
oru->ru_nswap = ru->ru_nswap;
oru->ru_inblock = ru->ru_inblock;
oru->ru_oublock = ru->ru_oublock;
oru->ru_msgsnd = ru->ru_msgsnd;
oru->ru_msgrcv = ru->ru_msgrcv;
oru->ru_nsignals = ru->ru_nsignals;
oru->ru_nvcsw = ru->ru_nvcsw;
oru->ru_nivcsw = ru->ru_nivcsw;
}
/*
* XXX: Only a subset of the flags is currently implemented.
*/
void
osf1_cvt_sigaction_from_native(const struct sigaction *bsa, struct osf1_sigaction *osa)
{
osa->osf1_sa_handler = bsa->sa_handler;
osf1_cvt_sigset_from_native(&bsa->sa_mask, &osa->osf1_sa_mask);
/* translate flags */
osa->osf1_sa_flags = emul_flags_translate(osf1_sigaction_flags_rxtab,
bsa->sa_flags, NULL);
}
int
osf1_cvt_sigaction_to_native(const struct osf1_sigaction *osa, struct sigaction *bsa)
{
bsa->sa_handler = osa->osf1_sa_handler;
osf1_cvt_sigset_to_native(&osa->osf1_sa_mask, &bsa->sa_mask);
/* translate flags */
bsa->sa_flags = emul_flags_translate(osf1_sigaction_flags_xtab,
osa->osf1_sa_flags, NULL);
/* XXX error if we can't translate */
return (0);
}
void
osf1_cvt_sigset_from_native(const sigset_t *bss, osf1_sigset_t *oss)
{
int i, newsig;
osf1_sigemptyset(oss);
for (i = 1; i < NSIG; i++) {
if (sigismember(bss, i)) {
newsig = native_to_osf1_signo[i];
if (newsig)
osf1_sigaddset(oss, newsig);
}
}
}
int
osf1_cvt_sigset_to_native(const osf1_sigset_t *oss, sigset_t *bss)
{
int i, newsig;
sigemptyset(bss);
for (i = 1; i < OSF1_NSIG; i++) {
if (osf1_sigismember(oss, i)) {
newsig = osf1_to_native_signo[i];
if (newsig)
sigaddset(bss, newsig);
}
}
return (0);
}
/*
* Convert from a stat structure to an osf1 stat structure.
*/
void
osf1_cvt_stat_from_native(const struct stat *st, struct osf1_stat *ost)
{
ost->st_dev = osf1_cvt_dev_from_native(st->st_dev);
ost->st_ino = st->st_ino;
ost->st_mode = st->st_mode;
ost->st_nlink = st->st_nlink;
ost->st_uid = st->st_uid == -2 ? (u_int16_t) -2 : st->st_uid;
ost->st_gid = st->st_gid == -2 ? (u_int16_t) -2 : st->st_gid;
ost->st_rdev = osf1_cvt_dev_from_native(st->st_rdev);
ost->st_size = st->st_size;
ost->st_atime_sec = st->st_atime;
ost->st_spare1 = 0;
ost->st_mtime_sec = st->st_mtime;
ost->st_spare2 = 0;
ost->st_ctime_sec = st->st_ctime;
ost->st_spare3 = 0;
ost->st_blksize = st->st_blksize;
ost->st_blocks = st->st_blocks;
ost->st_flags = st->st_flags;
ost->st_gen = st->st_gen;
}
/*
* Convert from a stat structure to an osf1 stat structure.
*/
void
osf1_cvt_stat2_from_native(const struct stat *st, struct osf1_stat2 *ost)
{
memset(ost, 0, sizeof *ost);
ost->st_dev = osf1_cvt_dev_from_native(st->st_dev);
ost->st_ino = st->st_ino;
ost->st_mode = st->st_mode;
ost->st_nlink = st->st_nlink;
ost->st_uid = st->st_uid == -2 ? (u_int16_t) -2 : st->st_uid;
ost->st_gid = st->st_gid == -2 ? (u_int16_t) -2 : st->st_gid;
ost->st_rdev = osf1_cvt_dev_from_native(st->st_rdev);
ost->st_size = st->st_size;
ost->st_atime_sec = st->st_atime;
ost->st_mtime_sec = st->st_mtime;
ost->st_ctime_sec = st->st_ctime;
ost->st_blocksize = st->st_blksize;
ost->st_blocks = st->st_blocks;
ost->st_flags = st->st_flags;
ost->st_generation = st->st_gen;
}
void
osf1_cvt_statfs_from_native(const struct statvfs *bsfs, struct osf1_statfs *osfs)
{
memset(osfs, 0, sizeof (struct osf1_statfs));
if (!strncmp(MOUNT_FFS, bsfs->f_fstypename, sizeof(bsfs->f_fstypename)))
osfs->f_type = OSF1_MOUNT_UFS;
else if (!strncmp(MOUNT_NFS, bsfs->f_fstypename, sizeof(bsfs->f_fstypename)))
osfs->f_type = OSF1_MOUNT_NFS;
else if (!strncmp(MOUNT_MFS, bsfs->f_fstypename, sizeof(bsfs->f_fstypename)))
osfs->f_type = OSF1_MOUNT_MFS;
else
/* uh oh... XXX = PC, CDFS, PROCFS, etc. */
osfs->f_type = OSF1_MOUNT_ADDON;
osfs->f_flags = bsfs->f_flag; /* XXX translate */
osfs->f_fsize = bsfs->f_frsize;
osfs->f_bsize = bsfs->f_bsize;
osfs->f_blocks = bsfs->f_blocks;
osfs->f_bfree = bsfs->f_bfree;
osfs->f_bavail = bsfs->f_bavail;
osfs->f_files = bsfs->f_files;
osfs->f_ffree = bsfs->f_ffree;
memcpy(&osfs->f_fsid, &bsfs->f_fsidx, sizeof osfs->f_fsid);
/* osfs->f_spare zeroed above */
memcpy(osfs->f_mntonname, bsfs->f_mntonname, sizeof osfs->f_mntonname);
memcpy(osfs->f_mntfromname, bsfs->f_mntfromname,
sizeof osfs->f_mntfromname);
/* XXX osfs->f_xxx should be filled in... */
}

View File

@ -1,96 +0,0 @@
/* $NetBSD: osf1_cvt.h,v 1.11 2007/06/16 20:04:28 dsl Exp $ */
/*
* Copyright (c) 1999 Christopher G. Demetriou. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Christopher G. Demetriou
* for the NetBSD Project.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _COMPAT_OSF1_OSF1_CVT_H_
#define _COMPAT_OSF1_OSF1_CVT_H_
#include <sys/param.h>
#include <sys/proc.h>
#include <sys/mount.h>
#include <sys/resource.h>
#include <sys/signal.h>
#include <sys/stat.h>
#include <sys/fcntl.h>
#include <compat/common/compat_util.h>
#define osf1_cvt_dev_from_native(dev) \
osf1_makedev(major(dev), minor(dev))
#define osf1_cvt_dev_to_native(dev) \
makedev(osf1_major(dev), osf1_minor(dev))
void osf1_cvt_flock_from_native(const struct flock *nf,
struct osf1_flock *of);
int osf1_cvt_flock_to_native(const struct osf1_flock *of,
struct flock *nf);
struct msghdr;
int osf1_cvt_msghdr_xopen_to_native(const struct osf1_msghdr_xopen *omh,
struct msghdr *nmh);
int osf1_cvt_pathconf_name_to_native(int oname, int *bnamep);
void osf1_cvt_rusage_from_native(const struct rusage *nru,
struct osf1_rusage *oru);
void osf1_cvt_sigaction_from_native(const struct sigaction *nsa,
struct osf1_sigaction *osa);
int osf1_cvt_sigaction_to_native(const struct osf1_sigaction *osa,
struct sigaction *nsa);
void osf1_cvt_sigset_from_native(const sigset_t *nss, osf1_sigset_t *oss);
int osf1_cvt_sigset_to_native(const osf1_sigset_t *oss, sigset_t *nss);
void osf1_cvt_stat_from_native(const struct stat *nst,
struct osf1_stat *ost);
void osf1_cvt_stat2_from_native(const struct stat *nst,
struct osf1_stat2 *ost);
void osf1_cvt_statfs_from_native(const struct statvfs *nsfs,
struct osf1_statfs *osfs);
extern const int native_to_osf1_errno[];
extern const int osf1_to_native_signo[];
extern const int native_to_osf1_signo[];
extern const struct emul_flags_xtab osf1_access_flags_xtab[];
extern const struct emul_flags_xtab osf1_fcntl_getsetfd_flags_rxtab[];
extern const struct emul_flags_xtab osf1_fcntl_getsetfd_flags_xtab[];
extern const struct emul_flags_xtab osf1_fcntl_getsetfl_flags_rxtab[];
extern const struct emul_flags_xtab osf1_fcntl_getsetfl_flags_xtab[];
extern const struct emul_flags_xtab osf1_mmap_flags_xtab[];
extern const struct emul_flags_xtab osf1_mmap_prot_xtab[];
extern const struct emul_flags_xtab osf1_nfs_mount_flags_xtab[];
extern const struct emul_flags_xtab osf1_open_flags_rxtab[];
extern const struct emul_flags_xtab osf1_open_flags_xtab[];
extern const struct emul_flags_xtab osf1_reboot_opt_xtab[];
extern const struct emul_flags_xtab osf1_sendrecv_msg_flags_xtab[];
extern const struct emul_flags_xtab osf1_sigaction_flags_rxtab[];
extern const struct emul_flags_xtab osf1_sigaction_flags_xtab[];
extern const struct emul_flags_xtab osf1_sigaltstack_flags_rxtab[];
extern const struct emul_flags_xtab osf1_sigaltstack_flags_xtab[];
extern const struct emul_flags_xtab osf1_wait_options_xtab[];
#endif /* _COMPAT_OSF1_OSF1_CVT_H_ */

View File

@ -1,271 +0,0 @@
/* $NetBSD: osf1_descrip.c,v 1.29 2010/04/23 15:19:20 rmind Exp $ */
/*
* Copyright (c) 1999 Christopher G. Demetriou. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Christopher G. Demetriou
* for the NetBSD Project.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: osf1_descrip.c,v 1.29 2010/04/23 15:19:20 rmind Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/namei.h>
#include <sys/proc.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <sys/filedesc.h>
#include <sys/kernel.h>
#include <sys/mman.h>
#include <sys/mount.h>
#include <sys/signal.h>
#include <sys/signalvar.h>
#include <sys/reboot.h>
#include <sys/syscallargs.h>
#include <sys/exec.h>
#include <sys/vnode.h>
#include <sys/socketvar.h>
#include <sys/resource.h>
#include <sys/resourcevar.h>
#include <sys/wait.h>
#include <compat/osf1/osf1.h>
#include <compat/osf1/osf1_syscallargs.h>
#include <compat/osf1/osf1_cvt.h>
int
osf1_sys_fcntl(struct lwp *l, const struct osf1_sys_fcntl_args *uap, register_t *retval)
{
struct sys_fcntl_args a;
struct osf1_flock oflock;
struct flock nflock;
unsigned long xfl, leftovers;
int error;
SCARG(&a, fd) = SCARG(uap, fd);
leftovers = 0;
switch (SCARG(uap, cmd)) {
case OSF1_F_DUPFD:
SCARG(&a, cmd) = F_DUPFD;
SCARG(&a, arg) = SCARG(uap, arg);
break;
case OSF1_F_GETFD:
SCARG(&a, cmd) = F_GETFD;
SCARG(&a, arg) = 0; /* ignored */
break;
case OSF1_F_SETFD:
SCARG(&a, cmd) = F_SETFD;
SCARG(&a, arg) = (void *)emul_flags_translate(
osf1_fcntl_getsetfd_flags_xtab,
(unsigned long)SCARG(uap, arg), &leftovers);
break;
case OSF1_F_GETFL:
SCARG(&a, cmd) = F_GETFL;
SCARG(&a, arg) = 0; /* ignored */
break;
case OSF1_F_SETFL:
SCARG(&a, cmd) = F_SETFL;
xfl = emul_flags_translate(osf1_open_flags_xtab,
(unsigned long)SCARG(uap, arg), &leftovers);
xfl |= emul_flags_translate(osf1_fcntl_getsetfl_flags_xtab,
leftovers, &leftovers);
SCARG(&a, arg) = (void *)xfl;
break;
case OSF1_F_GETOWN: /* XXX not yet supported */
case OSF1_F_SETOWN: /* XXX not yet supported */
/* XXX translate. */
return (EINVAL);
case OSF1_F_GETLK:
case OSF1_F_SETLK:
case OSF1_F_SETLKW:
if (SCARG(uap, cmd) == OSF1_F_GETLK)
SCARG(&a, cmd) = F_GETLK;
else if (SCARG(uap, cmd) == OSF1_F_SETLK)
SCARG(&a, cmd) = F_SETLK;
else if (SCARG(uap, cmd) == OSF1_F_SETLKW)
SCARG(&a, cmd) = F_SETLKW;
error = copyin(SCARG(uap, arg), &oflock, sizeof oflock);
if (error != 0)
return error;
error = osf1_cvt_flock_to_native(&oflock, &nflock);
if (error != 0)
return error;
error = do_fcntl_lock(SCARG(uap, fd), SCARG(&a, cmd), &nflock);
if (SCARG(&a, cmd) != F_GETLK || error != 0)
return error;
osf1_cvt_flock_from_native(&nflock, &oflock);
return copyout(&oflock, SCARG(uap, arg), sizeof oflock);
case OSF1_F_RGETLK: /* [lock mgr op] XXX not supported */
case OSF1_F_RSETLK: /* [lock mgr op] XXX not supported */
case OSF1_F_CNVT: /* [lock mgr op] XXX not supported */
case OSF1_F_RSETLKW: /* [lock mgr op] XXX not supported */
case OSF1_F_PURGEFS: /* [lock mgr op] XXX not supported */
case OSF1_F_PURGENFS: /* [DECsafe op] XXX not supported */
default:
/* XXX syslog? */
return (EINVAL);
}
if (leftovers != 0)
return (EINVAL);
error = sys_fcntl(l, &a, retval);
if (error)
return error;
switch (SCARG(uap, cmd)) {
case OSF1_F_GETFD:
retval[0] = emul_flags_translate(
osf1_fcntl_getsetfd_flags_rxtab, retval[0], NULL);
break;
case OSF1_F_GETFL:
xfl = emul_flags_translate(osf1_open_flags_rxtab,
retval[0], &leftovers);
xfl |= emul_flags_translate(osf1_fcntl_getsetfl_flags_rxtab,
leftovers, NULL);
retval[0] = xfl;
break;
}
return error;
}
int
osf1_sys_fpathconf(struct lwp *l, const struct osf1_sys_fpathconf_args *uap, register_t *retval)
{
struct sys_fpathconf_args a;
int error;
SCARG(&a, fd) = SCARG(uap, fd);
error = osf1_cvt_pathconf_name_to_native(SCARG(uap, name),
&SCARG(&a, name));
if (error == 0)
error = sys_fpathconf(l, &a, retval);
return (error);
}
/*
* Return status information about a file descriptor.
*/
int
osf1_sys_fstat(struct lwp *l, const struct osf1_sys_fstat_args *uap, register_t *retval)
{
struct stat ub;
struct osf1_stat oub;
int error;
error = do_sys_fstat(SCARG(uap, fd), &ub);
osf1_cvt_stat_from_native(&ub, &oub);
if (error == 0)
error = copyout(&oub, SCARG(uap, sb), sizeof(oub));
return (error);
}
/*
* Return status information about a file descriptor.
*/
int
osf1_sys_fstat2(struct lwp *l, const struct osf1_sys_fstat2_args *uap, register_t *retval)
{
struct stat ub;
struct osf1_stat2 oub;
int error;
error = do_sys_fstat(SCARG(uap, fd), &ub);
osf1_cvt_stat2_from_native(&ub, &oub);
if (error == 0)
error = copyout(&oub, SCARG(uap, sb), sizeof(oub));
return (error);
}
int
osf1_sys_ftruncate(struct lwp *l, const struct osf1_sys_ftruncate_args *uap, register_t *retval)
{
struct sys_ftruncate_args a;
SCARG(&a, fd) = SCARG(uap, fd);
SCARG(&a, PAD) = 0;
SCARG(&a, length) = SCARG(uap, length);
return sys_ftruncate(l, &a, retval);
}
int
osf1_sys_lseek(struct lwp *l, const struct osf1_sys_lseek_args *uap, register_t *retval)
{
struct sys_lseek_args a;
SCARG(&a, fd) = SCARG(uap, fd);
SCARG(&a, PAD) = 0;
SCARG(&a, offset) = SCARG(uap, offset);
SCARG(&a, whence) = SCARG(uap, whence);
return sys_lseek(l, &a, retval);
}

View File

@ -1,47 +0,0 @@
/* $NetBSD: osf1_dirent.h,v 1.1 2008/12/02 13:45:02 njoly Exp $ */
/*-
* Copyright (c) 1994 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Christos Zoulas.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _OSF1_DIRENT_H_
#define _OSF1_DIRENT_H_
#define OSF1_MAXNAMLEN 255
struct osf1_dirent {
osf1_ino_t d_ino;
u_short d_reclen;
u_short d_namlen;
char d_name[OSF1_MAXNAMLEN + 1];
};
#define OSF1_NAMEOFF(dp) ((char *)&(dp)->d_name - (char *)dp)
#define OSF1_RECLEN(de,namlen) ALIGN((OSF1_NAMEOFF(de) + (namlen) + 1))
#endif /* !_OSF1_DIRENT_H_ */

View File

@ -1,146 +0,0 @@
/* $NetBSD: osf1_errno.c,v 1.7 2013/12/22 17:14:22 njoly Exp $ */
/*
* Copyright (c) 1999 Christopher G. Demetriou. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Christopher G. Demetriou
* for the NetBSD Project.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: osf1_errno.c,v 1.7 2013/12/22 17:14:22 njoly Exp $");
#include <sys/errno.h>
#include <compat/osf1/osf1.h>
/*
* This table is used to translate NetBSD errnos to OSF/1 errnos
* when returning from a system call.
*
* It is up to date as of Digital UNIX V4.0 and NetBSD 1.4.
*/
const int native_to_osf1_errno[] = {
0,
OSF1_EPERM, /* EPERM (1) -> 1 */
OSF1_ENOENT, /* ENOENT (2) -> 2 */
OSF1_ESRCH, /* ESRCH (3) -> 3 */
OSF1_EINTR, /* EINTR (4) -> 4 */
OSF1_EIO, /* EIO (5) -> 5 */
OSF1_ENXIO, /* ENXIO (6) -> 6 */
OSF1_E2BIG, /* E2BIG (7) -> 7 */
OSF1_ENOEXEC, /* ENOEXEC (8) -> 8 */
OSF1_EBADF, /* EBADF (9) -> 9 */
OSF1_ECHILD, /* ECHILD (10) -> 10 */
OSF1_EDEADLK, /* EDEADLK (11) -> 11 */
OSF1_ENOMEM, /* ENOMEM (12) -> 12 */
OSF1_EACCES, /* EACCES (13) -> 13 */
OSF1_EFAULT, /* EFAULT (14) -> 14 */
OSF1_ENOTBLK, /* ENOTBLK (15) -> 15 */
OSF1_EBUSY, /* EBUSY (16) -> 16 */
OSF1_EEXIST, /* EEXIST (17) -> 17 */
OSF1_EXDEV, /* EXDEV (18) -> 18 */
OSF1_ENODEV, /* ENODEV (19) -> 19 */
OSF1_ENOTDIR, /* ENOTDIR (20) -> 20 */
OSF1_EISDIR, /* EISDIR (21) -> 21 */
OSF1_EINVAL, /* EINVAL (22) -> 22 */
OSF1_ENFILE, /* ENFILE (23) -> 23 */
OSF1_EMFILE, /* EMFILE (24) -> 24 */
OSF1_ENOTTY, /* ENOTTY (25) -> 25 */
OSF1_ETXTBSY, /* ETXTBSY (26) -> 26 */
OSF1_EFBIG, /* EFBIG (27) -> 27 */
OSF1_ENOSPC, /* ENOSPC (28) -> 28 */
OSF1_ESPIPE, /* ESPIPE (29) -> 29 */
OSF1_EROFS, /* EROFS (30) -> 30 */
OSF1_EMLINK, /* EMLINK (31) -> 31 */
OSF1_EPIPE, /* EPIPE (32) -> 32 */
OSF1_EDOM, /* EDOM (33) -> 33 */
OSF1_ERANGE, /* ERANGE (34) -> 34 */
OSF1_EWOULDBLOCK, /* EAGAIN (35) -> OSF1_EWOULDBLOCK (35) */
OSF1_EINPROGRESS, /* EINPROGRESS (36) -> 36 */
OSF1_EALREADY, /* EALREADY (37) -> 37 */
OSF1_ENOTSOCK, /* ENOTSOCK (38) -> 38 */
OSF1_EDESTADDRREQ, /* EDESTADDRREQ (39) -> 39 */
OSF1_EMSGSIZE, /* EMSGSIZE (40) -> 40 */
OSF1_EPROTOTYPE, /* EPROTOTYPE (41) -> 41 */
OSF1_ENOPROTOOPT, /* ENOPROTOOPT (42) -> 42 */
OSF1_EPROTONOSUPPORT, /* EPROTONOSUPPORT (43) -> 43 */
OSF1_ESOCKTNOSUPPORT, /* ESOCKTNOSUPPORT (44) -> 44 */
OSF1_EOPNOTSUPP, /* EOPNOTSUPP (45) -> 45 */
OSF1_EPFNOSUPPORT, /* EPFNOSUPPORT (46) -> 46 */
OSF1_EAFNOSUPPORT, /* EAFNOSUPPORT (47) -> 47 */
OSF1_EADDRINUSE, /* EADDRINUSE (48) -> 48 */
OSF1_EADDRNOTAVAIL, /* EADDRNOTAVAIL (49) -> 49 */
OSF1_ENETDOWN, /* ENETDOWN (50) -> 50 */
OSF1_ENETUNREACH, /* ENETUNREACH (51) -> 51 */
OSF1_ENETRESET, /* ENETRESET (52) -> 52 */
OSF1_ECONNABORTED, /* ECONNABORTED (53) -> 53 */
OSF1_ECONNRESET, /* ECONNRESET (54) -> 54 */
OSF1_ENOBUFS, /* ENOBUFS (55) -> 55 */
OSF1_EISCONN, /* EISCONN (56) -> 56 */
OSF1_ENOTCONN, /* ENOTCONN (57) -> 57 */
OSF1_ESHUTDOWN, /* ESHUTDOWN (58) -> 58 */
OSF1_ETOOMANYREFS, /* ETOOMANYREFS (59) -> 59 */
OSF1_ETIMEDOUT, /* ETIMEDOUT (60) -> 60 */
OSF1_ECONNREFUSED, /* ECONNREFUSED (61) -> 61 */
OSF1_ELOOP, /* ELOOP (62) -> 62 */
OSF1_ENAMETOOLONG, /* ENAMETOOLONG (63) -> 63 */
OSF1_EHOSTDOWN, /* EHOSTDOWN (64) -> 64 */
OSF1_EHOSTUNREACH, /* EHOSTUNREACH (65) -> 65 */
OSF1_ENOTEMPTY, /* ENOTEMPTY (66) -> 66 */
OSF1_EPROCLIM, /* EPROCLIM (67) -> 67 */
OSF1_EUSERS, /* EUSERS (68) -> 68 */
OSF1_EDQUOT, /* EDQUOT (69) -> 69 */
OSF1_ESTALE, /* ESTALE (70) -> 70 */
OSF1_EREMOTE, /* EREMOTE (71) -> 71 */
OSF1_EBADRPC, /* EBADRPC (72) -> 72 */
OSF1_ERPCMISMATCH, /* ERPCMISMATCH (73) -> 73 */
OSF1_EPROGUNAVAIL, /* EPROGUNAVAIL (74) -> 74 */
OSF1_EPROGMISMATCH, /* EPROGMISMATCH (75) -> 75 */
OSF1_EPROCUNAVAIL, /* EPROCUNAVAIL (76) -> 76 */
OSF1_ENOLCK, /* ENOLCK (77) -> 77 */
OSF1_ENOSYS, /* ENOSYS (78) -> 78 */
OSF1_EFTYPE, /* EFTYPE (79) -> 79 */
OSF1_ENOSYS, /* EAUTH (80) has no equivalent */
OSF1_ENOSYS, /* ENEEDAUTH (81) has no equivalent */
OSF1_EIDRM, /* EIDRM (82) -> 81 */
OSF1_ENOMSG, /* ENOMSG (83) -> 80 */
OSF1_EOVERFLOW, /* EOVERFLOW (84) -> 103 */
OSF1_EILSEQ, /* EILSEQ (85) -> 116 */
OSF1_ENOTSUP, /* ENOTSUP (86) -> 99 */
OSF1_ECANCELED, /* ECANCELED (87) -> 94 */
OSF1_EBADMSG, /* EBADMSG (88) -> 84 */
OSF1_ENODATA, /* ENODATA (89) -> 86 */
OSF1_ENOSR, /* ENOSR (90) -> 82 */
OSF1_ENOSTR, /* ENOSTR (91) -> 87 */
OSF1_ETIME, /* ETIME (92) -> 83 */
OSF1_ENOSYS, /* ENOATTR (93) has no equivalent */
OSF1_EMULTIHOP, /* EMULTIHOP (94) -> 101 */
OSF1_ENOLINK, /* ENOLINK (95) -> 102 */
OSF1_EPROTO, /* EPROTO (96) -> 85 */
};
__CTASSERT(__arraycount(native_to_osf1_errno) == ELAST + 1);

View File

@ -1,148 +0,0 @@
/* $NetBSD: osf1_errno.h,v 1.3 1999/05/01 02:57:10 cgd Exp $ */
/*
* Copyright (c) 1999 Christopher G. Demetriou. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Christopher G. Demetriou
* for the NetBSD Project.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* OSF/1 error number definitions, as described by the Digital UNIX V4.0
* <sys/errno.h>.
*/
#ifndef _COMPAT_OSF1_OSF1_ERRNO_H_
#define _COMPAT_OSF1_OSF1_ERRNO_H_
#define OSF1_ESUCCESS 0
#define OSF1_EPERM 1
#define OSF1_ENOENT 2
#define OSF1_ESRCH 3
#define OSF1_EINTR 4
#define OSF1_EIO 5
#define OSF1_ENXIO 6
#define OSF1_E2BIG 7
#define OSF1_ENOEXEC 8
#define OSF1_EBADF 9
#define OSF1_ECHILD 10
#define OSF1_EDEADLK 11
#define OSF1_ENOMEM 12
#define OSF1_EACCES 13
#define OSF1_EFAULT 14
#define OSF1_ENOTBLK 15
#define OSF1_EBUSY 16
#define OSF1_EEXIST 17
#define OSF1_EXDEV 18
#define OSF1_ENODEV 19
#define OSF1_ENOTDIR 20
#define OSF1_EISDIR 21
#define OSF1_EINVAL 22
#define OSF1_ENFILE 23
#define OSF1_EMFILE 24
#define OSF1_ENOTTY 25
#define OSF1_ETXTBSY 26
#define OSF1_EFBIG 27
#define OSF1_ENOSPC 28
#define OSF1_ESPIPE 29
#define OSF1_EROFS 30
#define OSF1_EMLINK 31
#define OSF1_EPIPE 32
#define OSF1_EDOM 33
#define OSF1_ERANGE 34
#define OSF1_EWOULDBLOCK 35
#define OSF1_EINPROGRESS 36
#define OSF1_EALREADY 37
#define OSF1_ENOTSOCK 38
#define OSF1_EDESTADDRREQ 39
#define OSF1_EMSGSIZE 40
#define OSF1_EPROTOTYPE 41
#define OSF1_ENOPROTOOPT 42
#define OSF1_EPROTONOSUPPORT 43
#define OSF1_ESOCKTNOSUPPORT 44
#define OSF1_EOPNOTSUPP 45
#define OSF1_EPFNOSUPPORT 46
#define OSF1_EAFNOSUPPORT 47
#define OSF1_EADDRINUSE 48
#define OSF1_EADDRNOTAVAIL 49
#define OSF1_ENETDOWN 50
#define OSF1_ENETUNREACH 51
#define OSF1_ENETRESET 52
#define OSF1_ECONNABORTED 53
#define OSF1_ECONNRESET 54
#define OSF1_ENOBUFS 55
#define OSF1_EISCONN 56
#define OSF1_ENOTCONN 57
#define OSF1_ESHUTDOWN 58
#define OSF1_ETOOMANYREFS 59
#define OSF1_ETIMEDOUT 60
#define OSF1_ECONNREFUSED 61
#define OSF1_ELOOP 62
#define OSF1_ENAMETOOLONG 63
#define OSF1_EHOSTDOWN 64
#define OSF1_EHOSTUNREACH 65
#define OSF1_ENOTEMPTY 66
#define OSF1_EPROCLIM 67
#define OSF1_EUSERS 68
#define OSF1_EDQUOT 69
#define OSF1_ESTALE 70
#define OSF1_EREMOTE 71
#define OSF1_EBADRPC 72
#define OSF1_ERPCMISMATCH 73
#define OSF1_EPROGUNAVAIL 74
#define OSF1_EPROGMISMATCH 75
#define OSF1_EPROCUNAVAIL 76
#define OSF1_ENOLCK 77
#define OSF1_ENOSYS 78
#define OSF1_EFTYPE 79
#define OSF1_ENOMSG 80
#define OSF1_EIDRM 81
#define OSF1_ENOSR 82
#define OSF1_ETIME 83
#define OSF1_EBADMSG 84
#define OSF1_EPROTO 85
#define OSF1_ENODATA 86
#define OSF1_ENOSTR 87
#define OSF1_ECLONEME 88
#define OSF1_EDIRTY 89
#define OSF1_EDUPPKG 90
#define OSF1_EVERSION 91
#define OSF1_ENOPKG 92
#define OSF1_ENOSYM 93
#define OSF1_ECANCELED 94
#define OSF1_EFAIL 95
#define OSF1_EINPROG 97
#define OSF1_EMTIMERS 98
#define OSF1_ENOTSUP 99
#define OSF1_EAIO 100
#define OSF1_EMULTIHOP 101
#define OSF1_ENOLINK 102
#define OSF1_EOVERFLOW 103
#define OSF1_EILSEQ 116
#define OSF1_ESOFT 123
#define OSF1_EMEDIA 124
#endif /* _COMPAT_OSF1_OSF1_ERRNO_H_ */

View File

@ -1,101 +0,0 @@
/* $NetBSD: osf1_exec.c,v 1.47 2018/08/10 21:44:58 pgoyette Exp $ */
/*
* Copyright (c) 1999 Christopher G. Demetriou. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Christopher G. Demetriou
* for the NetBSD Project.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: osf1_exec.c,v 1.47 2018/08/10 21:44:58 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "opt_syscall_debug.h"
#endif
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/proc.h>
#include <sys/signalvar.h>
#include <sys/exec.h>
#include <uvm/uvm_extern.h>
#include <compat/osf1/osf1.h>
#include <compat/osf1/osf1_syscall.h>
#include <compat/osf1/osf1_cvt.h>
extern struct sysent osf1_sysent[];
extern const uint32_t osf1_sysent_nomodbits[];
extern const char * const osf1_syscallnames[];
extern char osf1_sigcode[], osf1_esigcode[];
#ifdef __HAVE_SYSCALL_INTERN
void osf1_syscall_intern(struct proc *);
#else
void syscall(void);
#endif
struct uvm_object *emul_osf1_object;
struct emul emul_osf1 = {
.e_name = "osf1",
.e_path = "/emul/osf1",
#ifndef __HAVE_MINIMAL_EMUL
.e_flags = 0,
.e_errno = native_to_osf1_errno,
.e_nosys = OSF1_SYS_syscall,
.e_nsysent = OSF1_SYS_NSYSENT,
#endif
.e_sysent = osf1_sysent,
.e_nomodbits = osf1_sysent_nomodbits,
#ifdef SYSCALL_DEBUG
.e_syscallnames = osf1_syscallnames,
#else
.e_syscallnames = NULL,
#endif
.e_sendsig = sendsig_sigcontext,
.e_trapsignal = trapsignal,
.e_sigcode = osf1_sigcode,
.e_esigcode = osf1_esigcode,
.e_sigobject = &emul_osf1_object,
.e_setregs = setregs,
.e_proc_exec = NULL,
.e_proc_fork = NULL,
.e_proc_exit = NULL,
.e_lwp_fork = NULL,
.e_lwp_exit = NULL,
#ifdef __HAVE_SYSCALL_INTERN
.e_syscall_intern = osf1_syscall_intern,
#else
.e_syscall_intern = syscall,
#endif
.e_sysctlovly = NULL,
.e_vm_default_addr = uvm_default_mapaddr,
.e_usertrap = NULL,
.e_ucsize = 0,
.e_startlwp = NULL
};

View File

@ -1,45 +0,0 @@
/* $NetBSD: osf1_exec.h,v 1.13 2011/03/05 19:08:40 joerg Exp $ */
/*
* Copyright (c) 2000 The NetBSD foundation, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _OSF1_EXEC_H
#define _OSF1_EXEC_H
#define OSF1_MAX_AUX_ENTRIES 4 /* max we'll ever push (right now) */
extern struct emul emul_osf1;
int osf1_exec_ecoff_probe(struct lwp *, struct exec_package *);
struct ps_strings;
int osf1_copyargs(struct lwp *, struct exec_package *, struct ps_strings *, char **,
void *);
#endif /* OSF1_EXEC_H */

View File

@ -1,305 +0,0 @@
/* $NetBSD: osf1_exec_ecoff.c,v 1.24 2012/02/03 20:11:54 matt Exp $ */
/*
* Copyright (c) 1999 Christopher G. Demetriou. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Christopher G. Demetriou
* for the NetBSD Project.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: osf1_exec_ecoff.c,v 1.24 2012/02/03 20:11:54 matt Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/proc.h>
#include <sys/kmem.h>
#include <sys/namei.h>
#include <sys/vnode.h>
#include <sys/exec.h>
#include <sys/exec_ecoff.h>
#include <compat/osf1/osf1.h>
#include <compat/common/compat_util.h>
#include <compat/osf1/osf1_cvt.h>
#include <compat/osf1/osf1_exec.h>
struct osf1_exec_emul_arg {
int flags;
#define OSF1_EXEC_EMUL_FLAGS_HAVE_LOADER 0x01
char exec_name[MAXPATHLEN+1];
char loader_name[MAXPATHLEN+1];
};
static int osf1_exec_ecoff_dynamic(struct lwp *l, struct exec_package *epp);
static void osf1_free_emul_arg(void *);
int
osf1_exec_ecoff_probe(struct lwp *l, struct exec_package *epp)
{
struct ecoff_exechdr *execp = (struct ecoff_exechdr *)epp->ep_hdr;
struct osf1_exec_emul_arg *emul_arg;
int error;
/* check if the binary is osf1 ecoff */
if (execp->f.f_magic != ECOFF_MAGIC_ALPHA)
return ENOEXEC;
/* set up the exec package emul arg as appropriate */
emul_arg = kmem_alloc(sizeof(*emul_arg), KM_SLEEP);
epp->ep_emul_arg = emul_arg;
epp->ep_emul_arg_free = osf1_free_emul_arg;
emul_arg->flags = 0;
/* this cannot overflow because both are size PATH_MAX */
strcpy(emul_arg->exec_name, epp->ep_kname);
/* do any special object file handling */
switch (execp->f.f_flags & ECOFF_FLAG_OBJECT_TYPE_MASK) {
case ECOFF_OBJECT_TYPE_SHARABLE:
/* can't exec a shared library! */
#if 0
uprintf("can't execute OSF/1 shared libraries\n");
#endif
error = ENOEXEC;
break;
case ECOFF_OBJECT_TYPE_CALL_SHARED:
error = osf1_exec_ecoff_dynamic(l, epp);
break;
default:
/* just let the normal ECOFF handlers deal with it. */
error = 0;
break;
}
if (error) {
exec_free_emul_arg(epp);
kill_vmcmds(&epp->ep_vmcmds); /* if any */
}
return (error);
}
/*
* copy arguments onto the stack in the normal way, then copy out
* any ELF-like AUX entries used by the dynamic loading scheme.
*/
int
osf1_copyargs(struct lwp *l, struct exec_package *pack, struct ps_strings *arginfo, char **stackp, void *argp)
{
struct osf1_exec_emul_arg *emul_arg = pack->ep_emul_arg;
struct osf1_auxv ai[OSF1_MAX_AUX_ENTRIES], *a;
char *prognameloc, *loadernameloc;
size_t len;
int error;
if ((error = copyargs(l, pack, arginfo, stackp, argp)) != 0)
goto out;
a = ai;
memset(ai, 0, sizeof ai);
prognameloc = *stackp + sizeof ai;
if ((error = copyoutstr(emul_arg->exec_name, prognameloc,
MAXPATHLEN + 1, NULL)) != 0)
goto out;
a->a_type = OSF1_AT_EXEC_FILENAME;
a->a_un.a_ptr = prognameloc;
a++;
/*
* if there's a loader, push additional auxv entries on the stack.
*/
if (emul_arg->flags & OSF1_EXEC_EMUL_FLAGS_HAVE_LOADER) {
loadernameloc = prognameloc + MAXPATHLEN + 1;
if ((error = copyoutstr(emul_arg->loader_name, loadernameloc,
MAXPATHLEN + 1, NULL)) != 0)
goto out;
a->a_type = OSF1_AT_EXEC_LOADER_FILENAME;
a->a_un.a_ptr = loadernameloc;
a++;
a->a_type = OSF1_AT_EXEC_LOADER_FLAGS;
a->a_un.a_val = 0;
if (pack->ep_vap->va_mode & S_ISUID)
a->a_un.a_val |= OSF1_LDR_EXEC_SETUID_F;
if (pack->ep_vap->va_mode & S_ISGID)
a->a_un.a_val |= OSF1_LDR_EXEC_SETGID_F;
if (l->l_proc->p_slflag & PSL_TRACED)
a->a_un.a_val |= OSF1_LDR_EXEC_PTRACE_F;
a++;
}
a->a_type = OSF1_AT_NULL;
a->a_un.a_val = 0;
a++;
len = (a - ai) * sizeof(struct osf1_auxv);
if ((error = copyout(ai, *stackp, len)) != 0)
goto out;
*stackp += len;
out:
exec_free_emul_arg(pack);
return error;
}
static int
osf1_exec_ecoff_dynamic(struct lwp *l, struct exec_package *epp)
{
struct osf1_exec_emul_arg *emul_arg = epp->ep_emul_arg;
struct ecoff_exechdr ldr_exechdr;
struct vnode *ldr_vp;
size_t resid;
int error;
strncpy(emul_arg->loader_name, OSF1_LDR_EXEC_DEFAULT_LOADER,
MAXPATHLEN + 1);
/*
* locate the loader
* includes /emul/osf1 if appropriate
*/
error = emul_find_interp(LIST_FIRST(&l->l_proc->p_lwps),
epp, emul_arg->loader_name);
if (error)
return error;
emul_arg->flags |= OSF1_EXEC_EMUL_FLAGS_HAVE_LOADER;
#if 0
uprintf("loader is %s\n", emul_arg->loader_name);
#endif
/*
* open the loader, see if it's an ECOFF executable,
* make sure the object type is amenable, then arrange to
* load it up.
*/
ldr_vp = epp->ep_interp;
epp->ep_interp = NULL;
vn_lock(ldr_vp, LK_EXCLUSIVE | LK_RETRY);
/*
* Basic access checks. Reject if:
* not a regular file
* exec not allowed on binary
* exec not allowed on mount point
*/
if (ldr_vp->v_type != VREG) {
error = EACCES;
goto badunlock;
}
if ((error = VOP_ACCESS(ldr_vp, VEXEC, l->l_cred)) != 0)
goto badunlock;
if (ldr_vp->v_mount->mnt_flag & MNT_NOEXEC) {
error = EACCES;
goto badunlock;
}
/*
* If loader's mount point disallows set-id execution,
* disable set-id.
*/
if (ldr_vp->v_mount->mnt_flag & MNT_NOSUID)
epp->ep_vap->va_mode &= ~(S_ISUID | S_ISGID);
VOP_UNLOCK(ldr_vp);
/*
* read the header, and make sure we got all of it.
*/
if ((error = vn_rdwr(UIO_READ, ldr_vp, (void *)&ldr_exechdr,
sizeof ldr_exechdr, 0, UIO_SYSSPACE, 0, l->l_cred,
&resid, NULL)) != 0)
goto bad;
if (resid != 0) {
error = ENOEXEC;
goto bad;
}
/*
* Check the magic. We expect it to be the native Alpha ECOFF
* (Digital UNIX) magic number. Also make sure it's not a shared
* lib or dynamically linked executable.
*/
if (ldr_exechdr.f.f_magic != ECOFF_MAGIC_ALPHA) {
error = ENOEXEC;
goto bad;
}
switch (ldr_exechdr.f.f_flags & ECOFF_FLAG_OBJECT_TYPE_MASK) {
case ECOFF_OBJECT_TYPE_SHARABLE:
case ECOFF_OBJECT_TYPE_CALL_SHARED:
/* can't exec shared lib or dynamically linked executable. */
error = ENOEXEC;
goto bad;
}
switch (ldr_exechdr.a.magic) {
case ECOFF_OMAGIC:
error = exec_ecoff_prep_omagic(l, epp, &ldr_exechdr, ldr_vp);
break;
case ECOFF_NMAGIC:
error = exec_ecoff_prep_nmagic(l, epp, &ldr_exechdr, ldr_vp);
break;
case ECOFF_ZMAGIC:
error = exec_ecoff_prep_zmagic(l, epp, &ldr_exechdr, ldr_vp);
break;
default:
error = ENOEXEC;
}
if (error)
goto bad;
/* finally, set up the stack. */
error = (*epp->ep_esch->es_setup_stack)(l, epp);
if (error)
goto bad;
vrele(ldr_vp);
return (0);
badunlock:
VOP_UNLOCK(ldr_vp);
bad:
vrele(ldr_vp);
return (error);
}
void
osf1_free_emul_arg(void *arg)
{
struct osf1_exec_emul_arg *emul_arg = arg;
KASSERT(emul_arg != NULL);
kmem_free(emul_arg, sizeof(*emul_arg));
}

View File

@ -1,437 +0,0 @@
/* $NetBSD: osf1_file.c,v 1.45 2018/09/03 16:29:29 riastradh Exp $ */
/*
* Copyright (c) 1999 Christopher G. Demetriou. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Christopher G. Demetriou
* for the NetBSD Project.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: osf1_file.c,v 1.45 2018/09/03 16:29:29 riastradh Exp $");
#if defined(_KERNEL_OPT)
#include "opt_syscall_debug.h"
#endif
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/namei.h>
#include <sys/proc.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <sys/filedesc.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/mman.h>
#include <sys/mount.h>
#include <sys/signal.h>
#include <sys/signalvar.h>
#include <sys/reboot.h>
#include <sys/syscallargs.h>
#include <sys/exec.h>
#include <sys/vnode.h>
#include <sys/socketvar.h>
#include <sys/resource.h>
#include <sys/resourcevar.h>
#include <sys/wait.h>
#include <sys/vfs_syscalls.h>
#include <sys/dirent.h>
#include <compat/osf1/osf1.h>
#include <compat/osf1/osf1_syscallargs.h>
#include <compat/common/compat_util.h>
#include <compat/osf1/osf1_cvt.h>
#include <compat/osf1/osf1_dirent.h>
#ifdef SYSCALL_DEBUG
extern int scdebug;
#endif
int
osf1_sys_access(struct lwp *l, const struct osf1_sys_access_args *uap, register_t *retval)
{
struct sys_access_args a;
unsigned long leftovers;
SCARG(&a, path) = SCARG(uap, path);
/* translate flags */
SCARG(&a, flags) = emul_flags_translate(osf1_access_flags_xtab,
SCARG(uap, flags), &leftovers);
if (leftovers != 0)
return (EINVAL);
return sys_access(l, &a, retval);
}
int
osf1_sys_execve(struct lwp *l, const struct osf1_sys_execve_args *uap, register_t *retval)
{
struct sys_execve_args ap;
SCARG(&ap, path) = SCARG(uap, path);
SCARG(&ap, argp) = SCARG(uap, argp);
SCARG(&ap, envp) = SCARG(uap, envp);
return sys_execve(l, &ap, retval);
}
int
osf1_sys_getdirentries(struct lwp *l, const struct osf1_sys_getdirentries_args *uap, register_t *retval)
{
/* {
syscallarg(int) fd;
syscallarg(char *) buf;
syscallarg(int) nbytes;
syscallarg(long *) basep;
} */
struct dirent *bdp;
struct vnode *vp;
char *inp, *buf; /* BSD-format */
int len, reclen; /* BSD-format */
char *outp; /* OSF1-format */
int resid, osf1_reclen; /* OSF1-format */
struct file *fp;
struct uio auio;
struct iovec aiov;
struct osf1_dirent idb;
off_t off, off1; /* true file offset */
int buflen, error, eofflag;
off_t *cookiebuf = NULL, *cookie;
int ncookies, fd;
if (SCARG(uap, nbytes) < 0)
return EINVAL;
if (SCARG(uap, nbytes) == 0)
return 0;
fd = SCARG(uap, fd);
if ((error = fd_getvnode(fd, &fp)) != 0)
return (error);
if ((fp->f_flag & FREAD) == 0) {
error = EBADF;
goto out1;
}
vp = fp->f_vnode;
if (vp->v_type != VDIR) {
error = EINVAL;
goto out1;
}
buflen = uimin(MAXBSIZE, SCARG(uap, nbytes));
buf = kmem_alloc(buflen, KM_SLEEP);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
off = off1 = 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 allocated 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, nbytes);
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) {
error = EIO;
goto out;
}
if (cookie)
off = *cookie++; /* each entry points to the next */
else
off += reclen;
if ((off >> 32) != 0) {
compat_offseterr(vp, "osf1_sys_getdirentries");
error = EINVAL;
goto out;
}
if (bdp->d_fileno == 0) {
inp += reclen; /* it is a hole; squish it out */
continue;
}
osf1_reclen = OSF1_RECLEN(&idb, bdp->d_namlen);
if (reclen > len || resid < osf1_reclen) {
/* entry too big for buffer, so just stop */
outp++;
break;
}
/*
* Massage in place to make a OSF1-shaped dirent (otherwise
* we have to worry about touching user memory outside of
* the copyout() call).
*/
idb.d_ino = (osf1_ino_t)bdp->d_fileno;
idb.d_reclen = (u_short)osf1_reclen;
idb.d_namlen = (u_short)bdp->d_namlen;
strlcpy(idb.d_name, bdp->d_name, sizeof(idb.d_name));
if ((error = copyout((void *)&idb, outp, osf1_reclen)))
goto out;
/* advance past this real entry */
inp += reclen;
/* advance output past OSF1-shaped entry */
outp += osf1_reclen;
resid -= osf1_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, nbytes) - resid;
out:
VOP_UNLOCK(vp);
if (cookiebuf)
free(cookiebuf, M_TEMP);
kmem_free(buf, buflen);
if (SCARG(uap, basep) != NULL)
error = copyout(&off1, SCARG(uap, basep), sizeof(long));
out1:
fd_putfile(fd);
return error;
}
/*
* Get file status; this version does not follow links.
*/
/* ARGSUSED */
int
osf1_sys_lstat(struct lwp *l, const struct osf1_sys_lstat_args *uap, register_t *retval)
{
struct stat sb;
struct osf1_stat osb;
int error;
error = do_sys_stat(SCARG(uap, path), NOFOLLOW, &sb);
if (error)
return (error);
osf1_cvt_stat_from_native(&sb, &osb);
error = copyout(&osb, SCARG(uap, ub), sizeof (osb));
return (error);
}
/*
* Get file status; this version does not follow links.
*/
/* ARGSUSED */
int
osf1_sys_lstat2(struct lwp *l, const struct osf1_sys_lstat2_args *uap, register_t *retval)
{
struct stat sb;
struct osf1_stat2 osb;
int error;
error = do_sys_stat(SCARG(uap, path), NOFOLLOW, &sb);
if (error)
return (error);
osf1_cvt_stat2_from_native(&sb, &osb);
error = copyout((void *)&osb, (void *)SCARG(uap, ub), sizeof (osb));
return (error);
}
int
osf1_sys_mknod(struct lwp *l, const struct osf1_sys_mknod_args *uap, register_t *retval)
{
return do_sys_mknod(l, SCARG(uap, path), SCARG(uap, mode),
osf1_cvt_dev_to_native(SCARG(uap, dev)), retval, UIO_USERSPACE);
}
int
osf1_sys_open(struct lwp *l, const struct osf1_sys_open_args *uap, register_t *retval)
{
struct sys_open_args a;
const char *path;
unsigned long leftovers;
#ifdef SYSCALL_DEBUG
char pnbuf[1024];
if (scdebug &&
copyinstr(SCARG(uap, path), pnbuf, sizeof pnbuf, NULL) == 0)
printf("osf1_open: open: %s\n", pnbuf);
#endif
/* translate flags */
SCARG(&a, flags) = emul_flags_translate(osf1_open_flags_xtab,
SCARG(uap, flags), &leftovers);
if (leftovers != 0)
return (EINVAL);
/* copy mode, no translation necessary */
SCARG(&a, mode) = SCARG(uap, mode);
/* pick appropriate path */
path = SCARG(uap, path);
SCARG(&a, path) = path;
return sys_open(l, &a, retval);
}
int
osf1_sys_pathconf(struct lwp *l, const struct osf1_sys_pathconf_args *uap, register_t *retval)
{
struct sys_pathconf_args a;
int error;
SCARG(&a, path) = SCARG(uap, path);
error = osf1_cvt_pathconf_name_to_native(SCARG(uap, name),
&SCARG(&a, name));
if (error == 0)
error = sys_pathconf(l, &a, retval);
return (error);
}
/*
* Get file status; this version follows links.
*/
/* ARGSUSED */
int
osf1_sys_stat(struct lwp *l, const struct osf1_sys_stat_args *uap, register_t *retval)
{
struct stat sb;
struct osf1_stat osb;
int error;
error = do_sys_stat(SCARG(uap, path), FOLLOW, &sb);
if (error)
return (error);
osf1_cvt_stat_from_native(&sb, &osb);
error = copyout((void *)&osb, (void *)SCARG(uap, ub), sizeof (osb));
return (error);
}
/*
* Get file status; this version follows links.
*/
/* ARGSUSED */
int
osf1_sys_stat2(struct lwp *l, const struct osf1_sys_stat2_args *uap, register_t *retval)
{
struct stat sb;
struct osf1_stat2 osb;
int error;
error = do_sys_stat(SCARG(uap, path), FOLLOW, &sb);
if (error)
return (error);
osf1_cvt_stat2_from_native(&sb, &osb);
error = copyout((void *)&osb, (void *)SCARG(uap, ub), sizeof (osb));
return (error);
}
int
osf1_sys_truncate(struct lwp *l, const struct osf1_sys_truncate_args *uap, register_t *retval)
{
struct sys_truncate_args a;
SCARG(&a, path) = SCARG(uap, path);
SCARG(&a, PAD) = 0;
SCARG(&a, length) = SCARG(uap, length);
return sys_truncate(l, &a, retval);
}
int
osf1_sys_utimes(struct lwp *l, const struct osf1_sys_utimes_args *uap, register_t *retval)
{
struct osf1_timeval otv;
struct timeval tv[2], *tvp;
int error;
if (SCARG(uap, tptr) == NULL)
tvp = NULL;
else {
/* get the OSF/1 timeval argument */
error = copyin(SCARG(uap, tptr), &otv, sizeof otv);
if (error != 0)
return error;
/* fill in and copy out the NetBSD timeval */
tv[0].tv_sec = otv.tv_sec;
tv[0].tv_usec = otv.tv_usec;
/* Set access and modified to the same time */
tv[1].tv_sec = otv.tv_sec;
tv[1].tv_usec = otv.tv_usec;
tvp = tv;
}
return do_sys_utimes(l, NULL, SCARG(uap, path), FOLLOW,
tvp, UIO_SYSSPACE);
}

View File

@ -1,178 +0,0 @@
/* $NetBSD: osf1_generic.c,v 1.17 2010/04/23 15:19:20 rmind Exp $ */
/*
* Copyright (c) 1999 Christopher G. Demetriou. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Christopher G. Demetriou
* for the NetBSD Project.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: osf1_generic.c,v 1.17 2010/04/23 15:19:20 rmind Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/namei.h>
#include <sys/proc.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <sys/mount.h>
#include <sys/select.h>
#include <sys/syscallargs.h>
#include <sys/exec.h>
#include <compat/osf1/osf1.h>
#include <compat/osf1/osf1_syscallargs.h>
#include <compat/osf1/osf1_cvt.h>
/*
* The structures end up being the same... but we can't be sure that
* the other word of our iov_len is zero!
*/
static int __noinline
osf1_get_iov(struct osf1_iovec *uiov, unsigned int iovcnt, struct iovec **iovp)
{
struct iovec *iov = *iovp;
struct osf1_iovec osf1_iov[UIO_SMALLIOV];
int i, j, n, error;
if (iovcnt > IOV_MAX)
return EINVAL;
if (iovcnt > UIO_SMALLIOV) {
iov = kmem_alloc(iovcnt * sizeof(*iov), KM_SLEEP);
*iovp = iov;
/* Caller must free - even if we return an error */
}
for (i = 0; i < iovcnt; uiov += UIO_SMALLIOV, i += UIO_SMALLIOV) {
n = iovcnt - i;
if (n > UIO_SMALLIOV)
n = UIO_SMALLIOV;
error = copyin(uiov, osf1_iov, n * sizeof osf1_iov[0]);
if (error != 0)
return error;
for (j = 0; j < n; iov++, j++) {
iov->iov_base = osf1_iov[j].iov_base;
iov->iov_len = osf1_iov[j].iov_len;
}
}
return 0;
}
int
osf1_sys_readv(struct lwp *l, const struct osf1_sys_readv_args *uap, register_t *retval)
{
struct iovec aiov[UIO_SMALLIOV], *niov = aiov;
int error;
error = osf1_get_iov(SCARG(uap, iovp), SCARG(uap, iovcnt), &niov);
if (error == 0) {
error = do_filereadv(SCARG(uap, fd), niov,
SCARG(uap, iovcnt), NULL,
FOF_UPDATE_OFFSET | FOF_IOV_SYSSPACE, retval);
}
if (niov != aiov)
kmem_free(niov, SCARG(uap, iovcnt) * sizeof(*niov));
return error;
}
int
osf1_sys_writev(struct lwp *l, const struct osf1_sys_writev_args *uap, register_t *retval)
{
struct iovec aiov[UIO_SMALLIOV], *niov = aiov;
int error;
error = osf1_get_iov(SCARG(uap, iovp), SCARG(uap, iovcnt), &niov);
if (error == 0) {
error = do_filewritev(SCARG(uap, fd), niov,
SCARG(uap, iovcnt), NULL,
FOF_UPDATE_OFFSET | FOF_IOV_SYSSPACE, retval);
}
if (niov != aiov)
kmem_free(niov, SCARG(uap, iovcnt) * sizeof(*niov));
return error;
}
int
osf1_sys_select(struct lwp *l, const struct osf1_sys_select_args *uap,
register_t *retval)
{
struct osf1_timeval otv;
struct timespec ats, *ts = NULL;
int error;
if (SCARG(uap, tv)) {
/* get the OSF/1 timeval argument */
error = copyin(SCARG(uap, tv), &otv, sizeof otv);
if (error != 0)
return error;
ats.tv_sec = otv.tv_sec;
ats.tv_nsec = otv.tv_usec * 1000;
ts = &ats;
}
return selcommon(retval, SCARG(uap, nd), SCARG(uap, in),
SCARG(uap, ou), SCARG(uap, ex), ts, NULL);
}

View File

@ -1,231 +0,0 @@
/* $NetBSD: osf1_ioctl.c,v 1.23 2011/07/22 10:02:08 njoly Exp $ */
/*
* Copyright (c) 1999 Christopher G. Demetriou. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Christopher G. Demetriou
* for the NetBSD Project.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: osf1_ioctl.c,v 1.23 2011/07/22 10:02:08 njoly Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_43.h"
#include "opt_syscall_debug.h"
#endif
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/ioctl.h>
#include <sys/termios.h>
#include <sys/mount.h>
#include <sys/syscallargs.h>
#include <compat/osf1/osf1.h>
#include <compat/osf1/osf1_syscallargs.h>
#ifdef SYSCALL_DEBUG
extern int scdebug;
#endif
static int osf1_ioctl_f(struct lwp *l, const struct sys_ioctl_args *nuap,
register_t *retval, int cmd, int dir, int len);
static int osf1_ioctl_i(struct lwp *l, const struct sys_ioctl_args *nuap,
register_t *retval, int cmd, int dir, int len);
static int osf1_ioctl_t(struct lwp *l, const struct sys_ioctl_args *nuap,
register_t *retval, int cmd, int dir, int len);
int
osf1_sys_ioctl(struct lwp *l, const struct osf1_sys_ioctl_args *uap, register_t *retval)
{
struct sys_ioctl_args a;
int op, dir, group, cmd, len;
#ifdef SYSCALL_DEBUG
const char *dirstr;
#endif
op = SCARG(uap, com);
dir = op & OSF1_IOC_DIRMASK;
group = OSF1_IOCGROUP(op);
cmd = OSF1_IOCCMD(op);
len = OSF1_IOCPARM_LEN(op);
switch (dir) {
case OSF1_IOC_VOID:
dir = IOC_VOID;
#ifdef SYSCALL_DEBUG
dirstr = "none";
#endif
break;
case OSF1_IOC_OUT:
dir = IOC_OUT;
#ifdef SYSCALL_DEBUG
dirstr = "out";
#endif
break;
case OSF1_IOC_IN:
dir = IOC_IN;
#ifdef SYSCALL_DEBUG
dirstr = "in";
#endif
break;
case OSF1_IOC_INOUT:
dir = IOC_INOUT;
#ifdef SYSCALL_DEBUG
dirstr = "in-out";
#endif
break;
default:
return (EINVAL);
break;
}
#ifdef SYSCALL_DEBUG
if (scdebug)
printf(
"OSF/1 IOCTL: group = %c, cmd = %d, len = %d, dir = %s\n",
group, cmd, len, dirstr);
#endif
SCARG(&a, fd) = SCARG(uap, fd);
SCARG(&a, com) = SCARG(uap, com) & 0xffffffff; /* XXX */
SCARG(&a, data) = SCARG(uap, data);
switch (group) {
case 'f':
return osf1_ioctl_f(l, &a, retval, cmd, dir, len);
case 'i':
return osf1_ioctl_i(l, &a, retval, cmd, dir, len);
case 't':
return osf1_ioctl_t(l, &a, retval, cmd, dir, len);
default:
return (ENOTTY);
}
}
static int
osf1_ioctl_f(struct lwp *l, const struct sys_ioctl_args *uap, register_t *retval, int cmd, int dir, int len)
{
switch (cmd) {
case 1: /* OSF/1 FIOCLEX */
case 2: /* OSF/1 FIONCLEX */
case 123: /* OSF/1 FIOGETOWN */
case 124: /* OSF/1 FIOSETOWN */
case 125: /* OSF/1 FIOASYNC */
case 126: /* OSF/1 FIONBIO */
case 127: /* OSF/1 FIONREAD */
/* same as in NetBSD */
break;
default:
return (ENOTTY);
}
return sys_ioctl(l, uap, retval);
}
static int
osf1_ioctl_i(struct lwp *l, const struct sys_ioctl_args *uap, register_t *retval, int cmd, int dir, int len)
{
switch (cmd) {
case 12: /* OSF/1 SIOCSIFADDR */
case 14: /* OSF/1 SIOCSIFDSTADDR */
case 16: /* OSF/1 SIOCSIFFLAGS (XXX) */
case 17: /* OSF/1 SIOCGIFFLAGS (XXX) */
case 19: /* OSF/1 SIOCSIFBRDADDR */
case 22: /* OSF/1 SIOCSIFNETMASK */
case 23: /* OSF/1 SIOCGIFMETRIC */
case 24: /* OSF/1 SIOCSIFMETRIC */
case 25: /* OSF/1 SIOCDIFADDR */
case 33: /* OSF/1 SIOCGIFADDR */
case 34: /* OSF/1 SIOCGIFDSTADDR */
case 35: /* OSF/1 SIOCGIFBRDADDR */
case 37: /* OSF/1 SIOCGIFNETMASK */
/* same as in NetBSD */
break;
default:
return (ENOTTY);
}
return sys_ioctl(l, uap, retval);
}
static int
osf1_ioctl_t(struct lwp *l, const struct sys_ioctl_args *uap, register_t *retval, int cmd, int dir, int len)
{
switch (cmd) {
#ifdef COMPAT_43
case 8: /* OSF/1 COMPAT_43 TIOCGETP (XXX) */
case 9: /* OSF/1 COMPAT_43 TIOCSETP (XXX) */
#endif
case 19: /* OSF/1 TIOCGETA (XXX) */
case 20: /* OSF/1 TIOCSETA (XXX) */
case 21: /* OSF/1 TIOCSETAW (XXX) */
case 22: /* OSF/1 TIOCSETAF (XXX) */
case 26: /* OSF/1 TIOCGETD (XXX) */
case 27: /* OSF/1 TIOCSETD (XXX) */
case 97: /* OSF/1 TIOCSCTTY */
case 103: /* OSF/1 TIOCSWINSZ */
case 104: /* OSF/1 TIOCGWINSZ */
/* same as in NetBSD */
break;
default:
return (ENOTTY);
}
return sys_ioctl(l, uap, retval);
}

View File

@ -1,426 +0,0 @@
/* $NetBSD: osf1_misc.c,v 1.88 2018/09/03 16:29:29 riastradh Exp $ */
/*
* Copyright (c) 1999 Christopher G. Demetriou. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Christopher G. Demetriou
* for the NetBSD Project.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: osf1_misc.c,v 1.88 2018/09/03 16:29:29 riastradh Exp $");
#if defined(_KERNEL_OPT)
#include "opt_syscall_debug.h"
#endif
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/namei.h>
#include <sys/proc.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <sys/filedesc.h>
#include <sys/kernel.h>
#include <sys/mman.h>
#include <sys/mount.h>
#include <sys/signal.h>
#include <sys/signalvar.h>
#include <sys/reboot.h>
#include <sys/syscallargs.h>
#include <sys/exec.h>
#include <sys/vnode.h>
#include <sys/socketvar.h>
#include <sys/resource.h>
#include <sys/resourcevar.h>
#include <sys/wait.h>
#include <machine/alpha.h>
#include <machine/cpuconf.h>
#include <machine/rpb.h>
#include <machine/fpu.h>
#include <compat/osf1/osf1.h>
#include <compat/osf1/osf1_syscallargs.h>
#include <compat/common/compat_util.h>
#include <compat/osf1/osf1_cvt.h>
int
osf1_sys_classcntl(struct lwp *l, const struct osf1_sys_classcntl_args *uap, register_t *retval)
{
/* XXX */
return (ENOSYS);
}
int
osf1_sys_reboot(struct lwp *l, const struct osf1_sys_reboot_args *uap, register_t *retval)
{
struct sys_reboot_args a;
unsigned long leftovers;
/* translate opt */
SCARG(&a, opt) = emul_flags_translate(osf1_reboot_opt_xtab,
SCARG(uap, opt), &leftovers);
if (leftovers != 0)
return (EINVAL);
SCARG(&a, bootstr) = NULL;
return sys_reboot(l, &a, retval);
}
int
osf1_sys_set_program_attributes(struct lwp *l, const struct osf1_sys_set_program_attributes_args *uap, register_t *retval)
{
struct proc *p = l->l_proc;
segsz_t tsize, dsize;
tsize = btoc(SCARG(uap, tsize));
dsize = btoc(SCARG(uap, dsize));
if (dsize > p->p_rlimit[RLIMIT_DATA].rlim_cur)
return (ENOMEM);
if (tsize > MAXTSIZ)
return (ENOMEM);
/* XXXSMP unlocked */
p->p_vmspace->vm_taddr = SCARG(uap, taddr);
p->p_vmspace->vm_tsize = tsize;
p->p_vmspace->vm_daddr = SCARG(uap, daddr);
p->p_vmspace->vm_dsize = dsize;
return (0);
}
int
osf1_sys_getsysinfo(struct lwp *l, const struct osf1_sys_getsysinfo_args *uap, register_t *retval)
{
extern int ncpus;
int error;
int unit;
long percpu;
long proctype;
u_int64_t fpflags;
struct osf1_cpu_info cpuinfo;
const void *data;
size_t datalen;
error = 0;
switch(SCARG(uap, op))
{
case OSF_GET_MAX_UPROCS:
data = &maxproc;
datalen = sizeof(maxproc);
break;
case OSF_GET_PHYSMEM:
data = &physmem;
datalen = sizeof(physmem);
break;
case OSF_GET_MAX_CPU:
case OSF_GET_CPUS_IN_BOX:
data = &ncpus;
datalen = sizeof(ncpus);
break;
case OSF_GET_IEEE_FP_CONTROL:
if (((fpflags = alpha_read_fp_c(l)) & IEEE_INHERIT) != 0) {
fpflags |= 1ULL << 63;
fpflags &= ~IEEE_INHERIT;
}
data = &fpflags;
datalen = sizeof(fpflags);
break;
case OSF_GET_CPU_INFO:
memset(&cpuinfo, 0, sizeof(cpuinfo));
#ifdef __alpha__
unit = alpha_pal_whami();
#else
unit = 0; /* XXX */
#endif
cpuinfo.current_cpu = unit;
cpuinfo.cpus_in_box = ncpus;
cpuinfo.cpu_type = LOCATE_PCS(hwrpb, unit)->pcs_proc_type;
cpuinfo.ncpus = ncpus;
cpuinfo.cpus_present = ncpus;
cpuinfo.cpus_running = ncpus;
cpuinfo.cpu_binding = 1;
cpuinfo.cpu_ex_binding = 0;
cpuinfo.mhz = hwrpb->rpb_cc_freq / 1000000;
data = &cpuinfo;
datalen = sizeof(cpuinfo);
break;
case OSF_GET_PROC_TYPE:
#ifdef __alpha__
unit = alpha_pal_whami();
proctype = LOCATE_PCS(hwrpb, unit)->pcs_proc_type;
#else
proctype = 0; /* XXX */
#endif
data = &proctype;
datalen = sizeof(percpu);
break;
case OSF_GET_HWRPB: /* note -- osf/1 doesn't have rpb_tbhint[8] */
data = hwrpb;
datalen = hwrpb->rpb_size;
break;
case OSF_GET_PLATFORM_NAME:
data = platform.model;
datalen = strlen(platform.model) + 1;
break;
default:
printf("osf1_getsysinfo called with unknown op=%ld\n",
SCARG(uap, op));
/* return EINVAL; */
return 0;
}
if (SCARG(uap, nbytes) < datalen)
return (EINVAL);
error = copyout(data, SCARG(uap, buffer), datalen);
if (!error)
retval[0] = 1;
return (error);
}
int
osf1_sys_setsysinfo(struct lwp *l, const struct osf1_sys_setsysinfo_args *uap, register_t *retval)
{
u_int64_t temp;
int error;
error = 0;
switch(SCARG(uap, op)) {
case OSF_SET_IEEE_FP_CONTROL:
if ((error = copyin(SCARG(uap, buffer), &temp, sizeof(temp))))
break;
if (temp >> 63 != 0)
temp |= IEEE_INHERIT;
alpha_write_fp_c(l, temp);
break;
default:
uprintf("osf1_setsysinfo called with op=%ld\n", SCARG(uap, op));
//error = EINVAL;
}
retval[0] = 0;
return (error);
}
int
osf1_sys_sysinfo(struct lwp *l, const struct osf1_sys_sysinfo_args *uap, register_t *retval)
{
const char *string;
size_t slen;
int error;
error = 0;
switch (SCARG(uap, cmd)) {
case OSF1_SI_SYSNAME:
string = ostype;
break;
case OSF1_SI_HOSTNAME:
string = hostname;
break;
case OSF1_SI_RELEASE:
string = osrelease;
break;
case OSF1_SI_VERSION:
goto should_handle;
case OSF1_SI_MACHINE:
string = MACHINE;
break;
case OSF1_SI_ARCHITECTURE:
string = MACHINE_ARCH;
break;
case OSF1_SI_HW_SERIAL:
string = "666"; /* OSF/1 emulation? YES! */
break;
case OSF1_SI_HW_PROVIDER:
string = "unknown";
break;
case OSF1_SI_SRPC_DOMAIN:
goto dont_care;
case OSF1_SI_SET_HOSTNAME:
goto should_handle;
case OSF1_SI_SET_SYSNAME:
goto should_handle;
case OSF1_SI_SET_SRPC_DOMAIN:
goto dont_care;
default:
should_handle:
printf("osf1_sys_sysinfo(%d, %p, 0x%lx)\n", SCARG(uap, cmd),
SCARG(uap, buf), SCARG(uap,len));
dont_care:
return (EINVAL);
};
slen = strlen(string) + 1;
if (SCARG(uap, buf)) {
error = copyout(string, SCARG(uap, buf),
uimin(slen, SCARG(uap, len)));
if (!error && (SCARG(uap, len) > 0) && (SCARG(uap, len) < slen))
subyte(SCARG(uap, buf) + SCARG(uap, len) - 1, 0);
}
if (!error)
retval[0] = slen;
return (error);
}
int
osf1_sys_uname(struct lwp *l, const struct osf1_sys_uname_args *uap, register_t *retval)
{
struct osf1_utsname u;
const char *cp;
char *dp, *ep;
strncpy(u.sysname, ostype, sizeof(u.sysname));
strncpy(u.nodename, hostname, sizeof(u.nodename));
strncpy(u.release, osrelease, sizeof(u.release));
dp = u.version;
ep = &u.version[sizeof(u.version) - 1];
for (cp = version; *cp && *cp != '('; cp++)
;
for (cp++; *cp && *cp != ')' && dp < ep; cp++)
*dp++ = *cp;
for (; *cp && *cp != '#'; cp++)
;
for (; *cp && *cp != ':' && dp < ep; cp++)
*dp++ = *cp;
*dp = '\0';
strncpy(u.machine, MACHINE, sizeof(u.machine));
return (copyout((void *)&u, (void *)SCARG(uap, name), sizeof u));
}
int
osf1_sys_usleep_thread(struct lwp *l, const struct osf1_sys_usleep_thread_args *uap, register_t *retval)
{
struct osf1_timeval otv, endotv;
struct timeval tv, ntv, endtv;
u_long ticks;
int error;
if ((error = copyin(SCARG(uap, sleep), &otv, sizeof otv)))
return (error);
tv.tv_sec = otv.tv_sec;
tv.tv_usec = otv.tv_usec;
ticks = howmany((u_long)tv.tv_sec * 1000000 + tv.tv_usec, tick);
if (ticks == 0)
ticks = 1;
getmicrotime(&tv);
tsleep(l, PUSER|PCATCH, "uslpthrd", ticks); /* XXX */
if (SCARG(uap, slept) != NULL) {
getmicrotime(&ntv);
timersub(&ntv, &tv, &endtv);
if (endtv.tv_sec < 0 || endtv.tv_usec < 0)
endtv.tv_sec = endtv.tv_usec = 0;
endotv.tv_sec = endtv.tv_sec;
endotv.tv_usec = endtv.tv_usec;
error = copyout(&endotv, SCARG(uap, slept), sizeof endotv);
}
return (error);
}
int
osf1_sys_wait4(struct lwp *l, const struct osf1_sys_wait4_args *uap, register_t *retval)
{
struct osf1_rusage osf1_rusage;
struct rusage netbsd_rusage;
unsigned long leftovers;
int error, status;
int options = SCARG(uap, options);
int pid = SCARG(uap, pid);
/* translate options */
options = emul_flags_translate(osf1_wait_options_xtab,
options, &leftovers);
if (leftovers != 0)
return (EINVAL);
error = do_sys_wait(&pid, &status, options,
SCARG(uap, rusage) != NULL ? &netbsd_rusage : NULL);
retval[0] = pid;
if (pid == 0)
return error;
if (SCARG(uap, rusage)) {
osf1_cvt_rusage_from_native(&netbsd_rusage, &osf1_rusage);
error = copyout(&osf1_rusage, SCARG(uap, rusage),
sizeof osf1_rusage);
}
if (error == 0 && SCARG(uap, status))
error = copyout(&status, SCARG(uap, status), sizeof(status));
return error;
}

View File

@ -1,219 +0,0 @@
/* $NetBSD: osf1_mmap.c,v 1.14 2009/05/18 12:39:02 njoly Exp $ */
/*
* Copyright (c) 1999 Christopher G. Demetriou. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Christopher G. Demetriou
* for the NetBSD Project.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: osf1_mmap.c,v 1.14 2009/05/18 12:39:02 njoly Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/proc.h>
#include <sys/mman.h>
#include <sys/mount.h>
#include <sys/syscallargs.h>
#include <uvm/uvm.h> /* XXX see mmap emulation */
#include <compat/osf1/osf1.h>
#include <compat/osf1/osf1_syscallargs.h>
#include <compat/osf1/osf1_cvt.h>
int
osf1_sys_madvise(struct lwp *l, const struct osf1_sys_madvise_args *uap, register_t *retval)
{
struct sys_madvise_args a;
int error;
SCARG(&a, addr) = SCARG(uap, addr);
SCARG(&a, len) = SCARG(uap, len);
error = 0;
switch (SCARG(uap, behav)) {
case OSF1_MADV_NORMAL:
SCARG(&a, behav) = MADV_NORMAL;
break;
case OSF1_MADV_RANDOM:
SCARG(&a, behav) = MADV_RANDOM;
break;
case OSF1_MADV_SEQUENTIAL:
SCARG(&a, behav) = MADV_SEQUENTIAL;
break;
case OSF1_MADV_WILLNEED:
SCARG(&a, behav) = MADV_WILLNEED;
break;
case OSF1_MADV_DONTNEED_COMPAT:
SCARG(&a, behav) = MADV_DONTNEED;
break;
case OSF1_MADV_SPACEAVAIL:
SCARG(&a, behav) = MADV_SPACEAVAIL;
break;
case OSF1_MADV_DONTNEED:
/*
* XXX not supported. In Digital UNIX, this flushes all
* XXX data in the region and replaces it with ZFOD pages.
*/
error = EINVAL;
break;
default:
error = EINVAL;
break;
}
if (error == 0) {
error = sys_madvise(l, &a, retval);
/*
* NetBSD madvise() currently always returns ENOSYS.
* Digital UNIX says that non-operational requests (i.e.
* valid, but unimplemented 'behav') will return success.
*/
if (error == ENOSYS)
error = 0;
}
return (error);
}
int
osf1_sys_mmap(struct lwp *l, const struct osf1_sys_mmap_args *uap, register_t *retval)
{
struct proc *p = l->l_proc;
struct sys_mmap_args a;
unsigned long leftovers;
SCARG(&a, addr) = SCARG(uap, addr);
SCARG(&a, len) = SCARG(uap, len);
SCARG(&a, fd) = SCARG(uap, fd);
SCARG(&a, PAD) = 0;
SCARG(&a, pos) = SCARG(uap, pos);
/* translate prot */
SCARG(&a, prot) = emul_flags_translate(osf1_mmap_prot_xtab,
SCARG(uap, prot), &leftovers);
if (leftovers != 0)
return (EINVAL);
/* translate flags */
SCARG(&a, flags) = emul_flags_translate(osf1_mmap_flags_xtab,
SCARG(uap, flags), &leftovers);
if (leftovers != 0)
return (EINVAL);
/*
* XXX The following code is evil.
*
* The OSF/1 mmap() function attempts to map non-fixed entries
* near the address that the user specified. Therefore, for
* non-fixed entires we try to find space in the address space
* starting at that address. If the user specified zero, we
* start looking at at least PAGE_SIZE, so that programs can't
* accidentally live through deferencing NULL.
*
* The need for this kludgery is increased by the fact that
* the loader data segment is mapped at
* (end of user address space) - 1G, MAXDSIZ is 1G, and
* the VM system tries allocate non-fixed mappings _AFTER_
* (start of data) + MAXDSIZ. With the loader, of course,
* that means that it'll start trying at
* (end of user address space), and will never succeed!
*
* Notes:
*
* * Though we find space here, if something else (e.g. a second
* thread) were mucking with the address space the mapping
* we found might be used by another mmap(), and this call
* would clobber that region.
*
* * In general, tricks like this only work for MAP_ANON mappings,
* because of sharing/cache issues. That's not a problem on
* the Alpha, and though it's not good style to abuse that fact,
* there's little choice.
*
* * In order for this to be done right, the VM system should
* really try to use the requested 'addr' passed in to mmap()
* as a hint, even if non-fixed. If it's passed as zero,
* _maybe_ then try (start of data) + MAXDSIZ, or maybe
* provide a better way to avoid the data region altogether.
*/
if ((SCARG(&a, flags) & MAP_FIXED) == 0) {
vaddr_t addr = round_page((vaddr_t)SCARG(&a, addr));
vsize_t size = round_page((vsize_t)SCARG(&a, len));
int fixed = 0;
vm_map_lock(&p->p_vmspace->vm_map);
/* if non-NULL address given, start looking there */
if (addr != 0 && uvm_map_findspace(&p->p_vmspace->vm_map,
addr, size, &addr, NULL, 0, 0, 0) != NULL) {
fixed = 1;
goto done;
}
/* didn't find anything. take it again from the top. */
if (uvm_map_findspace(&p->p_vmspace->vm_map, PAGE_SIZE, size,
&addr, NULL, 0, 0, 0) != NULL) {
fixed = 1;
goto done;
}
done:
vm_map_unlock(&p->p_vmspace->vm_map);
if (fixed) {
SCARG(&a, flags) |= MAP_FIXED;
SCARG(&a, addr) = (void *)addr;
}
}
return sys_mmap(l, &a, retval);
}
int
osf1_sys_mprotect(struct lwp *l, const struct osf1_sys_mprotect_args *uap, register_t *retval)
{
struct sys_mprotect_args a;
unsigned long leftovers;
SCARG(&a, addr) = SCARG(uap, addr);
SCARG(&a, len) = SCARG(uap, len);
/* translate prot */
SCARG(&a, prot) = emul_flags_translate(osf1_mmap_prot_xtab,
SCARG(uap, prot), &leftovers);
if (leftovers != 0)
return (EINVAL);
return sys_mprotect(l, &a, retval);
}

View File

@ -1,84 +0,0 @@
/* $NetBSD: osf1_mod.c,v 1.6 2019/01/27 02:08:40 pgoyette 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.
*/
#ifdef _KERNEL_OPT
#include "opt_execfmt.h"
#endif
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: osf1_mod.c,v 1.6 2019/01/27 02:08:40 pgoyette Exp $");
#include <sys/param.h>
#include <sys/module.h>
#include <sys/exec.h>
#include <sys/exec_elf.h>
#include <sys/exec_ecoff.h>
#include <sys/signalvar.h>
#include <compat/osf1/osf1.h>
#include <compat/osf1/osf1_exec.h>
MODULE(MODULE_CLASS_EXEC, compat_osf1, "compat,compat_util,exec_ecoff");
#define OSF1_ARGLEN \
(OSF1_MAX_AUX_ENTRIES * sizeof (struct osf1_auxv) + \
2 * (MAXPATHLEN + 1)) /* exec & loader names */
static struct execsw osf1_execsw = {
.es_hdrsz = ECOFF_HDR_SIZE,
.es_makecmds = exec_ecoff_makecmds,
.u = {
.ecoff_probe_func = osf1_exec_ecoff_probe,
},
.es_emul = &emul_osf1,
.es_prio = EXECSW_PRIO_ANY,
.es_arglen = OSF1_ARGLEN,
.es_copyargs = osf1_copyargs,
.es_setregs = cpu_exec_ecoff_setregs,
.es_coredump = coredump_netbsd,
.es_setup_stack = exec_setup_stack,
};
static int
compat_osf1_modcmd(modcmd_t cmd, void *arg)
{
switch (cmd) {
case MODULE_CMD_INIT:
return exec_add(&osf1_execsw, 1);
case MODULE_CMD_FINI:
return exec_remove(&osf1_execsw, 1);
default:
return ENOTTY;
}
}

View File

@ -1,313 +0,0 @@
/* $NetBSD: osf1_mount.c,v 1.55 2018/09/03 16:29:29 riastradh Exp $ */
/*
* Copyright (c) 1999 Christopher G. Demetriou. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Christopher G. Demetriou
* for the NetBSD Project.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: osf1_mount.c,v 1.55 2018/09/03 16:29:29 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/namei.h>
#include <sys/proc.h>
#include <sys/file.h>
#include <sys/filedesc.h>
#include <sys/kernel.h>
#include <sys/mount.h>
#include <sys/vnode.h>
#include <sys/syscallargs.h>
#include <compat/osf1/osf1.h>
#include <compat/osf1/osf1_syscallargs.h>
#include <compat/common/compat_util.h>
#include <compat/osf1/osf1_cvt.h>
#include <net/if.h>
#include <netinet/in.h>
#include <nfs/rpcv2.h>
#include <nfs/nfsproto.h>
#include <nfs/nfs.h>
#include <nfs/nfsmount.h>
#include <ufs/ufs/quota.h>
#include <ufs/ufs/ufsmount.h>
#include <machine/vmparam.h>
#define OSF1_MNT_WAIT 0x1
#define OSF1_MNT_NOWAIT 0x2
#define OSF1_MNT_FORCE 0x1
#define OSF1_MNT_NOFORCE 0x2
/* acceptable flags for various calls */
#define OSF1_GETFSSTAT_FLAGS (OSF1_MNT_WAIT|OSF1_MNT_NOWAIT)
#define OSF1_MOUNT_FLAGS 0xffffffff /* XXX */
#define OSF1_UNMOUNT_FLAGS (OSF1_MNT_FORCE|OSF1_MNT_NOFORCE)
static int osf1_mount_mfs(struct lwp *, const struct osf1_sys_mount_args *);
static int osf1_mount_nfs(struct lwp *, const struct osf1_sys_mount_args *);
int
osf1_sys_fstatfs(struct lwp *l, const struct osf1_sys_fstatfs_args *uap, register_t *retval)
{
file_t *fp;
struct mount *mp;
struct statvfs *sp;
struct osf1_statfs osfs;
int error;
/* fd_getvnode() will use the descriptor for us */
if ((error = fd_getvnode(SCARG(uap, fd), &fp)))
return (error);
mp = fp->f_vnode->v_mount;
sp = &mp->mnt_stat;
if ((error = VFS_STATVFS(mp, sp)))
goto out;
sp->f_flag = mp->mnt_flag & MNT_VISFLAGMASK;
osf1_cvt_statfs_from_native(sp, &osfs);
error = copyout(&osfs, SCARG(uap, buf), uimin(sizeof osfs,
SCARG(uap, len)));
out:
fd_putfile(SCARG(uap, fd));
return (error);
}
int
osf1_sys_getfsstat(struct lwp *l, const struct osf1_sys_getfsstat_args *uap, register_t *retval)
{
mount_iterator_t *iter;
struct mount *mp;
struct statvfs *sp;
struct osf1_statfs osfs;
char *osf_sfsp;
long count, maxcount, error;
if (SCARG(uap, flags) & ~OSF1_GETFSSTAT_FLAGS)
return (EINVAL);
maxcount = SCARG(uap, bufsize) / sizeof(struct osf1_statfs);
osf_sfsp = (void *)SCARG(uap, buf);
mountlist_iterator_init(&iter);
count = 0;
while ((mp = mountlist_iterator_next(iter)) != NULL) {
if (osf_sfsp && count < maxcount) {
sp = &mp->mnt_stat;
/*
* If OSF1_MNT_NOWAIT is specified, do not refresh the
* fsstat cache. OSF1_MNT_WAIT overrides
* OSF1_MNT_NOWAIT.
*/
if (((SCARG(uap, flags) & OSF1_MNT_NOWAIT) == 0 ||
(SCARG(uap, flags) & OSF1_MNT_WAIT)) &&
(error = VFS_STATVFS(mp, sp)) == 0) {
sp->f_flag = mp->mnt_flag & MNT_VISFLAGMASK;
osf1_cvt_statfs_from_native(sp, &osfs);
if ((error = copyout(&osfs, osf_sfsp,
sizeof (struct osf1_statfs)))) {
mountlist_iterator_destroy(iter);
return (error);
}
osf_sfsp += sizeof (struct osf1_statfs);
}
}
count++;
}
mountlist_iterator_destroy(iter);
if (osf_sfsp && count > maxcount)
*retval = maxcount;
else
*retval = count;
return (0);
}
int
osf1_sys_mount(struct lwp *l, const struct osf1_sys_mount_args *uap, register_t *retval)
{
if (SCARG(uap, flags) & ~OSF1_MOUNT_FLAGS)
return (EINVAL);
/* XXX - xlate flags */
switch (SCARG(uap, type)) {
case OSF1_MOUNT_NFS:
return osf1_mount_nfs(l, uap);
break;
case OSF1_MOUNT_MFS:
return osf1_mount_mfs(l, uap);
default:
return (EINVAL);
}
}
int
osf1_sys_statfs(struct lwp *l, const struct osf1_sys_statfs_args *uap, register_t *retval)
{
struct mount *mp;
struct statvfs *sp;
struct osf1_statfs osfs;
int error;
struct vnode *vp;
error = namei_simple_user(SCARG(uap, path),
NSM_FOLLOW_TRYEMULROOT, &vp);
if (error != 0)
return (error);
mp = vp->v_mount;
sp = &mp->mnt_stat;
vrele(vp);
if ((error = VFS_STATVFS(mp, sp)))
return (error);
sp->f_flag = mp->mnt_flag & MNT_VISFLAGMASK;
osf1_cvt_statfs_from_native(sp, &osfs);
return copyout(&osfs, SCARG(uap, buf), uimin(sizeof osfs,
SCARG(uap, len)));
}
int
osf1_sys_unmount(struct lwp *l, const struct osf1_sys_unmount_args *uap, register_t *retval)
{
struct sys_unmount_args a;
SCARG(&a, path) = SCARG(uap, path);
if (SCARG(uap, flags) & ~OSF1_UNMOUNT_FLAGS)
return (EINVAL);
SCARG(&a, flags) = 0;
if ((SCARG(uap, flags) & OSF1_MNT_FORCE) &&
(SCARG(uap, flags) & OSF1_MNT_NOFORCE) == 0)
SCARG(&a, flags) |= MNT_FORCE;
return sys_unmount(l, &a, retval);
}
static int
osf1_mount_mfs(struct lwp *l, const struct osf1_sys_mount_args *uap)
{
struct osf1_mfs_args osf_ma;
struct mfs_args bsd_ma;
int error;
register_t dummy;
if ((error = copyin(SCARG(uap, data), &osf_ma, sizeof osf_ma)))
return error;
memset(&bsd_ma, 0, sizeof bsd_ma);
bsd_ma.fspec = osf_ma.name;
/* XXX export args */
bsd_ma.base = osf_ma.base;
bsd_ma.size = osf_ma.size;
return do_sys_mount(l, "mfs", UIO_SYSSPACE, SCARG(uap, path),
SCARG(uap, flags), &bsd_ma, UIO_SYSSPACE, sizeof bsd_ma, &dummy);
}
static int
osf1_mount_nfs(struct lwp *l, const struct osf1_sys_mount_args *uap)
{
struct osf1_nfs_args osf_na;
struct nfs_args bsd_na;
int error;
unsigned long leftovers;
register_t dummy;
if ((error = copyin(SCARG(uap, data), &osf_na, sizeof osf_na)))
return error;
memset(&bsd_na, 0, sizeof bsd_na);
bsd_na.addr = (struct sockaddr *)osf_na.addr;
bsd_na.addrlen = sizeof (struct sockaddr_in);
bsd_na.fh = osf_na.fh;
/* translate flags */
bsd_na.flags = emul_flags_translate(osf1_nfs_mount_flags_xtab,
osf_na.flags, &leftovers);
if (leftovers & OSF1_NFSMNT_HOSTNAME) {
leftovers &= ~OSF1_NFSMNT_HOSTNAME;
bsd_na.hostname = osf_na.hostname;
} else {
/* XXX FILL IN HOST NAME WITH IPADDR? */
}
if (leftovers & OSF1_NFSMNT_TCP) {
leftovers &= ~OSF1_NFSMNT_TCP;
bsd_na.sotype = SOCK_DGRAM;
bsd_na.proto = 0;
} else {
bsd_na.sotype = SOCK_STREAM;
bsd_na.proto = 0;
}
if (leftovers != 0)
return (EINVAL);
/* copy structure elements based on flags */
if (bsd_na.flags & NFSMNT_WSIZE)
bsd_na.wsize = osf_na.wsize;
if (bsd_na.flags & NFSMNT_RSIZE)
bsd_na.rsize = osf_na.rsize;
if (bsd_na.flags & NFSMNT_TIMEO)
bsd_na.timeo = osf_na.timeo;
if (bsd_na.flags & NFSMNT_RETRANS)
bsd_na.retrans = osf_na.retrans;
return do_sys_mount(l, "nfs", UIO_SYSSPACE, SCARG(uap, path),
SCARG(uap, flags), &bsd_na, UIO_SYSSPACE, sizeof bsd_na, &dummy);
}

View File

@ -1,117 +0,0 @@
/* $NetBSD: osf1_prot.c,v 1.13 2007/12/20 23:03:03 dsl Exp $ */
/*
* Copyright (c) 1999 Christopher G. Demetriou. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Christopher G. Demetriou
* for the NetBSD Project.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: osf1_prot.c,v 1.13 2007/12/20 23:03:03 dsl Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/proc.h>
#include <sys/prot.h>
#include <sys/mount.h>
#include <sys/syscallargs.h>
#include <compat/osf1/osf1.h>
#include <compat/osf1/osf1_syscallargs.h>
#include <compat/osf1/osf1_cvt.h>
/*
* OSF/1 defines _POSIX_SAVED_IDS, which means that our normal
* setgid() won't work.
*
* If you change "uid" to "gid" in the discussion, below, about
* setuid(), you'll get a correct description of setgid().
*/
int
osf1_sys_setgid(struct lwp *l, const struct osf1_sys_setgid_args *uap, register_t *retval)
{
gid_t gid = SCARG(uap, gid);
int error;
error = do_setresgid(l, gid, gid, gid, 0);
if (error != 0)
error = do_setresgid(l, -1, gid, -1, ID_E_EQ_R | ID_E_EQ_S );
return error;
}
/*
* OSF/1 defines _POSIX_SAVED_IDS, which means that our normal
* setuid() won't work.
*
* Instead, by P1003.1b-1993, setuid() is supposed to work like:
* If the process has appropriate [super-user] privileges, the
* setuid() function sets the real user ID, effective user
* ID, and the saved set-user-ID to uid.
* If the process does not have appropriate privileges, but uid
* is equal to the real user ID or the saved set-user-ID, the
* setuid() function sets the effective user ID to uid; the
* real user ID and saved set-user-ID remain unchanged by
* this function call.
*/
int
osf1_sys_setuid(struct lwp *l, const struct osf1_sys_setuid_args *uap, register_t *retval)
{
uid_t uid = SCARG(uap, uid);
int error;
error = do_setresuid(l, uid, uid, uid, 0);
if (error != 0)
error = do_setresuid(l, -1, uid, -1, ID_E_EQ_R | ID_E_EQ_S );
return error;
}

View File

@ -1,158 +0,0 @@
/* $NetBSD: osf1_resource.c,v 1.15 2012/11/03 23:22:22 njoly Exp $ */
/*
* Copyright (c) 1999 Christopher G. Demetriou. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Christopher G. Demetriou
* for the NetBSD Project.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: osf1_resource.c,v 1.15 2012/11/03 23:22:22 njoly Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/proc.h>
#include <sys/mount.h>
#include <sys/syscallargs.h>
#include <sys/resource.h>
#include <sys/resourcevar.h>
#include <compat/osf1/osf1.h>
#include <compat/osf1/osf1_syscallargs.h>
#include <compat/osf1/osf1_cvt.h>
int
osf1_sys_getrlimit(struct lwp *l, const struct osf1_sys_getrlimit_args *uap, register_t *retval)
{
struct sys_getrlimit_args a;
switch (SCARG(uap, which)) {
case OSF1_RLIMIT_CPU:
SCARG(&a, which) = RLIMIT_CPU;
break;
case OSF1_RLIMIT_FSIZE:
SCARG(&a, which) = RLIMIT_FSIZE;
break;
case OSF1_RLIMIT_DATA:
SCARG(&a, which) = RLIMIT_DATA;
break;
case OSF1_RLIMIT_STACK:
SCARG(&a, which) = RLIMIT_STACK;
break;
case OSF1_RLIMIT_CORE:
SCARG(&a, which) = RLIMIT_CORE;
break;
case OSF1_RLIMIT_RSS:
SCARG(&a, which) = RLIMIT_RSS;
break;
case OSF1_RLIMIT_NOFILE:
SCARG(&a, which) = RLIMIT_NOFILE;
break;
case OSF1_RLIMIT_AS:
SCARG(&a, which) = RLIMIT_AS;
break;
default:
return (EINVAL);
}
/* XXX should translate */
SCARG(&a, rlp) = SCARG(uap, rlp);
return sys_getrlimit(l, &a, retval);
}
int
osf1_sys_getrusage(struct lwp *l, const struct osf1_sys_getrusage_args *uap, register_t *retval)
{
int error, who;
struct osf1_rusage osf1_rusage;
struct rusage ru;
struct proc *p = l->l_proc;
switch (SCARG(uap, who)) {
case OSF1_RUSAGE_SELF:
who = RUSAGE_SELF;
break;
case OSF1_RUSAGE_CHILDREN:
who = RUSAGE_CHILDREN;
break;
case OSF1_RUSAGE_THREAD: /* XXX not supported */
default:
return EINVAL;
}
error = getrusage1(p, who, &ru);
if (error != 0)
return error;
osf1_cvt_rusage_from_native(&ru, &osf1_rusage);
return copyout(&osf1_rusage, SCARG(uap, rusage), sizeof osf1_rusage);
}
int
osf1_sys_setrlimit(struct lwp *l, const struct osf1_sys_setrlimit_args *uap, register_t *retval)
{
struct sys_setrlimit_args a;
switch (SCARG(uap, which)) {
case OSF1_RLIMIT_CPU:
SCARG(&a, which) = RLIMIT_CPU;
break;
case OSF1_RLIMIT_FSIZE:
SCARG(&a, which) = RLIMIT_FSIZE;
break;
case OSF1_RLIMIT_DATA:
SCARG(&a, which) = RLIMIT_DATA;
break;
case OSF1_RLIMIT_STACK:
SCARG(&a, which) = RLIMIT_STACK;
break;
case OSF1_RLIMIT_CORE:
SCARG(&a, which) = RLIMIT_CORE;
break;
case OSF1_RLIMIT_RSS:
SCARG(&a, which) = RLIMIT_RSS;
break;
case OSF1_RLIMIT_NOFILE:
SCARG(&a, which) = RLIMIT_NOFILE;
break;
case OSF1_RLIMIT_AS:
SCARG(&a, which) = RLIMIT_AS;
break;
default:
return (EINVAL);
}
/* XXX should translate */
SCARG(&a, rlp) = SCARG(uap, rlp);
return sys_setrlimit(l, &a, retval);
}

View File

@ -1,299 +0,0 @@
/* $NetBSD: osf1_signal.c,v 1.36 2010/04/23 15:19:21 rmind Exp $ */
/*
* Copyright (c) 1999 Christopher G. Demetriou. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Christopher G. Demetriou
* for the NetBSD Project.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: osf1_signal.c,v 1.36 2010/04/23 15:19:21 rmind Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/namei.h>
#include <sys/proc.h>
#include <sys/filedesc.h>
#include <sys/ioctl.h>
#include <sys/mount.h>
#include <sys/kernel.h>
#include <sys/signal.h>
#include <sys/signalvar.h>
#include <sys/syscallargs.h>
#include <compat/osf1/osf1.h>
#include <compat/osf1/osf1_signal.h>
#include <compat/osf1/osf1_syscallargs.h>
#include <compat/common/compat_util.h>
#include <compat/common/compat_sigaltstack.h>
#include <compat/osf1/osf1_cvt.h>
#if 0
int
osf1_sys_kill(struct lwp *l, const struct osf1_sys_kill_args *uap, register_t *retval)
{
struct sys_kill_args ka;
if (SCARG(uap, signum) < 0 || SCARG(uap, signum) > OSF1_NSIG)
return EINVAL;
SCARG(&ka, pid) = SCARG(uap, pid);
SCARG(&ka, signum) = osf1_to_native_signo[SCARG(uap, signum)];
return sys_kill(l, &ka, retval);
}
#endif
int
osf1_sys_sigaction(struct lwp *l, const struct osf1_sys_sigaction_args *uap, register_t *retval)
{
struct osf1_sigaction *nosa, *oosa, tmposa;
struct sigaction nbsa, obsa;
int error;
if (SCARG(uap, signum) < 0 || SCARG(uap, signum) > OSF1_NSIG)
return EINVAL;
nosa = SCARG(uap, nsa);
oosa = SCARG(uap, osa);
if (nosa != NULL) {
if ((error = copyin(nosa, &tmposa, sizeof(tmposa))) != 0)
return error;
osf1_cvt_sigaction_to_native(&tmposa, &nbsa);
}
if ((error = sigaction1(l,
osf1_to_native_signo[SCARG(uap, signum)],
(nosa ? &nbsa : NULL),
(oosa ? &obsa : NULL),
NULL, 0)) != 0)
return error;
if (oosa != NULL) {
osf1_cvt_sigaction_from_native(&obsa, &tmposa);
if ((error = copyout(&tmposa, oosa, sizeof(tmposa))) != 0)
return error;
}
return 0;
}
int
osf1_sys_sigaltstack(struct lwp *l, const struct osf1_sys_sigaltstack_args *uap, register_t *retval)
{
/* We silently ignore OSF1_SS_NOMASK and OSF1_SS_UCONTEXT */
compat_sigaltstack(uap, osf1_sigaltstack,
OSF1_SS_ONSTACK, OSF1_SS_DISABLE);
}
#if 0
int
osf1_sys_signal(struct lwp *l, const struct osf1_sys_signal_args *uap, register_t *retval)
{
struct proc *p = l->l_proc;
int signum;
int error;
if (SCARG(uap, signum) < 0 || SCARG(uap, signum) > OSF1_NSIG)
return EINVAL;
signum = osf1_to_native_signo[OSF1_SIGNO(SCARG(uap, signum))];
if (signum <= 0 || signum >= OSF1_NSIG) {
if (OSF1_SIGCALL(SCARG(uap, signum)) == OSF1_SIGNAL_MASK ||
OSF1_SIGCALL(SCARG(uap, signum)) == OSF1_SIGDEFER_MASK)
*retval = (int)OSF1_SIG_ERR;
return EINVAL;
}
switch (OSF1_SIGCALL(SCARG(uap, signum))) {
case OSF1_SIGDEFER_MASK:
/*
* sigset is identical to signal() except
* that SIG_HOLD is allowed as
* an action.
*/
if (SCARG(uap, handler) == OSF1_SIG_HOLD) {
struct sys_sigprocmask_args sa;
SCARG(&sa, how) = SIG_BLOCK;
SCARG(&sa, mask) = sigmask(signum);
return sys_sigprocmask(l, &sa, retval);
}
/* FALLTHROUGH */
case OSF1_SIGNAL_MASK:
{
struct sys_sigaction_args sa_args;
struct sigaction nbsa, obsa;
nbsa.sa_handler = SCARG(uap, handler);
sigemptyset(&nbsa.sa_mask);
nbsa.sa_flags = 0;
#if 0
if (signum != SIGALRM)
nbsa.sa_flags = SA_RESTART;
#endif
error = sigaction1(l, signum, &nbsa, &obsa, ?, ?);
if (error != 0) {
DPRINTF(("signal: sigaction failed: %d\n",
error));
*retval = (int)OSF1_SIG_ERR;
return error;
}
*retval = (int)obsa.sa_handler;
return 0;
}
case OSF1_SIGHOLD_MASK:
{
struct sys_sigprocmask_args sa;
SCARG(&sa, how) = SIG_BLOCK;
SCARG(&sa, mask) = sigmask(signum);
return sys_sigprocmask(l, &sa, retval);
}
case OSF1_SIGRELSE_MASK:
{
struct sys_sigprocmask_args sa;
SCARG(&sa, how) = SIG_UNBLOCK;
SCARG(&sa, mask) = sigmask(signum);
return sys_sigprocmask(l, &sa, retval);
}
case OSF1_SIGIGNORE_MASK:
{
struct sys_sigaction_args sa_args;
struct sigaction bsa;
bsa.sa_handler = SIG_IGN;
sigemptyset(&bsa.sa_mask);
bsa.sa_flags = 0;
if ((error = sigaction1(l, &bsa, NULL, ?, ?)) != 0) {
DPRINTF(("sigignore: sigaction failed\n"));
return error;
}
return 0;
}
case OSF1_SIGPAUSE_MASK:
{
struct sys_sigsuspend_args sa;
SCARG(&sa, mask) = p->p_sigmask & ~sigmask(signum);
return sys_sigsuspend(l, &sa, retval);
}
default:
return ENOSYS;
}
}
int
osf1_sys_sigpending(struct lwp *l, const struct osf1_sys_sigpending_args *uap, register_t *retval)
{
struct proc *p = l->l_proc;
sigset_t bss;
osf1_sigset_t oss;
bss = p->p_siglist & p->p_sigmask;
osf1_cvt_sigset_from_native(&bss, &oss);
return copyout(&oss, SCARG(uap, mask), sizeof(oss));
}
int
osf1_sys_sigprocmask(struct lwp *l, const struct osf1_sys_sigprocmask_args *uap, register_t *retval)
{
struct proc *p = l->l_proc;
osf1_sigset_t oss;
sigset_t bss;
int error = 0;
if (SCARG(uap, oset) != NULL) {
/* Fix the return value first if needed */
osf1_cvt_sigset_from_native(&p->p_sigmask, &oss);
if ((error = copyout(&oss, SCARG(uap, oset), sizeof(oss))) != 0)
return error;
}
if (SCARG(uap, set) == NULL)
/* Just examine */
return 0;
if ((error = copyin(SCARG(uap, set), &oss, sizeof(oss))) != 0)
return error;
osf1_cvt_sigset_to_native(&oss, &bss);
mutex_enter(p->p_lock);
switch (SCARG(uap, how)) {
case OSF1_SIG_BLOCK:
*l->l_sigmask |= bss & ~sigcantmask;
break;
case OSF1_SIG_UNBLOCK:
*l->l_sigmask &= ~bss;
lwp_lock(l);
l->l_flag |= LW_PENDSIG;
lwp_unlock(l);
break;
case OSF1_SIG_SETMASK:
*l->l_sigmask = bss & ~sigcantmask;
lwp_lock(l);
l->l_flag |= LW_PENDSIG;
lwp_unlock(l);
break;
default:
error = EINVAL;
break;
}
mutex_exit(p->p_lock);
return error;
}
int
osf1_sys_sigsuspend(struct lwp *l, const struct osf1_sys_sigsuspend_args *uap, register_t *retval)
{
osf1_sigset_t oss;
sigset_t bss;
struct sys_sigsuspend_args sa;
int error;
if ((error = copyin(SCARG(uap, ss), &oss, sizeof(oss))) != 0)
return error;
osf1_cvt_sigset_to_native(&oss, &bss);
SCARG(&sa, mask) = bss;
return sys_sigsuspend(l, &sa, retval);
}
#endif

View File

@ -1,50 +0,0 @@
/* $NetBSD: osf1_signal.h,v 1.6 1999/05/05 01:51:36 cgd Exp $ */
/* XXX OUT OF DATE, some of the non-signal number bits here don't belong */
#ifndef _OSF1_SIGNAL_H
#define _OSF1_SIGNAL_H
#define OSF1_SIGHUP 1
#define OSF1_SIGINT 2
#define OSF1_SIGQUIT 3
#define OSF1_SIGILL 4
#define OSF1_SIGTRAP 5
#define OSF1_SIGABRT 6
#define OSF1_SIGEMT 7
#define OSF1_SIGFPE 8
#define OSF1_SIGKILL 9
#define OSF1_SIGBUS 10
#define OSF1_SIGSEGV 11
#define OSF1_SIGSYS 12
#define OSF1_SIGPIPE 13
#define OSF1_SIGALRM 14
#define OSF1_SIGTERM 15
#define OSF1_SIGURG 16
#define OSF1_SIGSTOP 17
#define OSF1_SIGTSTP 18
#define OSF1_SIGCONT 19
#define OSF1_SIGCHLD 20
#define OSF1_SIGTTIN 21
#define OSF1_SIGTTOU 22
#define OSF1_SIGIO 23
#define OSF1_SIGXCPU 24
#define OSF1_SIGXFSZ 25
#define OSF1_SIGVTALRM 26
#define OSF1_SIGPROF 27
#define OSF1_SIGWINCH 28
#define OSF1_SIGINFO 29
#define OSF1_SIGUSR1 30
#define OSF1_SIGUSR2 31
#define OSF1_NSIG 32
#define OSF1_SIG_DFL (void(*)())0
#define OSF1_SIG_ERR (void(*)())-1
#define OSF1_SIG_IGN (void(*)())1
#define OSF1_SIG_HOLD (void(*)())2
#define OSF1_SIG_BLOCK 1
#define OSF1_SIG_UNBLOCK 2
#define OSF1_SIG_SETMASK 3
#endif /* !_OSF1_SIGNAL_H */

View File

@ -1,116 +0,0 @@
/* $NetBSD: osf1_signo.c,v 1.2 2013/01/02 18:48:22 dsl Exp $ */
/*
* Copyright (c) 1999 Christopher G. Demetriou. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Christopher G. Demetriou
* for the NetBSD Project.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: osf1_signo.c,v 1.2 2013/01/02 18:48:22 dsl Exp $");
#include <sys/types.h>
#include <sys/signal.h>
#include <compat/osf1/osf1.h>
/*
* These tables are used to translate between NetBSD and OSF/1 signal
* numbers.
*
* XXX IT IS NOT UP TO DATE.
*/
const int native_to_osf1_signo[] = {
0,
OSF1_SIGHUP,
OSF1_SIGINT,
OSF1_SIGQUIT,
OSF1_SIGILL,
OSF1_SIGTRAP,
OSF1_SIGABRT,
OSF1_SIGEMT,
OSF1_SIGFPE,
OSF1_SIGKILL,
OSF1_SIGBUS,
OSF1_SIGSEGV,
OSF1_SIGSYS,
OSF1_SIGPIPE,
OSF1_SIGALRM,
OSF1_SIGTERM,
OSF1_SIGURG,
OSF1_SIGSTOP,
OSF1_SIGTSTP,
OSF1_SIGCONT,
OSF1_SIGCHLD,
OSF1_SIGTTIN,
OSF1_SIGTTOU,
OSF1_SIGIO,
OSF1_SIGXCPU,
OSF1_SIGXFSZ,
OSF1_SIGVTALRM,
OSF1_SIGPROF,
OSF1_SIGWINCH,
OSF1_SIGINFO,
OSF1_SIGUSR1,
OSF1_SIGUSR2,
};
const int osf1_to_native_signo[] = {
0,
SIGHUP,
SIGINT,
SIGQUIT,
SIGILL,
SIGTRAP,
SIGABRT,
SIGEMT,
SIGFPE,
SIGKILL,
SIGBUS,
SIGSEGV,
SIGSYS,
SIGPIPE,
SIGALRM,
SIGTERM,
SIGURG,
SIGSTOP,
SIGTSTP,
SIGCONT,
SIGCHLD,
SIGTTIN,
SIGTTOU,
SIGIO,
SIGXCPU,
SIGXFSZ,
SIGVTALRM,
SIGPROF,
SIGWINCH,
SIGINFO,
SIGUSR1,
SIGUSR2,
};

View File

@ -1,193 +0,0 @@
/* $NetBSD: osf1_socket.c,v 1.23 2018/05/05 02:09:40 christos Exp $ */
/*
* Copyright (c) 1999 Christopher G. Demetriou. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Christopher G. Demetriou
* for the NetBSD Project.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: osf1_socket.c,v 1.23 2018/05/05 02:09:40 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/namei.h>
#include <sys/proc.h>
#include <sys/file.h>
#include <sys/mount.h>
#include <sys/syscallargs.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/exec.h>
#include <compat/osf1/osf1.h>
#include <compat/osf1/osf1_syscallargs.h>
#include <compat/common/compat_util.h>
#include <compat/osf1/osf1_cvt.h>
int
osf1_sys_recvmsg_xopen(struct lwp *l, const struct osf1_sys_recvmsg_xopen_args *uap, register_t *retval)
{
/* XXX */
return (EINVAL);
}
int
osf1_sys_sendmsg_xopen(struct lwp *l, const struct osf1_sys_sendmsg_xopen_args *uap, register_t *retval)
{
struct osf1_msghdr_xopen osf_msghdr;
struct osf1_iovec_xopen osf_iovec, *osf_iovec_ptr;
struct msghdr bsd_msghdr;
struct iovec *bsd_iovec;
unsigned long leftovers;
int flags;
unsigned int i, iov_len;
int error;
/*
* translate msghdr structure
*/
if ((error = copyin(SCARG(uap, msg), &osf_msghdr,
sizeof osf_msghdr)) != 0)
return (error);
error = osf1_cvt_msghdr_xopen_to_native(&osf_msghdr, &bsd_msghdr);
if (error != 0)
return (error);
/*
* translate flags
*/
flags = emul_flags_translate(osf1_sendrecv_msg_flags_xtab,
SCARG(uap, flags), &leftovers);
if (leftovers != 0)
return (EINVAL);
iov_len = bsd_msghdr.msg_iovlen;
if ((iov_len > IOV_MAX) || (iov_len == 0))
return EMSGSIZE;
bsd_iovec = kmem_alloc(iov_len * sizeof(struct iovec), KM_SLEEP);
bsd_msghdr.msg_iov = bsd_iovec;
osf_iovec_ptr = osf_msghdr.msg_iov;
for (i = 0; i < iov_len; i++) {
error = copyin(&osf_iovec_ptr[i], &osf_iovec, sizeof osf_iovec);
if (error != 0)
goto err;
bsd_iovec[i].iov_base = osf_iovec.iov_base;
bsd_iovec[i].iov_len = osf_iovec.iov_len;
}
error = do_sys_sendmsg(l, SCARG(uap, s), &bsd_msghdr, flags, retval);
err:
kmem_free(bsd_iovec, iov_len * sizeof(struct iovec));
return error;
}
int
osf1_sys_sendto(struct lwp *l, const struct osf1_sys_sendto_args *uap, register_t *retval)
{
struct sys_sendto_args a;
unsigned long leftovers;
SCARG(&a, s) = SCARG(uap, s);
SCARG(&a, buf) = SCARG(uap, buf);
SCARG(&a, len) = SCARG(uap, len);
SCARG(&a, to) = SCARG(uap, to);
SCARG(&a, tolen) = SCARG(uap, tolen);
/* translate flags */
SCARG(&a, flags) = emul_flags_translate(osf1_sendrecv_msg_flags_xtab,
SCARG(uap, flags), &leftovers);
if (leftovers != 0)
return (EINVAL);
return sys_sendto(l, &a, retval);
}
int
osf1_sys_socket(struct lwp *l, const struct osf1_sys_socket_args *uap, register_t *retval)
{
struct compat_30_sys_socket_args a;
/* XXX TRANSLATE */
if (SCARG(uap, domain) > AF_LINK)
return (EINVAL); /* XXX After AF_LINK, divergence. */
SCARG(&a, domain) = SCARG(uap, domain);
SCARG(&a, type) = SCARG(uap, type);
SCARG(&a, protocol) = SCARG(uap, protocol);
return compat_30_sys_socket(l, &a, retval);
}
int
osf1_sys_socketpair(struct lwp *l, const struct osf1_sys_socketpair_args *uap, register_t *retval)
{
struct sys_socketpair_args a;
/* XXX TRANSLATE */
if (SCARG(uap, domain) > AF_LINK)
return (EINVAL); /* XXX After AF_LINK, divergence. */
SCARG(&a, domain) = SCARG(uap, domain);
SCARG(&a, type) = SCARG(uap, type);
SCARG(&a, protocol) = SCARG(uap, protocol);
SCARG(&a, rsv) = SCARG(uap, rsv);
return sys_socketpair(l, &a, retval);
}

View File

@ -1,428 +0,0 @@
/* $NetBSD: osf1_syscall.h,v 1.67 2018/08/10 21:47:15 pgoyette Exp $ */
/*
* System call numbers.
*
* DO NOT EDIT-- this file is automatically generated.
* created from NetBSD: syscalls.master,v 1.49 2013/11/07 19:37:19 njoly Exp
*/
#ifndef _OSF1_SYS_SYSCALL_H_
#define _OSF1_SYS_SYSCALL_H_
#define OSF1_SYS_MAXSYSARGS 8
/* syscall: "syscall" ret: "int" args: */
#define OSF1_SYS_syscall 0
/* syscall: "exit" ret: "int" args: "int" */
#define OSF1_SYS_exit 1
/* syscall: "fork" ret: "int" args: */
#define OSF1_SYS_fork 2
/* syscall: "read" ret: "int" args: "int" "char *" "u_int" */
#define OSF1_SYS_read 3
/* syscall: "write" ret: "int" args: "int" "const char *" "u_int" */
#define OSF1_SYS_write 4
/* syscall: "close" ret: "int" args: "int" */
#define OSF1_SYS_close 6
/* syscall: "wait4" ret: "int" args: "int" "int *" "int" "struct osf1_rusage *" */
#define OSF1_SYS_wait4 7
/* syscall: "link" ret: "int" args: "const char *" "const char *" */
#define OSF1_SYS_link 9
/* syscall: "unlink" ret: "int" args: "const char *" */
#define OSF1_SYS_unlink 10
/* syscall: "chdir" ret: "int" args: "const char *" */
#define OSF1_SYS_chdir 12
/* syscall: "fchdir" ret: "int" args: "int" */
#define OSF1_SYS_fchdir 13
/* syscall: "mknod" ret: "int" args: "const char *" "int" "int" */
#define OSF1_SYS_mknod 14
/* syscall: "chmod" ret: "int" args: "const char *" "int" */
#define OSF1_SYS_chmod 15
/* syscall: "__posix_chown" ret: "int" args: "const char *" "int" "int" */
#define OSF1_SYS___posix_chown 16
/* syscall: "obreak" ret: "int" args: "char *" */
#define OSF1_SYS_obreak 17
/* syscall: "getfsstat" ret: "int" args: "struct osf1_statfs *" "long" "int" */
#define OSF1_SYS_getfsstat 18
/* syscall: "lseek" ret: "off_t" args: "int" "off_t" "int" */
#define OSF1_SYS_lseek 19
/* syscall: "getpid_with_ppid" ret: "pid_t" args: */
#define OSF1_SYS_getpid_with_ppid 20
/* syscall: "mount" ret: "int" args: "int" "const char *" "int" "void *" */
#define OSF1_SYS_mount 21
/* syscall: "unmount" ret: "int" args: "const char *" "int" */
#define OSF1_SYS_unmount 22
/* syscall: "setuid" ret: "int" args: "uid_t" */
#define OSF1_SYS_setuid 23
/* syscall: "getuid_with_euid" ret: "uid_t" args: */
#define OSF1_SYS_getuid_with_euid 24
/* syscall: "recvmsg_xopen" ret: "int" args: "int" "struct osf1_msghdr_xopen *" "int" */
#define OSF1_SYS_recvmsg_xopen 27
/* syscall: "sendmsg_xopen" ret: "int" args: "int" "const struct osf1_msghdr_xopen *" "int" */
#define OSF1_SYS_sendmsg_xopen 28
/* syscall: "access" ret: "int" args: "const char *" "int" */
#define OSF1_SYS_access 33
/* syscall: "sync" ret: "int" args: */
#define OSF1_SYS_sync 36
/* syscall: "kill" ret: "int" args: "int" "int" */
#define OSF1_SYS_kill 37
/* syscall: "setpgid" ret: "int" args: "int" "int" */
#define OSF1_SYS_setpgid 39
/* syscall: "dup" ret: "int" args: "int" */
#define OSF1_SYS_dup 41
/* syscall: "pipe" ret: "int" args: */
#define OSF1_SYS_pipe 42
/* syscall: "set_program_attributes" ret: "int" args: "void *" "unsigned long" "void *" "unsigned long" */
#define OSF1_SYS_set_program_attributes 43
/* syscall: "open" ret: "int" args: "const char *" "int" "int" */
#define OSF1_SYS_open 45
/* 46 is obsolete sigaction */
/* syscall: "getgid_with_egid" ret: "gid_t" args: */
#define OSF1_SYS_getgid_with_egid 47
/* syscall: "sigprocmask" ret: "int" args: "int" "sigset13_t" */
#define OSF1_SYS_sigprocmask 48
/* syscall: "__getlogin" ret: "int" args: "char *" "u_int" */
#define OSF1_SYS___getlogin 49
/* syscall: "__setlogin" ret: "int" args: "const char *" */
#define OSF1_SYS___setlogin 50
/* syscall: "acct" ret: "int" args: "const char *" */
#define OSF1_SYS_acct 51
/* syscall: "classcntl" ret: "int" args: "int" "int" "int" "int" */
#define OSF1_SYS_classcntl 53
/* syscall: "ioctl" ret: "int" args: "int" "int" "void *" */
#define OSF1_SYS_ioctl 54
/* syscall: "reboot" ret: "int" args: "int" */
#define OSF1_SYS_reboot 55
/* syscall: "revoke" ret: "int" args: "const char *" */
#define OSF1_SYS_revoke 56
/* syscall: "symlink" ret: "int" args: "const char *" "const char *" */
#define OSF1_SYS_symlink 57
/* syscall: "readlink" ret: "int" args: "const char *" "char *" "int" */
#define OSF1_SYS_readlink 58
/* syscall: "execve" ret: "int" args: "const char *" "char *const *" "char *const *" */
#define OSF1_SYS_execve 59
/* syscall: "umask" ret: "int" args: "int" */
#define OSF1_SYS_umask 60
/* syscall: "chroot" ret: "int" args: "const char *" */
#define OSF1_SYS_chroot 61
/* syscall: "getpgrp" ret: "int" args: */
#define OSF1_SYS_getpgrp 63
/* syscall: "getpagesize" ret: "int" args: */
#define OSF1_SYS_getpagesize 64
/* syscall: "vfork" ret: "int" args: */
#define OSF1_SYS_vfork 66
/* syscall: "stat" ret: "int" args: "const char *" "struct osf1_stat *" */
#define OSF1_SYS_stat 67
/* syscall: "lstat" ret: "int" args: "const char *" "struct osf1_stat *" */
#define OSF1_SYS_lstat 68
/* syscall: "mmap" ret: "void *" args: "void *" "size_t" "int" "int" "int" "off_t" */
#define OSF1_SYS_mmap 71
/* syscall: "munmap" ret: "int" args: "void *" "size_t" */
#define OSF1_SYS_munmap 73
/* syscall: "mprotect" ret: "int" args: "void *" "size_t" "int" */
#define OSF1_SYS_mprotect 74
/* syscall: "madvise" ret: "int" args: "void *" "size_t" "int" */
#define OSF1_SYS_madvise 75
/* syscall: "getgroups" ret: "int" args: "u_int" "gid_t *" */
#define OSF1_SYS_getgroups 79
/* syscall: "setgroups" ret: "int" args: "u_int" "gid_t *" */
#define OSF1_SYS_setgroups 80
/* syscall: "setpgrp" ret: "int" args: "int" "int" */
#define OSF1_SYS_setpgrp 82
/* syscall: "setitimer" ret: "int" args: "u_int" "struct osf1_itimerval *" "struct osf1_itimerval *" */
#define OSF1_SYS_setitimer 83
/* syscall: "getitimer" ret: "int" args: "u_int" "struct osf1_itimerval *" */
#define OSF1_SYS_getitimer 86
/* syscall: "gethostname" ret: "int" args: "char *" "u_int" */
#define OSF1_SYS_gethostname 87
/* syscall: "sethostname" ret: "int" args: "const char *" "u_int" */
#define OSF1_SYS_sethostname 88
/* syscall: "getdtablesize" ret: "int" args: */
#define OSF1_SYS_getdtablesize 89
/* syscall: "dup2" ret: "int" args: "int" "int" */
#define OSF1_SYS_dup2 90
/* syscall: "fstat" ret: "int" args: "int" "void *" */
#define OSF1_SYS_fstat 91
/* syscall: "fcntl" ret: "int" args: "int" "int" "void *" */
#define OSF1_SYS_fcntl 92
/* syscall: "select" ret: "int" args: "u_int" "fd_set *" "fd_set *" "fd_set *" "struct osf1_timeval *" */
#define OSF1_SYS_select 93
/* syscall: "poll" ret: "int" args: "struct pollfd *" "u_int" "int" */
#define OSF1_SYS_poll 94
/* syscall: "fsync" ret: "int" args: "int" */
#define OSF1_SYS_fsync 95
/* syscall: "setpriority" ret: "int" args: "int" "int" "int" */
#define OSF1_SYS_setpriority 96
/* syscall: "socket" ret: "int" args: "int" "int" "int" */
#define OSF1_SYS_socket 97
/* syscall: "connect" ret: "int" args: "int" "void *" "int" */
#define OSF1_SYS_connect 98
/* syscall: "accept" ret: "int" args: "int" "void *" "int *" */
#define OSF1_SYS_accept 99
/* syscall: "getpriority" ret: "int" args: "int" "int" */
#define OSF1_SYS_getpriority 100
/* syscall: "send" ret: "int" args: "int" "void *" "int" "int" */
#define OSF1_SYS_send 101
/* syscall: "recv" ret: "int" args: "int" "void *" "int" "int" */
#define OSF1_SYS_recv 102
/* syscall: "sigreturn" ret: "int" args: "struct sigcontext13 *" */
#define OSF1_SYS_sigreturn 103
/* syscall: "bind" ret: "int" args: "int" "void *" "int" */
#define OSF1_SYS_bind 104
/* syscall: "setsockopt" ret: "int" args: "int" "int" "int" "void *" "int" */
#define OSF1_SYS_setsockopt 105
/* syscall: "listen" ret: "int" args: "int" "int" */
#define OSF1_SYS_listen 106
/* syscall: "sigsuspend" ret: "int" args: "int" */
#define OSF1_SYS_sigsuspend 111
/* syscall: "sigstack" ret: "int" args: "struct sigstack *" "struct sigstack *" */
#define OSF1_SYS_sigstack 112
/* 115 is obsolete vtrace */
/* syscall: "gettimeofday" ret: "int" args: "struct osf1_timeval *" "struct osf1_timezone *" */
#define OSF1_SYS_gettimeofday 116
/* syscall: "getrusage" ret: "int" args: "int" "struct osf1_rusage *" */
#define OSF1_SYS_getrusage 117
/* syscall: "getsockopt" ret: "int" args: "int" "int" "int" "void *" "int *" */
#define OSF1_SYS_getsockopt 118
/* syscall: "readv" ret: "int" args: "int" "struct osf1_iovec *" "u_int" */
#define OSF1_SYS_readv 120
/* syscall: "writev" ret: "int" args: "int" "struct osf1_iovec *" "u_int" */
#define OSF1_SYS_writev 121
/* syscall: "settimeofday" ret: "int" args: "struct osf1_timeval *" "struct osf1_timezone *" */
#define OSF1_SYS_settimeofday 122
/* syscall: "__posix_fchown" ret: "int" args: "int" "int" "int" */
#define OSF1_SYS___posix_fchown 123
/* syscall: "fchmod" ret: "int" args: "int" "int" */
#define OSF1_SYS_fchmod 124
/* syscall: "recvfrom" ret: "int" args: "int" "void *" "size_t" "int" "void *" "int *" */
#define OSF1_SYS_recvfrom 125
/* syscall: "setreuid" ret: "int" args: "uid_t" "uid_t" */
#define OSF1_SYS_setreuid 126
/* syscall: "setregid" ret: "int" args: "gid_t" "gid_t" */
#define OSF1_SYS_setregid 127
/* syscall: "__posix_rename" ret: "int" args: "const char *" "const char *" */
#define OSF1_SYS___posix_rename 128
/* syscall: "truncate" ret: "int" args: "const char *" "off_t" */
#define OSF1_SYS_truncate 129
/* syscall: "ftruncate" ret: "int" args: "int" "off_t" */
#define OSF1_SYS_ftruncate 130
/* syscall: "flock" ret: "int" args: "int" "int" */
#define OSF1_SYS_flock 131
/* syscall: "setgid" ret: "int" args: "gid_t" */
#define OSF1_SYS_setgid 132
/* syscall: "sendto" ret: "int" args: "int" "void *" "size_t" "int" "struct sockaddr *" "int" */
#define OSF1_SYS_sendto 133
/* syscall: "shutdown" ret: "int" args: "int" "int" */
#define OSF1_SYS_shutdown 134
/* syscall: "socketpair" ret: "int" args: "int" "int" "int" "int *" */
#define OSF1_SYS_socketpair 135
/* syscall: "mkdir" ret: "int" args: "const char *" "int" */
#define OSF1_SYS_mkdir 136
/* syscall: "rmdir" ret: "int" args: "const char *" */
#define OSF1_SYS_rmdir 137
/* syscall: "utimes" ret: "int" args: "const char *" "const struct osf1_timeval *" */
#define OSF1_SYS_utimes 138
/* 139 is obsolete 4.2 sigreturn */
/* syscall: "getpeername" ret: "int" args: "int" "void *" "int *" */
#define OSF1_SYS_getpeername 141
/* syscall: "gethostid" ret: "int32_t" args: */
#define OSF1_SYS_gethostid 142
/* syscall: "sethostid" ret: "int" args: "int32_t" */
#define OSF1_SYS_sethostid 143
/* syscall: "getrlimit" ret: "int" args: "u_int" "struct rlimit *" */
#define OSF1_SYS_getrlimit 144
/* syscall: "setrlimit" ret: "int" args: "u_int" "struct rlimit *" */
#define OSF1_SYS_setrlimit 145
/* syscall: "setsid" ret: "int" args: */
#define OSF1_SYS_setsid 147
/* syscall: "quota" ret: "int" args: */
#define OSF1_SYS_quota 149
/* syscall: "getsockname" ret: "int" args: "int" "void *" "int *" */
#define OSF1_SYS_getsockname 150
/* syscall: "sigaction" ret: "int" args: "int" "struct osf1_sigaction *" "struct osf1_sigaction *" */
#define OSF1_SYS_sigaction 156
/* syscall: "getdirentries" ret: "int" args: "int" "char *" "int" "long *" */
#define OSF1_SYS_getdirentries 159
/* syscall: "statfs" ret: "int" args: "const char *" "struct osf1_statfs *" "int" */
#define OSF1_SYS_statfs 160
/* syscall: "fstatfs" ret: "int" args: "int" "struct osf1_statfs *" "int" */
#define OSF1_SYS_fstatfs 161
/* syscall: "getdomainname" ret: "int" args: "char *" "int" */
#define OSF1_SYS_getdomainname 165
/* syscall: "setdomainname" ret: "int" args: "char *" "int" */
#define OSF1_SYS_setdomainname 166
/* syscall: "uname" ret: "int" args: "struct osf1_uname *" */
#define OSF1_SYS_uname 207
/* syscall: "__posix_lchown" ret: "int" args: "const char *" "int" "int" */
#define OSF1_SYS___posix_lchown 208
/* syscall: "shmat" ret: "void *" args: "int" "const void *" "int" */
#define OSF1_SYS_shmat 209
/* syscall: "shmctl" ret: "int" args: "int" "int" "struct osf1_shmid_ds *" */
#define OSF1_SYS_shmctl 210
/* syscall: "shmdt" ret: "int" args: "const void *" */
#define OSF1_SYS_shmdt 211
/* syscall: "shmget" ret: "int" args: "osf1_key_t" "size_t" "int" */
#define OSF1_SYS_shmget 212
/* syscall: "stat2" ret: "int" args: "const char *" "struct osf1_stat2 *" */
#define OSF1_SYS_stat2 224
/* syscall: "lstat2" ret: "int" args: "const char *" "struct osf1_stat2 *" */
#define OSF1_SYS_lstat2 225
/* syscall: "fstat2" ret: "int" args: "int" "struct osf1_stat2 *" */
#define OSF1_SYS_fstat2 226
/* syscall: "getpgid" ret: "pid_t" args: "pid_t" */
#define OSF1_SYS_getpgid 233
/* syscall: "getsid" ret: "pid_t" args: "pid_t" */
#define OSF1_SYS_getsid 234
/* syscall: "sigaltstack" ret: "int" args: "struct osf1_sigaltstack *" "struct osf1_sigaltstack *" */
#define OSF1_SYS_sigaltstack 235
/* syscall: "sysinfo" ret: "int" args: "int" "char *" "long" */
#define OSF1_SYS_sysinfo 241
/* syscall: "pathconf" ret: "long" args: "const char *" "int" */
#define OSF1_SYS_pathconf 247
/* syscall: "fpathconf" ret: "long" args: "int" "int" */
#define OSF1_SYS_fpathconf 248
/* syscall: "usleep_thread" ret: "int" args: "struct osf1_timeval *" "struct osf1_timeval *" */
#define OSF1_SYS_usleep_thread 251
/* syscall: "getsysinfo" ret: "int" args: "u_long" "void *" "u_long" "void *" "u_long" */
#define OSF1_SYS_getsysinfo 256
/* syscall: "setsysinfo" ret: "int" args: "u_long" "void *" "u_long" "void *" "u_long" */
#define OSF1_SYS_setsysinfo 257
#define OSF1_SYS_MAXSYSCALL 267
#define OSF1_SYS_NSYSENT 512
#endif /* _OSF1_SYS_SYSCALL_H_ */

View File

@ -1,837 +0,0 @@
/* $NetBSD: osf1_syscallargs.h,v 1.68 2018/08/10 21:47:15 pgoyette Exp $ */
/*
* System call argument lists.
*
* DO NOT EDIT-- this file is automatically generated.
* created from NetBSD: syscalls.master,v 1.49 2013/11/07 19:37:19 njoly Exp
*/
#ifndef _OSF1_SYS_SYSCALLARGS_H_
#define _OSF1_SYS_SYSCALLARGS_H_
/* Forward declaration */
struct lwp;
#define OSF1_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) /*LINTED*/ \
typedef char call##_check_args[sizeof (struct call##_args) \
<= OSF1_SYS_MAXSYSARGS * sizeof (register_t) ? 1 : -1];
struct sys_exit_args;
struct sys_read_args;
struct sys_write_args;
struct sys_close_args;
struct osf1_sys_wait4_args {
syscallarg(int) pid;
syscallarg(int *) status;
syscallarg(int) options;
syscallarg(struct osf1_rusage *) rusage;
};
check_syscall_args(osf1_sys_wait4)
struct sys_link_args;
struct sys_unlink_args;
struct sys_chdir_args;
struct sys_fchdir_args;
struct osf1_sys_mknod_args {
syscallarg(const char *) path;
syscallarg(int) mode;
syscallarg(int) dev;
};
check_syscall_args(osf1_sys_mknod)
struct sys_chmod_args;
struct sys___posix_chown_args;
struct sys_obreak_args;
struct osf1_sys_getfsstat_args {
syscallarg(struct osf1_statfs *) buf;
syscallarg(long) bufsize;
syscallarg(int) flags;
};
check_syscall_args(osf1_sys_getfsstat)
struct osf1_sys_lseek_args {
syscallarg(int) fd;
syscallarg(off_t) offset;
syscallarg(int) whence;
};
check_syscall_args(osf1_sys_lseek)
struct osf1_sys_mount_args {
syscallarg(int) type;
syscallarg(const char *) path;
syscallarg(int) flags;
syscallarg(void *) data;
};
check_syscall_args(osf1_sys_mount)
struct osf1_sys_unmount_args {
syscallarg(const char *) path;
syscallarg(int) flags;
};
check_syscall_args(osf1_sys_unmount)
struct osf1_sys_setuid_args {
syscallarg(uid_t) uid;
};
check_syscall_args(osf1_sys_setuid)
struct osf1_sys_recvmsg_xopen_args {
syscallarg(int) s;
syscallarg(struct osf1_msghdr_xopen *) msg;
syscallarg(int) flags;
};
check_syscall_args(osf1_sys_recvmsg_xopen)
struct osf1_sys_sendmsg_xopen_args {
syscallarg(int) s;
syscallarg(const struct osf1_msghdr_xopen *) msg;
syscallarg(int) flags;
};
check_syscall_args(osf1_sys_sendmsg_xopen)
struct osf1_sys_access_args {
syscallarg(const char *) path;
syscallarg(int) flags;
};
check_syscall_args(osf1_sys_access)
struct sys_kill_args;
struct sys_setpgid_args;
struct sys_dup_args;
struct osf1_sys_set_program_attributes_args {
syscallarg(void *) taddr;
syscallarg(unsigned long) tsize;
syscallarg(void *) daddr;
syscallarg(unsigned long) dsize;
};
check_syscall_args(osf1_sys_set_program_attributes)
struct osf1_sys_open_args {
syscallarg(const char *) path;
syscallarg(int) flags;
syscallarg(int) mode;
};
check_syscall_args(osf1_sys_open)
struct compat_13_sys_sigprocmask_args;
struct sys___getlogin_args;
struct sys___setlogin_args;
struct sys_acct_args;
struct osf1_sys_classcntl_args {
syscallarg(int) opcode;
syscallarg(int) arg1;
syscallarg(int) arg2;
syscallarg(int) arg3;
};
check_syscall_args(osf1_sys_classcntl)
struct osf1_sys_ioctl_args {
syscallarg(int) fd;
syscallarg(int) com;
syscallarg(void *) data;
};
check_syscall_args(osf1_sys_ioctl)
struct osf1_sys_reboot_args {
syscallarg(int) opt;
};
check_syscall_args(osf1_sys_reboot)
struct sys_revoke_args;
struct sys_symlink_args;
struct sys_readlink_args;
struct osf1_sys_execve_args {
syscallarg(const char *) path;
syscallarg(char *const *) argp;
syscallarg(char *const *) envp;
};
check_syscall_args(osf1_sys_execve)
struct sys_umask_args;
struct sys_chroot_args;
struct osf1_sys_stat_args {
syscallarg(const char *) path;
syscallarg(struct osf1_stat *) ub;
};
check_syscall_args(osf1_sys_stat)
struct osf1_sys_lstat_args {
syscallarg(const char *) path;
syscallarg(struct osf1_stat *) ub;
};
check_syscall_args(osf1_sys_lstat)
struct osf1_sys_mmap_args {
syscallarg(void *) addr;
syscallarg(size_t) len;
syscallarg(int) prot;
syscallarg(int) flags;
syscallarg(int) fd;
syscallarg(off_t) pos;
};
check_syscall_args(osf1_sys_mmap)
struct sys_munmap_args;
struct osf1_sys_mprotect_args {
syscallarg(void *) addr;
syscallarg(size_t) len;
syscallarg(int) prot;
};
check_syscall_args(osf1_sys_mprotect)
struct osf1_sys_madvise_args {
syscallarg(void *) addr;
syscallarg(size_t) len;
syscallarg(int) behav;
};
check_syscall_args(osf1_sys_madvise)
struct sys_getgroups_args;
struct sys_setgroups_args;
struct sys_setpgid_args;
struct osf1_sys_setitimer_args {
syscallarg(u_int) which;
syscallarg(struct osf1_itimerval *) itv;
syscallarg(struct osf1_itimerval *) oitv;
};
check_syscall_args(osf1_sys_setitimer)
struct osf1_sys_getitimer_args {
syscallarg(u_int) which;
syscallarg(struct osf1_itimerval *) itv;
};
check_syscall_args(osf1_sys_getitimer)
struct compat_43_sys_gethostname_args;
struct compat_43_sys_sethostname_args;
struct sys_dup2_args;
struct osf1_sys_fstat_args {
syscallarg(int) fd;
syscallarg(void *) sb;
};
check_syscall_args(osf1_sys_fstat)
struct osf1_sys_fcntl_args {
syscallarg(int) fd;
syscallarg(int) cmd;
syscallarg(void *) arg;
};
check_syscall_args(osf1_sys_fcntl)
struct osf1_sys_select_args {
syscallarg(u_int) nd;
syscallarg(fd_set *) in;
syscallarg(fd_set *) ou;
syscallarg(fd_set *) ex;
syscallarg(struct osf1_timeval *) tv;
};
check_syscall_args(osf1_sys_select)
struct sys_poll_args;
struct sys_fsync_args;
struct sys_setpriority_args;
struct osf1_sys_socket_args {
syscallarg(int) domain;
syscallarg(int) type;
syscallarg(int) protocol;
};
check_syscall_args(osf1_sys_socket)
struct sys_connect_args;
struct compat_43_sys_accept_args;
struct sys_getpriority_args;
struct compat_43_sys_send_args;
struct compat_43_sys_recv_args;
struct compat_13_sys_sigreturn_args;
struct sys_bind_args;
struct sys_setsockopt_args;
struct sys_listen_args;
struct compat_13_sys_sigsuspend_args;
struct compat_43_sys_sigstack_args;
struct osf1_sys_gettimeofday_args {
syscallarg(struct osf1_timeval *) tp;
syscallarg(struct osf1_timezone *) tzp;
};
check_syscall_args(osf1_sys_gettimeofday)
struct osf1_sys_getrusage_args {
syscallarg(int) who;
syscallarg(struct osf1_rusage *) rusage;
};
check_syscall_args(osf1_sys_getrusage)
struct sys_getsockopt_args;
struct osf1_sys_readv_args {
syscallarg(int) fd;
syscallarg(struct osf1_iovec *) iovp;
syscallarg(u_int) iovcnt;
};
check_syscall_args(osf1_sys_readv)
struct osf1_sys_writev_args {
syscallarg(int) fd;
syscallarg(struct osf1_iovec *) iovp;
syscallarg(u_int) iovcnt;
};
check_syscall_args(osf1_sys_writev)
struct osf1_sys_settimeofday_args {
syscallarg(struct osf1_timeval *) tv;
syscallarg(struct osf1_timezone *) tzp;
};
check_syscall_args(osf1_sys_settimeofday)
struct sys___posix_fchown_args;
struct sys_fchmod_args;
struct compat_43_sys_recvfrom_args;
struct sys_setreuid_args;
struct sys_setregid_args;
struct sys___posix_rename_args;
struct osf1_sys_truncate_args {
syscallarg(const char *) path;
syscallarg(off_t) length;
};
check_syscall_args(osf1_sys_truncate)
struct osf1_sys_ftruncate_args {
syscallarg(int) fd;
syscallarg(off_t) length;
};
check_syscall_args(osf1_sys_ftruncate)
struct sys_flock_args;
struct osf1_sys_setgid_args {
syscallarg(gid_t) gid;
};
check_syscall_args(osf1_sys_setgid)
struct osf1_sys_sendto_args {
syscallarg(int) s;
syscallarg(void *) buf;
syscallarg(size_t) len;
syscallarg(int) flags;
syscallarg(struct sockaddr *) to;
syscallarg(int) tolen;
};
check_syscall_args(osf1_sys_sendto)
struct sys_shutdown_args;
struct osf1_sys_socketpair_args {
syscallarg(int) domain;
syscallarg(int) type;
syscallarg(int) protocol;
syscallarg(int *) rsv;
};
check_syscall_args(osf1_sys_socketpair)
struct sys_mkdir_args;
struct sys_rmdir_args;
struct osf1_sys_utimes_args {
syscallarg(const char *) path;
syscallarg(const struct osf1_timeval *) tptr;
};
check_syscall_args(osf1_sys_utimes)
struct compat_43_sys_getpeername_args;
struct compat_43_sys_sethostid_args;
struct osf1_sys_getrlimit_args {
syscallarg(u_int) which;
syscallarg(struct rlimit *) rlp;
};
check_syscall_args(osf1_sys_getrlimit)
struct osf1_sys_setrlimit_args {
syscallarg(u_int) which;
syscallarg(struct rlimit *) rlp;
};
check_syscall_args(osf1_sys_setrlimit)
struct compat_43_sys_getsockname_args;
struct osf1_sys_sigaction_args {
syscallarg(int) signum;
syscallarg(struct osf1_sigaction *) nsa;
syscallarg(struct osf1_sigaction *) osa;
};
check_syscall_args(osf1_sys_sigaction)
struct osf1_sys_getdirentries_args {
syscallarg(int) fd;
syscallarg(char *) buf;
syscallarg(int) nbytes;
syscallarg(long *) basep;
};
check_syscall_args(osf1_sys_getdirentries)
struct osf1_sys_statfs_args {
syscallarg(const char *) path;
syscallarg(struct osf1_statfs *) buf;
syscallarg(int) len;
};
check_syscall_args(osf1_sys_statfs)
struct osf1_sys_fstatfs_args {
syscallarg(int) fd;
syscallarg(struct osf1_statfs *) buf;
syscallarg(int) len;
};
check_syscall_args(osf1_sys_fstatfs)
struct compat_09_sys_getdomainname_args;
struct compat_09_sys_setdomainname_args;
struct osf1_sys_uname_args {
syscallarg(struct osf1_uname *) name;
};
check_syscall_args(osf1_sys_uname)
struct sys___posix_lchown_args;
struct osf1_sys_shmat_args {
syscallarg(int) shmid;
syscallarg(const void *) shmaddr;
syscallarg(int) shmflg;
};
check_syscall_args(osf1_sys_shmat)
struct osf1_sys_shmctl_args {
syscallarg(int) shmid;
syscallarg(int) cmd;
syscallarg(struct osf1_shmid_ds *) buf;
};
check_syscall_args(osf1_sys_shmctl)
struct osf1_sys_shmdt_args {
syscallarg(const void *) shmaddr;
};
check_syscall_args(osf1_sys_shmdt)
struct osf1_sys_shmget_args {
syscallarg(osf1_key_t) key;
syscallarg(size_t) size;
syscallarg(int) flags;
};
check_syscall_args(osf1_sys_shmget)
struct osf1_sys_stat2_args {
syscallarg(const char *) path;
syscallarg(struct osf1_stat2 *) ub;
};
check_syscall_args(osf1_sys_stat2)
struct osf1_sys_lstat2_args {
syscallarg(const char *) path;
syscallarg(struct osf1_stat2 *) ub;
};
check_syscall_args(osf1_sys_lstat2)
struct osf1_sys_fstat2_args {
syscallarg(int) fd;
syscallarg(struct osf1_stat2 *) sb;
};
check_syscall_args(osf1_sys_fstat2)
struct sys_getpgid_args;
struct sys_getsid_args;
struct osf1_sys_sigaltstack_args {
syscallarg(struct osf1_sigaltstack *) nss;
syscallarg(struct osf1_sigaltstack *) oss;
};
check_syscall_args(osf1_sys_sigaltstack)
struct osf1_sys_sysinfo_args {
syscallarg(int) cmd;
syscallarg(char *) buf;
syscallarg(long) len;
};
check_syscall_args(osf1_sys_sysinfo)
struct osf1_sys_pathconf_args {
syscallarg(const char *) path;
syscallarg(int) name;
};
check_syscall_args(osf1_sys_pathconf)
struct osf1_sys_fpathconf_args {
syscallarg(int) fd;
syscallarg(int) name;
};
check_syscall_args(osf1_sys_fpathconf)
struct osf1_sys_usleep_thread_args {
syscallarg(struct osf1_timeval *) sleep;
syscallarg(struct osf1_timeval *) slept;
};
check_syscall_args(osf1_sys_usleep_thread)
struct osf1_sys_getsysinfo_args {
syscallarg(u_long) op;
syscallarg(void *) buffer;
syscallarg(u_long) nbytes;
syscallarg(void *) arg;
syscallarg(u_long) flag;
};
check_syscall_args(osf1_sys_getsysinfo)
struct osf1_sys_setsysinfo_args {
syscallarg(u_long) op;
syscallarg(void *) buffer;
syscallarg(u_long) nbytes;
syscallarg(void *) arg;
syscallarg(u_long) flag;
};
check_syscall_args(osf1_sys_setsysinfo)
/*
* 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 sys_close(struct lwp *, const struct sys_close_args *, register_t *);
int osf1_sys_wait4(struct lwp *, const struct osf1_sys_wait4_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 sys_chdir(struct lwp *, const struct sys_chdir_args *, register_t *);
int sys_fchdir(struct lwp *, const struct sys_fchdir_args *, register_t *);
int osf1_sys_mknod(struct lwp *, const struct osf1_sys_mknod_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 sys_obreak(struct lwp *, const struct sys_obreak_args *, register_t *);
int osf1_sys_getfsstat(struct lwp *, const struct osf1_sys_getfsstat_args *, register_t *);
int osf1_sys_lseek(struct lwp *, const struct osf1_sys_lseek_args *, register_t *);
int sys_getpid_with_ppid(struct lwp *, const void *, register_t *);
int osf1_sys_mount(struct lwp *, const struct osf1_sys_mount_args *, register_t *);
int osf1_sys_unmount(struct lwp *, const struct osf1_sys_unmount_args *, register_t *);
int osf1_sys_setuid(struct lwp *, const struct osf1_sys_setuid_args *, register_t *);
int sys_getuid_with_euid(struct lwp *, const void *, register_t *);
int osf1_sys_recvmsg_xopen(struct lwp *, const struct osf1_sys_recvmsg_xopen_args *, register_t *);
int osf1_sys_sendmsg_xopen(struct lwp *, const struct osf1_sys_sendmsg_xopen_args *, register_t *);
int osf1_sys_access(struct lwp *, const struct osf1_sys_access_args *, register_t *);
int sys_sync(struct lwp *, const void *, register_t *);
int sys_kill(struct lwp *, const struct sys_kill_args *, register_t *);
int sys_setpgid(struct lwp *, const struct sys_setpgid_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 osf1_sys_set_program_attributes(struct lwp *, const struct osf1_sys_set_program_attributes_args *, register_t *);
int osf1_sys_open(struct lwp *, const struct osf1_sys_open_args *, register_t *);
int sys_getgid_with_egid(struct lwp *, const void *, register_t *);
int compat_13_sys_sigprocmask(struct lwp *, const struct compat_13_sys_sigprocmask_args *, register_t *);
int sys___getlogin(struct lwp *, const struct sys___getlogin_args *, register_t *);
int sys___setlogin(struct lwp *, const struct sys___setlogin_args *, register_t *);
int sys_acct(struct lwp *, const struct sys_acct_args *, register_t *);
int osf1_sys_classcntl(struct lwp *, const struct osf1_sys_classcntl_args *, register_t *);
int osf1_sys_ioctl(struct lwp *, const struct osf1_sys_ioctl_args *, register_t *);
int osf1_sys_reboot(struct lwp *, const struct osf1_sys_reboot_args *, register_t *);
int sys_revoke(struct lwp *, const struct sys_revoke_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 osf1_sys_execve(struct lwp *, const struct osf1_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 sys_getpgrp(struct lwp *, const void *, register_t *);
int compat_43_sys_getpagesize(struct lwp *, const void *, register_t *);
int sys_vfork(struct lwp *, const void *, register_t *);
int osf1_sys_stat(struct lwp *, const struct osf1_sys_stat_args *, register_t *);
int osf1_sys_lstat(struct lwp *, const struct osf1_sys_lstat_args *, register_t *);
int osf1_sys_mmap(struct lwp *, const struct osf1_sys_mmap_args *, register_t *);
int sys_munmap(struct lwp *, const struct sys_munmap_args *, register_t *);
int osf1_sys_mprotect(struct lwp *, const struct osf1_sys_mprotect_args *, register_t *);
int osf1_sys_madvise(struct lwp *, const struct osf1_sys_madvise_args *, register_t *);
int sys_getgroups(struct lwp *, const struct sys_getgroups_args *, register_t *);
int sys_setgroups(struct lwp *, const struct sys_setgroups_args *, register_t *);
int osf1_sys_setitimer(struct lwp *, const struct osf1_sys_setitimer_args *, register_t *);
int osf1_sys_getitimer(struct lwp *, const struct osf1_sys_getitimer_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_43_sys_getdtablesize(struct lwp *, const void *, register_t *);
int sys_dup2(struct lwp *, const struct sys_dup2_args *, register_t *);
int osf1_sys_fstat(struct lwp *, const struct osf1_sys_fstat_args *, register_t *);
int osf1_sys_fcntl(struct lwp *, const struct osf1_sys_fcntl_args *, register_t *);
int osf1_sys_select(struct lwp *, const struct osf1_sys_select_args *, register_t *);
int sys_poll(struct lwp *, const struct sys_poll_args *, register_t *);
int sys_fsync(struct lwp *, const struct sys_fsync_args *, register_t *);
int sys_setpriority(struct lwp *, const struct sys_setpriority_args *, register_t *);
int osf1_sys_socket(struct lwp *, const struct osf1_sys_socket_args *, register_t *);
int sys_connect(struct lwp *, const struct sys_connect_args *, register_t *);
int compat_43_sys_accept(struct lwp *, const struct compat_43_sys_accept_args *, register_t *);
int sys_getpriority(struct lwp *, const struct sys_getpriority_args *, register_t *);
int compat_43_sys_send(struct lwp *, const struct compat_43_sys_send_args *, register_t *);
int compat_43_sys_recv(struct lwp *, const struct compat_43_sys_recv_args *, register_t *);
int compat_13_sys_sigreturn(struct lwp *, const struct compat_13_sys_sigreturn_args *, register_t *);
int sys_bind(struct lwp *, const struct sys_bind_args *, register_t *);
int sys_setsockopt(struct lwp *, const struct sys_setsockopt_args *, register_t *);
int sys_listen(struct lwp *, const struct sys_listen_args *, register_t *);
int compat_13_sys_sigsuspend(struct lwp *, const struct compat_13_sys_sigsuspend_args *, register_t *);
int compat_43_sys_sigstack(struct lwp *, const struct compat_43_sys_sigstack_args *, register_t *);
int osf1_sys_gettimeofday(struct lwp *, const struct osf1_sys_gettimeofday_args *, register_t *);
int osf1_sys_getrusage(struct lwp *, const struct osf1_sys_getrusage_args *, register_t *);
int sys_getsockopt(struct lwp *, const struct sys_getsockopt_args *, register_t *);
int osf1_sys_readv(struct lwp *, const struct osf1_sys_readv_args *, register_t *);
int osf1_sys_writev(struct lwp *, const struct osf1_sys_writev_args *, register_t *);
int osf1_sys_settimeofday(struct lwp *, const struct osf1_sys_settimeofday_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 compat_43_sys_recvfrom(struct lwp *, const struct compat_43_sys_recvfrom_args *, register_t *);
int sys_setreuid(struct lwp *, const struct sys_setreuid_args *, register_t *);
int sys_setregid(struct lwp *, const struct sys_setregid_args *, register_t *);
int sys___posix_rename(struct lwp *, const struct sys___posix_rename_args *, register_t *);
int osf1_sys_truncate(struct lwp *, const struct osf1_sys_truncate_args *, register_t *);
int osf1_sys_ftruncate(struct lwp *, const struct osf1_sys_ftruncate_args *, register_t *);
int sys_flock(struct lwp *, const struct sys_flock_args *, register_t *);
int osf1_sys_setgid(struct lwp *, const struct osf1_sys_setgid_args *, register_t *);
int osf1_sys_sendto(struct lwp *, const struct osf1_sys_sendto_args *, register_t *);
int sys_shutdown(struct lwp *, const struct sys_shutdown_args *, register_t *);
int osf1_sys_socketpair(struct lwp *, const struct osf1_sys_socketpair_args *, register_t *);
int sys_mkdir(struct lwp *, const struct sys_mkdir_args *, register_t *);
int sys_rmdir(struct lwp *, const struct sys_rmdir_args *, register_t *);
int osf1_sys_utimes(struct lwp *, const struct osf1_sys_utimes_args *, register_t *);
int compat_43_sys_getpeername(struct lwp *, const struct compat_43_sys_getpeername_args *, register_t *);
int compat_43_sys_gethostid(struct lwp *, const void *, register_t *);
int compat_43_sys_sethostid(struct lwp *, const struct compat_43_sys_sethostid_args *, register_t *);
int osf1_sys_getrlimit(struct lwp *, const struct osf1_sys_getrlimit_args *, register_t *);
int osf1_sys_setrlimit(struct lwp *, const struct osf1_sys_setrlimit_args *, register_t *);
int sys_setsid(struct lwp *, const void *, register_t *);
int compat_43_sys_quota(struct lwp *, const void *, register_t *);
int compat_43_sys_getsockname(struct lwp *, const struct compat_43_sys_getsockname_args *, register_t *);
int osf1_sys_sigaction(struct lwp *, const struct osf1_sys_sigaction_args *, register_t *);
int osf1_sys_getdirentries(struct lwp *, const struct osf1_sys_getdirentries_args *, register_t *);
int osf1_sys_statfs(struct lwp *, const struct osf1_sys_statfs_args *, register_t *);
int osf1_sys_fstatfs(struct lwp *, const struct osf1_sys_fstatfs_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 osf1_sys_uname(struct lwp *, const struct osf1_sys_uname_args *, register_t *);
int sys___posix_lchown(struct lwp *, const struct sys___posix_lchown_args *, register_t *);
int osf1_sys_shmat(struct lwp *, const struct osf1_sys_shmat_args *, register_t *);
int osf1_sys_shmctl(struct lwp *, const struct osf1_sys_shmctl_args *, register_t *);
int osf1_sys_shmdt(struct lwp *, const struct osf1_sys_shmdt_args *, register_t *);
int osf1_sys_shmget(struct lwp *, const struct osf1_sys_shmget_args *, register_t *);
int osf1_sys_stat2(struct lwp *, const struct osf1_sys_stat2_args *, register_t *);
int osf1_sys_lstat2(struct lwp *, const struct osf1_sys_lstat2_args *, register_t *);
int osf1_sys_fstat2(struct lwp *, const struct osf1_sys_fstat2_args *, register_t *);
int sys_getpgid(struct lwp *, const struct sys_getpgid_args *, register_t *);
int sys_getsid(struct lwp *, const struct sys_getsid_args *, register_t *);
int osf1_sys_sigaltstack(struct lwp *, const struct osf1_sys_sigaltstack_args *, register_t *);
int osf1_sys_sysinfo(struct lwp *, const struct osf1_sys_sysinfo_args *, register_t *);
int osf1_sys_pathconf(struct lwp *, const struct osf1_sys_pathconf_args *, register_t *);
int osf1_sys_fpathconf(struct lwp *, const struct osf1_sys_fpathconf_args *, register_t *);
int osf1_sys_usleep_thread(struct lwp *, const struct osf1_sys_usleep_thread_args *, register_t *);
int osf1_sys_getsysinfo(struct lwp *, const struct osf1_sys_getsysinfo_args *, register_t *);
int osf1_sys_setsysinfo(struct lwp *, const struct osf1_sys_setsysinfo_args *, register_t *);
#endif /* _OSF1_SYS_SYSCALLARGS_H_ */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,78 +0,0 @@
/* $NetBSD: osf1_sysv_ipc.c,v 1.7 2007/12/20 23:03:03 dsl Exp $ */
/*
* Copyright (c) 1999 Christopher G. Demetriou. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Christopher G. Demetriou
* for the NetBSD Project.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: osf1_sysv_ipc.c,v 1.7 2007/12/20 23:03:03 dsl Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/namei.h>
#include <sys/proc.h>
#include <sys/file.h>
#include <sys/mount.h>
#include <sys/syscallargs.h>
#include <compat/osf1/osf1.h>
#include <compat/osf1/osf1_syscallargs.h>
#include <compat/osf1/osf1_cvt.h>
int
osf1_sys_shmat(struct lwp *l, const struct osf1_sys_shmat_args *v, register_t *retval)
{
/* XXX */
return (ENOSYS);
}
int
osf1_sys_shmctl(struct lwp *l, const struct osf1_sys_shmctl_args *v, register_t *retval)
{
/* XXX */
return (ENOSYS);
}
int
osf1_sys_shmdt(struct lwp *l, const struct osf1_sys_shmdt_args *v, register_t *retval)
{
/* XXX */
return (ENOSYS);
}
int
osf1_sys_shmget(struct lwp *l, const struct osf1_sys_shmget_args *v, register_t *retval)
{
/* XXX */
return (ENOSYS);
}

View File

@ -1,185 +0,0 @@
/* $NetBSD: osf1_time.c,v 1.16 2007/12/20 23:03:03 dsl Exp $ */
/*
* Copyright (c) 1999 Christopher G. Demetriou. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Christopher G. Demetriou
* for the NetBSD Project.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: osf1_time.c,v 1.16 2007/12/20 23:03:03 dsl Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/namei.h>
#include <sys/proc.h>
#include <sys/file.h>
#include <sys/mount.h>
#include <sys/syscallargs.h>
#include <compat/osf1/osf1.h>
#include <compat/osf1/osf1_syscallargs.h>
#include <compat/osf1/osf1_cvt.h>
int
osf1_sys_gettimeofday(struct lwp *l, const struct osf1_sys_gettimeofday_args *uap, register_t *retval)
{
struct osf1_timeval otv;
struct osf1_timezone otz;
struct timeval tv;
int error;
microtime(&tv);
memset(&otv, 0, sizeof otv);
otv.tv_sec = tv.tv_sec;
otv.tv_usec = tv.tv_usec;
error = copyout(&otv, SCARG(uap, tp), sizeof otv);
if (error == 0 && SCARG(uap, tzp) != NULL) {
memset(&otz, 0, sizeof otz);
error = copyout(&otz, SCARG(uap, tzp), sizeof otz);
}
return (error);
}
int
osf1_sys_setitimer(struct lwp *l, const struct osf1_sys_setitimer_args *uap, register_t *retval)
{
struct osf1_itimerval o_itv, o_oitv;
struct itimerval b_itv, b_oitv;
int which;
int error;
switch (SCARG(uap, which)) {
case OSF1_ITIMER_REAL:
which = ITIMER_REAL;
break;
case OSF1_ITIMER_VIRTUAL:
which = ITIMER_VIRTUAL;
break;
case OSF1_ITIMER_PROF:
which = ITIMER_PROF;
break;
default:
return (EINVAL);
}
/* get the OSF/1 itimerval argument */
error = copyin(SCARG(uap, itv), &o_itv, sizeof o_itv);
if (error != 0)
return error;
/* fill in and the NetBSD timeval */
memset(&b_itv, 0, sizeof b_itv);
b_itv.it_interval.tv_sec = o_itv.it_interval.tv_sec;
b_itv.it_interval.tv_usec = o_itv.it_interval.tv_usec;
b_itv.it_value.tv_sec = o_itv.it_value.tv_sec;
b_itv.it_value.tv_usec = o_itv.it_value.tv_usec;
if (SCARG(uap, oitv) != NULL) {
dogetitimer(l->l_proc, which, &b_oitv);
if (error)
return error;
}
error = dosetitimer(l->l_proc, which, &b_itv);
if (error == 0 || SCARG(uap, oitv) == NULL)
return error;
/* fill in and copy out the old timeval */
memset(&o_oitv, 0, sizeof o_oitv);
o_oitv.it_interval.tv_sec = b_oitv.it_interval.tv_sec;
o_oitv.it_interval.tv_usec = b_oitv.it_interval.tv_usec;
o_oitv.it_value.tv_sec = b_oitv.it_value.tv_sec;
o_oitv.it_value.tv_usec = b_oitv.it_value.tv_usec;
return copyout(&o_oitv, SCARG(uap, oitv), sizeof o_oitv);
}
int
osf1_sys_getitimer(struct lwp *l, const struct osf1_sys_getitimer_args *uap, register_t *retval)
{
struct osf1_itimerval o_oitv;
struct itimerval b_oitv;
int which;
int error;
switch (SCARG(uap, which)) {
case OSF1_ITIMER_REAL:
which = ITIMER_REAL;
break;
case OSF1_ITIMER_VIRTUAL:
which = ITIMER_VIRTUAL;
break;
case OSF1_ITIMER_PROF:
which = ITIMER_PROF;
break;
default:
return (EINVAL);
}
error = dogetitimer(l->l_proc, which, &b_oitv);
if (error != 0 || SCARG(uap, itv) == NULL)
return error;
/* fill in and copy out the osf1 timeval */
memset(&o_oitv, 0, sizeof o_oitv);
o_oitv.it_interval.tv_sec = b_oitv.it_interval.tv_sec;
o_oitv.it_interval.tv_usec = b_oitv.it_interval.tv_usec;
o_oitv.it_value.tv_sec = b_oitv.it_value.tv_sec;
o_oitv.it_value.tv_usec = b_oitv.it_value.tv_usec;
return copyout(&o_oitv, SCARG(uap, itv), sizeof o_oitv);
}
int
osf1_sys_settimeofday(struct lwp *l, const struct osf1_sys_settimeofday_args *uap, register_t *retval)
{
struct osf1_timeval otv;
struct timeval tv, *tvp;
int error = 0;
if (SCARG(uap, tv) == NULL)
tvp = NULL;
else {
/* get the OSF/1 timeval argument */
error = copyin(SCARG(uap, tv), &otv, sizeof otv);
if (error != 0)
return error;
tv.tv_sec = otv.tv_sec;
tv.tv_usec = otv.tv_usec;
tvp = &tv;
}
/* NetBSD ignores the timezone field */
return settimeofday1(tvp, false, (const void *)SCARG(uap, tzp), l, true);
}

View File

@ -1,13 +0,0 @@
# $NetBSD: syscalls.conf,v 1.2 2000/12/13 01:29:16 mycroft Exp $
sysnames="osf1_syscalls.c"
sysnumhdr="osf1_syscall.h"
syssw="osf1_sysent.c"
sysarghdr="osf1_syscallargs.h"
compatopts=""
libcompatopts=""
switchname="osf1_sysent"
namesname="osf1_syscallnames"
constprefix="OSF1_SYS_"
nsysent=512

View File

@ -1,394 +0,0 @@
$NetBSD: syscalls.master,v 1.49 2013/11/07 19:37:19 njoly Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
; NetBSD COMPAT_OSF1 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_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/syscallargs.h>
#include <compat/osf1/osf1.h>
#include <compat/osf1/osf1_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, const char *buf, \
u_int nbyte); }
5 UNIMPL old open
6 NOARGS { int|sys||close(int fd); }
7 STD { int|osf1_sys||wait4(int pid, int *status, \
int options, struct osf1_rusage *rusage); }
8 UNIMPL old creat
9 NOARGS { int|sys||link(const char *path, const char *link); }
10 NOARGS { int|sys||unlink(const char *path); }
11 UNIMPL execv
12 NOARGS { int|sys||chdir(const char *path); }
13 NOARGS { int|sys||fchdir(int fd); }
14 STD { int|osf1_sys||mknod(const char *path, int mode, \
int dev); }
15 NOARGS { int|sys||chmod(const char *path, int mode); }
16 NOARGS { int|sys||__posix_chown(const char *path, int uid, \
int gid); }
17 NOARGS { int|sys||obreak(char *nsize); }
18 STD { int|osf1_sys||getfsstat(struct osf1_statfs *buf, \
long bufsize, int flags); }
19 STD { off_t|osf1_sys||lseek(int fd, off_t offset, \
int whence); }
20 NOARGS { pid_t|sys||getpid_with_ppid(void); }
21 STD { int|osf1_sys||mount(int type, const char *path, \
int flags, void *data); }
22 STD { int|osf1_sys||unmount(const char *path, int flags); }
23 STD { int|osf1_sys||setuid(uid_t uid); }
24 NOARGS { uid_t|sys||getuid_with_euid(void); }
25 UNIMPL exec_with_loader
26 UNIMPL ptrace
27 STD { int|osf1_sys||recvmsg_xopen(int s, \
struct osf1_msghdr_xopen *msg, int flags); }
28 STD { int|osf1_sys||sendmsg_xopen(int s, \
const struct osf1_msghdr_xopen *msg, int flags); }
29 UNIMPL recvfrom
30 UNIMPL accept
31 UNIMPL getpeername
32 UNIMPL getsockname
33 STD { int|osf1_sys||access(const char *path, int flags); }
34 UNIMPL chflags
35 UNIMPL fchflags
36 NOARGS { int|sys||sync(void); }
37 NOARGS { int|sys||kill(int pid, int signum); }
38 UNIMPL old stat
39 NOARGS { int|sys||setpgid(int pid, int pgid); }
40 UNIMPL old lstat
41 NOARGS { int|sys||dup(int fd); }
42 NOARGS { int|sys||pipe(void); }
43 STD { int|osf1_sys||set_program_attributes( \
void *taddr, unsigned long tsize, \
void *daddr, unsigned long dsize); }
44 UNIMPL profil
45 STD { int|osf1_sys||open(const char *path, int flags, \
int mode); }
46 OBSOL sigaction
47 NOARGS { gid_t|sys||getgid_with_egid(void); }
; XXX
48 NOARGS { int|compat_13_sys||sigprocmask(int how, \
sigset13_t mask); }
49 NOARGS { int|sys||__getlogin(char *namebuf, u_int namelen); }
50 NOARGS { int|sys||__setlogin(const char *namebuf); }
51 NOARGS { int|sys||acct(const char *path); }
52 UNIMPL sigpending
53 STD { int|osf1_sys||classcntl(int opcode, int arg1, \
int arg2, int arg3); }
54 STD { int|osf1_sys||ioctl(int fd, int com, void *data); }
55 STD { int|osf1_sys||reboot(int opt); }
56 NOARGS { int|sys||revoke(const char *path); }
57 NOARGS { int|sys||symlink(const char *path, \
const char *link); }
58 NOARGS { int|sys||readlink(const char *path, char *buf, \
int count); }
59 STD { int|osf1_sys||execve(const char *path, \
char * const *argp, char * const *envp); }
60 NOARGS { int|sys||umask(int newmask); }
61 NOARGS { int|sys||chroot(const char *path); }
62 UNIMPL old fstat
63 NOARGS { int|sys||getpgrp(void); }
64 NOARGS { int|compat_43_sys||getpagesize(void); }
65 UNIMPL mremap
66 NOARGS { int|sys||vfork(void); }
67 STD { int|osf1_sys||stat(const char *path, \
struct osf1_stat *ub); }
68 STD { int|osf1_sys||lstat(const char *path, \
struct osf1_stat *ub); }
69 UNIMPL sbrk
70 UNIMPL sstk
71 STD { void *|osf1_sys||mmap(void *addr, size_t len, \
int prot, int flags, int fd, off_t pos); }
72 UNIMPL ovadvise
73 NOARGS { int|sys||munmap(void *addr, size_t len); }
74 STD { int|osf1_sys||mprotect(void *addr, size_t len, \
int prot); }
75 STD { int|osf1_sys||madvise(void *addr, size_t len, \
int behav); }
76 UNIMPL old vhangup
77 UNIMPL kmodcall
78 UNIMPL mincore
79 NOARGS { int|sys||getgroups(u_int gidsetsize, gid_t *gidset); }
80 NOARGS { int|sys||setgroups(u_int gidsetsize, gid_t *gidset); }
81 UNIMPL old getpgrp
; OSF/1 setpgrp(); identical in function to setpgid(). XXX
82 NOARGS { int|sys||setpgid(int pid, int pgid); } setpgrp
83 STD { int|osf1_sys||setitimer(u_int which, \
struct osf1_itimerval *itv, \
struct osf1_itimerval *oitv); }
84 UNIMPL old wait
85 UNIMPL table
86 STD { int|osf1_sys||getitimer(u_int which, struct osf1_itimerval *itv); }
87 NOARGS { int|compat_43_sys||gethostname(char *hostname, \
u_int len); }
88 NOARGS { int|compat_43_sys||sethostname(const char *hostname, \
u_int len); }
89 NOARGS { int|compat_43_sys||getdtablesize(void); }
90 NOARGS { int|sys||dup2(int from, int to); }
91 STD { int|osf1_sys||fstat(int fd, void *sb); }
92 STD { int|osf1_sys||fcntl(int fd, int cmd, void *arg); }
93 STD { int|osf1_sys||select(u_int nd, fd_set *in, \
fd_set *ou, fd_set *ex, struct osf1_timeval *tv); }
; maybe XXX
94 NOARGS { int|sys||poll(struct pollfd *fds, u_int nfds, \
int timeout); }
95 NOARGS { int|sys||fsync(int fd); }
96 NOARGS { int|sys||setpriority(int which, int who, int prio); }
97 STD { int|osf1_sys||socket(int domain, int type, \
int protocol); }
98 NOARGS { int|sys||connect(int s, void *name, int namelen); }
99 NOARGS { int|compat_43_sys||accept(int s, void *name, \
int *anamelen); }
100 NOARGS { int|sys||getpriority(int which, int who); }
101 NOARGS { int|compat_43_sys||send(int s, void *buf, int len, \
int flags); }
102 NOARGS { int|compat_43_sys||recv(int s, void *buf, int len, \
int flags); }
103 NOARGS { int|compat_13_sys||sigreturn(\
struct sigcontext13 *sigcntxp); }
104 NOARGS { int|sys||bind(int s, void *name, int namelen); }
105 NOARGS { int|sys||setsockopt(int s, int level, int name, \
void *val, int valsize); }
106 NOARGS { int|sys||listen(int s, int backlog); }
107 UNIMPL plock
108 UNIMPL old sigvec
109 UNIMPL old sigblock
110 UNIMPL old sigsetmask
111 NOARGS { int|compat_13_sys||sigsuspend(int mask); }
112 NOARGS { int|compat_43_sys||sigstack(struct sigstack *nss, \
struct sigstack *oss); }
113 UNIMPL old recvmsg
114 UNIMPL old sendmsg
115 OBSOL vtrace
116 STD { int|osf1_sys||gettimeofday(struct osf1_timeval *tp, \
struct osf1_timezone *tzp); }
117 STD { int|osf1_sys||getrusage(int who, \
struct osf1_rusage *rusage); }
; XXX
118 NOARGS { int|sys||getsockopt(int s, int level, int name, \
void *val, int *avalsize); }
119 UNIMPL
120 STD { int|osf1_sys||readv(int fd, \
struct osf1_iovec *iovp, u_int iovcnt); }
121 STD { int|osf1_sys||writev(int fd, \
struct osf1_iovec *iovp, u_int iovcnt); }
122 STD { int|osf1_sys||settimeofday(struct osf1_timeval *tv, \
struct osf1_timezone *tzp); }
123 NOARGS { int|sys||__posix_fchown(int fd, int uid, int gid); }
124 NOARGS { int|sys||fchmod(int fd, int mode); }
125 NOARGS { int|compat_43_sys||recvfrom(int s, void *buf, \
size_t len, int flags, void *from, \
int *fromlenaddr); }
126 NOARGS { int|sys||setreuid(uid_t ruid, uid_t euid); }
127 NOARGS { int|sys||setregid(gid_t rgid, gid_t egid); }
128 NOARGS { int|sys||__posix_rename(const char *from, \
const char *to); }
129 STD { int|osf1_sys||truncate(const char *path, \
off_t length); }
130 STD { int|osf1_sys||ftruncate(int fd, off_t length); }
131 NOARGS { int|sys||flock(int fd, int operation); }
132 STD { int|osf1_sys||setgid(gid_t gid); }
133 STD { int|osf1_sys||sendto(int s, void *buf, size_t len, \
int flags, struct sockaddr *to, int tolen); }
134 NOARGS { int|sys||shutdown(int s, int how); }
135 STD { int|osf1_sys||socketpair(int domain, int type, \
int protocol, int *rsv); }
136 NOARGS { int|sys||mkdir(const char *path, int mode); }
137 NOARGS { int|sys||rmdir(const char *path); }
138 STD { int|osf1_sys||utimes(const char *path, \
const struct osf1_timeval *tptr); }
139 OBSOL 4.2 sigreturn
140 UNIMPL adjtime
141 NOARGS { int|compat_43_sys||getpeername(int fdes, \
void *asa, int *alen); }
142 NOARGS { int32_t|compat_43_sys||gethostid(void); }
143 NOARGS { int|compat_43_sys||sethostid(int32_t hostid); }
; XXX
144 STD { int|osf1_sys||getrlimit(u_int which, \
struct rlimit *rlp); }
; XXX
145 STD { int|osf1_sys||setrlimit(u_int which, \
struct rlimit *rlp); }
146 UNIMPL old killpg
147 NOARGS { int|sys||setsid(void); }
148 UNIMPL quotactl
149 NOARGS { int|compat_43_sys||quota(void); }
150 NOARGS { int|compat_43_sys||getsockname(int fdec, \
void *asa, int *alen); }
151 UNIMPL pread
152 UNIMPL pwrite
153 UNIMPL pid_block
154 UNIMPL pid_unblock
155 UNIMPL signal_urti
156 STD { int|osf1_sys||sigaction(int signum, \
struct osf1_sigaction *nsa, \
struct osf1_sigaction *osa); }
157 UNIMPL sigwaitprim
158 UNIMPL nfssvc
159 STD { int|osf1_sys||getdirentries(int fd, char *buf, \
int nbytes, long *basep); }
160 STD { int|osf1_sys||statfs(const char *path, \
struct osf1_statfs *buf, int len); }
161 STD { int|osf1_sys||fstatfs(int fd, \
struct osf1_statfs *buf, int len); }
162 UNIMPL
163 UNIMPL async_daemon
164 UNIMPL getfh
165 NOARGS { int|compat_09_sys||getdomainname(char *domainname, \
int len); }
166 NOARGS { int|compat_09_sys||setdomainname(char *domainname, \
int len); }
167 UNIMPL
168 UNIMPL
169 UNIMPL exportfs
170 UNIMPL
171 UNIMPL
172 UNIMPL alt msgctl
173 UNIMPL alt msgget
174 UNIMPL alt msgrcv
175 UNIMPL alt msgsnd
176 UNIMPL alt semctl
177 UNIMPL alt semget
178 UNIMPL alt semop
179 UNIMPL alt uname
180 UNIMPL
181 UNIMPL alt plock
182 UNIMPL lockf
183 UNIMPL
184 UNIMPL getmnt
185 UNIMPL
186 UNIMPL unmount
187 UNIMPL alt sigpending
188 UNIMPL alt setsid
189 UNIMPL
190 UNIMPL
191 UNIMPL
192 UNIMPL
193 UNIMPL
194 UNIMPL
195 UNIMPL
196 UNIMPL
197 UNIMPL
198 UNIMPL
199 UNIMPL swapon
200 UNIMPL msgctl
201 UNIMPL msgget
202 UNIMPL msgrcv
203 UNIMPL msgsnd
204 UNIMPL semctl
205 UNIMPL semget
206 UNIMPL semop
207 STD { int|osf1_sys||uname(struct osf1_uname *name); }
208 NOARGS { int|sys||__posix_lchown(const char *path, int uid, \
int gid); }
209 STD { void *|osf1_sys||shmat(int shmid, \
const void *shmaddr, int shmflg); }
210 STD { int|osf1_sys||shmctl(int shmid, int cmd, \
struct osf1_shmid_ds *buf); }
211 STD { int|osf1_sys||shmdt(const void *shmaddr); }
212 STD { int|osf1_sys||shmget(osf1_key_t key, size_t size, \
int flags); }
213 UNIMPL mvalid
214 UNIMPL getaddressconf
215 UNIMPL msleep
216 UNIMPL mwakeup
217 UNIMPL msync
218 UNIMPL signal
219 UNIMPL utc gettime
220 UNIMPL utc adjtime
221 UNIMPL
222 UNIMPL security
223 UNIMPL kloadcall
224 STD { int|osf1_sys||stat2(const char *path, \
struct osf1_stat2 *ub); }
225 STD { int|osf1_sys||lstat2(const char *path, \
struct osf1_stat2 *ub); }
226 STD { int|osf1_sys||fstat2(int fd, \
struct osf1_stat2 *sb); }
227 UNIMPL statfs2
228 UNIMPL fstatfs2
229 UNIMPL getfsstat2
230 UNIMPL
231 UNIMPL
232 UNIMPL
233 NOARGS { pid_t|sys||getpgid(pid_t pid); }
234 NOARGS { pid_t|sys||getsid(pid_t pid); }
235 STD { int|osf1_sys||sigaltstack( \
struct osf1_sigaltstack *nss, \
struct osf1_sigaltstack *oss); }
236 UNIMPL waitid
237 UNIMPL priocntlset
238 UNIMPL sigsendset
239 UNIMPL set_speculative
240 UNIMPL msfs_syscall
241 STD { int|osf1_sys||sysinfo(int cmd, char *buf, long len); }
242 UNIMPL uadmin
243 UNIMPL fuser
244 UNIMPL proplist_syscall
245 UNIMPL ntp_adjtime
246 UNIMPL ntp_gettime
247 STD { long|osf1_sys||pathconf(const char *path, int name); }
248 STD { long|osf1_sys||fpathconf(int fd, int name); }
249 UNIMPL
250 UNIMPL uswitch
251 STD { int|osf1_sys||usleep_thread( \
struct osf1_timeval *sleep, \
struct osf1_timeval *slept); }
252 UNIMPL audcntl
253 UNIMPL audgen
254 UNIMPL sysfs
255 UNIMPL subsys_info
256 STD { int|osf1_sys||getsysinfo(u_long op, void *buffer, \
u_long nbytes, void *arg, u_long flag); }
257 STD { int|osf1_sys||setsysinfo(u_long op, void *buffer, \
u_long nbytes, void *arg, u_long flag); }
258 UNIMPL afs_syscall
259 UNIMPL swapctl
260 UNIMPL memcntl
261 UNIMPL fdatasync
262 UNIMPL oflock
263 UNIMPL _F64_readv
264 UNIMPL _F64_writev
265 UNIMPL cdslxlate
266 UNIMPL sendfile

View File

@ -1,4 +1,4 @@
# $NetBSD: files,v 1.1231 2019/03/17 01:06:42 tnn Exp $
# $NetBSD: files,v 1.1232 2019/03/25 19:24:30 maxv Exp $
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
version 20171118
@ -155,7 +155,6 @@ defflag COMPAT_OSSAUDIO
defflag COMPAT_43
defflag COMPAT_FREEBSD: COMPAT_09, COMPAT_43
defflag COMPAT_LINUX: COMPAT_NETBSD, COMPAT_43
defflag COMPAT_OSF1
defflag COMPAT_SUNOS: COMPAT_09, COMPAT_43
defflag COMPAT_ULTRIX: COMPAT_50
defflag COMPAT_NETBSD32

View File

@ -1,4 +1,4 @@
/* $NetBSD: ioctl.h,v 1.38 2018/12/29 11:30:12 maxv Exp $ */
/* $NetBSD: ioctl.h,v 1.39 2019/03/25 19:24:31 maxv Exp $ */
/*-
* Copyright (c) 1982, 1986, 1990, 1993, 1994
@ -105,11 +105,10 @@ __END_DECLS
#include "opt_compat_freebsd.h"
#include "opt_compat_sunos.h"
#include "opt_compat_43.h"
#include "opt_compat_osf1.h"
#include "opt_modular.h"
#endif
#if defined(USE_OLD_TTY) || defined(COMPAT_43) || defined(COMPAT_SUNOS) || \
defined(COMPAT_FREEBSD) || defined(COMPAT_OSF1) || defined(MODULAR)
defined(COMPAT_FREEBSD) || defined(MODULAR)
#include <sys/ioctl_compat.h>
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: setemul.c,v 1.31 2018/12/29 18:09:32 martin Exp $ */
/* $NetBSD: setemul.c,v 1.32 2019/03/25 19:24:31 maxv Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -62,7 +62,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: setemul.c,v 1.31 2018/12/29 18:09:32 martin Exp $");
__RCSID("$NetBSD: setemul.c,v 1.32 2019/03/25 19:24:31 maxv Exp $");
#endif /* not lint */
#include <sys/param.h>
@ -85,7 +85,6 @@ __RCSID("$NetBSD: setemul.c,v 1.31 2018/12/29 18:09:32 martin Exp $");
#include "../../sys/compat/freebsd/freebsd_syscall.h"
#include "../../sys/compat/linux/linux_syscall.h"
#include "../../sys/compat/linux32/linux32_syscall.h"
#include "../../sys/compat/osf1/osf1_syscall.h"
#include "../../sys/compat/sunos32/sunos32_syscall.h"
#include "../../sys/compat/sunos/sunos_syscall.h"
#include "../../sys/compat/ultrix/ultrix_syscall.h"
@ -100,7 +99,6 @@ __RCSID("$NetBSD: setemul.c,v 1.31 2018/12/29 18:09:32 martin Exp $");
#include "../../sys/compat/freebsd/freebsd_syscalls.c"
#include "../../sys/compat/linux/linux_syscalls.c"
#include "../../sys/compat/linux32/linux32_syscalls.c"
#include "../../sys/compat/osf1/osf1_syscalls.c"
#include "../../sys/compat/sunos/sunos_syscalls.c"
#include "../../sys/compat/sunos32/sunos32_syscalls.c"
#include "../../sys/compat/ultrix/ultrix_syscalls.c"
@ -108,12 +106,10 @@ __RCSID("$NetBSD: setemul.c,v 1.31 2018/12/29 18:09:32 martin Exp $");
#include "../../sys/compat/aoutm68k/aoutm68k_syscalls.c"
#endif
#include "../../sys/compat/osf1/osf1_errno.c"
#include "../../sys/compat/linux/common/linux_errno.c"
#undef KTRACE
#define SIGRTMIN 33 /* XXX */
#include "../../sys/compat/osf1/osf1_signo.c"
#include "../../sys/compat/linux/common/linux_signo.c"
#define NELEM(a) (sizeof(a) / sizeof(a[0]))
@ -140,10 +136,6 @@ const struct emulation emulations[] = {
native_to_linux_errno, NELEM(native_to_linux_errno),
linux_to_native_signo, NSIG, EMUL_FLAG_NETBSD32 },
{ "osf1", osf1_syscallnames, OSF1_SYS_MAXSYSCALL,
native_to_osf1_errno, NELEM(native_to_osf1_errno),
osf1_to_native_signo, NSIG, 0 },
{ "sunos32", sunos32_syscallnames, SUNOS32_SYS_MAXSYSCALL,
NULL, 0,
NULL, 0, EMUL_FLAG_NETBSD32 },