diff options
author | Ludovic Hirlimann <ludovic@mozilla.com> | 2019-06-29 00:05:59 +0200 |
---|---|---|
committer | Ludovic Hirlimann <ludovic@mozilla.com> | 2019-06-29 00:05:59 +0200 |
commit | aace8a10ff70178ef8923fb351362cd37fa1fb10 (patch) | |
tree | 545562f8a77bac4cd668244e1f95efb23c5ef27c | |
parent | a087d65d548c3c08548f61ae674357d09df49c51 (diff) | |
download | nspr-hg-aace8a10ff70178ef8923fb351362cd37fa1fb10.tar.gz |
Bug 1535665 - Remove IRIX support. r=kaie
46 files changed, 16 insertions, 3403 deletions
diff --git a/admin/makeTargetDirs.sh b/admin/makeTargetDirs.sh index a78f8db5..6faf4bd1 100644 --- a/admin/makeTargetDirs.sh +++ b/admin/makeTargetDirs.sh @@ -26,8 +26,6 @@ mkdir HP-UXB.11.00_64_DBG.OBJ mkdir HP-UXB.11.00_64_OPT.OBJ mkdir HP-UXB.11.00_DBG.OBJ mkdir HP-UXB.11.00_OPT.OBJ -mkdir IRIX6.5_n32_PTH_DBG.OBJ -mkdir IRIX6.5_n32_PTH_OPT.OBJ mkdir Linux2.2_x86_glibc_PTH_DBG.OBJ mkdir Linux2.2_x86_glibc_PTH_OPT.OBJ mkdir Linux2.4_x86_glibc_PTH_DBG.OBJ diff --git a/config/Makefile.in b/config/Makefile.in index 7062c5ca..c8695e93 100644 --- a/config/Makefile.in +++ b/config/Makefile.in @@ -48,22 +48,6 @@ ifeq (,$(filter-out QNX SCOOS UNIXWARE,$(OS_ARCH))) DEFINES += -DOMIT_LIB_BUILD_TIME endif -ifeq ($(OS_ARCH), IRIX) - ifeq ($(basename $(OS_RELEASE)),6) - ifndef NS_USE_GCC - ifeq ($(USE_N32),1) - XLDOPTS += -n32 -Wl,-woff,85 - else - ifeq ($(USE_64),1) - XLDOPTS += -64 - else - XLDOPTS += -32 - endif - endif - endif - endif -endif - ifeq ($(OS_ARCH), HP-UX) ifeq ($(USE_64),1) XLDOPTS += +DD64 @@ -1457,7 +1457,6 @@ Optional Features: Specify symbian flavor. (WINSCW or GCCE) --enable-debug-rtl Use the MSVC debug runtime library --enable-static-rtl Use the MSVC static runtime library - --enable-n32 Enable n32 ABI support (IRIX only) --enable-x32 Enable x32 ABI support (x86_64 only) --enable-64bit Enable 64-bit support (on certain platforms) --enable-mdupdate Enable use of certain compilers' mdupdate feature @@ -2984,10 +2983,6 @@ if test -z "$CC"; then CC=cc ;; - *-irix*) - CC=cc - ;; - *-solaris*) CC=cc ;; @@ -3020,10 +3015,6 @@ if test -z "$CXX"; then esac ;; - *-irix*) - CXX=CC - ;; - *-solaris*) CXX=CC ;; @@ -5615,10 +5606,6 @@ else OS_TEST=`uname -m` fi -if test "$OS_ARCH" = "IRIX64"; then - OS_ARCH=IRIX -fi - if test "$OS_ARCH" = "AIX"; then OS_RELEASE=`uname -v`.`uname -r` fi @@ -6857,110 +6844,6 @@ tools are selected during the Xcode/Developer Tools installation." "$LINENO" 5 fi ;; -*-irix*) - $as_echo "#define XP_UNIX 1" >>confdefs.h - - $as_echo "#define IRIX 1" >>confdefs.h - - $as_echo "#define SVR4 1" >>confdefs.h - - $as_echo "#define _SGI_MP_SOURCE 1" >>confdefs.h - - $as_echo "#define HAVE_FCNTL_FILE_LOCKING 1" >>confdefs.h - - PR_MD_CSRCS=irix.c - PR_MD_ASFILES=os_Irix.s - MKSHLIB='$(LD) $(DSO_LDOPTS) -rdata_shared -shared -soname $(notdir $@) -o $@' - STRIP="$STRIP -f" - RESOLVE_LINK_SYMBOLS=1 - if test -n "$USE_64"; then - MDCPUCFG_H=_irix64.cfg - else - MDCPUCFG_H=_irix32.cfg - fi - case "${target_os}" in - irix6*) - $as_echo "#define IRIX6 1" >>confdefs.h - - USE_PTHREADS=1 - USE_N32=1 - COMPILER_TAG=_n32 - IMPL_STRATEGY=_PTH - ;; - irix5*) - $as_echo "#define IRIX5 1" >>confdefs.h - - USE_NSPR_THREADS=1 - ;; - *) - USE_PTHREADS=1 - USE_N32=1 - ;; - esac - if test "$GNU_CC"; then - AS='$(CC) -Wp,-P -x assembler-with-cpp -D_ASM -mips2 $(INCLUDES)' - CFLAGS="$CFLAGS -Wall -Wno-format" - _OPTIMIZE_FLAGS="-O6" - else - if test -n "$USE_N32"; then - AS='as -D_ASM $(INCLUDES) -n32' - else - AS='as -D_ASM $(INCLUDES)' - fi - CFLAGS="$CFLAGS -fullwarn -xansi" - if test "$USE_N32"; then - _OPTIMIZE_FLAGS="-O -OPT:Olimit=4000" - else - _OPTIMIZE_FLAGS="-O -Olimit 4000" - fi - if test "$USE_MDUPDATE"; then - CFLAGS="$CFLAGS -MDupdate \$(DEPENDENCIES)" - fi - case "${target}" in - *-irix6.*) - CFLAGS="$CFLAGS -multigot" - DSO_LDOPTS="-no_unresolved" - if test "$USE_N32"; then - CFLAGS="$CFLAGS -n32 -woff 1209" - DSO_LDOPTS="$DSO_LDOPTS -n32" - else - if test "$USE_64"; then - CFLAGS="$CFLAGS -64" - else - CFLAGS="$CFLAGS -32" - fi - fi - ;; - *) - CFLAGS="$CFLAGS -xgot" - ;; - esac - fi - if test "${target_os}" = "irix5.3"; then - $as_echo "#define IRIX5_3 1" >>confdefs.h - - fi - case "${target_os}" in - irix6.5) - if test -z "$GNU_CC"; then - CFLAGS="$CFLAGS -mips3" - fi - $as_echo "#define _PR_HAVE_GETPROTO_R 1" >>confdefs.h - - $as_echo "#define _PR_HAVE_GETPROTO_R_POINTER 1" >>confdefs.h - - $as_echo "#define _PR_HAVE_SGI_PRDA_PROCMASK 1" >>confdefs.h - - ;; - irix5*) - ;; - *) - $as_echo "#define _PR_HAVE_SGI_PRDA_PROCMASK 1" >>confdefs.h - - ;; - esac - ;; - *-linux*|*-gnu*|*-k*bsd*-gnu|*-android*|*-linuxandroid*) if test -z "$USE_NSPR_THREADS"; then USE_PTHREADS=1 @@ -8385,16 +8268,6 @@ _ACEOF fi ;; -*-irix*) - if test "${target_os}" = "irix6.5"; then - if test -n "$USE_PTHREADS"; then - $as_echo "#define _PR_HAVE_GETHOST_R 1" >>confdefs.h - - $as_echo "#define _PR_HAVE_GETHOST_R_POINTER 1" >>confdefs.h - - fi - fi - ;; *-linux*|*-gnu*|*-k*bsd*-gnu) if test -n "$USE_NSPR_THREADS"; then $as_echo "#define _PR_LOCAL_THREADS_ONLY 1" >>confdefs.h diff --git a/configure.in b/configure.in index 88ad727e..e6a1a0f4 100644 --- a/configure.in +++ b/configure.in @@ -358,15 +358,6 @@ AC_ARG_ENABLE(static-rtl, USE_STATIC_RTL=1 fi ]) -AC_ARG_ENABLE(n32, - [ --enable-n32 Enable n32 ABI support (IRIX only)], - [ if test "$enableval" = "yes"; then - USE_N32=1 - else if test "$enableval" = "no"; then - USE_N32= - fi - fi ]) - AC_ARG_ENABLE(x32, [ --enable-x32 Enable x32 ABI support (x86_64 only)], [ if test "$enableval" = "yes"; then @@ -454,10 +445,6 @@ if test -z "$CC"; then CC=cc ;; - *-irix*) - CC=cc - ;; - *-solaris*) CC=cc ;; @@ -495,10 +482,6 @@ if test -z "$CXX"; then esac ;; - *-irix*) - CXX=CC - ;; - *-solaris*) CXX=CC ;; @@ -854,10 +837,6 @@ else OS_TEST=`uname -m` fi -if test "$OS_ARCH" = "IRIX64"; then - OS_ARCH=IRIX -fi - if test "$OS_ARCH" = "AIX"; then OS_RELEASE=`uname -v`.`uname -r` fi @@ -1691,105 +1670,6 @@ tools are selected during the Xcode/Developer Tools installation.]) fi ;; -*-irix*) - AC_DEFINE(XP_UNIX) - AC_DEFINE(IRIX) - AC_DEFINE(SVR4) - AC_DEFINE(_SGI_MP_SOURCE) - AC_DEFINE(HAVE_FCNTL_FILE_LOCKING) - PR_MD_CSRCS=irix.c - PR_MD_ASFILES=os_Irix.s - MKSHLIB='$(LD) $(DSO_LDOPTS) -rdata_shared -shared -soname $(notdir $@) -o $@' - STRIP="$STRIP -f" - RESOLVE_LINK_SYMBOLS=1 - if test -n "$USE_64"; then - MDCPUCFG_H=_irix64.cfg - else - MDCPUCFG_H=_irix32.cfg - fi - case "${target_os}" in - irix6*) - AC_DEFINE(IRIX6) - USE_PTHREADS=1 - USE_N32=1 - COMPILER_TAG=_n32 - IMPL_STRATEGY=_PTH - ;; - irix5*) - AC_DEFINE(IRIX5) - USE_NSPR_THREADS=1 - ;; - *) - USE_PTHREADS=1 - USE_N32=1 - ;; - esac - if test "$GNU_CC"; then - dnl - dnl If we are using gcc with native binutils, we need to - dnl suppress the - dnl #lineno "filename" num num - dnl lines, which confuse IRIX native as. Add -Wp,-P to the - dnl gcc command line, which passes -P to the preprocessor. - dnl - AS='$(CC) -Wp,-P -x assembler-with-cpp -D_ASM -mips2 $(INCLUDES)' - CFLAGS="$CFLAGS -Wall -Wno-format" - _OPTIMIZE_FLAGS="-O6" - else - if test -n "$USE_N32"; then - AS='as -D_ASM $(INCLUDES) -n32' - else - AS='as -D_ASM $(INCLUDES)' - fi - CFLAGS="$CFLAGS -fullwarn -xansi" - if test "$USE_N32"; then - _OPTIMIZE_FLAGS="-O -OPT:Olimit=4000" - else - _OPTIMIZE_FLAGS="-O -Olimit 4000" - fi - if test "$USE_MDUPDATE"; then - CFLAGS="$CFLAGS -MDupdate \$(DEPENDENCIES)" - fi - case "${target}" in - *-irix6.*) - CFLAGS="$CFLAGS -multigot" - DSO_LDOPTS="-no_unresolved" - if test "$USE_N32"; then - CFLAGS="$CFLAGS -n32 -woff 1209" - DSO_LDOPTS="$DSO_LDOPTS -n32" - else - if test "$USE_64"; then - CFLAGS="$CFLAGS -64" - else - CFLAGS="$CFLAGS -32" - fi - fi - ;; - *) - CFLAGS="$CFLAGS -xgot" - ;; - esac - fi - if test "${target_os}" = "irix5.3"; then - AC_DEFINE(IRIX5_3) - fi - case "${target_os}" in - irix6.5) - if test -z "$GNU_CC"; then - CFLAGS="$CFLAGS -mips3" - fi - AC_DEFINE(_PR_HAVE_GETPROTO_R) - AC_DEFINE(_PR_HAVE_GETPROTO_R_POINTER) - AC_DEFINE(_PR_HAVE_SGI_PRDA_PROCMASK) - ;; - irix5*) - ;; - *) - AC_DEFINE(_PR_HAVE_SGI_PRDA_PROCMASK) - ;; - esac - ;; - *-linux*|*-gnu*|*-k*bsd*-gnu|*-android*|*-linuxandroid*) if test -z "$USE_NSPR_THREADS"; then USE_PTHREADS=1 @@ -2826,14 +2706,6 @@ case "$target" in AC_DEFINE_UNQUOTED(_POSIX_C_SOURCE,199506L) fi ;; -*-irix*) - if test "${target_os}" = "irix6.5"; then - if test -n "$USE_PTHREADS"; then - AC_DEFINE(_PR_HAVE_GETHOST_R) - AC_DEFINE(_PR_HAVE_GETHOST_R_POINTER) - fi - fi - ;; *-linux*|*-gnu*|*-k*bsd*-gnu) if test -n "$USE_NSPR_THREADS"; then AC_DEFINE(_PR_LOCAL_THREADS_ONLY) diff --git a/lib/ds/Makefile.in b/lib/ds/Makefile.in index e7377912..38a9e3dd 100644 --- a/lib/ds/Makefile.in +++ b/lib/ds/Makefile.in @@ -43,10 +43,6 @@ OS_LIBS = -lc_r endif endif -ifeq ($(OS_ARCH),IRIX) -OS_LIBS = -lc -endif - ifeq ($(OS_ARCH),SunOS) OS_LIBS = -lc MAPFILE = $(OBJDIR)/pldsmap.sun diff --git a/lib/libc/src/Makefile.in b/lib/libc/src/Makefile.in index e8a6d9fd..be488e95 100644 --- a/lib/libc/src/Makefile.in +++ b/lib/libc/src/Makefile.in @@ -52,10 +52,6 @@ OS_LIBS = -lc_r endif endif -ifeq ($(OS_ARCH),IRIX) -OS_LIBS = -lc -endif - ifeq ($(OS_ARCH),SunOS) OS_LIBS = -lc MAPFILE = $(OBJDIR)/plcmap.sun diff --git a/lib/prstreams/Makefile.in b/lib/prstreams/Makefile.in index aeb29440..a380cab4 100644 --- a/lib/prstreams/Makefile.in +++ b/lib/prstreams/Makefile.in @@ -14,12 +14,6 @@ include $(MOD_DEPTH)/config/autoconf.mk include $(topsrcdir)/config/config.mk -ifeq ($(OS_ARCH), IRIX) - ifneq ($(OS_RELEASE),5.3) - CCC_ONLY_FLAGS += -exceptions - endif -endif - ifeq ($(OS_ARCH), BeOS) CFLAGS += -frtti -fexceptions endif diff --git a/lib/prstreams/tests/testprstrm/Makefile.in b/lib/prstreams/tests/testprstrm/Makefile.in index 4f68ec93..74ef1ac2 100644 --- a/lib/prstreams/tests/testprstrm/Makefile.in +++ b/lib/prstreams/tests/testprstrm/Makefile.in @@ -57,10 +57,6 @@ ifneq ($(OS_ARCH), WINNT) PWD = $(shell pwd) endif -ifeq ($(OS_ARCH), IRIX) -LDOPTS += -rpath $(PWD)/$(dist_libdir) -endif - ifeq ($(OS_ARCH), HP-UX) LDOPTS += -Wl,+s,+b,$(PWD)/$(dist_libdir) endif diff --git a/lib/tests/Makefile.in b/lib/tests/Makefile.in index 85519077..76b567d0 100644 --- a/lib/tests/Makefile.in +++ b/lib/tests/Makefile.in @@ -64,10 +64,6 @@ ifneq ($(OS_ARCH), WINNT) PWD = $(shell pwd) endif -ifeq ($(OS_ARCH), IRIX) -LDOPTS += -rpath $(PWD)/$(dist_libdir) -endif - ifeq ($(OS_ARCH), Linux) ifeq ($(OS_RELEASE), 1.2) EXTRA_LIBS = -ldl diff --git a/pr/include/gencfg.c b/pr/include/gencfg.c index 6a58f95d..d7308820 100644 --- a/pr/include/gencfg.c +++ b/pr/include/gencfg.c @@ -5,12 +5,6 @@ #include <stdio.h> -#if defined(sgi) -#ifndef IRIX - error - IRIX is not defined -#endif -#endif - #if defined(__sun) #ifndef SOLARIS error - SOLARIS is not defined diff --git a/pr/include/md/_irix.h b/pr/include/md/_irix.h deleted file mode 100644 index 04413b99..00000000 --- a/pr/include/md/_irix.h +++ /dev/null @@ -1,438 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef nspr_irix_defs_h___ -#define nspr_irix_defs_h___ - -#define _PR_HAVE_ATOMIC_CAS - -/* - * MipsPro assembler defines _LANGUAGE_ASSEMBLY - */ -#ifndef _LANGUAGE_ASSEMBLY - -#include "prclist.h" -#include "prthread.h" -#include <sys/ucontext.h> - -/* - * Internal configuration macros - */ - -#define PR_LINKER_ARCH "irix" -#define _PR_SI_SYSNAME "IRIX" -#define _PR_SI_ARCHITECTURE "mips" -#define PR_DLL_SUFFIX ".so" - -#define _PR_VMBASE 0x30000000 -#define _PR_STACK_VMBASE 0x50000000 -#define _PR_NUM_GCREGS 9 -#define _MD_MMAP_FLAGS MAP_PRIVATE - -#define _MD_DEFAULT_STACK_SIZE 65536L -#define _MD_MIN_STACK_SIZE 16384L - -#undef HAVE_STACK_GROWING_UP -#define HAVE_WEAK_IO_SYMBOLS -#define HAVE_WEAK_MALLOC_SYMBOLS -#define HAVE_DLL -#define USE_DLFCN -#define _PR_HAVE_ATOMIC_OPS -#define _PR_POLL_AVAILABLE -#define _PR_USE_POLL -#define _PR_STAT_HAS_ST_ATIM -#define _PR_HAVE_OFF64_T -#define HAVE_POINTER_LOCALTIME_R -#define _PR_HAVE_POSIX_SEMAPHORES -#define PR_HAVE_POSIX_NAMED_SHARED_MEMORY -#define _PR_ACCEPT_INHERIT_NONBLOCK - -#ifdef _PR_INET6 -#define _PR_HAVE_INET_NTOP -#define _PR_HAVE_GETIPNODEBYNAME -#define _PR_HAVE_GETIPNODEBYADDR -#define _PR_HAVE_GETADDRINFO -#endif - -/* Initialization entry points */ -NSPR_API(void) _MD_EarlyInit(void); -#define _MD_EARLY_INIT _MD_EarlyInit - -NSPR_API(void) _MD_IrixInit(void); -#define _MD_FINAL_INIT _MD_IrixInit - -#define _MD_INIT_IO() - -/* Timer operations */ -NSPR_API(PRIntervalTime) _MD_IrixGetInterval(void); -#define _MD_GET_INTERVAL _MD_IrixGetInterval - -NSPR_API(PRIntervalTime) _MD_IrixIntervalPerSec(void); -#define _MD_INTERVAL_PER_SEC _MD_IrixIntervalPerSec - -/* GC operations */ -NSPR_API(void *) _MD_GetSP(PRThread *thread); -#define _MD_GET_SP _MD_GetSP - -/* The atomic operations */ -#include <mutex.h> -#define _MD_INIT_ATOMIC() -#define _MD_ATOMIC_INCREMENT(val) add_then_test((unsigned long*)val, 1) -#define _MD_ATOMIC_ADD(ptr, val) add_then_test((unsigned long*)ptr, (unsigned long)val) -#define _MD_ATOMIC_DECREMENT(val) add_then_test((unsigned long*)val, 0xffffffff) -#define _MD_ATOMIC_SET(val, newval) test_and_set((unsigned long*)val, newval) - -#if defined(_PR_PTHREADS) -#else /* defined(_PR_PTHREADS) */ - -/************************************************************************/ - -#include <setjmp.h> -#include <errno.h> -#include <unistd.h> -#include <bstring.h> -#include <sys/time.h> -#include <ulocks.h> -#include <sys/prctl.h> - - -/* - * Data region private to each sproc. This region is setup by calling - * mmap(...,MAP_LOCAL,...). The private data is mapped at the same - * address in every sproc, but every sproc gets a private mapping. - * - * Just make sure that this structure fits in a page, as only one page - * is allocated for the private region. - */ -struct sproc_private_data { - struct PRThread *me; - struct _PRCPU *cpu; - struct PRThread *last; - PRUintn intsOff; - int sproc_pid; -}; - -extern char *_nspr_sproc_private; - -#define _PR_PRDA() ((struct sproc_private_data *) _nspr_sproc_private) -#define _MD_SET_CURRENT_THREAD(_thread) _PR_PRDA()->me = (_thread) -#define _MD_THIS_THREAD() (_PR_PRDA()->me) -#define _MD_LAST_THREAD() (_PR_PRDA()->last) -#define _MD_SET_LAST_THREAD(_thread) _PR_PRDA()->last = (_thread) -#define _MD_CURRENT_CPU() (_PR_PRDA()->cpu) -#define _MD_SET_CURRENT_CPU(_cpu) _PR_PRDA()->cpu = (_cpu) -#define _MD_SET_INTSOFF(_val) (_PR_PRDA()->intsOff = _val) -#define _MD_GET_INTSOFF() (_PR_PRDA()->intsOff) - -#define _MD_SET_SPROC_PID(_val) (_PR_PRDA()->sproc_pid = _val) -#define _MD_GET_SPROC_PID() (_PR_PRDA()->sproc_pid) - -NSPR_API(struct PRThread*) _MD_get_attached_thread(void); -NSPR_API(struct PRThread*) _MD_get_current_thread(void); -#define _MD_GET_ATTACHED_THREAD() _MD_get_attached_thread() -#define _MD_CURRENT_THREAD() _MD_get_current_thread() - -#define _MD_CHECK_FOR_EXIT() { \ - if (_pr_irix_exit_now) { \ - _PR_POST_SEM(_pr_irix_exit_sem); \ - _MD_Wakeup_CPUs(); \ - _exit(0); \ - } \ - } - -#define _MD_ATTACH_THREAD(threadp) - -#define _MD_SAVE_ERRNO(_thread) (_thread)->md.errcode = errno; -#define _MD_RESTORE_ERRNO(_thread) errno = (_thread)->md.errcode; - -extern struct _PRCPU *_pr_primordialCPU; -extern usema_t *_pr_irix_exit_sem; -extern PRInt32 _pr_irix_exit_now; -extern int _pr_irix_primoridal_cpu_fd[]; -extern PRInt32 _pr_irix_process_exit; -extern PRInt32 _pr_irix_process_exit_code; - -/* Thread operations */ -#define _PR_LOCK_HEAP() { \ - PRIntn _is; \ - if (_pr_primordialCPU) { \ - if (_MD_GET_ATTACHED_THREAD() && \ - !_PR_IS_NATIVE_THREAD( \ - _MD_GET_ATTACHED_THREAD())) \ - _PR_INTSOFF(_is); \ - _PR_LOCK(_pr_heapLock); \ - } - -#define _PR_UNLOCK_HEAP() if (_pr_primordialCPU) { \ - _PR_UNLOCK(_pr_heapLock); \ - if (_MD_GET_ATTACHED_THREAD() && \ - !_PR_IS_NATIVE_THREAD( \ - _MD_GET_ATTACHED_THREAD())) \ - _PR_INTSON(_is); \ - } \ - } - -#define _PR_OPEN_POLL_SEM(_sem) usopenpollsema(_sem, 0666) -#define _PR_WAIT_SEM(_sem) uspsema(_sem) -#define _PR_POST_SEM(_sem) usvsema(_sem) - -#define _MD_CVAR_POST_SEM(threadp) usvsema((threadp)->md.cvar_pollsem) - -#define _MD_IOQ_LOCK() -#define _MD_IOQ_UNLOCK() - -struct _MDLock { - ulock_t lock; - usptr_t *arena; -}; - -/* - * disable pre-emption for the LOCAL threads when calling the arena lock - * routines - */ - -#define _PR_LOCK(lock) { \ - PRIntn _is; \ - PRThread *me = _MD_GET_ATTACHED_THREAD(); \ - if (me && !_PR_IS_NATIVE_THREAD(me)) \ - _PR_INTSOFF(_is); \ - ussetlock(lock); \ - if (me && !_PR_IS_NATIVE_THREAD(me)) \ - _PR_FAST_INTSON(_is); \ - } - -#define _PR_UNLOCK(lock) { \ - PRIntn _is; \ - PRThread *me = _MD_GET_ATTACHED_THREAD(); \ - if (me && !_PR_IS_NATIVE_THREAD(me)) \ - _PR_INTSOFF(_is); \ - usunsetlock(lock); \ - if (me && !_PR_IS_NATIVE_THREAD(me)) \ - _PR_FAST_INTSON(_is); \ - } - -NSPR_API(PRStatus) _MD_NEW_LOCK(struct _MDLock *md); -NSPR_API(void) _MD_FREE_LOCK(struct _MDLock *lockp); - -#define _MD_LOCK(_lockp) _PR_LOCK((_lockp)->lock) -#define _MD_UNLOCK(_lockp) _PR_UNLOCK((_lockp)->lock) -#define _MD_TEST_AND_LOCK(_lockp) (uscsetlock((_lockp)->lock, 1) == 0) - -extern ulock_t _pr_heapLock; - -struct _MDThread { - jmp_buf jb; - usptr_t *pollsem_arena; - usema_t *cvar_pollsem; - PRInt32 cvar_pollsemfd; - PRInt32 cvar_pollsem_select; /* acquire sem by calling select */ - PRInt32 cvar_wait; /* if 1, thread is waiting on cvar Q */ - PRInt32 id; - PRInt32 suspending_id; - int errcode; -}; - -struct _MDThreadStack { - PRInt8 notused; -}; - -struct _MDSemaphore { - usema_t *sem; -}; - -struct _MDCVar { - ulock_t mdcvar_lock; -}; - -struct _MDSegment { - PRInt8 notused; -}; - -/* - * md-specific cpu structure field - */ -#define _PR_MD_MAX_OSFD FD_SETSIZE - -struct _MDCPU_Unix { - PRCList ioQ; - PRUint32 ioq_timeout; - PRInt32 ioq_max_osfd; - PRInt32 ioq_osfd_cnt; -#ifndef _PR_USE_POLL - fd_set fd_read_set, fd_write_set, fd_exception_set; - PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD], - fd_exception_cnt[_PR_MD_MAX_OSFD]; -#else - struct pollfd *ioq_pollfds; - int ioq_pollfds_size; -#endif /* _PR_USE_POLL */ -}; - -#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ) -#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu)) -#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set) -#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt) -#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set) -#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt) -#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set) -#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt) -#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout) -#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd) -#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt) -#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds) -#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size) - -#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32 - - -struct _MDCPU { - PRInt32 id; - PRInt32 suspending_id; - struct _MDCPU_Unix md_unix; -}; - -/* -** Initialize the thread context preparing it to execute _main. -*/ -#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \ - PR_BEGIN_MACRO \ - int *jb = (_thread)->md.jb; \ - *status = PR_TRUE; \ - (void) setjmp(jb); \ - (_thread)->md.jb[JB_SP] = (int) ((_sp) - 64); \ - (_thread)->md.jb[JB_PC] = (int) _main; \ - _thread->no_sched = 0; \ - PR_END_MACRO - -/* -** Switch away from the current thread context by saving its state and -** calling the thread scheduler. Reload cpu when we come back from the -** context switch because it might have changed. -* -* XXX RUNQ lock needed before clearing _PR_NO_SCHED flag, because the -* thread may be unr RUNQ? -*/ -#define _MD_SWITCH_CONTEXT(_thread) \ - PR_BEGIN_MACRO \ - PR_ASSERT(_thread->no_sched); \ - if (!setjmp(_thread->md.jb)) { \ - _MD_SAVE_ERRNO(_thread) \ - _MD_SET_LAST_THREAD(_thread); \ - _PR_Schedule(); \ - } else { \ - PR_ASSERT(_MD_LAST_THREAD() !=_MD_CURRENT_THREAD()); \ - _MD_LAST_THREAD()->no_sched = 0; \ - } \ - PR_END_MACRO - -/* -** Restore a thread context that was saved by _MD_SWITCH_CONTEXT or -** initialized by _MD_INIT_CONTEXT. -*/ -#define _MD_RESTORE_CONTEXT(_newThread) \ - PR_BEGIN_MACRO \ - int *jb = (_newThread)->md.jb; \ - _MD_RESTORE_ERRNO(_newThread) \ - _MD_SET_CURRENT_THREAD(_newThread); \ - _newThread->no_sched = 1; \ - longjmp(jb, 1); \ - PR_END_MACRO - -NSPR_API(PRStatus) _MD_InitThread(struct PRThread *thread, - PRBool wakeup_parent); -NSPR_API(PRStatus) _MD_InitAttachedThread(struct PRThread *thread, - PRBool wakeup_parent); -#define _MD_INIT_THREAD(thread) _MD_InitThread(thread, PR_TRUE) -#define _MD_INIT_ATTACHED_THREAD(thread) \ - _MD_InitAttachedThread(thread, PR_FALSE) - -NSPR_API(void) _MD_ExitThread(struct PRThread *thread); -#define _MD_EXIT_THREAD _MD_ExitThread - -NSPR_API(void) _MD_SuspendThread(struct PRThread *thread); -#define _MD_SUSPEND_THREAD _MD_SuspendThread - -NSPR_API(void) _MD_ResumeThread(struct PRThread *thread); -#define _MD_RESUME_THREAD _MD_ResumeThread - -NSPR_API(void) _MD_SuspendCPU(struct _PRCPU *thread); -#define _MD_SUSPEND_CPU _MD_SuspendCPU - -NSPR_API(void) _MD_ResumeCPU(struct _PRCPU *thread); -#define _MD_RESUME_CPU _MD_ResumeCPU - -#define _MD_BEGIN_SUSPEND_ALL() -#define _MD_END_SUSPEND_ALL() -#define _MD_BEGIN_RESUME_ALL() -#define _MD_END_RESUME_ALL() - -NSPR_API(void) _MD_InitLocks(void); -#define _MD_INIT_LOCKS _MD_InitLocks - -NSPR_API(void) _MD_CleanThread(struct PRThread *thread); -#define _MD_CLEAN_THREAD _MD_CleanThread - -#define _MD_YIELD() sginap(0) - -/* The _PR_MD_WAIT_LOCK and _PR_MD_WAKEUP_WAITER functions put to sleep and - * awaken a thread which is waiting on a lock or cvar. - */ -NSPR_API(PRStatus) _MD_wait(struct PRThread *, PRIntervalTime timeout); -#define _MD_WAIT _MD_wait - -NSPR_API(void) _PR_MD_primordial_cpu(); -NSPR_API(void) _PR_MD_WAKEUP_PRIMORDIAL_CPU(); - -NSPR_API(PRStatus) _MD_WakeupWaiter(struct PRThread *); -#define _MD_WAKEUP_WAITER _MD_WakeupWaiter - -NSPR_API(void ) _MD_exit(PRIntn status); -#define _MD_EXIT _MD_exit - -#include "prthread.h" - -NSPR_API(void) _MD_SetPriority(struct _MDThread *thread, - PRThreadPriority newPri); -#define _MD_SET_PRIORITY _MD_SetPriority - -NSPR_API(PRStatus) _MD_CreateThread( - struct PRThread *thread, - void (*start) (void *), - PRThreadPriority priority, - PRThreadScope scope, - PRThreadState state, - PRUint32 stackSize); -#define _MD_CREATE_THREAD _MD_CreateThread - -extern void _MD_CleanupBeforeExit(void); -#define _MD_CLEANUP_BEFORE_EXIT _MD_CleanupBeforeExit - -NSPR_API(void) _PR_MD_PRE_CLEANUP(PRThread *me); - - -/* The following defines the unwrapped versions of select() and poll(). */ -extern int _select(int nfds, fd_set *readfds, fd_set *writefds, - fd_set *exceptfds, struct timeval *timeout); -#define _MD_SELECT _select - -#include <stropts.h> -#include <poll.h> -#define _MD_POLL _poll -extern int _poll(struct pollfd *fds, unsigned long nfds, int timeout); - - -#define HAVE_THREAD_AFFINITY 1 - -NSPR_API(PRInt32) _MD_GetThreadAffinityMask(PRThread *unused, PRUint32 *mask); -#define _MD_GETTHREADAFFINITYMASK _MD_GetThreadAffinityMask - -NSPR_API(void) _MD_InitRunningCPU(struct _PRCPU *cpu); -#define _MD_INIT_RUNNING_CPU _MD_InitRunningCPU - -#endif /* defined(_PR_PTHREADS) */ - -#endif /* _LANGUAGE_ASSEMBLY */ - -#endif /* nspr_irix_defs_h___ */ diff --git a/pr/include/md/_irix32.cfg b/pr/include/md/_irix32.cfg deleted file mode 100644 index 3a5005c2..00000000 --- a/pr/include/md/_irix32.cfg +++ /dev/null @@ -1,119 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef nspr_cpucfg___ -#define nspr_cpucfg___ - -#ifndef _SGI_MP_SOURCE -#define _SGI_MP_SOURCE -#endif - -#ifndef XP_UNIX -#define XP_UNIX -#endif - -#ifndef IRIX -#define IRIX -#endif - -#undef IS_LITTLE_ENDIAN -#define IS_BIG_ENDIAN 1 - -#define PR_AF_INET6 24 /* same as AF_INET6 */ - -#define PR_BYTES_PER_BYTE 1 -#define PR_BYTES_PER_SHORT 2 -#define PR_BYTES_PER_INT 4 -#define PR_BYTES_PER_INT64 8 -#define PR_BYTES_PER_LONG 4 -#define PR_BYTES_PER_FLOAT 4 -#define PR_BYTES_PER_DOUBLE 8 -#define PR_BYTES_PER_WORD 4 -#define PR_BYTES_PER_DWORD 8 - -#define PR_BITS_PER_BYTE 8 -#define PR_BITS_PER_SHORT 16 -#define PR_BITS_PER_INT 32 -#define PR_BITS_PER_INT64 64 -#define PR_BITS_PER_LONG 32 -#define PR_BITS_PER_FLOAT 32 -#define PR_BITS_PER_DOUBLE 64 -#define PR_BITS_PER_WORD 32 - -#define PR_BITS_PER_BYTE_LOG2 3 -#define PR_BITS_PER_SHORT_LOG2 4 -#define PR_BITS_PER_INT_LOG2 5 -#define PR_BITS_PER_INT64_LOG2 6 -#define PR_BITS_PER_LONG_LOG2 5 -#define PR_BITS_PER_FLOAT_LOG2 5 -#define PR_BITS_PER_DOUBLE_LOG2 6 -#define PR_BITS_PER_WORD_LOG2 5 - -#define PR_BYTES_PER_WORD_LOG2 2 -#define PR_BYTES_PER_DWORD_LOG2 3 - -#define PR_ALIGN_OF_SHORT 2 -#define PR_ALIGN_OF_INT 4 -#define PR_ALIGN_OF_LONG 4 -#define PR_ALIGN_OF_INT64 8 -#define PR_ALIGN_OF_FLOAT 4 -#define PR_ALIGN_OF_DOUBLE 8 -#define PR_ALIGN_OF_POINTER 4 -#define PR_ALIGN_OF_WORD 4 - -#ifndef HAVE_LONG_LONG -#define HAVE_LONG_LONG -#endif -#define HAVE_ALIGNED_DOUBLES -#define HAVE_ALIGNED_LONGLONGS - -#define _PR_POLL_BACKCOMPAT - -#ifndef NO_NSPR_10_SUPPORT - -#define BYTES_PER_BYTE PR_BYTES_PER_BYTE -#define BYTES_PER_SHORT PR_BYTES_PER_SHORT -#define BYTES_PER_INT PR_BYTES_PER_INT -#define BYTES_PER_INT64 PR_BYTES_PER_INT64 -#define BYTES_PER_LONG PR_BYTES_PER_LONG -#define BYTES_PER_FLOAT PR_BYTES_PER_FLOAT -#define BYTES_PER_DOUBLE PR_BYTES_PER_DOUBLE -#define BYTES_PER_WORD PR_BYTES_PER_WORD -#define BYTES_PER_DWORD PR_BYTES_PER_DWORD - -#define BITS_PER_BYTE PR_BITS_PER_BYTE -#define BITS_PER_SHORT PR_BITS_PER_SHORT -#define BITS_PER_INT PR_BITS_PER_INT -#define BITS_PER_INT64 PR_BITS_PER_INT64 -#define BITS_PER_LONG PR_BITS_PER_LONG -#define BITS_PER_FLOAT PR_BITS_PER_FLOAT -#define BITS_PER_DOUBLE PR_BITS_PER_DOUBLE -#define BITS_PER_WORD PR_BITS_PER_WORD - -#define BITS_PER_BYTE_LOG2 PR_BITS_PER_BYTE_LOG2 -#define BITS_PER_SHORT_LOG2 PR_BITS_PER_SHORT_LOG2 -#define BITS_PER_INT_LOG2 PR_BITS_PER_INT_LOG2 -#define BITS_PER_INT64_LOG2 PR_BITS_PER_INT64_LOG2 -#define BITS_PER_LONG_LOG2 PR_BITS_PER_LONG_LOG2 -#define BITS_PER_FLOAT_LOG2 PR_BITS_PER_FLOAT_LOG2 -#define BITS_PER_DOUBLE_LOG2 PR_BITS_PER_DOUBLE_LOG2 -#define BITS_PER_WORD_LOG2 PR_BITS_PER_WORD_LOG2 - -#define ALIGN_OF_SHORT PR_ALIGN_OF_SHORT -#define ALIGN_OF_INT PR_ALIGN_OF_INT -#define ALIGN_OF_LONG PR_ALIGN_OF_LONG -#define ALIGN_OF_INT64 PR_ALIGN_OF_INT64 -#define ALIGN_OF_FLOAT PR_ALIGN_OF_FLOAT -#define ALIGN_OF_DOUBLE PR_ALIGN_OF_DOUBLE -#define ALIGN_OF_POINTER PR_ALIGN_OF_POINTER -#define ALIGN_OF_WORD PR_ALIGN_OF_WORD - -#define BYTES_PER_WORD_LOG2 PR_BYTES_PER_WORD_LOG2 -#define BYTES_PER_DWORD_LOG2 PR_BYTES_PER_DWORD_LOG2 -#define WORDS_PER_DWORD_LOG2 PR_WORDS_PER_DWORD_LOG2 - -#endif /* NO_NSPR_10_SUPPORT */ - -#endif /* nspr_cpucfg___ */ diff --git a/pr/include/md/_irix64.cfg b/pr/include/md/_irix64.cfg deleted file mode 100644 index e6f29e3a..00000000 --- a/pr/include/md/_irix64.cfg +++ /dev/null @@ -1,118 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef nspr_cpucfg___ -#define nspr_cpucfg___ - -#ifndef _SGI_MP_SOURCE -#define _SGI_MP_SOURCE -#endif - -#ifndef XP_UNIX -#define XP_UNIX -#endif - -#ifndef IRIX -#define IRIX -#endif - -#undef IS_LITTLE_ENDIAN -#define IS_BIG_ENDIAN 1 -#define IS_64 - -#define PR_AF_INET6 24 /* same as AF_INET6 */ - -#define PR_BYTES_PER_BYTE 1 -#define PR_BYTES_PER_SHORT 2 -#define PR_BYTES_PER_INT 4 -#define PR_BYTES_PER_INT64 8 -#define PR_BYTES_PER_LONG 8 -#define PR_BYTES_PER_FLOAT 4 -#define PR_BYTES_PER_DOUBLE 8 -#define PR_BYTES_PER_WORD 8 -#define PR_BYTES_PER_DWORD 8 - -#define PR_BITS_PER_BYTE 8 -#define PR_BITS_PER_SHORT 16 -#define PR_BITS_PER_INT 32 -#define PR_BITS_PER_INT64 64 -#define PR_BITS_PER_LONG 64 -#define PR_BITS_PER_FLOAT 32 -#define PR_BITS_PER_DOUBLE 64 -#define PR_BITS_PER_WORD 64 - -#define PR_BITS_PER_BYTE_LOG2 3 -#define PR_BITS_PER_SHORT_LOG2 4 -#define PR_BITS_PER_INT_LOG2 5 -#define PR_BITS_PER_INT64_LOG2 6 -#define PR_BITS_PER_LONG_LOG2 6 -#define PR_BITS_PER_FLOAT_LOG2 5 -#define PR_BITS_PER_DOUBLE_LOG2 6 -#define PR_BITS_PER_WORD_LOG2 6 - -#define PR_BYTES_PER_WORD_LOG2 3 -#define PR_BYTES_PER_DWORD_LOG2 3 - -#define PR_ALIGN_OF_SHORT 2 -#define PR_ALIGN_OF_INT 4 -#define PR_ALIGN_OF_LONG 4 -#define PR_ALIGN_OF_INT64 8 -#define PR_ALIGN_OF_FLOAT 4 -#define PR_ALIGN_OF_DOUBLE 8 -#define PR_ALIGN_OF_POINTER 4 -#define PR_ALIGN_OF_WORD 4 - -#ifndef HAVE_LONG_LONG -#define HAVE_LONG_LONG -#endif -#define HAVE_ALIGNED_DOUBLES -#define HAVE_ALIGNED_LONGLONGS - -#ifndef NO_NSPR_10_SUPPORT - -#define BYTES_PER_BYTE PR_BYTES_PER_BYTE -#define BYTES_PER_SHORT PR_BYTES_PER_SHORT -#define BYTES_PER_INT PR_BYTES_PER_INT -#define BYTES_PER_INT64 PR_BYTES_PER_INT64 -#define BYTES_PER_LONG PR_BYTES_PER_LONG -#define BYTES_PER_FLOAT PR_BYTES_PER_FLOAT -#define BYTES_PER_DOUBLE PR_BYTES_PER_DOUBLE -#define BYTES_PER_WORD PR_BYTES_PER_WORD -#define BYTES_PER_DWORD PR_BYTES_PER_DWORD - -#define BITS_PER_BYTE PR_BITS_PER_BYTE -#define BITS_PER_SHORT PR_BITS_PER_SHORT -#define BITS_PER_INT PR_BITS_PER_INT -#define BITS_PER_INT64 PR_BITS_PER_INT64 -#define BITS_PER_LONG PR_BITS_PER_LONG -#define BITS_PER_FLOAT PR_BITS_PER_FLOAT -#define BITS_PER_DOUBLE PR_BITS_PER_DOUBLE -#define BITS_PER_WORD PR_BITS_PER_WORD - -#define BITS_PER_BYTE_LOG2 PR_BITS_PER_BYTE_LOG2 -#define BITS_PER_SHORT_LOG2 PR_BITS_PER_SHORT_LOG2 -#define BITS_PER_INT_LOG2 PR_BITS_PER_INT_LOG2 -#define BITS_PER_INT64_LOG2 PR_BITS_PER_INT64_LOG2 -#define BITS_PER_LONG_LOG2 PR_BITS_PER_LONG_LOG2 -#define BITS_PER_FLOAT_LOG2 PR_BITS_PER_FLOAT_LOG2 -#define BITS_PER_DOUBLE_LOG2 PR_BITS_PER_DOUBLE_LOG2 -#define BITS_PER_WORD_LOG2 PR_BITS_PER_WORD_LOG2 - -#define ALIGN_OF_SHORT PR_ALIGN_OF_SHORT -#define ALIGN_OF_INT PR_ALIGN_OF_INT -#define ALIGN_OF_LONG PR_ALIGN_OF_LONG -#define ALIGN_OF_INT64 PR_ALIGN_OF_INT64 -#define ALIGN_OF_FLOAT PR_ALIGN_OF_FLOAT -#define ALIGN_OF_DOUBLE PR_ALIGN_OF_DOUBLE -#define ALIGN_OF_POINTER PR_ALIGN_OF_POINTER -#define ALIGN_OF_WORD PR_ALIGN_OF_WORD - -#define BYTES_PER_WORD_LOG2 PR_BYTES_PER_WORD_LOG2 -#define BYTES_PER_DWORD_LOG2 PR_BYTES_PER_DWORD_LOG2 -#define WORDS_PER_DWORD_LOG2 PR_WORDS_PER_DWORD_LOG2 - -#endif /* NO_NSPR_10_SUPPORT */ - -#endif /* nspr_cpucfg___ */ diff --git a/pr/include/md/_pth.h b/pr/include/md/_pth.h index bbe9e385..4890966f 100644 --- a/pr/include/md/_pth.h +++ b/pr/include/md/_pth.h @@ -84,7 +84,7 @@ * PR_EnterMonitor calls any of these functions, infinite * recursion ensues. */ -#if defined(IRIX) || defined(AIX) || defined(SOLARIS) \ +#if defined(AIX) || defined(SOLARIS) \ || defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) \ || defined(HPUX) || defined(FREEBSD) \ || defined(NETBSD) || defined(OPENBSD) || defined(BSDI) \ @@ -120,11 +120,7 @@ #define PT_NO_SIGTIMEDWAIT #endif -#if defined(IRIX) -#include <sys/sched.h> -#define PT_PRIO_MIN PX_PRIO_MIN -#define PT_PRIO_MAX PX_PRIO_MAX -#elif defined(AIX) +#if defined(AIX) #include <sys/priv.h> #include <sys/sched.h> #ifndef PTHREAD_CREATE_JOINABLE @@ -177,14 +173,6 @@ #if defined(AIX) extern int (*_PT_aix_yield_fcn)(); #define _PT_PTHREAD_YIELD() (*_PT_aix_yield_fcn)() -#elif defined(IRIX) -#include <time.h> -#define _PT_PTHREAD_YIELD() \ - PR_BEGIN_MACRO \ - struct timespec onemillisec = {0}; \ - onemillisec.tv_nsec = 1000000L; \ - nanosleep(&onemillisec,NULL); \ - PR_END_MACRO #elif defined(HPUX) || defined(SOLARIS) \ || defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) \ || defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD) \ diff --git a/pr/include/md/_unixos.h b/pr/include/md/_unixos.h index ea46b3a4..96b81859 100644 --- a/pr/include/md/_unixos.h +++ b/pr/include/md/_unixos.h @@ -261,9 +261,7 @@ extern void _MD_Wakeup_CPUs(void); #define _MD_CLEANUP_BEFORE_EXIT() #endif -#ifndef IRIX #define _MD_EXIT(status) _exit(status) -#endif /************************************************************************/ diff --git a/pr/include/md/prosdep.h b/pr/include/md/prosdep.h index 891eb13a..b47e101e 100644 --- a/pr/include/md/prosdep.h +++ b/pr/include/md/prosdep.h @@ -49,9 +49,6 @@ PR_BEGIN_EXTERN_C #elif defined(HPUX) #include "md/_hpux.h" -#elif defined(IRIX) -#include "md/_irix.h" - #elif defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) #include "md/_linux.h" diff --git a/pr/include/private/pprthred.h b/pr/include/private/pprthred.h index eb60baed..3e034b87 100644 --- a/pr/include/private/pprthred.h +++ b/pr/include/private/pprthred.h @@ -283,26 +283,6 @@ NSPR_API(PRMonitor*) PR_CTestAndEnterMonitor(void *address); /*--------------------------------------------------------------------------- ** PLATFORM-SPECIFIC INITIALIZATION FUNCTIONS ---------------------------------------------------------------------------*/ -#if defined(IRIX) -/* -** Irix specific initialization funtion to be called before PR_Init -** is called by the application. Sets the CONF_INITUSERS and CONF_INITSIZE -** attributes of the shared arena set up by nspr. -** -** The environment variables _NSPR_IRIX_INITUSERS and _NSPR_IRIX_INITSIZE -** can also be used to set these arena attributes. If _NSPR_IRIX_INITUSERS -** is set, but not _NSPR_IRIX_INITSIZE, the value of the CONF_INITSIZE -** attribute of the nspr arena is scaled as a function of the -** _NSPR_IRIX_INITUSERS value. -** -** If the _PR_Irix_Set_Arena_Params() is called in addition to setting the -** environment variables, the values of the environment variables are used. -** -*/ -NSPR_API(void) _PR_Irix_Set_Arena_Params(PRInt32 initusers, PRInt32 initsize); - -#endif /* IRIX */ - #if defined(XP_OS2) /* ** These functions need to be called at the start and end of a thread. diff --git a/pr/include/private/primpl.h b/pr/include/private/primpl.h index a817c206..90acdff5 100644 --- a/pr/include/private/primpl.h +++ b/pr/include/private/primpl.h @@ -274,7 +274,7 @@ typedef struct _PRInterruptTable { #define _PR_CPU_PTR(_qp) \ ((_PRCPU*) ((char*) (_qp) - offsetof(_PRCPU,links))) -#if !defined(IRIX) && !defined(WIN32) && !defined(XP_OS2) \ +#if !defined(WIN32) && !defined(XP_OS2) \ && !(defined(SOLARIS) && defined(_PR_GLOBAL_THREADS_ONLY)) #define _MD_GET_ATTACHED_THREAD() (_PR_MD_CURRENT_THREAD()) #endif @@ -948,10 +948,6 @@ extern void _PR_MD_BEGIN_RESUME_ALL(void); extern void _PR_MD_END_RESUME_ALL(void); #define _PR_MD_END_RESUME_ALL _MD_END_RESUME_ALL -#if defined(IRIX) -NSPR_API(void) _PR_IRIX_CHILD_PROCESS(void); -#endif /* IRIX */ - #endif /* !_PR_LOCAL_THREADS_ONLY */ extern void _PR_MD_CLEAN_THREAD(PRThread *thread); diff --git a/pr/src/Makefile.in b/pr/src/Makefile.in index f647769b..2258dae6 100644 --- a/pr/src/Makefile.in +++ b/pr/src/Makefile.in @@ -66,13 +66,6 @@ endif endif # sparc endif # SunOS -ifeq ($(OS_ARCH), IRIX) -ifeq ($(USE_PTHREADS), 1) -OS_LIBS = -lpthread -endif -OS_LIBS += -lc -endif - ifeq ($(OS_ARCH),AIX) DSO_LDOPTS += -binitfini::_PR_Fini OS_LIBS = -lodm -lcfg diff --git a/pr/src/cplus/tests/Makefile.in b/pr/src/cplus/tests/Makefile.in index 8be1453f..df482765 100644 --- a/pr/src/cplus/tests/Makefile.in +++ b/pr/src/cplus/tests/Makefile.in @@ -49,24 +49,6 @@ LDOPTS = -L$(dist_libdir) LIBPR = -lnspr$(MOD_MAJOR_VERSION) LIBPL = -lplc$(MOD_MAJOR_VERSION) -ifeq ($(OS_ARCH), IRIX) - LDOPTS += -rpath $(PWD)/$(dist_libdir) -rdata_shared - # For 6.x machines, include this flag - ifeq ($(basename $(OS_RELEASE)),6) - ifeq ($(USE_N32),1) - LDOPTS += -n32 - else - LDOPTS += -32 - endif - - ifeq ($(USE_PTHREADS), 1) - ifeq ($(OS_RELEASE), 6.2) - LDOPTS += -Wl,-woff,85 - endif - endif - endif -endif - # Solaris ifeq ($(OS_ARCH), SunOS) ifdef NS_USE_GCC diff --git a/pr/src/io/prscanf.c b/pr/src/io/prscanf.c index 5618f878..4a200698 100644 --- a/pr/src/io/prscanf.c +++ b/pr/src/io/prscanf.c @@ -365,11 +365,7 @@ GetFloat(ScanfState *state) if (state->sizeSpec == _PR_size_l) { *va_arg(state->ap, PRFloat64 *) = dval; } else if (state->sizeSpec == _PR_size_L) { -#if defined(IRIX) - *va_arg(state->ap, double *) = dval; -#else *va_arg(state->ap, long double *) = dval; -#endif } else { *va_arg(state->ap, float *) = (float) dval; } diff --git a/pr/src/io/prsocket.c b/pr/src/io/prsocket.c index 26f7a245..4063bd84 100644 --- a/pr/src/io/prsocket.c +++ b/pr/src/io/prsocket.c @@ -478,7 +478,7 @@ PRIntervalTime timeout) * platforms can skip the following _PR_MD_MAKE_NONBLOCK * call. */ -#if !defined(SOLARIS) && !defined(IRIX) && !defined(WINNT) +#if !defined(SOLARIS) && !defined(WINNT) _PR_MD_MAKE_NONBLOCK(fd2); #endif diff --git a/pr/src/malloc/prmem.c b/pr/src/malloc/prmem.c index e4ae42a9..735bb395 100644 --- a/pr/src/malloc/prmem.c +++ b/pr/src/malloc/prmem.c @@ -556,26 +556,6 @@ static pthread_mutex_t _PR_MD_malloc_crustylock; #else /* _PR_PTHREADS */ static _MDLock _PR_MD_malloc_crustylock; -#ifdef IRIX -#define _PR_Lock_Malloc() { \ - PRIntn _is; \ - if(PR_TRUE == _PR_malloc_initialised) { \ - if (_PR_MD_GET_ATTACHED_THREAD() && \ - !_PR_IS_NATIVE_THREAD( \ - _PR_MD_GET_ATTACHED_THREAD())) \ - _PR_INTSOFF(_is); \ - _PR_MD_LOCK(&_PR_MD_malloc_crustylock); \ - } - -#define _PR_Unlock_Malloc() if(PR_TRUE == _PR_malloc_initialised) { \ - _PR_MD_UNLOCK(&_PR_MD_malloc_crustylock); \ - if (_PR_MD_GET_ATTACHED_THREAD() && \ - !_PR_IS_NATIVE_THREAD( \ - _PR_MD_GET_ATTACHED_THREAD())) \ - _PR_INTSON(_is); \ - } \ - } -#else /* IRIX */ #define _PR_Lock_Malloc() { \ PRIntn _is; \ if(PR_TRUE == _PR_malloc_initialised) { \ @@ -594,7 +574,6 @@ static _MDLock _PR_MD_malloc_crustylock; _PR_INTSON(_is); \ } \ } -#endif /* IRIX */ #endif /* _PR_PTHREADS */ PR_IMPLEMENT(PRStatus) _PR_MallocInit(void) @@ -636,22 +615,6 @@ void *malloc(size_t size) return p; } -#if defined(IRIX) -void *memalign(size_t alignment, size_t size) -{ - void *p; - _PR_Lock_Malloc(); - p = _PR_UnlockedMemalign(alignment, size); - _PR_Unlock_Malloc(); - return p; -} - -void *valloc(size_t size) -{ - return(memalign(sysconf(_SC_PAGESIZE),size)); -} -#endif /* IRIX */ - void free(void *ptr) { _PR_Lock_Malloc(); diff --git a/pr/src/md/unix/irix.c b/pr/src/md/unix/irix.c deleted file mode 100644 index c57a07b3..00000000 --- a/pr/src/md/unix/irix.c +++ /dev/null @@ -1,1648 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "primpl.h" - -#include <signal.h> - -#include <sys/types.h> -#include <fcntl.h> -#include <unistd.h> -#include <string.h> -#include <sys/mman.h> -#include <sys/syssgi.h> -#include <sys/time.h> -#include <sys/immu.h> -#include <sys/utsname.h> -#include <sys/sysmp.h> -#include <sys/pda.h> -#include <sys/prctl.h> -#include <sys/wait.h> -#include <sys/resource.h> -#include <sys/procfs.h> -#include <task.h> -#include <dlfcn.h> - -static void _MD_IrixIntervalInit(void); - -#if defined(_PR_PTHREADS) -/* - * for compatibility with classic nspr - */ -void _PR_IRIX_CHILD_PROCESS() -{ -} -#else /* defined(_PR_PTHREADS) */ - -static void irix_detach_sproc(void); -char *_nspr_sproc_private; /* ptr. to private region in every sproc */ - -extern PRUintn _pr_numCPU; - -typedef struct nspr_arena { - PRCList links; - usptr_t *usarena; -} nspr_arena; - -#define ARENA_PTR(qp) \ - ((nspr_arena *) ((char*) (qp) - offsetof(nspr_arena , links))) - -static usptr_t *alloc_new_arena(void); - -PRCList arena_list = PR_INIT_STATIC_CLIST(&arena_list); -ulock_t arena_list_lock; -nspr_arena first_arena; -int _nspr_irix_arena_cnt = 1; - -PRCList sproc_list = PR_INIT_STATIC_CLIST(&sproc_list); -ulock_t sproc_list_lock; - -typedef struct sproc_data { - void (*entry) (void *, size_t); - unsigned inh; - void *arg; - caddr_t sp; - size_t len; - int *pid; - int creator_pid; -} sproc_data; - -typedef struct sproc_params { - PRCList links; - sproc_data sd; -} sproc_params; - -#define SPROC_PARAMS_PTR(qp) \ - ((sproc_params *) ((char*) (qp) - offsetof(sproc_params , links))) - -long _nspr_irix_lock_cnt = 0; -long _nspr_irix_sem_cnt = 0; -long _nspr_irix_pollsem_cnt = 0; - -usptr_t *_pr_usArena; -ulock_t _pr_heapLock; - -usema_t *_pr_irix_exit_sem; -PRInt32 _pr_irix_exit_now = 0; -PRInt32 _pr_irix_process_exit_code = 0; /* exit code for PR_ProcessExit */ -PRInt32 _pr_irix_process_exit = 0; /* process exiting due to call to - PR_ProcessExit */ - -int _pr_irix_primoridal_cpu_fd[2] = { -1, -1 }; -static void (*libc_exit)(int) = NULL; -static void *libc_handle = NULL; - -#define _NSPR_DEF_INITUSERS 100 /* default value of CONF_INITUSERS */ -#define _NSPR_DEF_INITSIZE (4 * 1024 * 1024) /* 4 MB */ - -int _irix_initusers = _NSPR_DEF_INITUSERS; -int _irix_initsize = _NSPR_DEF_INITSIZE; - -PRIntn _pr_io_in_progress, _pr_clock_in_progress; - -PRInt32 _pr_md_irix_sprocs_created, _pr_md_irix_sprocs_failed; -PRInt32 _pr_md_irix_sprocs = 1; -PRCList _pr_md_irix_sproc_list = -PR_INIT_STATIC_CLIST(&_pr_md_irix_sproc_list); - -sigset_t ints_off; -extern sigset_t timer_set; - -#if !defined(PR_SETABORTSIG) -#define PR_SETABORTSIG 18 -#endif -/* - * terminate the entire application if any sproc exits abnormally - */ -PRBool _nspr_terminate_on_error = PR_TRUE; - -/* - * exported interface to set the shared arena parameters - */ -void _PR_Irix_Set_Arena_Params(PRInt32 initusers, PRInt32 initsize) -{ - _irix_initusers = initusers; - _irix_initsize = initsize; -} - -static usptr_t *alloc_new_arena() -{ - return(usinit("/dev/zero")); -} - -static PRStatus new_poll_sem(struct _MDThread *mdthr, int val) -{ -PRIntn _is; -PRStatus rv = PR_SUCCESS; -usema_t *sem = NULL; -PRCList *qp; -nspr_arena *arena; -usptr_t *irix_arena; -PRThread *me = _MD_GET_ATTACHED_THREAD(); - - if (me && !_PR_IS_NATIVE_THREAD(me)) - _PR_INTSOFF(_is); - _PR_LOCK(arena_list_lock); - for (qp = arena_list.next; qp != &arena_list; qp = qp->next) { - arena = ARENA_PTR(qp); - sem = usnewpollsema(arena->usarena, val); - if (sem != NULL) { - mdthr->cvar_pollsem = sem; - mdthr->pollsem_arena = arena->usarena; - break; - } - } - if (sem == NULL) { - /* - * If no space left in the arena allocate a new one. - */ - if (errno == ENOMEM) { - arena = PR_NEWZAP(nspr_arena); - if (arena != NULL) { - irix_arena = alloc_new_arena(); - if (irix_arena) { - PR_APPEND_LINK(&arena->links, &arena_list); - _nspr_irix_arena_cnt++; - arena->usarena = irix_arena; - sem = usnewpollsema(arena->usarena, val); - if (sem != NULL) { - mdthr->cvar_pollsem = sem; - mdthr->pollsem_arena = arena->usarena; - } else - rv = PR_FAILURE; - } else { - PR_DELETE(arena); - rv = PR_FAILURE; - } - - } else - rv = PR_FAILURE; - } else - rv = PR_FAILURE; - } - _PR_UNLOCK(arena_list_lock); - if (me && !_PR_IS_NATIVE_THREAD(me)) - _PR_FAST_INTSON(_is); - if (rv == PR_SUCCESS) - _MD_ATOMIC_INCREMENT(&_nspr_irix_pollsem_cnt); - return rv; -} - -static void free_poll_sem(struct _MDThread *mdthr) -{ -PRIntn _is; -PRThread *me = _MD_GET_ATTACHED_THREAD(); - - if (me && !_PR_IS_NATIVE_THREAD(me)) - _PR_INTSOFF(_is); - usfreepollsema(mdthr->cvar_pollsem, mdthr->pollsem_arena); - if (me && !_PR_IS_NATIVE_THREAD(me)) - _PR_FAST_INTSON(_is); - _MD_ATOMIC_DECREMENT(&_nspr_irix_pollsem_cnt); -} - -static PRStatus new_lock(struct _MDLock *lockp) -{ -PRIntn _is; -PRStatus rv = PR_SUCCESS; -ulock_t lock = NULL; -PRCList *qp; -nspr_arena *arena; -usptr_t *irix_arena; -PRThread *me = _MD_GET_ATTACHED_THREAD(); - - if (me && !_PR_IS_NATIVE_THREAD(me)) - _PR_INTSOFF(_is); - _PR_LOCK(arena_list_lock); - for (qp = arena_list.next; qp != &arena_list; qp = qp->next) { - arena = ARENA_PTR(qp); - lock = usnewlock(arena->usarena); - if (lock != NULL) { - lockp->lock = lock; - lockp->arena = arena->usarena; - break; - } - } - if (lock == NULL) { - /* - * If no space left in the arena allocate a new one. - */ - if (errno == ENOMEM) { - arena = PR_NEWZAP(nspr_arena); - if (arena != NULL) { - irix_arena = alloc_new_arena(); - if (irix_arena) { - PR_APPEND_LINK(&arena->links, &arena_list); - _nspr_irix_arena_cnt++; - arena->usarena = irix_arena; - lock = usnewlock(irix_arena); - if (lock != NULL) { - lockp->lock = lock; - lockp->arena = arena->usarena; - } else - rv = PR_FAILURE; - } else { - PR_DELETE(arena); - rv = PR_FAILURE; - } - - } else - rv = PR_FAILURE; - } else - rv = PR_FAILURE; - } - _PR_UNLOCK(arena_list_lock); - if (me && !_PR_IS_NATIVE_THREAD(me)) - _PR_FAST_INTSON(_is); - if (rv == PR_SUCCESS) - _MD_ATOMIC_INCREMENT(&_nspr_irix_lock_cnt); - return rv; -} - -static void free_lock(struct _MDLock *lockp) -{ -PRIntn _is; -PRThread *me = _MD_GET_ATTACHED_THREAD(); - - if (me && !_PR_IS_NATIVE_THREAD(me)) - _PR_INTSOFF(_is); - usfreelock(lockp->lock, lockp->arena); - if (me && !_PR_IS_NATIVE_THREAD(me)) - _PR_FAST_INTSON(_is); - _MD_ATOMIC_DECREMENT(&_nspr_irix_lock_cnt); -} - -void _MD_FREE_LOCK(struct _MDLock *lockp) -{ - PRIntn _is; - PRThread *me = _MD_GET_ATTACHED_THREAD(); - - if (me && !_PR_IS_NATIVE_THREAD(me)) - _PR_INTSOFF(_is); - free_lock(lockp); - if (me && !_PR_IS_NATIVE_THREAD(me)) - _PR_FAST_INTSON(_is); -} - -/* - * _MD_get_attached_thread - * Return the thread pointer of the current thread if it is attached. - * - * This function is needed for Irix because the thread-local-storage is - * implemented by mmapin'g a page with the MAP_LOCAL flag. This causes the - * sproc-private page to inherit contents of the page of the caller of sproc(). - */ -PRThread *_MD_get_attached_thread(void) -{ - - if (_MD_GET_SPROC_PID() == get_pid()) - return _MD_THIS_THREAD(); - else - return 0; -} - -/* - * _MD_get_current_thread - * Return the thread pointer of the current thread (attaching it if - * necessary) - */ -PRThread *_MD_get_current_thread(void) -{ -PRThread *me; - - me = _MD_GET_ATTACHED_THREAD(); - if (NULL == me) { - me = _PRI_AttachThread( - PR_USER_THREAD, PR_PRIORITY_NORMAL, NULL, 0); - } - PR_ASSERT(me != NULL); - return(me); -} - -/* - * irix_detach_sproc - * auto-detach a sproc when it exits - */ -void irix_detach_sproc(void) -{ -PRThread *me; - - me = _MD_GET_ATTACHED_THREAD(); - if ((me != NULL) && (me->flags & _PR_ATTACHED)) { - _PRI_DetachThread(); - } -} - - -PRStatus _MD_NEW_LOCK(struct _MDLock *lockp) -{ - PRStatus rv; - PRIntn is; - PRThread *me = _MD_GET_ATTACHED_THREAD(); - - if (me && !_PR_IS_NATIVE_THREAD(me)) - _PR_INTSOFF(is); - rv = new_lock(lockp); - if (me && !_PR_IS_NATIVE_THREAD(me)) - _PR_FAST_INTSON(is); - return rv; -} - -static void -sigchld_handler(int sig) -{ - pid_t pid; - int status; - - /* - * If an sproc exited abnormally send a SIGKILL signal to all the - * sprocs in the process to terminate the application - */ - while ((pid = waitpid(0, &status, WNOHANG)) > 0) { - if (WIFSIGNALED(status) && ((WTERMSIG(status) == SIGSEGV) || - (WTERMSIG(status) == SIGBUS) || - (WTERMSIG(status) == SIGABRT) || - (WTERMSIG(status) == SIGILL))) { - - prctl(PR_SETEXITSIG, SIGKILL); - _exit(status); - } - } -} - -static void save_context_and_block(int sig) -{ -PRThread *me = _PR_MD_CURRENT_THREAD(); -_PRCPU *cpu = _PR_MD_CURRENT_CPU(); - - /* - * save context - */ - (void) setjmp(me->md.jb); - /* - * unblock the suspending thread - */ - if (me->cpu) { - /* - * I am a cpu thread, not a user-created GLOBAL thread - */ - unblockproc(cpu->md.suspending_id); - } else { - unblockproc(me->md.suspending_id); - } - /* - * now, block current thread - */ - blockproc(getpid()); -} - -/* -** The irix kernel has a bug in it which causes async connect's which are -** interrupted by a signal to fail terribly (EADDRINUSE is returned). -** We work around the bug by blocking signals during the async connect -** attempt. -*/ -PRInt32 _MD_irix_connect( - PRInt32 osfd, const PRNetAddr *addr, PRInt32 addrlen, PRIntervalTime timeout) -{ - PRInt32 rv; - sigset_t oldset; - - sigprocmask(SIG_BLOCK, &ints_off, &oldset); - rv = connect(osfd, addr, addrlen); - sigprocmask(SIG_SETMASK, &oldset, 0); - - return(rv); -} - -#include "prprf.h" - -/********************************************************************/ -/********************************************************************/ -/*************** Various thread like things for IRIX ****************/ -/********************************************************************/ -/********************************************************************/ - -void *_MD_GetSP(PRThread *t) -{ - PRThread *me = _PR_MD_CURRENT_THREAD(); - void *sp; - - if (me == t) - (void) setjmp(t->md.jb); - - sp = (void *)(t->md.jb[JB_SP]); - PR_ASSERT((sp >= (void *) t->stack->stackBottom) && - (sp <= (void *) (t->stack->stackBottom + t->stack->stackSize))); - return(sp); -} - -void _MD_InitLocks() -{ - char buf[200]; - char *init_users, *init_size; - - PR_snprintf(buf, sizeof(buf), "/dev/zero"); - - if (init_users = getenv("_NSPR_IRIX_INITUSERS")) - _irix_initusers = atoi(init_users); - - if (init_size = getenv("_NSPR_IRIX_INITSIZE")) - _irix_initsize = atoi(init_size); - - usconfig(CONF_INITUSERS, _irix_initusers); - usconfig(CONF_INITSIZE, _irix_initsize); - usconfig(CONF_AUTOGROW, 1); - usconfig(CONF_AUTORESV, 1); - if (usconfig(CONF_ARENATYPE, US_SHAREDONLY) < 0) { - perror("PR_Init: unable to config mutex arena"); - exit(-1); - } - - _pr_usArena = usinit(buf); - if (!_pr_usArena) { - fprintf(stderr, - "PR_Init: Error - unable to create lock/monitor arena\n"); - exit(-1); - } - _pr_heapLock = usnewlock(_pr_usArena); - _nspr_irix_lock_cnt++; - - arena_list_lock = usnewlock(_pr_usArena); - _nspr_irix_lock_cnt++; - - sproc_list_lock = usnewlock(_pr_usArena); - _nspr_irix_lock_cnt++; - - _pr_irix_exit_sem = usnewsema(_pr_usArena, 0); - _nspr_irix_sem_cnt = 1; - - first_arena.usarena = _pr_usArena; - PR_INIT_CLIST(&first_arena.links); - PR_APPEND_LINK(&first_arena.links, &arena_list); -} - -/* _PR_IRIX_CHILD_PROCESS is a private API for Server group */ -void _PR_IRIX_CHILD_PROCESS() -{ -extern PRUint32 _pr_global_threads; - - PR_ASSERT(_PR_MD_CURRENT_CPU() == _pr_primordialCPU); - PR_ASSERT(_pr_numCPU == 1); - PR_ASSERT(_pr_global_threads == 0); - /* - * save the new pid - */ - _pr_primordialCPU->md.id = getpid(); - _MD_SET_SPROC_PID(getpid()); -} - -static PRStatus pr_cvar_wait_sem(PRThread *thread, PRIntervalTime timeout) -{ - int rv; - -#ifdef _PR_USE_POLL - struct pollfd pfd; - int msecs; - - if (timeout == PR_INTERVAL_NO_TIMEOUT) - msecs = -1; - else - msecs = PR_IntervalToMilliseconds(timeout); -#else - struct timeval tv, *tvp; - fd_set rd; - - if(timeout == PR_INTERVAL_NO_TIMEOUT) - tvp = NULL; - else { - tv.tv_sec = PR_IntervalToSeconds(timeout); - tv.tv_usec = PR_IntervalToMicroseconds( - timeout - PR_SecondsToInterval(tv.tv_sec)); - tvp = &tv; - } - FD_ZERO(&rd); - FD_SET(thread->md.cvar_pollsemfd, &rd); -#endif - - /* - * call uspsema only if a previous select call on this semaphore - * did not timeout - */ - if (!thread->md.cvar_pollsem_select) { - rv = _PR_WAIT_SEM(thread->md.cvar_pollsem); - PR_ASSERT(rv >= 0); - } else - rv = 0; -again: - if(!rv) { -#ifdef _PR_USE_POLL - pfd.events = POLLIN; - pfd.fd = thread->md.cvar_pollsemfd; - rv = _MD_POLL(&pfd, 1, msecs); -#else - rv = _MD_SELECT(thread->md.cvar_pollsemfd + 1, &rd, NULL,NULL,tvp); -#endif - if ((rv == -1) && (errno == EINTR)) { - rv = 0; - goto again; - } - PR_ASSERT(rv >= 0); - } - - if (rv > 0) { - /* - * acquired the semaphore, call uspsema next time - */ - thread->md.cvar_pollsem_select = 0; - return PR_SUCCESS; - } else { - /* - * select timed out; must call select, not uspsema, when trying - * to acquire the semaphore the next time - */ - thread->md.cvar_pollsem_select = 1; - return PR_FAILURE; - } -} - -PRStatus _MD_wait(PRThread *thread, PRIntervalTime ticks) -{ - if ( thread->flags & _PR_GLOBAL_SCOPE ) { - _MD_CHECK_FOR_EXIT(); - if (pr_cvar_wait_sem(thread, ticks) == PR_FAILURE) { - _MD_CHECK_FOR_EXIT(); - /* - * wait timed out - */ - _PR_THREAD_LOCK(thread); - if (thread->wait.cvar) { - /* - * The thread will remove itself from the waitQ - * of the cvar in _PR_WaitCondVar - */ - thread->wait.cvar = NULL; - thread->state = _PR_RUNNING; - _PR_THREAD_UNLOCK(thread); - } else { - _PR_THREAD_UNLOCK(thread); - /* - * This thread was woken up by a notifying thread - * at the same time as a timeout; so, consume the - * extra post operation on the semaphore - */ - _MD_CHECK_FOR_EXIT(); - pr_cvar_wait_sem(thread, PR_INTERVAL_NO_TIMEOUT); - } - _MD_CHECK_FOR_EXIT(); - } - } else { - _PR_MD_SWITCH_CONTEXT(thread); - } - return PR_SUCCESS; -} - -PRStatus _MD_WakeupWaiter(PRThread *thread) -{ - PRThread *me = _PR_MD_CURRENT_THREAD(); - PRIntn is; - - PR_ASSERT(_pr_md_idle_cpus >= 0); - if (thread == NULL) { - if (_pr_md_idle_cpus) - _MD_Wakeup_CPUs(); - } else if (!_PR_IS_NATIVE_THREAD(thread)) { - if (_pr_md_idle_cpus) - _MD_Wakeup_CPUs(); - } else { - PR_ASSERT(_PR_IS_NATIVE_THREAD(thread)); - if (!_PR_IS_NATIVE_THREAD(me)) - _PR_INTSOFF(is); - _MD_CVAR_POST_SEM(thread); - if (!_PR_IS_NATIVE_THREAD(me)) - _PR_FAST_INTSON(is); - } - return PR_SUCCESS; -} - -void create_sproc (void (*entry) (void *, size_t), unsigned inh, - void *arg, caddr_t sp, size_t len, int *pid) -{ -sproc_params sparams; -char data; -int rv; -PRThread *me = _PR_MD_CURRENT_THREAD(); - - if (!_PR_IS_NATIVE_THREAD(me) && (_PR_MD_CURRENT_CPU()->id == 0)) { - *pid = sprocsp(entry, /* startup func */ - inh, /* attribute flags */ - arg, /* thread param */ - sp, /* stack address */ - len); /* stack size */ - } else { - sparams.sd.entry = entry; - sparams.sd.inh = inh; - sparams.sd.arg = arg; - sparams.sd.sp = sp; - sparams.sd.len = len; - sparams.sd.pid = pid; - sparams.sd.creator_pid = getpid(); - _PR_LOCK(sproc_list_lock); - PR_APPEND_LINK(&sparams.links, &sproc_list); - rv = write(_pr_irix_primoridal_cpu_fd[1], &data, 1); - PR_ASSERT(rv == 1); - _PR_UNLOCK(sproc_list_lock); - blockproc(getpid()); - } -} - -/* - * _PR_MD_WAKEUP_PRIMORDIAL_CPU - * - * wakeup cpu 0 - */ - -void _PR_MD_WAKEUP_PRIMORDIAL_CPU() -{ -char data = '0'; -int rv; - - rv = write(_pr_irix_primoridal_cpu_fd[1], &data, 1); - PR_ASSERT(rv == 1); -} - -/* - * _PR_MD_primordial_cpu - * - * process events that need to executed by the primordial cpu on each - * iteration through the idle loop - */ - -void _PR_MD_primordial_cpu() -{ -PRCList *qp; -sproc_params *sp; -int pid; - - _PR_LOCK(sproc_list_lock); - while ((qp = sproc_list.next) != &sproc_list) { - sp = SPROC_PARAMS_PTR(qp); - PR_REMOVE_LINK(&sp->links); - pid = sp->sd.creator_pid; - (*(sp->sd.pid)) = sprocsp(sp->sd.entry, /* startup func */ - sp->sd.inh, /* attribute flags */ - sp->sd.arg, /* thread param */ - sp->sd.sp, /* stack address */ - sp->sd.len); /* stack size */ - unblockproc(pid); - } - _PR_UNLOCK(sproc_list_lock); -} - -PRStatus _MD_CreateThread(PRThread *thread, -void (*start)(void *), -PRThreadPriority priority, -PRThreadScope scope, -PRThreadState state, -PRUint32 stackSize) -{ - typedef void (*SprocEntry) (void *, size_t); - SprocEntry spentry = (SprocEntry)start; - PRIntn is; - PRThread *me = _PR_MD_CURRENT_THREAD(); - PRInt32 pid; - PRStatus rv; - - if (!_PR_IS_NATIVE_THREAD(me)) - _PR_INTSOFF(is); - thread->md.cvar_pollsem_select = 0; - thread->flags |= _PR_GLOBAL_SCOPE; - - thread->md.cvar_pollsemfd = -1; - if (new_poll_sem(&thread->md,0) == PR_FAILURE) { - if (!_PR_IS_NATIVE_THREAD(me)) - _PR_FAST_INTSON(is); - return PR_FAILURE; - } - thread->md.cvar_pollsemfd = - _PR_OPEN_POLL_SEM(thread->md.cvar_pollsem); - if ((thread->md.cvar_pollsemfd < 0)) { - free_poll_sem(&thread->md); - if (!_PR_IS_NATIVE_THREAD(me)) - _PR_FAST_INTSON(is); - return PR_FAILURE; - } - - create_sproc(spentry, /* startup func */ - PR_SALL, /* attribute flags */ - (void *)thread, /* thread param */ - NULL, /* stack address */ - stackSize, &pid); /* stack size */ - if (pid > 0) { - _MD_ATOMIC_INCREMENT(&_pr_md_irix_sprocs_created); - _MD_ATOMIC_INCREMENT(&_pr_md_irix_sprocs); - rv = PR_SUCCESS; - if (!_PR_IS_NATIVE_THREAD(me)) - _PR_FAST_INTSON(is); - return rv; - } else { - close(thread->md.cvar_pollsemfd); - thread->md.cvar_pollsemfd = -1; - free_poll_sem(&thread->md); - thread->md.cvar_pollsem = NULL; - _MD_ATOMIC_INCREMENT(&_pr_md_irix_sprocs_failed); - if (!_PR_IS_NATIVE_THREAD(me)) - _PR_FAST_INTSON(is); - return PR_FAILURE; - } -} - -void _MD_CleanThread(PRThread *thread) -{ - if (thread->flags & _PR_GLOBAL_SCOPE) { - close(thread->md.cvar_pollsemfd); - thread->md.cvar_pollsemfd = -1; - free_poll_sem(&thread->md); - thread->md.cvar_pollsem = NULL; - } -} - -void _MD_SetPriority(_MDThread *thread, PRThreadPriority newPri) -{ - return; -} - -extern void _MD_unix_terminate_waitpid_daemon(void); - -void -_MD_CleanupBeforeExit(void) -{ - extern PRInt32 _pr_cpus_exit; - - _MD_unix_terminate_waitpid_daemon(); - - _pr_irix_exit_now = 1; - if (_pr_numCPU > 1) { - /* - * Set a global flag, and wakeup all cpus which will notice the flag - * and exit. - */ - _pr_cpus_exit = getpid(); - _MD_Wakeup_CPUs(); - while(_pr_numCPU > 1) { - _PR_WAIT_SEM(_pr_irix_exit_sem); - _pr_numCPU--; - } - } - /* - * cause global threads on the recycle list to exit - */ - _PR_DEADQ_LOCK; - if (_PR_NUM_DEADNATIVE != 0) { - PRThread *thread; - PRCList *ptr; - - ptr = _PR_DEADNATIVEQ.next; - while( ptr != &_PR_DEADNATIVEQ ) { - thread = _PR_THREAD_PTR(ptr); - _MD_CVAR_POST_SEM(thread); - ptr = ptr->next; - } - } - _PR_DEADQ_UNLOCK; - while(_PR_NUM_DEADNATIVE > 1) { - _PR_WAIT_SEM(_pr_irix_exit_sem); - _PR_DEC_DEADNATIVE; - } -} - -#ifdef _PR_HAVE_SGI_PRDA_PROCMASK -extern void __sgi_prda_procmask(int); -#endif - -PRStatus -_MD_InitAttachedThread(PRThread *thread, PRBool wakeup_parent) -{ - PRStatus rv = PR_SUCCESS; - - if (thread->flags & _PR_GLOBAL_SCOPE) { - if (new_poll_sem(&thread->md,0) == PR_FAILURE) { - return PR_FAILURE; - } - thread->md.cvar_pollsemfd = - _PR_OPEN_POLL_SEM(thread->md.cvar_pollsem); - if ((thread->md.cvar_pollsemfd < 0)) { - free_poll_sem(&thread->md); - return PR_FAILURE; - } - if (_MD_InitThread(thread, PR_FALSE) == PR_FAILURE) { - close(thread->md.cvar_pollsemfd); - thread->md.cvar_pollsemfd = -1; - free_poll_sem(&thread->md); - thread->md.cvar_pollsem = NULL; - return PR_FAILURE; - } - } - return rv; -} - -PRStatus -_MD_InitThread(PRThread *thread, PRBool wakeup_parent) -{ - struct sigaction sigact; - PRStatus rv = PR_SUCCESS; - - if (thread->flags & _PR_GLOBAL_SCOPE) { - thread->md.id = getpid(); - setblockproccnt(thread->md.id, 0); - _MD_SET_SPROC_PID(getpid()); -#ifdef _PR_HAVE_SGI_PRDA_PROCMASK - /* - * enable user-level processing of sigprocmask(); this is an - * undocumented feature available in Irix 6.2, 6.3, 6.4 and 6.5 - */ - __sgi_prda_procmask(USER_LEVEL); -#endif - /* - * set up SIGUSR1 handler; this is used to save state - */ - sigact.sa_handler = save_context_and_block; - sigact.sa_flags = SA_RESTART; - /* - * Must mask clock interrupts - */ - sigact.sa_mask = timer_set; - sigaction(SIGUSR1, &sigact, 0); - - - /* - * PR_SETABORTSIG is a new command implemented in a patch to - * Irix 6.2, 6.3 and 6.4. This causes a signal to be sent to all - * sprocs in the process when one of them terminates abnormally - * - */ - if (prctl(PR_SETABORTSIG, SIGKILL) < 0) { - /* - * if (errno == EINVAL) - * - * PR_SETABORTSIG not supported under this OS. - * You may want to get a recent kernel rollup patch that - * supports this feature. - */ - } - /* - * SIGCLD handler for detecting abormally-terminating - * sprocs and for reaping sprocs - */ - sigact.sa_handler = sigchld_handler; - sigact.sa_flags = SA_RESTART; - sigact.sa_mask = ints_off; - sigaction(SIGCLD, &sigact, NULL); - } - return rv; -} - -/* - * PR_Cleanup should be executed on the primordial sproc; migrate the thread - * to the primordial cpu - */ - -void _PR_MD_PRE_CLEANUP(PRThread *me) -{ -PRIntn is; -_PRCPU *cpu = _pr_primordialCPU; - - PR_ASSERT(cpu); - - me->flags |= _PR_BOUND_THREAD; - - if (me->cpu->id != 0) { - _PR_INTSOFF(is); - _PR_RUNQ_LOCK(cpu); - me->cpu = cpu; - me->state = _PR_RUNNABLE; - _PR_ADD_RUNQ(me, cpu, me->priority); - _PR_RUNQ_UNLOCK(cpu); - _MD_Wakeup_CPUs(); - - _PR_MD_SWITCH_CONTEXT(me); - - _PR_FAST_INTSON(is); - PR_ASSERT(me->cpu->id == 0); - } -} - -/* - * process exiting - */ -PR_EXTERN(void ) _MD_exit(PRIntn status) -{ -PRThread *me = _PR_MD_CURRENT_THREAD(); - - /* - * the exit code of the process is the exit code of the primordial - * sproc - */ - if (!_PR_IS_NATIVE_THREAD(me) && (_PR_MD_CURRENT_CPU()->id == 0)) { - /* - * primordial sproc case: call _exit directly - * Cause SIGKILL to be sent to other sprocs - */ - prctl(PR_SETEXITSIG, SIGKILL); - _exit(status); - } else { - int rv; - char data; - sigset_t set; - - /* - * non-primordial sproc case: cause the primordial sproc, cpu 0, - * to wakeup and call _exit - */ - _pr_irix_process_exit = 1; - _pr_irix_process_exit_code = status; - rv = write(_pr_irix_primoridal_cpu_fd[1], &data, 1); - PR_ASSERT(rv == 1); - /* - * block all signals and wait for SIGKILL to terminate this sproc - */ - sigfillset(&set); - sigsuspend(&set); - /* - * this code doesn't (shouldn't) execute - */ - prctl(PR_SETEXITSIG, SIGKILL); - _exit(status); - } -} - -/* - * Override the exit() function in libc to cause the process to exit - * when the primodial/main nspr thread calls exit. Calls to exit by any - * other thread simply result in a call to the exit function in libc. - * The exit code of the process is the exit code of the primordial - * sproc. - */ - -void exit(int status) -{ -PRThread *me, *thr; -PRCList *qp; - - if (!_pr_initialized) { - if (!libc_exit) { - - if (!libc_handle) - libc_handle = dlopen("libc.so",RTLD_NOW); - if (libc_handle) - libc_exit = (void (*)(int)) dlsym(libc_handle, "exit"); - } - if (libc_exit) - (*libc_exit)(status); - else - _exit(status); - } - - me = _PR_MD_CURRENT_THREAD(); - - if (me == NULL) /* detached thread */ - (*libc_exit)(status); - - PR_ASSERT(_PR_IS_NATIVE_THREAD(me) || - (_PR_MD_CURRENT_CPU())->id == me->cpu->id); - - if (me->flags & _PR_PRIMORDIAL) { - - me->flags |= _PR_BOUND_THREAD; - - PR_ASSERT((_PR_MD_CURRENT_CPU())->id == me->cpu->id); - if (me->cpu->id != 0) { - _PRCPU *cpu = _pr_primordialCPU; - PRIntn is; - - _PR_INTSOFF(is); - _PR_RUNQ_LOCK(cpu); - me->cpu = cpu; - me->state = _PR_RUNNABLE; - _PR_ADD_RUNQ(me, cpu, me->priority); - _PR_RUNQ_UNLOCK(cpu); - _MD_Wakeup_CPUs(); - - _PR_MD_SWITCH_CONTEXT(me); - - _PR_FAST_INTSON(is); - } - - PR_ASSERT((_PR_MD_CURRENT_CPU())->id == 0); - - if (prctl(PR_GETNSHARE) > 1) { -#define SPROC_EXIT_WAIT_TIME 5 - int sleep_cnt = SPROC_EXIT_WAIT_TIME; - - /* - * sprocs still running; caue cpus and recycled global threads - * to exit - */ - _pr_irix_exit_now = 1; - if (_pr_numCPU > 1) { - _MD_Wakeup_CPUs(); - } - _PR_DEADQ_LOCK; - if (_PR_NUM_DEADNATIVE != 0) { - PRThread *thread; - PRCList *ptr; - - ptr = _PR_DEADNATIVEQ.next; - while( ptr != &_PR_DEADNATIVEQ ) { - thread = _PR_THREAD_PTR(ptr); - _MD_CVAR_POST_SEM(thread); - ptr = ptr->next; - } - } - - while (sleep_cnt-- > 0) { - if (waitpid(0, NULL, WNOHANG) >= 0) - sleep(1); - else - break; - } - prctl(PR_SETEXITSIG, SIGKILL); - } - (*libc_exit)(status); - } else { - /* - * non-primordial thread; simply call exit in libc. - */ - (*libc_exit)(status); - } -} - - -void -_MD_InitRunningCPU(_PRCPU *cpu) -{ - extern int _pr_md_pipefd[2]; - - _MD_unix_init_running_cpu(cpu); - cpu->md.id = getpid(); - _MD_SET_SPROC_PID(getpid()); - if (_pr_md_pipefd[0] >= 0) { - _PR_IOQ_MAX_OSFD(cpu) = _pr_md_pipefd[0]; -#ifndef _PR_USE_POLL - FD_SET(_pr_md_pipefd[0], &_PR_FD_READ_SET(cpu)); -#endif - } -} - -void -_MD_ExitThread(PRThread *thread) -{ - if (thread->flags & _PR_GLOBAL_SCOPE) { - _MD_ATOMIC_DECREMENT(&_pr_md_irix_sprocs); - _MD_CLEAN_THREAD(thread); - _MD_SET_CURRENT_THREAD(NULL); - } -} - -void -_MD_SuspendCPU(_PRCPU *cpu) -{ - PRInt32 rv; - - cpu->md.suspending_id = getpid(); - rv = kill(cpu->md.id, SIGUSR1); - PR_ASSERT(rv == 0); - /* - * now, block the current thread/cpu until woken up by the suspended - * thread from it's SIGUSR1 signal handler - */ - blockproc(getpid()); - -} - -void -_MD_ResumeCPU(_PRCPU *cpu) -{ - unblockproc(cpu->md.id); -} - -#if 0 -/* - * save the register context of a suspended sproc - */ -void get_context(PRThread *thr) -{ - int len, fd; - char pidstr[24]; - char path[24]; - - /* - * open the file corresponding to this process in procfs - */ - sprintf(path,"/proc/%s","00000"); - len = strlen(path); - sprintf(pidstr,"%d",thr->md.id); - len -= strlen(pidstr); - sprintf(path + len,"%s",pidstr); - fd = open(path,O_RDONLY); - if (fd >= 0) { - (void) ioctl(fd, PIOCGREG, thr->md.gregs); - close(fd); - } - return; -} -#endif /* 0 */ - -void -_MD_SuspendThread(PRThread *thread) -{ - PRInt32 rv; - - PR_ASSERT((thread->flags & _PR_GLOBAL_SCOPE) && - _PR_IS_GCABLE_THREAD(thread)); - - thread->md.suspending_id = getpid(); - rv = kill(thread->md.id, SIGUSR1); - PR_ASSERT(rv == 0); - /* - * now, block the current thread/cpu until woken up by the suspended - * thread from it's SIGUSR1 signal handler - */ - blockproc(getpid()); -} - -void -_MD_ResumeThread(PRThread *thread) -{ - PR_ASSERT((thread->flags & _PR_GLOBAL_SCOPE) && - _PR_IS_GCABLE_THREAD(thread)); - (void)unblockproc(thread->md.id); -} - -/* - * return the set of processors available for scheduling procs in the - * "mask" argument - */ -PRInt32 _MD_GetThreadAffinityMask(PRThread *unused, PRUint32 *mask) -{ - PRInt32 nprocs, rv; - struct pda_stat *pstat; -#define MAX_PROCESSORS 32 - - nprocs = sysmp(MP_NPROCS); - if (nprocs < 0) - return(-1); - pstat = (struct pda_stat*)PR_MALLOC(sizeof(struct pda_stat) * nprocs); - if (pstat == NULL) - return(-1); - rv = sysmp(MP_STAT, pstat); - if (rv < 0) { - PR_DELETE(pstat); - return(-1); - } - /* - * look at the first 32 cpus - */ - nprocs = (nprocs > MAX_PROCESSORS) ? MAX_PROCESSORS : nprocs; - *mask = 0; - while (nprocs) { - if ((pstat->p_flags & PDAF_ENABLED) && - !(pstat->p_flags & PDAF_ISOLATED)) { - *mask |= (1 << pstat->p_cpuid); - } - nprocs--; - pstat++; - } - return 0; -} - -static char *_thr_state[] = { - "UNBORN", - "RUNNABLE", - "RUNNING", - "LOCK_WAIT", - "COND_WAIT", - "JOIN_WAIT", - "IO_WAIT", - "SUSPENDED", - "DEAD" -}; - -void _PR_List_Threads() -{ - PRThread *thr; - void *handle; - struct _PRCPU *cpu; - PRCList *qp; - int len, fd; - char pidstr[24]; - char path[24]; - prpsinfo_t pinfo; - - - printf("\n%s %-s\n"," ","LOCAL Threads"); - printf("%s %-s\n"," ","----- -------"); - printf("%s %-14s %-10s %-12s %-3s %-10s %-10s %-12s\n\n"," ", - "Thread", "State", "Wait-Handle", - "Cpu","Stk-Base","Stk-Sz","SP"); - for (qp = _PR_ACTIVE_LOCAL_THREADQ().next; - qp != &_PR_ACTIVE_LOCAL_THREADQ(); qp = qp->next) { - thr = _PR_ACTIVE_THREAD_PTR(qp); - printf("%s 0x%-12x %-10s "," ",thr,_thr_state[thr->state]); - if (thr->state == _PR_LOCK_WAIT) - handle = thr->wait.lock; - else if (thr->state == _PR_COND_WAIT) - handle = thr->wait.cvar; - else - handle = NULL; - if (handle) - printf("0x%-10x ",handle); - else - printf("%-12s "," "); - printf("%-3d ",thr->cpu->id); - printf("0x%-8x ",thr->stack->stackBottom); - printf("0x%-8x ",thr->stack->stackSize); - printf("0x%-10x\n",thr->md.jb[JB_SP]); - } - - printf("\n%s %-s\n"," ","GLOBAL Threads"); - printf("%s %-s\n"," ","------ -------"); - printf("%s %-14s %-6s %-12s %-12s %-12s %-12s\n\n"," ","Thread", - "Pid","State","Wait-Handle", - "Stk-Base","Stk-Sz"); - - for (qp = _PR_ACTIVE_GLOBAL_THREADQ().next; - qp != &_PR_ACTIVE_GLOBAL_THREADQ(); qp = qp->next) { - thr = _PR_ACTIVE_THREAD_PTR(qp); - if (thr->cpu != NULL) - continue; /* it is a cpu thread */ - printf("%s 0x%-12x %-6d "," ",thr,thr->md.id); - /* - * check if the sproc is still running - * first call prctl(PR_GETSHMASK,pid) to check if - * the process is part of the share group (the pid - * could have been recycled by the OS) - */ - if (prctl(PR_GETSHMASK,thr->md.id) < 0) { - printf("%-12s\n","TERMINATED"); - continue; - } - /* - * Now, check if the sproc terminated and is in zombie - * state - */ - sprintf(path,"/proc/pinfo/%s","00000"); - len = strlen(path); - sprintf(pidstr,"%d",thr->md.id); - len -= strlen(pidstr); - sprintf(path + len,"%s",pidstr); - fd = open(path,O_RDONLY); - if (fd >= 0) { - if (ioctl(fd, PIOCPSINFO, &pinfo) < 0) - printf("%-12s ","TERMINATED"); - else if (pinfo.pr_zomb) - printf("%-12s ","TERMINATED"); - else - printf("%-12s ",_thr_state[thr->state]); - close(fd); - } else { - printf("%-12s ","TERMINATED"); - } - - if (thr->state == _PR_LOCK_WAIT) - handle = thr->wait.lock; - else if (thr->state == _PR_COND_WAIT) - handle = thr->wait.cvar; - else - handle = NULL; - if (handle) - printf("%-12x ",handle); - else - printf("%-12s "," "); - printf("0x%-10x ",thr->stack->stackBottom); - printf("0x%-10x\n",thr->stack->stackSize); - } - - printf("\n%s %-s\n"," ","CPUs"); - printf("%s %-s\n"," ","----"); - printf("%s %-14s %-6s %-12s \n\n"," ","Id","Pid","State"); - - - for (qp = _PR_CPUQ().next; qp != &_PR_CPUQ(); qp = qp->next) { - cpu = _PR_CPU_PTR(qp); - printf("%s %-14d %-6d "," ",cpu->id,cpu->md.id); - /* - * check if the sproc is still running - * first call prctl(PR_GETSHMASK,pid) to check if - * the process is part of the share group (the pid - * could have been recycled by the OS) - */ - if (prctl(PR_GETSHMASK,cpu->md.id) < 0) { - printf("%-12s\n","TERMINATED"); - continue; - } - /* - * Now, check if the sproc terminated and is in zombie - * state - */ - sprintf(path,"/proc/pinfo/%s","00000"); - len = strlen(path); - sprintf(pidstr,"%d",cpu->md.id); - len -= strlen(pidstr); - sprintf(path + len,"%s",pidstr); - fd = open(path,O_RDONLY); - if (fd >= 0) { - if (ioctl(fd, PIOCPSINFO, &pinfo) < 0) - printf("%-12s\n","TERMINATED"); - else if (pinfo.pr_zomb) - printf("%-12s\n","TERMINATED"); - else - printf("%-12s\n","RUNNING"); - close(fd); - } else { - printf("%-12s\n","TERMINATED"); - } - - } - fflush(stdout); -} -#endif /* defined(_PR_PTHREADS) */ - -PRWord *_MD_HomeGCRegisters(PRThread *t, int isCurrent, int *np) -{ -#if !defined(_PR_PTHREADS) - if (isCurrent) { - (void) setjmp(t->md.jb); - } - *np = sizeof(t->md.jb) / sizeof(PRWord); - return (PRWord *) (t->md.jb); -#else - *np = 0; - return NULL; -#endif -} - -void _MD_EarlyInit(void) -{ -#if !defined(_PR_PTHREADS) - char *eval; - int fd; - extern int __ateachexit(void (*func)(void)); - - sigemptyset(&ints_off); - sigaddset(&ints_off, SIGALRM); - sigaddset(&ints_off, SIGIO); - sigaddset(&ints_off, SIGCLD); - - if (eval = getenv("_NSPR_TERMINATE_ON_ERROR")) - _nspr_terminate_on_error = (0 == atoi(eval) == 0) ? PR_FALSE : PR_TRUE; - - fd = open("/dev/zero",O_RDWR , 0); - if (fd < 0) { - perror("open /dev/zero failed"); - exit(1); - } - /* - * Set up the sproc private data area. - * This region exists at the same address, _nspr_sproc_private, for - * every sproc, but each sproc gets a private copy of the region. - */ - _nspr_sproc_private = (char*)mmap(0, _pr_pageSize, PROT_READ | PROT_WRITE, - MAP_PRIVATE| MAP_LOCAL, fd, 0); - if (_nspr_sproc_private == (void*)-1) { - perror("mmap /dev/zero failed"); - exit(1); - } - _MD_SET_SPROC_PID(getpid()); - close(fd); - __ateachexit(irix_detach_sproc); -#endif - _MD_IrixIntervalInit(); -} /* _MD_EarlyInit */ - -void _MD_IrixInit(void) -{ -#if !defined(_PR_PTHREADS) - struct sigaction sigact; - PRThread *me = _PR_MD_CURRENT_THREAD(); - int rv; - -#ifdef _PR_HAVE_SGI_PRDA_PROCMASK - /* - * enable user-level processing of sigprocmask(); this is an undocumented - * feature available in Irix 6.2, 6.3, 6.4 and 6.5 - */ - __sgi_prda_procmask(USER_LEVEL); -#endif - - /* - * set up SIGUSR1 handler; this is used to save state - * during PR_SuspendAll - */ - sigact.sa_handler = save_context_and_block; - sigact.sa_flags = SA_RESTART; - sigact.sa_mask = ints_off; - sigaction(SIGUSR1, &sigact, 0); - - /* - * Change the name of the core file from core to core.pid, - * This is inherited by the sprocs created by this process - */ -#ifdef PR_COREPID - prctl(PR_COREPID, 0, 1); -#endif - /* - * Irix-specific terminate on error processing - */ - /* - * PR_SETABORTSIG is a new command implemented in a patch to - * Irix 6.2, 6.3 and 6.4. This causes a signal to be sent to all - * sprocs in the process when one of them terminates abnormally - * - */ - if (prctl(PR_SETABORTSIG, SIGKILL) < 0) { - /* - * if (errno == EINVAL) - * - * PR_SETABORTSIG not supported under this OS. - * You may want to get a recent kernel rollup patch that - * supports this feature. - * - */ - } - /* - * PR_SETEXITSIG - send the SIGCLD signal to the parent - * sproc when any sproc terminates - * - * This is used to cause the entire application to - * terminate when any sproc terminates abnormally by - * receipt of a SIGSEGV, SIGBUS or SIGABRT signal. - * If this is not done, the application may seem - * "hung" to the user because the other sprocs may be - * waiting for resources held by the - * abnormally-terminating sproc. - */ - prctl(PR_SETEXITSIG, 0); - - sigact.sa_handler = sigchld_handler; - sigact.sa_flags = SA_RESTART; - sigact.sa_mask = ints_off; - sigaction(SIGCLD, &sigact, NULL); - - /* - * setup stack fields for the primordial thread - */ - me->stack->stackSize = prctl(PR_GETSTACKSIZE); - me->stack->stackBottom = me->stack->stackTop - me->stack->stackSize; - - rv = pipe(_pr_irix_primoridal_cpu_fd); - PR_ASSERT(rv == 0); -#ifndef _PR_USE_POLL - _PR_IOQ_MAX_OSFD(me->cpu) = _pr_irix_primoridal_cpu_fd[0]; - FD_SET(_pr_irix_primoridal_cpu_fd[0], &_PR_FD_READ_SET(me->cpu)); -#endif - - libc_handle = dlopen("libc.so",RTLD_NOW); - PR_ASSERT(libc_handle != NULL); - libc_exit = (void (*)(int)) dlsym(libc_handle, "exit"); - PR_ASSERT(libc_exit != NULL); - /* dlclose(libc_handle); */ - -#endif /* _PR_PTHREADS */ - - _PR_UnixInit(); -} - -/**************************************************************************/ -/************** code and such for NSPR 2.0's interval times ***************/ -/**************************************************************************/ - -#define PR_PSEC_PER_SEC 1000000000000ULL /* 10^12 */ - -#ifndef SGI_CYCLECNTR_SIZE -#define SGI_CYCLECNTR_SIZE 165 /* Size user needs to use to read CC */ -#endif - -static PRIntn mmem_fd = -1; -static PRIntn clock_width = 0; -static void *iotimer_addr = NULL; -static PRUint32 pr_clock_mask = 0; -static PRUint32 pr_clock_shift = 0; -static PRIntervalTime pr_ticks = 0; -static PRUint32 pr_clock_granularity = 1; -static PRUint32 pr_previous = 0, pr_residual = 0; -static PRUint32 pr_ticks_per_second = 0; - -extern PRIntervalTime _PR_UNIX_GetInterval(void); -extern PRIntervalTime _PR_UNIX_TicksPerSecond(void); - -static void _MD_IrixIntervalInit(void) -{ - /* - * As much as I would like, the service available through this - * interface on R3000's (aka, IP12) just isn't going to make it. - * The register is only 24 bits wide, and rolls over at a verocious - * rate. - */ - PRUint32 one_tick = 0; - struct utsname utsinfo; - uname(&utsinfo); - if ((strncmp("IP12", utsinfo.machine, 4) != 0) - && ((mmem_fd = open("/dev/mmem", O_RDONLY)) != -1)) - { - int poffmask = getpagesize() - 1; - __psunsigned_t phys_addr, raddr, cycleval; - - phys_addr = syssgi(SGI_QUERY_CYCLECNTR, &cycleval); - raddr = phys_addr & ~poffmask; - iotimer_addr = mmap( - 0, poffmask, PROT_READ, MAP_PRIVATE, mmem_fd, (__psint_t)raddr); - - clock_width = syssgi(SGI_CYCLECNTR_SIZE); - if (clock_width < 0) - { - /* - * We must be executing on a 6.0 or earlier system, since the - * SGI_CYCLECNTR_SIZE call is not supported. - * - * The only pre-6.1 platforms with 64-bit counters are - * IP19 and IP21 (Challenge, PowerChallenge, Onyx). - */ - if (!strncmp(utsinfo.machine, "IP19", 4) || - !strncmp(utsinfo.machine, "IP21", 4)) - clock_width = 64; - else - clock_width = 32; - } - - /* - * 'cycleval' is picoseconds / increment of the counter. - * I'm pushing for a tick to be 100 microseconds, 10^(-4). - * That leaves 10^(-8) left over, or 10^8 / cycleval. - * Did I do that right? - */ - - one_tick = 100000000UL / cycleval ; /* 100 microseconds */ - - while (0 != one_tick) - { - pr_clock_shift += 1; - one_tick = one_tick >> 1; - pr_clock_granularity = pr_clock_granularity << 1; - } - pr_clock_mask = pr_clock_granularity - 1; /* to make a mask out of it */ - pr_ticks_per_second = PR_PSEC_PER_SEC - / ((PRUint64)pr_clock_granularity * (PRUint64)cycleval); - - iotimer_addr = (void*) - ((__psunsigned_t)iotimer_addr + (phys_addr & poffmask)); - } - else - { - pr_ticks_per_second = _PR_UNIX_TicksPerSecond(); - } -} /* _MD_IrixIntervalInit */ - -PRIntervalTime _MD_IrixIntervalPerSec(void) -{ - return pr_ticks_per_second; -} - -PRIntervalTime _MD_IrixGetInterval(void) -{ - if (mmem_fd != -1) - { - if (64 == clock_width) - { - PRUint64 temp = *(PRUint64*)iotimer_addr; - pr_ticks = (PRIntervalTime)(temp >> pr_clock_shift); - } - else - { - PRIntervalTime ticks = pr_ticks; - PRUint32 now = *(PRUint32*)iotimer_addr, temp; - PRUint32 residual = pr_residual, previous = pr_previous; - - temp = now - previous + residual; - residual = temp & pr_clock_mask; - ticks += temp >> pr_clock_shift; - - pr_previous = now; - pr_residual = residual; - pr_ticks = ticks; - } - } - else - { - /* - * No fast access. Use the time of day clock. This isn't the - * right answer since this clock can get set back, tick at odd - * rates, and it's expensive to acqurie. - */ - pr_ticks = _PR_UNIX_GetInterval(); - } - return pr_ticks; -} /* _MD_IrixGetInterval */ - diff --git a/pr/src/md/unix/os_Irix.s b/pr/src/md/unix/os_Irix.s deleted file mode 100644 index ab1cb0b3..00000000 --- a/pr/src/md/unix/os_Irix.s +++ /dev/null @@ -1,134 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -/* - * Atomically add a new element to the top of the stack - * - * usage : PR_StackPush(listp, elementp); - * ----------------------- - */ - -#include "md/_irix.h" -#ifdef _PR_HAVE_ATOMIC_CAS - -#include <sys/asm.h> -#include <sys/regdef.h> - -LEAF(PR_StackPush) - -retry_push: -.set noreorder - lw v0,0(a0) - li t1,1 - beq v0,t1,retry_push - move t0,a1 - - ll v0,0(a0) - beq v0,t1,retry_push - nop - sc t1,0(a0) - beq t1,0,retry_push - nop - sw v0,0(a1) - sync - sw t0,0(a0) - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - jr ra - nop - -END(PR_StackPush) - -/* - * - * Atomically remove the element at the top of the stack - * - * usage : elemep = PR_StackPop(listp); - * - */ - -LEAF(PR_StackPop) -retry_pop: -.set noreorder - - - lw v0,0(a0) - li t1,1 - beq v0,0,done - nop - beq v0,t1,retry_pop - nop - - ll v0,0(a0) - beq v0,0,done - nop - beq v0,t1,retry_pop - nop - sc t1,0(a0) - beq t1,0,retry_pop - nop - lw t0,0(v0) - sw t0,0(a0) -done: - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - nop - jr ra - nop - -END(PR_StackPop) - -#endif /* _PR_HAVE_ATOMIC_CAS */ diff --git a/pr/src/md/unix/unix.c b/pr/src/md/unix/unix.c index 099e741e..ceb67f07 100644 --- a/pr/src/md/unix/unix.c +++ b/pr/src/md/unix/unix.c @@ -41,7 +41,7 @@ #if defined(HAVE_SOCKLEN_T) \ || (defined(__GLIBC__) && __GLIBC__ >= 2) #define _PRSockLen_t socklen_t -#elif defined(IRIX) || defined(HPUX) || defined(SOLARIS) \ +#elif defined(HPUX) || defined(SOLARIS) \ || defined(AIX4_1) || defined(LINUX) \ || defined(BSDI) || defined(SCO) \ || defined(DARWIN) \ @@ -84,10 +84,6 @@ static sigset_t empty_set; */ int _nspr_noclock = 1; -#ifdef IRIX -extern PRInt32 _nspr_terminate_on_error; -#endif - /* * There is an assertion in this code that NSPR's definition of PRIOVec * is bit compatible with UNIX' definition of a struct iovec. This is @@ -1084,10 +1080,6 @@ PRInt32 _MD_connect( PRInt32 rv, err; PRThread *me = _PR_MD_CURRENT_THREAD(); PRInt32 osfd = fd->secret->md.osfd; -#ifdef IRIX -extern PRInt32 _MD_irix_connect( - PRInt32 osfd, const PRNetAddr *addr, PRInt32 addrlen, PRIntervalTime timeout); -#endif #ifdef _PR_HAVE_SOCKADDR_LEN PRNetAddr addrCopy; @@ -1109,15 +1101,11 @@ extern PRInt32 _MD_irix_connect( */ retry: -#ifdef IRIX - if ((rv = _MD_irix_connect(osfd, addr, addrlen, timeout)) == -1) { -#else #ifdef _PR_HAVE_SOCKADDR_LEN if ((rv = connect(osfd, (struct sockaddr *)&addrCopy, addrlen)) == -1) { #else if ((rv = connect(osfd, (struct sockaddr *)addr, addrlen)) == -1) { #endif -#endif err = _MD_ERRNO(); if (err == EINTR) { @@ -1466,9 +1454,6 @@ void _MD_PauseCPU(PRIntervalTime ticks) PRCList *q; PRUint32 min_timeout; sigset_t oldset; -#ifdef IRIX -extern sigset_t ints_off; -#endif PR_ASSERT(_PR_MD_GET_INTSOFF() != 0); @@ -1487,16 +1472,6 @@ extern sigset_t ints_off; */ if (_PR_IS_NATIVE_THREAD_SUPPORTED()) { npollfds++; -#ifdef IRIX - /* - * On Irix, a second pipe is used to cause the primordial cpu to - * wakeup and exit, when the process is exiting because of a call - * to exit/PR_ProcessExit. - */ - if (me->cpu->id == 0) { - npollfds++; - } -#endif } /* @@ -1522,16 +1497,6 @@ extern sigset_t ints_off; pollfdPtr->fd = _pr_md_pipefd[0]; pollfdPtr->events = POLLIN; pollfdPtr++; -#ifdef IRIX - /* - * On Irix, the second element is the exit pipe - */ - if (me->cpu->id == 0) { - pollfdPtr->fd = _pr_irix_primoridal_cpu_fd[0]; - pollfdPtr->events = POLLIN; - pollfdPtr++; - } -#endif } min_timeout = PR_INTERVAL_NO_TIMEOUT; @@ -1615,22 +1580,9 @@ extern sigset_t ints_off; * are enabled. Otherwise, when the select/poll calls are interrupted, the * timer value starts ticking from zero again when the system call is restarted. */ -#ifdef IRIX - /* - * SIGCHLD signal is used on Irix to detect he termination of an - * sproc by SIGSEGV, SIGBUS or SIGABRT signals when - * _nspr_terminate_on_error is set. - */ - if ((!_nspr_noclock) || (_nspr_terminate_on_error)) -#else if (!_nspr_noclock) -#endif /* IRIX */ -#ifdef IRIX - sigprocmask(SIG_BLOCK, &ints_off, &oldset); -#else PR_ASSERT(sigismember(&timer_set, SIGALRM)); sigprocmask(SIG_BLOCK, &timer_set, &oldset); -#endif /* IRIX */ #endif /* !_PR_NO_CLOCK_TIMER */ #ifndef _PR_USE_POLL @@ -1641,19 +1593,13 @@ extern sigset_t ints_off; #endif /* !_PR_USE_POLL */ #ifndef _PR_NO_CLOCK_TIMER -#ifdef IRIX - if ((!_nspr_noclock) || (_nspr_terminate_on_error)) -#else if (!_nspr_noclock) -#endif /* IRIX */ sigprocmask(SIG_SETMASK, &oldset, 0); #endif /* !_PR_NO_CLOCK_TIMER */ _MD_CHECK_FOR_EXIT(); -#ifdef IRIX _PR_MD_primordial_cpu(); -#endif _PR_MD_IOQ_LOCK(); /* @@ -1679,30 +1625,6 @@ extern sigset_t ints_off; PR_ASSERT((rv > 0) || ((rv == -1) && (errno == EAGAIN))); } pollfdPtr++; -#ifdef IRIX - /* - * On Irix, check to see if the primordial cpu needs to exit - * to cause the process to terminate - */ - if (me->cpu->id == 0) { - PR_ASSERT(pollfds[1].fd == _pr_irix_primoridal_cpu_fd[0]); - if (pollfdPtr->revents & POLLIN) { - if (_pr_irix_process_exit) { - /* - * process exit due to a call to PR_ProcessExit - */ - prctl(PR_SETEXITSIG, SIGKILL); - _exit(_pr_irix_process_exit_code); - } else { - while ((rv = read(_pr_irix_primoridal_cpu_fd[0], - _pr_md_pipebuf, PIPE_BUF)) == PIPE_BUF) { - } - PR_ASSERT(rv > 0); - } - } - pollfdPtr++; - } -#endif } for (q = _PR_IOQ(me->cpu).next; q != &_PR_IOQ(me->cpu); q = q->next) { PRPollQueue *pq = _PR_POLLQUEUE_PTR(q); @@ -1898,27 +1820,6 @@ extern sigset_t ints_off; } if (_PR_IOQ_MAX_OSFD(me->cpu) < _pr_md_pipefd[0]) _PR_IOQ_MAX_OSFD(me->cpu) = _pr_md_pipefd[0]; -#ifdef IRIX - if ((me->cpu->id == 0) && - (FD_ISSET(_pr_irix_primoridal_cpu_fd[0], rp))) { - if (_pr_irix_process_exit) { - /* - * process exit due to a call to PR_ProcessExit - */ - prctl(PR_SETEXITSIG, SIGKILL); - _exit(_pr_irix_process_exit_code); - } else { - while ((rv = read(_pr_irix_primoridal_cpu_fd[0], - _pr_md_pipebuf, PIPE_BUF)) == PIPE_BUF) { - } - PR_ASSERT(rv > 0); - } - } - if (me->cpu->id == 0) { - if (_PR_IOQ_MAX_OSFD(me->cpu) < _pr_irix_primoridal_cpu_fd[0]) - _PR_IOQ_MAX_OSFD(me->cpu) = _pr_irix_primoridal_cpu_fd[0]; - } -#endif } } else if (nfd < 0) { if (errno == EBADF) { @@ -2241,7 +2142,7 @@ PRInt32 _MD_open(const char *name, PRIntn flags, PRIntn mode) PRIntervalTime intr_timeout_ticks; -#if defined(SOLARIS) || defined(IRIX) +#if defined(SOLARIS) static void sigsegvhandler() { fprintf(stderr,"Received SIGSEGV\n"); fflush(stderr); @@ -2259,7 +2160,7 @@ static void sigbushandler() { fflush(stderr); pause(); } -#endif /* SOLARIS, IRIX */ +#endif /* SOLARIS */ #endif /* !defined(_PR_PTHREADS) */ @@ -2767,7 +2668,7 @@ static void _PR_InitIOV(void) _md_iovector._stat64 = stat; _md_iovector._lseek64 = _MD_Unix_lseek64; #elif defined(_PR_HAVE_OFF64_T) -#if defined(IRIX5_3) || (defined(ANDROID) && __ANDROID_API__ < 21) +#if (defined(ANDROID) && __ANDROID_API__ < 21) /* * Android < 21 doesn't have open64. We pass the O_LARGEFILE flag to open * in _MD_open. @@ -2812,7 +2713,7 @@ void _PR_UnixInit(void) intr_timeout_ticks = PR_SecondsToInterval(_PR_INTERRUPT_CHECK_INTERVAL_SECS); -#if defined(SOLARIS) || defined(IRIX) +#if defined(SOLARIS) if (getenv("NSPR_SIGSEGV_HANDLE")) { sigact.sa_handler = sigsegvhandler; diff --git a/pr/src/md/unix/uxproces.c b/pr/src/md/unix/uxproces.c index 18f23fde..808b6c93 100644 --- a/pr/src/md/unix/uxproces.c +++ b/pr/src/md/unix/uxproces.c @@ -55,11 +55,10 @@ typedef struct pr_PidRecord { } pr_PidRecord; /* - * Irix sprocs and LinuxThreads are actually a kind of processes + * LinuxThreads are actually a kind of processes * that can share the virtual address space and file descriptors. */ -#if (defined(IRIX) && !defined(_PR_PTHREADS)) \ - || ((defined(LINUX) || defined(__GNU__) || defined(__GLIBC__)) \ +#if ((defined(LINUX) || defined(__GNU__) || defined(__GLIBC__)) \ && defined(_PR_PTHREADS)) #define _PR_SHARE_CLONES #endif diff --git a/pr/src/md/unix/uxrng.c b/pr/src/md/unix/uxrng.c index cca6f28f..339c70be 100644 --- a/pr/src/md/unix/uxrng.c +++ b/pr/src/md/unix/uxrng.c @@ -104,89 +104,6 @@ GetHighResClock(void *buf, size_t maxbytes) return(GetDevURandom( buf, maxbytes )); } -#elif defined(IRIX) -#include <fcntl.h> -#undef PRIVATE -#include <sys/mman.h> -#include <sys/syssgi.h> -#include <sys/immu.h> -#include <sys/systeminfo.h> -#include <sys/utsname.h> - -static size_t GetHighResClock(void *buf, size_t maxbuf) -{ - unsigned phys_addr, raddr, cycleval; - static volatile unsigned *iotimer_addr = NULL; - static int tries = 0; - static int cntr_size; - int mfd; - unsigned s0[2]; - -#ifndef SGI_CYCLECNTR_SIZE -#define SGI_CYCLECNTR_SIZE 165 /* Size user needs to use to read CC */ -#endif - - if (iotimer_addr == NULL) { - if (tries++ > 1) { - /* Don't keep trying if it didn't work */ - return 0; - } - - /* - ** For SGI machines we can use the cycle counter, if it has one, - ** to generate some truly random numbers - */ - phys_addr = syssgi(SGI_QUERY_CYCLECNTR, &cycleval); - if (phys_addr) { - int pgsz = getpagesize(); - int pgoffmask = pgsz - 1; - - raddr = phys_addr & ~pgoffmask; - mfd = open("/dev/mmem", O_RDONLY); - if (mfd < 0) { - return 0; - } - iotimer_addr = (unsigned *) - mmap(0, pgoffmask, PROT_READ, MAP_PRIVATE, mfd, (int)raddr); - if (iotimer_addr == (unsigned*)-1) { - close(mfd); - iotimer_addr = NULL; - return 0; - } - iotimer_addr = (unsigned*) - ((__psint_t)iotimer_addr | (phys_addr & pgoffmask)); - /* - * The file 'mfd' is purposefully not closed. - */ - cntr_size = syssgi(SGI_CYCLECNTR_SIZE); - if (cntr_size < 0) { - struct utsname utsinfo; - - /* - * We must be executing on a 6.0 or earlier system, since the - * SGI_CYCLECNTR_SIZE call is not supported. - * - * The only pre-6.1 platforms with 64-bit counters are - * IP19 and IP21 (Challenge, PowerChallenge, Onyx). - */ - uname(&utsinfo); - if (!strncmp(utsinfo.machine, "IP19", 4) || - !strncmp(utsinfo.machine, "IP21", 4)) - cntr_size = 64; - else - cntr_size = 32; - } - cntr_size /= 8; /* Convert from bits to bytes */ - } - } - - s0[0] = *iotimer_addr; - if (cntr_size > 4) - s0[1] = *(iotimer_addr + 1); - memcpy(buf, (char *)&s0[0], cntr_size); - return _pr_CopyLowBits(buf, maxbuf, &s0, cntr_size); -} - #elif defined(SCO) || defined(UNIXWARE) || defined(BSDI) || defined(NTO) \ || defined(QNX) || defined(DARWIN) || defined(RISCOS) #include <sys/times.h> diff --git a/pr/src/md/unix/uxwrap.c b/pr/src/md/unix/uxwrap.c index 99259065..e03b030a 100644 --- a/pr/src/md/unix/uxwrap.c +++ b/pr/src/md/unix/uxwrap.c @@ -18,11 +18,6 @@ /* Do not wrap select() and poll(). */ #else /* defined(_PR_PTHREADS) || defined(_PR_GLOBAL_THREADS_ONLY) */ /* The include files for select() */ -#ifdef IRIX -#include <unistd.h> -#include <bstring.h> -#endif - #include <string.h> #include <sys/types.h> #include <sys/time.h> @@ -257,8 +252,6 @@ int select(int width, fd_set *rd, fd_set *wr, fd_set *ex, struct timeval *tv) PR_ASSERT(nbits > 0); #if defined(HPUX) || defined(SOLARIS) || defined(AIX) retVal += nbits; -#else /* IRIX */ - retVal += 1; #endif } } diff --git a/pr/src/misc/prinit.c b/pr/src/misc/prinit.c index 43048a0d..89cf3277 100644 --- a/pr/src/misc/prinit.c +++ b/pr/src/misc/prinit.c @@ -369,14 +369,6 @@ PR_IMPLEMENT(PRStatus) PR_Cleanup() } PR_Unlock(_pr_activeLock); -#ifdef IRIX - _PR_MD_PRE_CLEANUP(me); - /* - * The primordial thread must now be running on the primordial cpu - */ - PR_ASSERT((_PR_IS_NATIVE_THREAD(me)) || (me->cpu->id == 0)); -#endif - _PR_MD_EARLY_CLEANUP(); _PR_CleanupMW(); diff --git a/pr/src/misc/prnetdb.c b/pr/src/misc/prnetdb.c index 21ca20b8..982331c1 100644 --- a/pr/src/misc/prnetdb.c +++ b/pr/src/misc/prnetdb.c @@ -35,7 +35,7 @@ extern int h_errno; * - _PR_HAVE_GETHOST_R_INT: the gethostbyXXX_r functions return an * int. For example, Linux glibc. * - _PR_HAVE_GETHOST_R_POINTER: the gethostbyXXX_r functions return - * a struct hostent* pointer. For example, Solaris and IRIX. + * a struct hostent* pointer. For example, Solaris. */ #if defined(_PR_NO_PREEMPT) || defined(_PR_HAVE_GETHOST_R) \ || defined(_PR_HAVE_THREADSAFE_GETHOST) diff --git a/pr/src/misc/prsystem.c b/pr/src/misc/prsystem.c index eba85fb0..cdf7c6c3 100644 --- a/pr/src/misc/prsystem.c +++ b/pr/src/misc/prsystem.c @@ -208,8 +208,6 @@ PR_IMPLEMENT(PRInt32) PR_GetNumberOfProcessors( void ) numCpus = -1; /* set to -1 for return value on error */ _PR_MD_MAP_DEFAULT_ERROR( _MD_ERRNO() ); } -#elif defined(IRIX) - numCpus = sysconf( _SC_NPROC_ONLN ); #elif defined(RISCOS) || defined(SYMBIAN) numCpus = 1; #elif defined(LINUX) diff --git a/pr/src/pthreads/ptio.c b/pr/src/pthreads/ptio.c index 47b37601..a8e0d689 100644 --- a/pr/src/pthreads/ptio.c +++ b/pr/src/pthreads/ptio.c @@ -177,7 +177,7 @@ static PRBool _pr_ipv6_v6only_on_by_default; #define _PRSelectFdSetArg_t int * #elif defined(AIX4_1) #define _PRSelectFdSetArg_t void * -#elif defined(IRIX) || (defined(AIX) && !defined(AIX4_1)) \ +#elif (defined(AIX) && !defined(AIX4_1)) \ || defined(SOLARIS) \ || defined(HPUX10_30) || defined(HPUX11) \ || defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) \ @@ -3334,7 +3334,7 @@ static PRIOMethods _pr_socketpollfd_methods = { (PRReservedFN)_PR_InvalidInt }; -#if defined(HPUX) || defined(SOLARIS) || defined (IRIX) \ +#if defined(HPUX) || defined(SOLARIS) \ || defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) \ || defined(AIX) || defined(FREEBSD) || defined(NETBSD) \ || defined(OPENBSD) || defined(BSDI) || defined(NTO) \ diff --git a/pr/src/pthreads/ptthread.c b/pr/src/pthreads/ptthread.c index 0a3a9a7c..069870da 100644 --- a/pr/src/pthreads/ptthread.c +++ b/pr/src/pthreads/ptthread.c @@ -438,17 +438,6 @@ static PRThread* _PR_CreateThread( if (EPERM == rv) { -#if defined(IRIX) - if (PR_GLOBAL_BOUND_THREAD == scope) { - /* - * SCOPE_SYSTEM requires appropriate privilege - * reset to process scope and try again - */ - rv = pthread_attr_setscope(&tattr, PTHREAD_SCOPE_PROCESS); - PR_ASSERT(0 == rv); - thred->state &= ~PT_THREAD_BOUND; - } -#else /* Remember that we don't have thread scheduling privilege. */ pt_schedpriv = EPERM; PR_LOG(_pr_thread_lm, PR_LOG_MIN, @@ -458,7 +447,6 @@ static PRThread* _PR_CreateThread( rv = pthread_attr_setinheritsched(&tattr, PTHREAD_INHERIT_SCHED); PR_ASSERT(0 == rv); #endif -#endif /* IRIX */ rv = _PT_PTHREAD_CREATE(&id, tattr, _pt_root, thred); } diff --git a/pr/src/threads/combined/pruthr.c b/pr/src/threads/combined/pruthr.c index 4625ab24..436acf84 100644 --- a/pr/src/threads/combined/pruthr.c +++ b/pr/src/threads/combined/pruthr.c @@ -786,9 +786,6 @@ static PRThread *get_thread(_PRCPU *cpu, PRBool *wakeup_cpus) */ thread = NULL; -#ifdef IRIX - _PR_MD_WAKEUP_PRIMORDIAL_CPU(); -#endif continue; } else if (thread->io_pending == PR_TRUE) { /* @@ -1453,10 +1450,10 @@ PR_IMPLEMENT(PRThread*) PR_AttachThread(PRThreadType type, PR_IMPLEMENT(void) PR_DetachThread(void) { /* - * On IRIX, Solaris, and Windows, foreign threads are detached when + * On Solaris, and Windows, foreign threads are detached when * they terminate. */ -#if !defined(IRIX) && !defined(WIN32) \ +#if !defined(WIN32) \ && !(defined(SOLARIS) && defined(_PR_GLOBAL_THREADS_ONLY)) PRThread *me; if (_pr_initialized) { diff --git a/pr/src/threads/prcthr.c b/pr/src/threads/prcthr.c index 26881447..d271f312 100644 --- a/pr/src/threads/prcthr.c +++ b/pr/src/threads/prcthr.c @@ -280,12 +280,8 @@ PR_IMPLEMENT(PRInt32) PR_GetThreadAffinityMask(PRThread *thread, PRUint32 *mask) PR_IMPLEMENT(PRInt32) PR_SetThreadAffinityMask(PRThread *thread, PRUint32 mask ) { #ifdef HAVE_THREAD_AFFINITY -#ifndef IRIX return _PR_MD_SETTHREADAFFINITYMASK(thread, mask); #else - return 0; -#endif -#else return 0; #endif } diff --git a/pr/tests/Makefile.in b/pr/tests/Makefile.in index 95152152..8a87ad09 100644 --- a/pr/tests/Makefile.in +++ b/pr/tests/Makefile.in @@ -150,8 +150,6 @@ CSRCS = \ sockping.c \ sockpong.c \ sprintf.c \ - sproc_ch.c \ - sproc_p.c \ stack.c \ stdio.c \ str2addr.c \ @@ -237,34 +235,6 @@ ABSOLUTE_LIB_DIR = $(PWD)/$(dist_libdir) endif endif -ifeq ($(OS_ARCH), IRIX) - ifeq ($(USE_CPLUS), 1) - CC = CC - endif - LDOPTS += -rpath $(ABSOLUTE_LIB_DIR) - ifdef NS_USE_GCC - LDOPTS += -Wl,-rdata_shared - else - LDOPTS += -rdata_shared - endif -# For 6.x machines, include this flag - ifeq ($(basename $(OS_RELEASE)),6) - ifndef NS_USE_GCC - ifeq ($(USE_N32),1) - LDOPTS += -n32 - else - LDOPTS += -32 - endif - - ifeq ($(USE_PTHREADS), 1) - ifeq ($(OS_RELEASE), 6.2) - LDOPTS += -Wl,-woff,85 - endif - endif - endif - endif -endif - ifeq ($(OS_ARCH), HP-UX) LDOPTS += -z -Wl,+s,+b,$(ABSOLUTE_LIB_DIR) ifeq ($(USE_64),1) diff --git a/pr/tests/README.TXT b/pr/tests/README.TXT index 94349fa2..ebae6cdc 100644 --- a/pr/tests/README.TXT +++ b/pr/tests/README.TXT @@ -317,12 +317,6 @@ sockopt.c sprintf.c Tests sprintf. -sproc_ch.c - Obsolete. Tests IRIX sproc-based threads. - -sproc_p.c - Obsolete. Tests IRIX sproc-based threads. - stack.c Test atomic stack operations. diff --git a/pr/tests/attach.c b/pr/tests/attach.c index a1493b8e..d466644e 100644 --- a/pr/tests/attach.c +++ b/pr/tests/attach.c @@ -40,11 +40,6 @@ #elif defined(_PR_PTHREADS) #include <pthread.h> #include "md/_pth.h" -#elif defined(IRIX) -#include <sys/types.h> -#include <sys/prctl.h> -#include <sys/wait.h> -#include <errno.h> #elif defined(SOLARIS) #include <thread.h> #elif defined(OS2) @@ -103,8 +98,6 @@ static void Measure(void (*func)(void), const char *msg) #ifdef WIN32 static unsigned __stdcall threadStartFunc(void *arg) -#elif defined(IRIX) && !defined(_PR_PTHREADS) -static void threadStartFunc(void *arg) #elif defined(XP_BEOS) static int32 threadStartFunc(void *arg) #else @@ -113,9 +106,7 @@ static void * threadStartFunc(void *arg) { Measure(AttachDetach, "Attach/Detach"); -#ifndef IRIX return 0; -#endif } int main(int argc, char **argv) @@ -131,9 +122,6 @@ int main(int argc, char **argv) DWORD rv; unsigned threadID; HANDLE hThread; -#elif defined(IRIX) - int rv; - int threadID; #elif defined(OS2) int rv; TID threadID; @@ -262,30 +250,6 @@ int main(int argc, char **argv) goto exit_now; } -#elif defined(IRIX) - - threadID = sproc(threadStartFunc, PR_SALL, NULL); - if (threadID == -1) { - - fprintf(stderr, "thread creation failed: error code %d\n", - errno); - failed_already=1; - goto exit_now; - - } - else { - if (debug_mode) - printf ("thread creation succeeded \n"); - sleep(3); - goto exit_now; - } - rv = waitpid(threadID, NULL, 0); - if (debug_mode) PR_ASSERT(rv != -1); - else if (rv != -1) { - failed_already=1; - goto exit_now; - } - #elif defined(OS2) threadID = (TID) _beginthread((void *)threadStartFunc, NULL, diff --git a/pr/tests/foreign.c b/pr/tests/foreign.c index cfb2e56e..f4d80504 100644 --- a/pr/tests/foreign.c +++ b/pr/tests/foreign.c @@ -65,19 +65,6 @@ static void *pthread_start(void *arg) } /* pthread_start */ #endif /* defined(_PR_PTHREADS) */ -#if defined(IRIX) && !defined(_PR_PTHREADS) -#include <sys/types.h> -#include <sys/prctl.h> -static void sproc_start(void *arg, PRSize size) -{ - StartObject *so = (StartObject*)arg; - StartFn start = so->start; - void *data = so->arg; - PR_Free(so); - start(data); -} /* sproc_start */ -#endif /* defined(IRIX) && !defined(_PR_PTHREADS) */ - #if defined(WIN32) #include <windows.h> #include <process.h> /* for _beginthreadex() */ @@ -140,22 +127,8 @@ static PRStatus NSPRPUB_TESTS_CreateThread(StartFn start, void *arg) #endif /* defined(_PR_PTHREADS) */ case thread_sproc: -#if defined(IRIX) && !defined(_PR_PTHREADS) - { - PRInt32 pid; - StartObject *start_object; - start_object = PR_NEW(StartObject); - PR_ASSERT(NULL != start_object); - start_object->start = start; - start_object->arg = arg; - pid = sprocsp( - sproc_start, PR_SALL, start_object, NULL, 64 * 1024); - rv = (0 < pid) ? PR_SUCCESS : PR_FAILURE; - } -#else PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); rv = PR_FAILURE; -#endif /* defined(IRIX) && !defined(_PR_PTHREADS) */ break; case thread_win32: #if defined(WIN32) @@ -310,8 +283,6 @@ int main(int argc, char **argv) thread_provider = thread_win32; #elif defined(_PR_PTHREADS) thread_provider = thread_pthread; -#elif defined(IRIX) - thread_provider = thread_sproc; #else thread_provider = thread_nspr; #endif diff --git a/pr/tests/forktest.c b/pr/tests/forktest.c index 66dc6457..aeb22d50 100644 --- a/pr/tests/forktest.c +++ b/pr/tests/forktest.c @@ -217,13 +217,6 @@ int main(int argc, char **argv) printf("Fork succeeded. Parent process continues.\n"); DoIO(); if ((rv = waitpid(pid, &childStatus, 0)) != pid) { -#if defined(IRIX) && !defined(_PR_PTHREADS) - /* - * nspr may handle SIGCLD signal - */ - if ((rv < 0) && (errno == ECHILD)) { - } else -#endif { fprintf(stderr, "waitpid failed: %d\n", errno); failed_already = 1; @@ -240,10 +233,6 @@ int main(int argc, char **argv) } return failed_already; } else { -#if defined(IRIX) && !defined(_PR_PTHREADS) - extern void _PR_IRIX_CHILD_PROCESS(void); - _PR_IRIX_CHILD_PROCESS(); -#endif printf("Fork succeeded. Child process continues.\n"); DoIO(); printf("Child process exits.\n"); diff --git a/pr/tests/provider.c b/pr/tests/provider.c index 932241ec..75c7168a 100644 --- a/pr/tests/provider.c +++ b/pr/tests/provider.c @@ -621,19 +621,6 @@ static void *pthread_start(void *arg) } /* pthread_start */ #endif /* defined(_PR_PTHREADS) */ -#if defined(IRIX) && !defined(_PR_PTHREADS) -#include <sys/types.h> -#include <sys/prctl.h> -static void sproc_start(void *arg, PRSize size) -{ - StartObject *so = (StartObject*)arg; - StartFn start = so->start; - void *data = so->arg; - PR_Free(so); - start(data); -} /* sproc_start */ -#endif /* defined(IRIX) && !defined(_PR_PTHREADS) */ - #if defined(WIN32) #include <process.h> /* for _beginthreadex() */ @@ -721,22 +708,8 @@ static PRStatus NewThread( break; case thread_sproc: -#if defined(IRIX) && !defined(_PR_PTHREADS) - { - PRInt32 pid; - StartObject *start_object; - start_object = PR_NEW(StartObject); - PR_ASSERT(NULL != start_object); - start_object->start = start; - start_object->arg = arg; - pid = sprocsp( - sproc_start, PR_SALL, start_object, NULL, 64 * 1024); - rv = (0 < pid) ? PR_SUCCESS : PR_FAILURE; - } -#else PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); rv = PR_FAILURE; -#endif /* defined(IRIX) && !defined(_PR_PTHREADS) */ break; case thread_win32: #if defined(WIN32) @@ -1082,8 +1055,6 @@ int main(int argc, char **argv) thread_provider = thread_win32; #elif defined(_PR_PTHREADS) thread_provider = thread_pthread; -#elif defined(IRIX) - thread_provider = thread_sproc; #else thread_provider = thread_nspr; #endif diff --git a/pr/tests/runtests.sh b/pr/tests/runtests.sh index d021287b..c570bf86 100755 --- a/pr/tests/runtests.sh +++ b/pr/tests/runtests.sh @@ -36,8 +36,6 @@ fi #dceemu - used to tests special functions in NSPR for DCE emulation #ipv6 - IPV6 not in use by NSPR clients #mbcs - tests use of multi-byte charset for filenames. See BugZilla #25140 -#sproc_ch - obsolete; sproc-based tests for Irix -#sproc_p - obsolete; sproc-based tests for Irix #io_timeoutk - obsolete; subsumed in io_timeout #io_timeoutu - obsolete; subsumed in io_timeout #prftest1 - obsolete; subsumed by prftest diff --git a/pr/tests/sproc_ch.c b/pr/tests/sproc_ch.c deleted file mode 100644 index 0264b4ce..00000000 --- a/pr/tests/sproc_ch.c +++ /dev/null @@ -1,87 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -/* - * Test sproc_ch.c - * - * The purpose of this test and the sproc_p.c test is to test the shutdown - * of all the IRIX sprocs in a program when one of them dies due to an error. - * - * There are three sprocs in this test: the parent, the child, and the - * grandchild. The parent and child sprocs never stop on their own. - * The grandchild sproc gets a segmentation fault and dies. You should - * You should use "ps" to see if the parent and child sprocs are killed - * after the grandchild dies. - */ - -#include "prinit.h" -#include <stdio.h> - -#if !defined(IRIX) - -int main(int argc, char **argv) -{ - printf("This test applies to IRIX only.\n"); - return 0; -} - -#else /* IRIX */ - -#include "prthread.h" -#include <sys/types.h> -#include <unistd.h> - -void SegFault(void *unused) -{ - int *p = 0; - - printf("The grandchild sproc has pid %d.\n", getpid()); - printf("The grandchild sproc will get a segmentation fault and die.\n"); - printf("The parent and child sprocs should be killed after the " - "grandchild sproc dies.\n"); - printf("Use 'ps' to make sure this is so.\n"); - fflush(stdout); - /* Force a segmentation fault */ - *p = 0; -} - -void NeverStops(void *unused) -{ - int i = 0; - - printf("The child sproc has pid %d.\n", getpid()); - printf("The child sproc won't stop on its own.\n"); - fflush(stdout); - - /* create the grandchild sproc */ - PR_CreateThread(PR_USER_THREAD, SegFault, NULL, - PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_UNJOINABLE_THREAD, 0); - - while (1) { - i++; - } -} - -int main() -{ - int i= 0; - - PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0); - - printf("The parent sproc has pid %d.\n", getpid()); - printf("The parent sproc won't stop on its own.\n"); - fflush(stdout); - - /* create the child sproc */ - PR_CreateThread(PR_USER_THREAD, NeverStops, NULL, - PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_UNJOINABLE_THREAD, 0); - - while (1) { - i++; - } - return 0; -} - -#endif /* IRIX */ diff --git a/pr/tests/sproc_p.c b/pr/tests/sproc_p.c deleted file mode 100644 index 8911f1f5..00000000 --- a/pr/tests/sproc_p.c +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -/* - * Test sproc_p.c - * - * The purpose of this test and the sproc_ch.c test is to test the shutdown - * of all the IRIX sprocs in a program when one of them dies due to an error. - * - * In this test, the parent sproc gets a segmentation fault and dies. - * The child sproc never stops on its own. You should use "ps" to see if - * the child sproc is killed after the parent dies. - */ - -#include "prinit.h" -#include <stdio.h> - -#if !defined(IRIX) - -int main(int argc, char **argv) -{ - printf("This test applies to IRIX only.\n"); - return 0; -} - -#else /* IRIX */ - -#include "prthread.h" -#include <sys/types.h> -#include <unistd.h> - -void NeverStops(void *unused) -{ - int i = 0; - - printf("The child sproc has pid %d.\n", getpid()); - printf("The child sproc won't stop on its own.\n"); - fflush(stdout); - - /* I never stop */ - while (1) { - i++; - } -} - -int main() -{ - int *p = 0; - - PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0); - - printf("The parent sproc has pid %d.\n", getpid()); - printf("The parent sproc will first create a child sproc.\n"); - printf("Then the parent sproc will get a segmentation fault and die.\n"); - printf("The child sproc should be killed after the parent sproc dies.\n"); - printf("Use 'ps' to make sure this is so.\n"); - fflush(stdout); - - PR_CreateThread(PR_USER_THREAD, NeverStops, NULL, - PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD, PR_UNJOINABLE_THREAD, 0); - - /* Force a segmentation fault */ - *p = 0; - return 0; -} - -#endif /* IRIX */ diff --git a/tools/Makefile.in b/tools/Makefile.in index 22faf203..29f19d94 100644 --- a/tools/Makefile.in +++ b/tools/Makefile.in @@ -65,10 +65,6 @@ ifneq ($(OS_ARCH), WINNT) PWD = $(shell pwd) endif -ifeq ($(OS_ARCH), IRIX) -LDOPTS += -rpath $(PWD)/$(dist_libdir) -endif - ifeq ($(OS_ARCH), HP-UX) LDOPTS += -Wl,+s,+b,$(PWD)/$(dist_libdir) endif |