Added enough of prctl emulation so that program do not crash on exit

This commit is contained in:
manu 2001-12-02 09:23:58 +00:00
parent 427b57c20e
commit ef711afc33
8 changed files with 171 additions and 16 deletions

View File

@ -1,10 +1,11 @@
# $NetBSD: files.irix,v 1.4 2001/12/02 08:30:10 manu Exp $
# $NetBSD: files.irix,v 1.5 2001/12/02 09:23:58 manu Exp $
#
file arch/mips/mips/irix_syscall.c compat_irix
file compat/irix/irix_exec.c compat_irix
file compat/irix/irix_exec_elf32.c compat_irix & exec_elf32
file compat/irix/irix_prctl.c compat_irix
file compat/irix/irix_sysent.c compat_irix
file compat/irix/irix_syssgi.c compat_irix
file compat/irix/irix_sysmp.c compat_irix

View File

@ -0,0 +1,79 @@
/* $NetBSD: irix_prctl.c,v 1.1 2001/12/02 09:23:58 manu Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Emmanuel Dreyfus.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 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. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: irix_prctl.c,v 1.1 2001/12/02 09:23:58 manu Exp $");
#include <sys/errno.h>
#include <sys/types.h>
#include <sys/systm.h>
#include <compat/svr4/svr4_types.h>
#include <compat/irix/irix_prctl.h>
#include <compat/irix/irix_syscallargs.h>
int
irix_sys_prctl(p, v, retval)
struct proc *p;
void *v;
register_t *retval;
{
struct irix_sys_prctl_args /* {
syscallarg(int) option;
syscallarg(void *) arg1;
} */ *uap = v;
int option = SCARG(uap, option);
#ifdef DEBUG_IRIX
printf("irix_sys_prctl(): option = %d\n", option);
#endif
switch(option) {
case IRIX_PR_LASTSHEXIT: /* "Last sproc exit" */
/* We do nothing */
break;
default:
printf("Warning: call to unimplemented prctl() command %d\n",
option);
return EINVAL;
break;
}
return 0;
}

View File

@ -0,0 +1,65 @@
/* $NetBSD: irix_prctl.h,v 1.1 2001/12/02 09:23:59 manu Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Emmanuel Dreyfus.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 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. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _IRIX_PRCTL_H_
#define _IRIX_PRCTL_H_
/* From IRIX's <sys/prctl.h> */
#define IRIX_PR_MAXPROCS 1
#define IRIX_PR_ISBLOCKED 2
#define IRIX_PR_SETSTACKSIZE 3
#define IRIX_PR_GETSTACKSIZE 4
#define IRIX_PR_MAXPPROCS 5
#define IRIX_PR_UNBLKONEXEC 6
#define IRIX_PR_SETEXITSIG 8
#define IRIX_PR_RESIDENT 9
#define IRIX_PR_ATTACHADDR 10
#define IRIX_PR_DETACHADDR 11
#define IRIX_PR_TERMCHILD 12
#define IRIX_PR_GETSHMASK 13
#define IRIX_PR_GETNSHARE 14
#define IRIX_PR_COREPID 15
#define IRIX_PR_ATTACHADDRPERM 16
#define IRIX_PR_PTHREADEXIT 17
#define IRIX_PR_SETABORTSIG 18
#define IRIX_PR_INIT_THREADS 20
#define IRIX_PR_THREAD_CTL 21
#define IRIX_PR_LASTSHEXIT 22
#endif /* _IRIX_IRIX_PRCTL_H_ */

View File

@ -1,10 +1,10 @@
/* $NetBSD: irix_syscall.h,v 1.6 2001/12/02 08:47:17 manu Exp $ */
/* $NetBSD: irix_syscall.h,v 1.7 2001/12/02 09:23:59 manu Exp $ */
/*
* System call numbers.
*
* DO NOT EDIT-- this file is automatically generated.
* created from NetBSD: syscalls.master,v 1.4 2001/12/02 08:30:11 manu Exp
* created from NetBSD: syscalls.master,v 1.5 2001/12/02 08:47:17 manu Exp
*/
/* syscall: "syscall" ret: "int" args: */
@ -173,6 +173,9 @@
/* syscall: "poll" ret: "int" args: "struct pollfd *" "u_int" "int" */
#define IRIX_SYS_poll 87
/* syscall: "prctl" ret: "ptrdiff_t" args: "unsigned int" "void *" */
#define IRIX_SYS_prctl 130
/* syscall: "mmap" ret: "void *" args: "void *" "svr4_size_t" "int" "int" "int" "svr4_off_t" */
#define IRIX_SYS_mmap 134

View File

