Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/compat/irix - the signal trampoline address is now copie...
details: https://anonhg.NetBSD.org/src/rev/2bbf55a4d2e3
branches: trunk
changeset: 531910:2bbf55a4d2e3
user: manu <manu%NetBSD.org@localhost>
date: Tue May 28 21:15:41 2002 +0000
description:
- the signal trampoline address is now copied during a fork(). This avoids
a SIGSEGV when sigaction(2) is used before a fork(2) and a signal is received
in the child.
- we now nearly correctly emulate PR_TERMCHILD in prctl(2). (the perfect
emulation would not send a SIGHUP if the parent is killed)
diffstat:
sys/compat/irix/irix_exec.c | 35 ++++++++++++++++++++++++++++++++---
sys/compat/irix/irix_exec.h | 5 ++++-
sys/compat/irix/irix_misc.c | 5 +++--
sys/compat/irix/irix_prctl.c | 19 +++++++++++++------
sys/compat/irix/irix_syscall.h | 4 ++--
sys/compat/irix/irix_syscallargs.h | 4 ++--
sys/compat/irix/irix_syscalls.c | 6 +++---
sys/compat/irix/irix_sysent.c | 6 +++---
sys/compat/irix/irix_syssgi.c | 6 +++---
9 files changed, 65 insertions(+), 25 deletions(-)
diffs (272 lines):
diff -r 8a981590b58c -r 2bbf55a4d2e3 sys/compat/irix/irix_exec.c
--- a/sys/compat/irix/irix_exec.c Tue May 28 21:11:04 2002 +0000
+++ b/sys/compat/irix/irix_exec.c Tue May 28 21:15:41 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: irix_exec.c,v 1.14 2002/04/20 16:19:22 manu Exp $ */
+/* $NetBSD: irix_exec.c,v 1.15 2002/05/28 21:15:41 manu Exp $ */
/*-
* Copyright (c) 2001-2002 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: irix_exec.c,v 1.14 2002/04/20 16:19:22 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: irix_exec.c,v 1.15 2002/05/28 21:15:41 manu Exp $");
#ifndef ELFSIZE
#define ELFSIZE 32 /* XXX should die */
@@ -62,6 +62,8 @@
#include <compat/irix/irix_signal.h>
#include <compat/irix/irix_errno.h>
+extern const int native_to_svr4_signo[];
+
static void setregs_n32 __P((struct proc *, struct exec_package *, u_long));
static void irix_e_proc_exec __P((struct proc *, struct exec_package *));
static void irix_e_proc_fork __P((struct proc *, struct proc *));
@@ -295,6 +297,24 @@
irix_e_proc_exit(p)
struct proc *p;
{
+ struct proc *pp;
+ struct irix_emuldata *ied;
+
+ LIST_FOREACH(pp, &allproc, p_list) {
+ /*
+ * Select IRIX processes.
+ * XXX not nice, but we need to do this
+ * before we reference p_emuldata.
+ */
+ if (pp->p_emul != &emul_irix_o32 &&
+ pp->p_emul != &emul_irix_n32)
+ continue;
+
+ ied = (struct irix_emuldata *)(pp->p_emuldata);
+ if (ied->ied_pptr == p)
+ psignal(pp, native_to_svr4_signo[SIGHUP]);
+ }
+
FREE(p->p_emuldata, M_EMULDATA);
p->p_emuldata = NULL;
}
@@ -306,8 +326,17 @@
irix_e_proc_fork(p, parent)
struct proc *p, *parent;
{
+ struct irix_emuldata *ied1;
+ struct irix_emuldata *ied2;
+
p->p_emuldata = NULL;
- /* Use parent's vmspace beacause our vmspace may not be setup yet) */
+ /* Use parent's vmspace beacause our vmspace may not be setup yet */
irix_e_proc_init(p, parent->p_vmspace);
+
+ ied1 = p->p_emuldata;
+ ied2 = parent->p_emuldata;
+
+ (void) memcpy(ied1, ied2, (unsigned)
+ ((caddr_t)&ied1->ied_endcopy - (caddr_t)&ied1->ied_startcopy));
}
diff -r 8a981590b58c -r 2bbf55a4d2e3 sys/compat/irix/irix_exec.h
--- a/sys/compat/irix/irix_exec.h Tue May 28 21:11:04 2002 +0000
+++ b/sys/compat/irix/irix_exec.h Tue May 28 21:15:41 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: irix_exec.h,v 1.7 2002/04/20 16:19:22 manu Exp $ */
+/* $NetBSD: irix_exec.h,v 1.8 2002/05/28 21:15:41 manu Exp $ */
/*-
* Copyright (c) 2001-2002 The NetBSD Foundation, Inc.
@@ -51,7 +51,10 @@
/* IRIX specific per-process data */
struct irix_emuldata {
+#define ied_startcopy ied_sigtramp
void *ied_sigtramp; /* Address of signal trampoline */
+#define ied_endcopy ied_pptr
+ struct proc *ied_pptr; /* parent process or NULL */
};
/* e_flags used by IRIX for ABI selection */
diff -r 8a981590b58c -r 2bbf55a4d2e3 sys/compat/irix/irix_misc.c
--- a/sys/compat/irix/irix_misc.c Tue May 28 21:11:04 2002 +0000
+++ b/sys/compat/irix/irix_misc.c Tue May 28 21:15:41 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: irix_misc.c,v 1.1 2002/04/20 07:42:32 manu Exp $ */
+/* $NetBSD: irix_misc.c,v 1.2 2002/05/28 21:15:41 manu Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: irix_misc.c,v 1.1 2002/04/20 07:42:32 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: irix_misc.c,v 1.2 2002/05/28 21:15:41 manu Exp $");
#include <sys/types.h>
#include <sys/signal.h>
@@ -50,6 +50,7 @@
#include <compat/irix/irix_types.h>
#include <compat/irix/irix_signal.h>
+#include <compat/irix/irix_exec.h>
#include <compat/irix/irix_syscallargs.h>
/*
diff -r 8a981590b58c -r 2bbf55a4d2e3 sys/compat/irix/irix_prctl.c
--- a/sys/compat/irix/irix_prctl.c Tue May 28 21:11:04 2002 +0000
+++ b/sys/compat/irix/irix_prctl.c Tue May 28 21:15:41 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: irix_prctl.c,v 1.9 2002/05/02 17:17:29 manu Exp $ */
+/* $NetBSD: irix_prctl.c,v 1.10 2002/05/28 21:15:42 manu Exp $ */
/*-
* Copyright (c) 2001-2002 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: irix_prctl.c,v 1.9 2002/05/02 17:17:29 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: irix_prctl.c,v 1.10 2002/05/28 21:15:42 manu Exp $");
#include <sys/errno.h>
#include <sys/types.h>
@@ -55,6 +55,7 @@
#include <compat/svr4/svr4_types.h>
#include <compat/irix/irix_types.h>
+#include <compat/irix/irix_exec.h>
#include <compat/irix/irix_prctl.h>
#include <compat/irix/irix_signal.h>
#include <compat/irix/irix_syscallargs.h>
@@ -112,17 +113,23 @@
break;
}
- case IRIX_PR_LASTSHEXIT: /* "Last sproc exit" */
+ case IRIX_PR_LASTSHEXIT: /* "Last sproc exit" */
/* We do nothing */
break;
+
case IRIX_PR_GETNSHARE: /* Number of sproc share group memb.*/
/* XXX This only gives threads that share VM space ... */
*retval = p->p_vmspace->vm_refcnt;
break;
- case IRIX_PR_TERMCHILD: /* Send SIGHUP to parrent on exit */
- p->p_exitsig = SIGHUP;
- *retval = 0;
+
+ case IRIX_PR_TERMCHILD: { /* Send SIGHUP to children on exit */
+ struct irix_emuldata *ied;
+
+ ied = (struct irix_emuldata *)(p->p_emuldata);
+ ied->ied_pptr = p->p_pptr;
break;
+ }
+
default:
printf("Warning: call to unimplemented prctl() command %d\n",
option);
diff -r 8a981590b58c -r 2bbf55a4d2e3 sys/compat/irix/irix_syscall.h
--- a/sys/compat/irix/irix_syscall.h Tue May 28 21:11:04 2002 +0000
+++ b/sys/compat/irix/irix_syscall.h Tue May 28 21:15:41 2002 +0000
@@ -1,10 +1,10 @@
-/* $NetBSD: irix_syscall.h,v 1.44 2002/05/22 05:14:01 manu Exp $ */
+/* $NetBSD: irix_syscall.h,v 1.45 2002/05/28 21:15:42 manu Exp $ */
/*
* System call numbers.
*
* DO NOT EDIT-- this file is automatically generated.
- * created from NetBSD: syscalls.master,v 1.42 2002/05/04 07:45:05 manu Exp
+ * created from NetBSD: syscalls.master,v 1.43 2002/05/22 05:14:03 manu Exp
*/
/* syscall: "syscall" ret: "int" args: */
diff -r 8a981590b58c -r 2bbf55a4d2e3 sys/compat/irix/irix_syscallargs.h
--- a/sys/compat/irix/irix_syscallargs.h Tue May 28 21:11:04 2002 +0000
+++ b/sys/compat/irix/irix_syscallargs.h Tue May 28 21:15:41 2002 +0000
@@ -1,10 +1,10 @@
-/* $NetBSD: irix_syscallargs.h,v 1.44 2002/05/22 05:14:51 manu Exp $ */
+/* $NetBSD: irix_syscallargs.h,v 1.45 2002/05/28 21:15:42 manu Exp $ */
/*
* System call argument lists.
*
* DO NOT EDIT-- this file is automatically generated.
- * created from NetBSD: syscalls.master,v 1.42 2002/05/04 07:45:05 manu Exp
+ * created from NetBSD: syscalls.master,v 1.43 2002/05/22 05:14:03 manu Exp
*/
#ifndef _IRIX_SYS__SYSCALLARGS_H_
diff -r 8a981590b58c -r 2bbf55a4d2e3 sys/compat/irix/irix_syscalls.c
--- a/sys/compat/irix/irix_syscalls.c Tue May 28 21:11:04 2002 +0000
+++ b/sys/compat/irix/irix_syscalls.c Tue May 28 21:15:41 2002 +0000
@@ -1,14 +1,14 @@
-/* $NetBSD: irix_syscalls.c,v 1.44 2002/05/22 05:14:02 manu Exp $ */
+/* $NetBSD: irix_syscalls.c,v 1.45 2002/05/28 21:15:42 manu Exp $ */
/*
* System call names.
*
* DO NOT EDIT-- this file is automatically generated.
- * created from NetBSD: syscalls.master,v 1.42 2002/05/04 07:45:05 manu Exp
+ * created from NetBSD: syscalls.master,v 1.43 2002/05/22 05:14:03 manu Exp
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: irix_syscalls.c,v 1.44 2002/05/22 05:14:02 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: irix_syscalls.c,v 1.45 2002/05/28 21:15:42 manu Exp $");
#if defined(_KERNEL_OPT)
#if defined(_KERNEL_OPT)
diff -r 8a981590b58c -r 2bbf55a4d2e3 sys/compat/irix/irix_sysent.c
--- a/sys/compat/irix/irix_sysent.c Tue May 28 21:11:04 2002 +0000
+++ b/sys/compat/irix/irix_sysent.c Tue May 28 21:15:41 2002 +0000
@@ -1,14 +1,14 @@
-/* $NetBSD: irix_sysent.c,v 1.44 2002/05/22 05:14:02 manu Exp $ */
+/* $NetBSD: irix_sysent.c,v 1.45 2002/05/28 21:15:42 manu Exp $ */
/*
* System call switch table.
*
* DO NOT EDIT-- this file is automatically generated.
- * created from NetBSD: syscalls.master,v 1.42 2002/05/04 07:45:05 manu Exp
+ * created from NetBSD: syscalls.master,v 1.43 2002/05/22 05:14:03 manu Exp
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: irix_sysent.c,v 1.44 2002/05/22 05:14:02 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: irix_sysent.c,v 1.45 2002/05/28 21:15:42 manu Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ntp.h"
diff -r 8a981590b58c -r 2bbf55a4d2e3 sys/compat/irix/irix_syssgi.c
--- a/sys/compat/irix/irix_syssgi.c Tue May 28 21:11:04 2002 +0000
+++ b/sys/compat/irix/irix_syssgi.c Tue May 28 21:15:41 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: irix_syssgi.c,v 1.26 2002/04/20 07:43:35 manu Exp $ */
+/* $NetBSD: irix_syssgi.c,v 1.27 2002/05/28 21:15:42 manu Exp $ */
/*-
* Copyright (c) 2001-2002 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: irix_syssgi.c,v 1.26 2002/04/20 07:43:35 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: irix_syssgi.c,v 1.27 2002/05/28 21:15:42 manu Exp $");
#include "opt_ddb.h"
@@ -469,7 +469,7 @@
default:
printf("Warning: syssgi(SYSCONF) unsupported variable %d\n",
name);
- return EINVAL;
+ return EINVAL;
break;
}
Home |
Main Index |
Thread Index |
Old Index