summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwtc <devnull@localhost>1998-04-15 01:02:00 +0000
committerwtc <devnull@localhost>1998-04-15 01:02:00 +0000
commit3fd86cbe8d0ac4f7f857042044548e5438893580 (patch)
treee00bdd9cedb68bc3cf3f9e298897bab977284455
parenteb88759b01d6b3e0c572a5783ff26689155b8040 (diff)
downloadnspr-hg-3fd86cbe8d0ac4f7f857042044548e5438893580.tar.gz
Ported to HP-UX 9. We acknowledge Richard K. Lloyd <rkl@csc.liv.ac.uk>
for his help. Files changed: HP-UX.mk, pr/src/Makefile, hpux.c, unix.c, and uxproces.c. HP-UX.mk: Compare $(basename $(OS_RELEASE)) with A.09 to cover all HP-UX 9 revisions. Define _PR_NEED_H_ERRNO for HP-UX 9.
-rw-r--r--config/HP-UX.mk23
-rw-r--r--pr/src/Makefile2
-rw-r--r--pr/src/md/unix/hpux.c13
-rw-r--r--pr/src/md/unix/unix.c34
-rw-r--r--pr/src/md/unix/uxproces.c7
5 files changed, 59 insertions, 20 deletions
diff --git a/config/HP-UX.mk b/config/HP-UX.mk
index e98793e7..2e40d050 100644
--- a/config/HP-UX.mk
+++ b/config/HP-UX.mk
@@ -32,10 +32,14 @@ CPU_ARCH = hppa
OS_CFLAGS = +ESlit $(DSO_CFLAGS) -DHPUX -D$(CPU_ARCH) -D_HPUX_SOURCE
#
-# The header netdb.h on 10.10 and 10.20 declares h_errno only
-# if _XOPEN_SOURCE_EXTENDED is defined. So we need to declare
+# The header netdb.h on HP-UX 9 does not declare h_errno.
+# On 10.10 and 10.20, netdb.h declares h_errno only if
+# _XOPEN_SOURCE_EXTENDED is defined. So we need to declare
# h_errno ourselves.
#
+ifeq ($(basename $(OS_RELEASE)),A.09)
+OS_CFLAGS += -D_PR_NEED_H_ERRNO
+endif
ifeq (,$(filter-out B.10.10 B.10.20,$(OS_RELEASE)))
OS_CFLAGS += -D_PR_NEED_H_ERRNO
endif
@@ -58,12 +62,7 @@ endif
# On HP-UX 10.30 and 11.00, the default implementation strategy is
# pthreads. Classic nspr and pthreads-user are also available.
#
-ifeq ($(OS_RELEASE),A.09.03)
-OS_CFLAGS += -DHPUX9
-DEFAULT_IMPL_STRATEGY = _CLASSIC
-endif
-
-ifeq ($(OS_RELEASE),A.09.07)
+ifeq ($(basename $(OS_RELEASE)),A.09)
OS_CFLAGS += -DHPUX9
DEFAULT_IMPL_STRATEGY = _CLASSIC
endif
@@ -89,17 +88,21 @@ endif
ifeq ($(OS_RELEASE),B.10.30)
CCC = /opt/aCC/bin/aCC
-OS_CFLAGS += +DA1.0 +DS1.0 -DHPUX10 -DHPUX10_30
+OS_CFLAGS += +DAportable +DS1.1 -DHPUX10 -DHPUX10_30
DEFAULT_IMPL_STRATEGY = _PTH
endif
# 11.00 is similar to 10.30.
ifeq ($(OS_RELEASE),B.11.00)
CCC = /opt/aCC/bin/aCC
-OS_CFLAGS += +DA1.0 +DS1.0 -DHPUX10 -DHPUX11
+OS_CFLAGS += +DAportable +DS1.1 -DHPUX10 -DHPUX11
DEFAULT_IMPL_STRATEGY = _PTH
endif
+ifeq ($(DEFAULT_IMPL_STRATEGY),_CLASSIC)
+CLASSIC_NSPR = 1
+endif
+
ifeq ($(DEFAULT_IMPL_STRATEGY),_PTH)
USE_PTHREADS = 1
ifeq ($(CLASSIC_NSPR),1)
diff --git a/pr/src/Makefile b/pr/src/Makefile
index 6e514e2d..2dd9ea1b 100644
--- a/pr/src/Makefile
+++ b/pr/src/Makefile
@@ -108,7 +108,7 @@ endif
endif
ifeq ($(OS_ARCH),HP-UX)
-ifeq ($(OS_RELEASE),A.09.03)
+ifeq ($(basename $(OS_RELEASE)),A.09)
OS_LIBS = -ldld -L/lib/pa1.1 -lm
else
OS_LIBS = -ldld -lm -lc
diff --git a/pr/src/md/unix/hpux.c b/pr/src/md/unix/hpux.c
index 701a854b..79e244c1 100644
--- a/pr/src/md/unix/hpux.c
+++ b/pr/src/md/unix/hpux.c
@@ -36,9 +36,12 @@
** Under DCE threads, sigaction() installs a per-thread signal handler,
** so we use the sigvector() interface to install a process-wide
** handler.
+**
+** On HP-UX 9, struct sigaction doesn't have the sa_sigaction field,
+** so we also need to use the sigvector() interface.
*/
-#ifdef _PR_DCETHREADS
+#if defined(_PR_DCETHREADS) || defined(HPUX9)
static void
CatchFPE(int sig, int code, struct sigcontext *scp)
{
@@ -68,7 +71,7 @@ CatchFPE(int sig, int code, struct sigcontext *scp)
/* clear T-bit */
scp->sc_sl.sl_ss.ss_frstat &= ~0x40;
}
-#else /* _PR_DCETHREADS */
+#else /* _PR_DCETHREADS || HPUX9 */
static void
CatchFPE(int sig, siginfo_t *info, void *context)
{
@@ -99,11 +102,11 @@ CatchFPE(int sig, siginfo_t *info, void *context)
/* clear T-bit */
ucp->uc_mcontext.ss_frstat &= ~0x40;
}
-#endif /* _PR_DCETHREADS */
+#endif /* _PR_DCETHREADS || HPUX9 */
void _MD_hpux_install_sigfpe_handler(void)
{
-#ifdef _PR_DCETHREADS
+#if defined(_PR_DCETHREADS) || defined(HPUX9)
struct sigvec v;
v.sv_handler = CatchFPE;
@@ -117,7 +120,7 @@ void _MD_hpux_install_sigfpe_handler(void)
act.sa_flags |= SA_SIGINFO;
act.sa_sigaction = CatchFPE;
sigaction(SIGFPE, &act, NULL);
-#endif /* _PR_DCETHREADS */
+#endif /* _PR_DCETHREADS || HPUX9 */
#if defined(HPUX10_30) || defined(HPUX11)
fesettrapenable(FE_INVALID);
diff --git a/pr/src/md/unix/unix.c b/pr/src/md/unix/unix.c
index c17c2d77..3fcd26d2 100644
--- a/pr/src/md/unix/unix.c
+++ b/pr/src/md/unix/unix.c
@@ -2213,6 +2213,23 @@ static void ClockInterruptHandler()
_PR_MD_SET_INTSOFF(0);
}
+/*
+ * On HP-UX 9, we have to use the sigvector() interface to restart
+ * interrupted system calls, because sigaction() does not have the
+ * SA_RESTART flag.
+ */
+
+#ifdef HPUX9
+static void HPUX9_ClockInterruptHandler(
+ int sig,
+ int code,
+ struct sigcontext *scp)
+{
+ ClockInterruptHandler();
+ scp->sc_syscall_action = SIG_RESTART;
+}
+#endif /* HPUX9 */
+
/* # of milliseconds per clock tick that we will use */
#define MSEC_PER_TICK 50
@@ -2221,12 +2238,21 @@ void _MD_StartInterrupts()
{
struct itimerval itval;
char *eval;
+#ifdef HPUX9
+ struct sigvec vec;
+
+ vec.sv_handler = (void (*)()) HPUX9_ClockInterruptHandler;
+ vec.sv_mask = 0;
+ vec.sv_flags = 0;
+ sigvector(SIGALRM, &vec, 0);
+#else
struct sigaction vtact;
vtact.sa_handler = (void (*)()) ClockInterruptHandler;
+ sigemptyset(&vtact.sa_mask);
vtact.sa_flags = SA_RESTART;
- vtact.sa_mask = timer_set;
sigaction(SIGALRM, &vtact, 0);
+#endif /* HPUX9 */
if ((eval = getenv("NSPR_NOCLOCK")) != NULL) {
if (atoi(eval) == 0)
@@ -2388,21 +2414,21 @@ void _PR_UnixInit()
if (getenv("NSPR_SIGSEGV_HANDLE")) {
sigact.sa_handler = sigsegvhandler;
- sigact.sa_flags = SA_RESTART;
+ sigact.sa_flags = 0;
sigact.sa_mask = timer_set;
sigaction(SIGSEGV, &sigact, 0);
}
if (getenv("NSPR_SIGABRT_HANDLE")) {
sigact.sa_handler = sigaborthandler;
- sigact.sa_flags = SA_RESTART;
+ sigact.sa_flags = 0;
sigact.sa_mask = timer_set;
sigaction(SIGABRT, &sigact, 0);
}
if (getenv("NSPR_SIGBUS_HANDLE")) {
sigact.sa_handler = sigbushandler;
- sigact.sa_flags = SA_RESTART;
+ sigact.sa_flags = 0;
sigact.sa_mask = timer_set;
sigaction(SIGBUS, &sigact, 0);
}
diff --git a/pr/src/md/unix/uxproces.c b/pr/src/md/unix/uxproces.c
index 7f8ab887..b5f11748 100644
--- a/pr/src/md/unix/uxproces.c
+++ b/pr/src/md/unix/uxproces.c
@@ -25,6 +25,13 @@
#include <sys/wait.h>
/*
+ * HP-UX 9 doesn't have the SA_RESTART flag.
+ */
+#ifndef SA_RESTART
+#define SA_RESTART 0
+#endif
+
+/*
**********************************************************************
*
* The Unix process routines