@ -1,10 +1,10 @@
/* $NetBSD: irix_syscallargs.h,v 1.6 2001/12/02 08:47:17 manu Exp $ */
/* $NetBSD: irix_syscallargs.h,v 1.7 2001/12/02 09:23:59 manu Exp $ */
/*
* System call argument lists.
*
* DO NOT EDIT-- this file is automatically generated.
* created from NetBSD: syscalls.master,v 1.4 2001/12/02 08:30:11 manu Exp
* created from NetBSD: syscalls.master,v 1.5 2001/12/02 08:47:17 manu Exp
*/
#ifndef _IRIX_SYS__SYSCALLARGS_H_
@ -175,6 +175,11 @@ struct svr4_sys_putmsg_args {
syscallarg(int) flags;
};
struct irix_sys_prctl_args {
syscallarg(unsigned int) option;
syscallarg(void *) arg1;
};
struct svr4_sys_mmap_args {
syscallarg(void *) addr;
syscallarg(svr4_size_t) len;
@ -248,5 +253,6 @@ int svr4_sys_getdents(struct proc *, void *, register_t *);
int svr4_sys_getmsg(struct proc *, void *, register_t *);
int svr4_sys_putmsg(struct proc *, void *, register_t *);
int sys_poll(struct proc *, void *, register_t *);
int irix_sys_prctl(struct proc *, void *, register_t *);
int svr4_sys_mmap(struct proc *, void *, register_t *);
#endif /* _IRIX_SYS__SYSCALLARGS_H_ */

View File

@ -1,14 +1,14 @@
/* $NetBSD: irix_syscalls.c,v 1.6 2001/12/02 08:47:17 manu Exp $ */
/* $NetBSD: irix_syscalls.c,v 1.7 2001/12/02 09:23:59 manu Exp $ */
/*
* System call names.
*
* DO NOT EDIT-- this file is automatically generated.
* created from NetBSD: syscalls.master,v 1.4 2001/12/02 08:30:11 manu Exp
* created from NetBSD: syscalls.master,v 1.5 2001/12/02 08:47:17 manu Exp
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: irix_syscalls.c,v 1.6 2001/12/02 08:47:17 manu Exp $");
__KERNEL_RCSID(0, "$NetBSD: irix_syscalls.c,v 1.7 2001/12/02 09:23:59 manu Exp $");
#if defined(_KERNEL_OPT)
#if defined(_KERNEL_OPT)
@ -170,7 +170,7 @@ const char *const irix_syscallnames[] = {
"#127 (unimplemented adjtime)", /* 127 = unimplemented adjtime */
"#128 (unimplemented gettimeofday)", /* 128 = unimplemented gettimeofday */
"#129 (unimplemented sproc)", /* 129 = unimplemented sproc */
"#130 (unimplemented prctl)", /* 130 = unimplemented prctl */
"prctl", /* 130 = prctl */
"#131 (unimplemented procblk)", /* 131 = unimplemented procblk */
"#132 (unimplemented sprocsp)", /* 132 = unimplemented sprocsp */
"#133 (unimplemented sgigsc)", /* 133 = unimplemented sgigsc */

View File

@ -1,14 +1,14 @@
/* $NetBSD: irix_sysent.c,v 1.6 2001/12/02 08:47:17 manu Exp $ */
/* $NetBSD: irix_sysent.c,v 1.7 2001/12/02 09:23:59 manu Exp $ */
/*
* System call switch table.
*
* DO NOT EDIT-- this file is automatically generated.
* created from NetBSD: syscalls.master,v 1.4 2001/12/02 08:30:11 manu Exp
* created from NetBSD: syscalls.master,v 1.5 2001/12/02 08:47:17 manu Exp
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: irix_sysent.c,v 1.6 2001/12/02 08:47:17 manu Exp $");
__KERNEL_RCSID(0, "$NetBSD: irix_sysent.c,v 1.7 2001/12/02 09:23:59 manu Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ntp.h"
@ -303,8 +303,8 @@ struct sysent irix_sysent[] = {
sys_nosys }, /* 128 = unimplemented gettimeofday */
{ 0, 0, 0,
sys_nosys }, /* 129 = unimplemented sproc */
{ 0, 0, 0,
sys_nosys }, /* 130 = unimplemented prctl */
{ 2, s(struct irix_sys_prctl_args), 0,
irix_sys_prctl }, /* 130 = prctl */
{ 0, 0, 0,
sys_nosys }, /* 131 = unimplemented procblk */
{ 0, 0, 0,

View File

@ -1,4 +1,4 @@
$NetBSD: syscalls.master,v 1.5 2001/12/02 08:47:17 manu Exp $
$NetBSD: syscalls.master,v 1.6 2001/12/02 09:23:59 manu Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
@ -209,7 +209,8 @@
127 UNIMPL adjtime
128 UNIMPL gettimeofday
129 UNIMPL sproc
130 UNIMPL prctl
130 STD { ptrdiff_t irix_sys_prctl(unsigned int option, \
void *arg1); }
131 UNIMPL procblk
132 UNIMPL sprocsp
133 UNIMPL sgigsc