diff options
author | srinivas%netscape.com <devnull@localhost> | 1999-05-19 00:53:52 +0000 |
---|---|---|
committer | srinivas%netscape.com <devnull@localhost> | 1999-05-19 00:53:52 +0000 |
commit | 7c0041fa568c1ae538c87f0fb2f495c39218c878 (patch) | |
tree | 2dbc5b2e0b5e377fec8ea29478822dff6c83b24f | |
parent | a9a702ec4120438d5721df28bcc3db078437c25c (diff) | |
download | nspr-hg-7c0041fa568c1ae538c87f0fb2f495c39218c878.tar.gz |
OpenVMS port; checkin for "Colin R. Blake" <colin@theblakes.com>.
-rw-r--r-- | config/OpenVMS.mk | 8 | ||||
-rw-r--r-- | lib/ds/plevent.c | 81 | ||||
-rw-r--r-- | lib/prstreams/prstrms.cpp | 4 | ||||
-rw-r--r-- | pr/include/md/_openvms.cfg | 4 | ||||
-rw-r--r-- | pr/include/md/_openvms.h | 30 | ||||
-rw-r--r-- | pr/include/md/_pth.h | 9 | ||||
-rw-r--r-- | pr/include/md/_unixos.h | 4 | ||||
-rw-r--r-- | pr/include/md/prosdep.h | 3 | ||||
-rw-r--r-- | pr/include/obsolete/protypes.h | 11 | ||||
-rw-r--r-- | pr/src/Makefile | 4 | ||||
-rw-r--r-- | pr/src/io/prpolevt.c | 2 | ||||
-rw-r--r-- | pr/src/md/unix/Makefile | 7 | ||||
-rw-r--r-- | pr/src/md/unix/objs.mk | 7 | ||||
-rw-r--r-- | pr/src/md/unix/openvms.c | 189 | ||||
-rw-r--r-- | pr/src/md/unix/unix.c | 2 | ||||
-rw-r--r-- | pr/src/pthreads/ptio.c | 17 | ||||
-rw-r--r-- | pr/src/pthreads/ptthread.c | 10 | ||||
-rw-r--r-- | pr/tests/op_filok.c | 4 |
18 files changed, 358 insertions, 38 deletions
diff --git a/config/OpenVMS.mk b/config/OpenVMS.mk index ca5005a7..12ba6178 100644 --- a/config/OpenVMS.mk +++ b/config/OpenVMS.mk @@ -23,18 +23,18 @@ include $(MOD_DEPTH)/config/UNIX.mk ifdef INTERNAL_TOOLS CC = c89 +CCC = cxx OPTIMIZER = -O else CC = ccc +CCC = ccc endif RANLIB = /bin/true CPU_ARCH_TAG = _$(CPU_ARCH) -NON_LD_FLAGS = -ieee_with_inexact - -OS_CFLAGS = -DOSF1 -DVMS +OS_CFLAGS = -DVMS # The command to build a shared library in POSIX on OpenVMS. -MKSHLIB = c89 -wl,share +XXXMKSHLIB = c89 -Wl,share diff --git a/lib/ds/plevent.c b/lib/ds/plevent.c index 4d42e93a..5ac6aaf5 100644 --- a/lib/ds/plevent.c +++ b/lib/ds/plevent.c @@ -50,6 +50,18 @@ typedef MPARAM WPARAM,LPARAM; #include "private/primpl.h" #endif /* XP_MAC */ +#if defined(VMS) +/* +** On OpenVMS, XtAppAddInput doesn't want a regular fd, instead it +** wants an event flag. So, we don't create and use a pipe for +** notification of when an event queue has something ready, instead +** we use an event flag. Shouldn't be a problem if we only have +** a few event queues. +*/ +#include <lib$routines.h> +#include <starlet.h> +#include <stsdef.h> +#endif /* VMS */ static PRLogModuleInfo *event_lm = NULL; @@ -75,7 +87,10 @@ struct PLEventQueue { PRThread* handlerThread; EventQueueType type; PRBool processingEvents; -#if defined(XP_UNIX) +#if defined(VMS) + int efn; + int notifyCount; +#elif defined(XP_UNIX) PRInt32 eventPipe[2]; int notifyCount; #elif defined(_WIN32) || defined(WIN16) @@ -585,7 +600,26 @@ _pl_SetupNativeNotifier(PLEventQueue* self) #pragma unused (self) #endif -#if defined(XP_UNIX) +#if defined(VMS) + { +#ifdef VMS_USE_GETEF + unsigned int status; + status = LIB$GET_EF(&self->efn); + if (!$VMS_STATUS_SUCCESS(status)) + return PR_FAILURE; +#else + static int next_event_flag = 2; + if (next_event_flag <= 23) { + self->efn = next_event_flag++; + } + else { + printf("ERROR: Out of event flags\n"); + return PR_FAILURE; + } +#endif + return PR_SUCCESS; + } +#elif defined(XP_UNIX) int err; int flags; @@ -629,7 +663,14 @@ _pl_CleanupNativeNotifier(PLEventQueue* self) #pragma unused (self) #endif -#if defined(XP_UNIX) +#if defined(VMS) +#ifdef VMS_USE_GETEF + { + unsigned int status; + status = LIB$FREE_EF(&self->efn); + } +#endif /* VMS_USE_GETEF */ +#elif defined(XP_UNIX) close(self->eventPipe[0]); close(self->eventPipe[1]); #endif @@ -655,7 +696,20 @@ _pl_NativeNotify(PLEventQueue* self) }/* --- end _pl_NativeNotify() --- */ #endif /* XP_OS2 */ -#if defined(XP_UNIX) +#if defined(VMS) +/* Just set the event flag */ +static PRStatus +_pl_NativeNotify(PLEventQueue* self) +{ + unsigned int status; + status = SYS$SETEF(self->efn); + self->notifyCount++; + if ($VMS_STATUS_SUCCESS(status)) + return PR_SUCCESS; + else + return PR_FAILURE; +}/* --- end _pl_NativeNotify() --- */ +#elif defined(XP_UNIX) static PRStatus _pl_NativeNotify(PLEventQueue* self) { @@ -690,7 +744,20 @@ _pl_NativeNotify(PLEventQueue* self) static PRStatus _pl_AcknowledgeNativeNotify(PLEventQueue* self) { -#if defined(XP_UNIX) +#if defined(VMS) +/* Clear the event flag if we're all done */ +/* NOTE that we might want to always clear the event flag, even if the */ +/* notifyCount says we shouldn't. */ + if (self->notifyCount <= 0) return PR_SUCCESS; + self->notifyCount--; + if (self->notifyCount == 0) { + unsigned int status; + status = SYS$CLREF(self->efn); + if (!$VMS_STATUS_SUCCESS(status)) + return PR_FAILURE; + } + return PR_SUCCESS; +#elif defined(XP_UNIX) PRInt32 count; unsigned char c; @@ -720,7 +787,9 @@ PL_GetEventQueueSelectFD(PLEventQueue* self) if (self == NULL) return -1; -#if defined(XP_UNIX) +#if defined(VMS) + return self->efn; +#elif defined(XP_UNIX) return self->eventPipe[0]; #else return -1; /* other platforms don't handle this (yet) */ diff --git a/lib/prstreams/prstrms.cpp b/lib/prstreams/prstrms.cpp index 7c9972a8..00c641bc 100644 --- a/lib/prstreams/prstrms.cpp +++ b/lib/prstreams/prstrms.cpp @@ -45,6 +45,10 @@ #define _PRSTR_BP bp #define _PRSTR_DELBUF(x) delbuf(x) #define _PRSTR_DELBUF_C(c, x) c::_PRSTR_DELBUF(x) +#elif defined(VMS) +#undef _PRSTR_BP /* as nothing */ +#define _PRSTR_DELBUF(x) /* as nothing */ +#define _PRSTR_DELBUF_C(c, x) /* as nothing */ #elif defined(OSF1) #define _PRSTR_BP m_psb #define _PRSTR_DELBUF(x) /* as nothing */ diff --git a/pr/include/md/_openvms.cfg b/pr/include/md/_openvms.cfg index b1bc96a4..b9dd6d97 100644 --- a/pr/include/md/_openvms.cfg +++ b/pr/include/md/_openvms.cfg @@ -23,10 +23,6 @@ #define XP_UNIX #endif -#ifndef OSF1 -#define OSF1 -#endif - #ifndef VMS #define VMS #endif diff --git a/pr/include/md/_openvms.h b/pr/include/md/_openvms.h index 4de41431..ebc12887 100644 --- a/pr/include/md/_openvms.h +++ b/pr/include/md/_openvms.h @@ -34,12 +34,28 @@ #define _PR_SI_ARCHITECTURE "alpha" #else #define _PR_SI_ARCHITECTURE "vax" -endif -#define PR_DLL_SUFFIX ".so" +#endif +#define PR_DLL_SUFFIX ".exe" #define _PR_VMBASE 0x30000000 #define _PR_STACK_VMBASE 0x50000000 #define _MD_DEFAULT_STACK_SIZE 131072L + +/* +** This is not defined on OpenVMS. I believe its only used in GC code, and +** isn't that only used in Java? Anyway, for now, let's keep the compiler +** happy. +*/ +#define SA_RESTART 0 + +/* +** OpenVMS doesn't have these in socket.h. +*/ +struct ip_mreq { + struct in_addr imr_multiaddr; /* IP multicast address of group */ + struct in_addr imr_interface; /* local IP address of interface */ +}; + /* * OSF1 needs the MAP_FIXED flag to ensure that mmap returns a pointer * with the upper 32 bits zero. This is because Java sticks a pointer @@ -50,16 +66,17 @@ endif #undef HAVE_STACK_GROWING_UP #undef HAVE_WEAK_IO_SYMBOLS #undef HAVE_WEAK_MALLOC_SYMBOLS -#undef HAVE_DLL #undef HAVE_BSD_FLOCK #define NEED_TIME_R + +#undef HAVE_DLL #undef USE_DLFCN #define _PR_POLL_AVAILABLE #define _PR_USE_POLL #define _PR_STAT_HAS_ONLY_ST_ATIME -#define _PR_HAVE_LARGE_OFF_T +#define _PR_NO_LARGE_FILES #undef USE_SETJMP @@ -197,9 +214,7 @@ struct _MDCPU { #define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond #define _MD_EARLY_INIT _MD_EarlyInit -#ifdef __VMS void _MD_EarlyInit(void); -#endif #define _MD_FINAL_INIT _PR_UnixInit #define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu) #define _MD_INIT_THREAD _MD_InitializeThread @@ -237,4 +252,7 @@ PR_EXTERN(void) _PR_MD_START_INTERRUPTS(void); #define _MD_ATOMIC_DECREMENT(val) (__ATOMIC_DECREMENT_LONG(val) - 1) #define _MD_ATOMIC_SET(val, newval) __ATOMIC_EXCH_LONG(val, newval) +extern int thread_suspend(PRThread *thr_id); +extern int thread_resume(PRThread *thr_id); + #endif /* nspr_openvms_defs_h___ */ diff --git a/pr/include/md/_pth.h b/pr/include/md/_pth.h index fec73471..280542cb 100644 --- a/pr/include/md/_pth.h +++ b/pr/include/md/_pth.h @@ -92,7 +92,8 @@ #define PTHREAD_COPY_THR_HANDLE(st, dt) (dt) = (st) #elif defined(IRIX) || defined(OSF1) || defined(AIX) || defined(SOLARIS) \ || defined(HPUX) || defined(LINUX) || defined(FREEBSD) \ - || defined(NETBSD) || defined(OPENBSD) || defined(BSDI) + || defined(NETBSD) || defined(OPENBSD) || defined(BSDI) \ + || defined(VMS) #define PTHREAD_ZERO_THR_HANDLE(t) (t) = 0 #define PTHREAD_THR_HANDLE_IS_ZERO(t) (t) == 0 #define PTHREAD_COPY_THR_HANDLE(st, dt) (dt) = (st) @@ -152,11 +153,11 @@ */ #if (defined(AIX) && !defined(AIX4_3)) || defined(LINUX) \ || defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD) \ - || defined(BSDI) + || defined(BSDI) || defined(VMS) #define PT_NO_SIGTIMEDWAIT #endif -#if defined(OSF1) +#if defined(OSF1) || defined(VMS) #define PT_PRIO_MIN PRI_OTHER_MIN #define PT_PRIO_MAX PRI_OTHER_MAX #elif defined(IRIX) @@ -209,7 +210,7 @@ */ #if defined(_PR_DCETHREADS) #define PTHREAD_YIELD() pthread_yield() -#elif defined(OSF1) +#elif defined(OSF1) || defined(VMS) /* * sched_yield can't be called from a signal handler. Must use * the _np version. diff --git a/pr/include/md/_unixos.h b/pr/include/md/_unixos.h index fb5fea17..10b3c6be 100644 --- a/pr/include/md/_unixos.h +++ b/pr/include/md/_unixos.h @@ -568,7 +568,11 @@ typedef PRInt64 _MDOff64_t; typedef PRIntn (*_MD_Fstat64)(PRIntn osfd, _MDStat64 *buf); typedef PRIntn (*_MD_Open64)(const char *path, int oflag, ...); +#if defined(VMS) +typedef PRIntn (*_MD_Stat64)(const char *path, _MDStat64 *buf, ...); +#else typedef PRIntn (*_MD_Stat64)(const char *path, _MDStat64 *buf); +#endif typedef _MDOff64_t (*_MD_Lseek64)(PRIntn osfd, _MDOff64_t, PRIntn whence); typedef void* (*_MD_Mmap64)( void *addr, PRSize len, PRIntn prot, PRIntn flags, diff --git a/pr/include/md/prosdep.h b/pr/include/md/prosdep.h index 6b5c6744..39f8abee 100644 --- a/pr/include/md/prosdep.h +++ b/pr/include/md/prosdep.h @@ -113,6 +113,9 @@ PR_BEGIN_EXTERN_C #elif defined(QNX) #include "md/_qnx.h" +#elif defined(VMS) +#include "md/_openvms.h" + #else #error unknown Unix flavor diff --git a/pr/include/obsolete/protypes.h b/pr/include/obsolete/protypes.h index 8eb492d4..d1875b7b 100644 --- a/pr/include/obsolete/protypes.h +++ b/pr/include/obsolete/protypes.h @@ -39,7 +39,14 @@ typedef PRIntn intn; #include <support/SupportDefs.h> -#else /* XP_BEOS */ +#elif VMS +/* + * OpenVMS already defines the integer types below in its standard + * header files ints.h and types.h. + */ +#include <ints.h> +#include <types.h> +#else /* SVR4 typedef of uint is commonly found on UNIX machines. */ #ifdef XP_UNIX @@ -84,7 +91,7 @@ typedef PRInt8 int8; #endif /* HPUX */ #endif /* AIX4_3 */ -#endif /* XP_BEOS */ +#endif /* XP_BEOS VMS */ typedef PRFloat64 float64; typedef PRUptrdiff uptrdiff_t; diff --git a/pr/src/Makefile b/pr/src/Makefile index f37545da..ae988c03 100644 --- a/pr/src/Makefile +++ b/pr/src/Makefile @@ -91,6 +91,10 @@ endif endif endif +ifeq ($(OS_ARCH),OpenVMS) +OS_LIBS = -lvms_jackets +endif + ifeq ($(OS_ARCH),OSF1) ifeq ($(USE_PTHREADS), 1) OS_LIBS = -lpthread -lrt diff --git a/pr/src/io/prpolevt.c b/pr/src/io/prpolevt.c index 9df2d81a..5151afd1 100644 --- a/pr/src/io/prpolevt.c +++ b/pr/src/io/prpolevt.c @@ -32,7 +32,7 @@ typedef struct MyFilePrivate { PRFilePrivate *oldSecret; } MyFilePrivate; -#ifndef XP_UNIX +#if !defined(XP_UNIX) || defined(VMS) #define USE_TCP_SOCKETPAIR #endif diff --git a/pr/src/md/unix/Makefile b/pr/src/md/unix/Makefile index 9d887b6a..0f7b3da6 100644 --- a/pr/src/md/unix/Makefile +++ b/pr/src/md/unix/Makefile @@ -74,6 +74,10 @@ HPUX_CSRCS = \ hpux.c \ $(NULL) +OPENVMS_CSRCS = \ + openvms.c \ + $(NULL) + OSF1_CSRCS = \ osf1.c \ $(NULL) @@ -156,6 +160,9 @@ endif ifeq ($(OS_ARCH),HP-UX) CSRCS += $(HPUX_CSRCS) endif +ifeq ($(OS_ARCH),OpenVMS) +CSRCS += $(OPENVMS_CSRCS) +endif ifeq ($(OS_ARCH),OSF1) CSRCS += $(OSF1_CSRCS) endif diff --git a/pr/src/md/unix/objs.mk b/pr/src/md/unix/objs.mk index c87d4b88..390e3531 100644 --- a/pr/src/md/unix/objs.mk +++ b/pr/src/md/unix/objs.mk @@ -70,6 +70,10 @@ OSF1_CSRCS = \ osf1.c \ $(NULL) +OPENVMS_CSRCS = \ + openvms.c \ + $(NULL) + LINUX_CSRCS = \ linux.c \ $(NULL) @@ -151,6 +155,9 @@ CSRCS += $(HPUX_CSRCS) endif ifeq ($(OS_ARCH),OSF1) CSRCS += $(OSF1_CSRCS) +endi: +ifeq ($(OS_ARCH),OpenVMS) +CSRCS += $(OPENVMS_CSRCS) endif ifeq ($(OS_ARCH),Linux) CSRCS += $(LINUX_CSRCS) diff --git a/pr/src/md/unix/openvms.c b/pr/src/md/unix/openvms.c new file mode 100644 index 00000000..d81abeca --- /dev/null +++ b/pr/src/md/unix/openvms.c @@ -0,0 +1,189 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* + * The contents of this file are subject to the Netscape Public License + * Version 1.1 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ + +#include "primpl.h" + +void _MD_EarlyInit(void) +{ +} + +PRWord *_MD_HomeGCRegisters(PRThread *t, int isCurrent, int *np) +{ +#ifndef _PR_PTHREADS + if (isCurrent) { + (void) setjmp(CONTEXT(t)); + } + *np = sizeof(CONTEXT(t)) / sizeof(PRWord); + return (PRWord *) CONTEXT(t); +#else + *np = 0; + return NULL; +#endif +} + +#ifndef _PR_PTHREADS +void +_MD_SET_PRIORITY(_MDThread *thread, PRUintn newPri) +{ + return; +} + +PRStatus +_MD_InitializeThread(PRThread *thread) +{ + return PR_SUCCESS; +} + +PRStatus +_MD_WAIT(PRThread *thread, PRIntervalTime ticks) +{ + PR_ASSERT(!(thread->flags & _PR_GLOBAL_SCOPE)); + _PR_MD_SWITCH_CONTEXT(thread); + return PR_SUCCESS; +} + +PRStatus +_MD_WAKEUP_WAITER(PRThread *thread) +{ + if (thread) { + PR_ASSERT(!(thread->flags & _PR_GLOBAL_SCOPE)); + } + return PR_SUCCESS; +} + +/* These functions should not be called for OSF1 */ +void +_MD_YIELD(void) +{ + PR_NOT_REACHED("_MD_YIELD should not be called for OSF1."); +} + +PRStatus +_MD_CREATE_THREAD( + PRThread *thread, + void (*start) (void *), + PRThreadPriority priority, + PRThreadScope scope, + PRThreadState state, + PRUint32 stackSize) +{ + PR_NOT_REACHED("_MD_CREATE_THREAD should not be called for OSF1."); + return PR_FAILURE; +} +#endif /* ! _PR_PTHREADS */ + +#ifdef _PR_HAVE_ATOMIC_CAS + +#include <c_asm.h> + +#define _PR_OSF_ATOMIC_LOCK 1 + +void +PR_StackPush(PRStack *stack, PRStackElem *stack_elem) +{ +long locked; + + do { + while ((long) stack->prstk_head.prstk_elem_next == + _PR_OSF_ATOMIC_LOCK) + ; + locked = __ATOMIC_EXCH_QUAD(&stack->prstk_head.prstk_elem_next, + _PR_OSF_ATOMIC_LOCK); + + } while (locked == _PR_OSF_ATOMIC_LOCK); + stack_elem->prstk_elem_next = (PRStackElem *) locked; + /* + * memory-barrier instruction + */ + asm("mb"); + stack->prstk_head.prstk_elem_next = stack_elem; +} + +PRStackElem * +PR_StackPop(PRStack *stack) +{ +PRStackElem *element; +long locked; + + do { + while ((long)stack->prstk_head.prstk_elem_next == _PR_OSF_ATOMIC_LOCK) + ; + locked = __ATOMIC_EXCH_QUAD(&stack->prstk_head.prstk_elem_next, + _PR_OSF_ATOMIC_LOCK); + + } while (locked == _PR_OSF_ATOMIC_LOCK); + + element = (PRStackElem *) locked; + + if (element == NULL) { + stack->prstk_head.prstk_elem_next = NULL; + } else { + stack->prstk_head.prstk_elem_next = + element->prstk_elem_next; + } + /* + * memory-barrier instruction + */ + asm("mb"); + return element; +} +#endif /* _PR_HAVE_ATOMIC_CAS */ + + +/* +** thread_suspend and thread_resume are used by the gc code +** in nsprpub/pr/src/pthreads/ptthread.c +** +** These routines are never called for the current thread, and +** there is no check for that - so beware! +*/ +int thread_suspend(PRThread *thr_id) { + + extern int pthread_suspend_np ( + pthread_t thread, + __pthreadLongUint_t *regs, + void *spare); + + __pthreadLongUint_t regs[34]; + int res; + + /* + ** A return res < 0 indicates that the thread was suspended + ** but register information could not be obtained + */ + + res = pthread_suspend_np(thr_id->id,®s[0],0); + if (res==0) + thr_id->sp = (void *) regs[30]; + + thr_id->suspend |= PT_THREAD_SUSPENDED; + + /* Always succeeds */ + return 0; +} + +int thread_resume(PRThread *thr_id) { + extern int pthread_resume_np(pthread_t thread); + int res; + + res = pthread_resume_np (thr_id->id); + + thr_id->suspend |= PT_THREAD_RESUMED; + + return 0; +} diff --git a/pr/src/md/unix/unix.c b/pr/src/md/unix/unix.c index 85c7c0de..c4731823 100644 --- a/pr/src/md/unix/unix.c +++ b/pr/src/md/unix/unix.c @@ -52,7 +52,7 @@ #define _PRSockLen_t int #elif (defined(AIX) && !defined(AIX4_1)) || defined(FREEBSD) \ || defined(NETBSD) || defined(OPENBSD) || defined(UNIXWARE) \ - || defined(DGUX) + || defined(DGUX) || defined(VMS) #define _PRSockLen_t size_t #else #error "Cannot determine architecture" diff --git a/pr/src/pthreads/ptio.c b/pr/src/pthreads/ptio.c index 01a289a9..b44c45fd 100644 --- a/pr/src/pthreads/ptio.c +++ b/pr/src/pthreads/ptio.c @@ -123,7 +123,7 @@ static ssize_t (*pt_aix_sendfile_fptr)() = NULL; #if defined(SOLARIS) #define _PRSockOptVal_t char * #elif defined(IRIX) || defined(OSF1) || defined(AIX) || defined(HPUX) \ - || defined(LINUX) || defined(FREEBSD) || defined(BSDI) + || defined(LINUX) || defined(FREEBSD) || defined(BSDI) || defined(VMS) #define _PRSockOptVal_t void * #else #error "Cannot determine architecture" @@ -137,7 +137,7 @@ static ssize_t (*pt_aix_sendfile_fptr)() = NULL; || defined(OSF1) || defined(SOLARIS) \ || defined(HPUX10_30) || defined(HPUX11) || defined(LINUX) \ || defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD) \ - || defined(BSDI) + || defined(BSDI) || defined(VMS) #define _PRSelectFdSetArg_t fd_set * #else #error "Cannot determine architecture" @@ -201,7 +201,8 @@ static PRBool IsValidNetAddrLen(const PRNetAddr *addr, PRInt32 addr_len) && !defined(__alpha)) typedef socklen_t pt_SockLen; #elif (defined(AIX) && !defined(AIX4_1)) \ - || (defined(LINUX) && defined(__alpha)) + || (defined(LINUX) && defined(__alpha)) \ + || defined(VMS) typedef PRSize pt_SockLen; #else typedef PRIntn pt_SockLen; @@ -2813,7 +2814,7 @@ static PRIOMethods _pr_socketpollfd_methods = { #if defined(HPUX) || defined(OSF1) || defined(SOLARIS) || defined (IRIX) \ || defined(AIX) || defined(LINUX) || defined(FREEBSD) || defined(NETBSD) \ - || defined(OPENBSD) || defined(BSDI) + || defined(OPENBSD) || defined(BSDI) || defined(VMS) #define _PR_FCNTL_FLAGS O_NONBLOCK #else #error "Can't determine architecture" @@ -3707,21 +3708,21 @@ PR_IMPLEMENT(PRStatus) PR_UnlockFile(PRFileDesc *fd) PRInt32 PR_GetSysfdTableMax(void) { -#if defined(XP_UNIX) && !defined(AIX) +#if defined(XP_UNIX) && !defined(AIX) && !defined(VMS) struct rlimit rlim; if ( getrlimit(RLIMIT_NOFILE, &rlim) < 0) return -1; return rlim.rlim_max; -#elif defined(AIX) +#elif defined(AIX) || defined(VMS) return sysconf(_SC_OPEN_MAX); #endif } PRInt32 PR_SetSysfdTableSize(PRIntn table_size) { -#if defined(XP_UNIX) && !defined(AIX) +#if defined(XP_UNIX) && !defined(AIX) && !defined(VMS) struct rlimit rlim; PRInt32 tableMax = PR_GetSysfdTableMax(); @@ -3738,7 +3739,7 @@ PRInt32 PR_SetSysfdTableSize(PRIntn table_size) return -1; return rlim.rlim_cur; -#elif defined(AIX) +#elif defined(AIX) || defined(VMS) return -1; #endif } diff --git a/pr/src/pthreads/ptthread.c b/pr/src/pthreads/ptthread.c index 4aacf9b0..6e06e652 100644 --- a/pr/src/pthreads/ptthread.c +++ b/pr/src/pthreads/ptthread.c @@ -1146,7 +1146,7 @@ static void suspend_signal_handler(PRIntn sig) while (me->suspend & PT_THREAD_SUSPENDED) { #if !defined(FREEBSD) && !defined(NETBSD) && !defined(OPENBSD) \ - && !defined(BSDI) /*XXX*/ + && !defined(BSDI) && !defined(VMS) /*XXX*/ PRIntn rv; sigwait(&sigwait_set, &rv); #endif @@ -1190,7 +1190,11 @@ static void PR_SuspendSet(PRThread *thred) PR_LOG(_pr_gc_lm, PR_LOG_ALWAYS, ("doing pthread_kill in PR_SuspendSet thred %X tid = %X\n", thred, thred->id)); +#if defined(VMS) + rv = thread_suspend(thred); +#else rv = pthread_kill (thred->id, SIGUSR2); +#endif PR_ASSERT(0 == rv); } @@ -1244,8 +1248,12 @@ PR_IMPLEMENT(void) PR_ResumeSet(PRThread *thred) thred->suspend &= ~PT_THREAD_SUSPENDED; #if defined(PT_NO_SIGTIMEDWAIT) +#if defined(VMS) + thread_resume(thred); +#else pthread_kill(thred->id, SIGUSR1); #endif +#endif } /* PR_ResumeSet */ diff --git a/pr/tests/op_filok.c b/pr/tests/op_filok.c index 2e47844e..a7e33fdd 100644 --- a/pr/tests/op_filok.c +++ b/pr/tests/op_filok.c @@ -46,7 +46,9 @@ * The name of a file that is guaranteed to exist * on every machine of a particular OS. */ -#ifdef XP_UNIX +#ifdef VMS +#define EXISTING_FILENAME "SYS$LOGIN:LOGIN.COM" +#elif XP_UNIX #define EXISTING_FILENAME "/bin/sh" #elif defined(WIN32) #define EXISTING_FILENAME "c:/autoexec.bat" |