jim 98/11/25 05:45:21
Added: nsprpub/pr/include/md _aux3.cfg _aux3.h nsprpub/pr/src/md/unix aux3.c Removed: nsprpub/pr/include/md _aux.cfg _aux.h nsprpub/pr/src/md/unix aux.c Log: Rename of files. aux -> aux3 to avoid conflicts Revision Changes Path 1.1 apache-2.0/nsprpub/pr/include/md/_aux3.cfg Index: _aux3.cfg =================================================================== /* -*- 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.0 (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. */ #ifndef nspr_cpucfg___ #define nspr_cpucfg___ #ifndef XP_UNIX #define XP_UNIX #endif #ifndef AUX #define AUX #endif #undef IS_LITTLE_ENDIAN #define IS_BIG_ENDIAN 1 #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_ALIGN_OF_SHORT 2 #define PR_ALIGN_OF_INT 2 #define PR_ALIGN_OF_LONG 2 #define PR_ALIGN_OF_INT64 2 #define PR_ALIGN_OF_FLOAT 2 #define PR_ALIGN_OF_DOUBLE 2 #define PR_ALIGN_OF_POINTER 2 #define PR_BYTES_PER_WORD_LOG2 2 #define PR_BYTES_PER_DWORD_LOG2 3 #undef HAVE_LONG_LONG /* * XXX These two macros need to be investigated for different architectures. */ #undef HAVE_ALIGNED_DOUBLES #undef 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___ */ 1.1 apache-2.0/nsprpub/pr/include/md/_aux3.h Index: _aux3.h =================================================================== /* -*- 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.0 (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. */ #ifndef nspr_aux_defs_h___ #define nspr_aux_defs_h___ /* * Internal configuration macros */ #define PR_LINKER_ARCH "aux" #define _PR_SI_SYSNAME "A/UX" #define _PR_SI_ARCHITECTURE "m68k" #define _PR_VMBASE 0x30000000 #define _PR_STACK_VMBASE 0x50000000 #define _MD_DEFAULT_STACK_SIZE 65536L #undef HAVE_DLL #undef USE_DLFCN #define PR_DLL_SUFFIX "" #define _PR_RECV_BROKEN /* recv doesn't work on Unix Domain Sockets */ #if !defined (HAVE_STRERROR) #define HAVE_STRERROR #endif #ifndef HAVE_WEAK_IO_SYMBOLS #define HAVE_WEAK_IO_SYMBOLS #endif #undef HAVE_STACK_GROWING_UP #define HAVE_NETCONFIG #define NEED_STRFTIME_LOCK #define NEED_TIME_R #define NEED_LOCALTIME_R #define NEED_GMTIME_R #define NEED_ASCTIME_R #define NEED_STRTOK_R #define NEED_CTIME_R #define _PR_NEED_STRCASECMP #define USE_SETJMP #include <setjmp.h> #define _SETJMP setjmp #define _LONGJMP longjmp #define _PR_CONTEXT_TYPE jmp_buf #define _MD_GET_SP(_t) (_t)->md.context[4] #define _PR_NUM_GCREGS _JBLEN #define CONTEXT(_th) ((_th)->md.context) /* ** Initialize the thread context preparing it to execute _main. */ #define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \ { \ *status = PR_TRUE; \ if(_SETJMP(CONTEXT(_thread))) (*_main)(); \ _MD_GET_SP(_thread) = (int) ((_sp) - 128); \ } #define _MD_SWITCH_CONTEXT(_thread) \ if (!_SETJMP(CONTEXT(_thread))) { \ (_thread)->md.errcode = errno; \ _PR_Schedule(); \ } /* ** Restore a thread context, saved by _MD_SWITCH_CONTEXT */ #define _MD_RESTORE_CONTEXT(_thread) \ { \ errno = (_thread)->md.errcode; \ _MD_SET_CURRENT_THREAD(_thread); \ _LONGJMP(CONTEXT(_thread), 1); \ } /* Machine-dependent (MD) data structures. * Don't use SVR4 native threads (yet). */ struct _MDThread { _PR_CONTEXT_TYPE context; int id; int errcode; }; struct _MDThreadStack { PRInt8 notused; }; struct _MDLock { PRInt8 notused; }; struct _MDSemaphore { PRInt8 notused; }; struct _MDCVar { PRInt8 notused; }; struct _MDSegment { PRInt8 notused; }; struct _MDCPU { struct _MDCPU_Unix md_unix; }; #define _MD_INIT_LOCKS() #define _MD_NEW_LOCK(lock) PR_SUCCESS #define _MD_FREE_LOCK(lock) #define _MD_LOCK(lock) #define _MD_UNLOCK(lock) #define _MD_INIT_IO() #define _MD_IOQ_LOCK() #define _MD_IOQ_UNLOCK() /* * The following are copied from _sunos.h, _aix.h. This means * some of them should probably be moved into _unixos.h. But * _irix.h seems to be quite different in regard to these macros. */ #define _MD_GET_INTERVAL _PR_UNIX_GetInterval #define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond #define _MD_EARLY_INIT _MD_EarlyInit #define _MD_FINAL_INIT _PR_UnixInit #define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu) #define _MD_INIT_THREAD _MD_InitializeThread #define _MD_EXIT_THREAD(thread) #define _MD_SUSPEND_THREAD(thread) #define _MD_RESUME_THREAD(thread) #define _MD_CLEAN_THREAD(_thread) /* * We wrapped the select() call. _MD_SELECT refers to the built-in, * unwrapped version. */ #include <sys/time.h> #include <sys/types.h> extern int _select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *execptfds, struct timeval *timeout); #define _MD_SELECT _select /* #define _MD_POLL _poll extern int _poll(struct pollfd *fds, unsigned long nfds, int timeout); */ #endif /* nspr_aux_defs_h */ 1.1 apache-2.0/nsprpub/pr/src/md/unix/aux3.c Index: aux3.c =================================================================== /* -*- 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.0 (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. */ /* * A/UX 3.1.1 - cloned from NCR */ #include "primpl.h" #include <setjmp.h> void _MD_EarlyInit(void) { } PRWord *_MD_HomeGCRegisters(PRThread *t, int isCurrent, int *np) { if (isCurrent) { (void) setjmp(CONTEXT(t)); } *np = sizeof(CONTEXT(t)) / sizeof(PRWord); return (PRWord *) CONTEXT(t); } #ifdef ALARMS_BREAK_TCP /* I don't think they do */ PRInt32 _MD_connect(PRInt32 osfd, const PRNetAddr *addr, PRInt32 addrlen, PRIntervalTime timeout) { PRInt32 rv; _MD_BLOCK_CLOCK_INTERRUPTS(); rv = _connect(osfd,addr,addrlen); _MD_UNBLOCK_CLOCK_INTERRUPTS(); } PRInt32 _MD_accept(PRInt32 osfd, PRNetAddr *addr, PRInt32 addrlen, PRIntervalTime timeout) { PRInt32 rv; _MD_BLOCK_CLOCK_INTERRUPTS(); rv = _accept(osfd,addr,addrlen); _MD_UNBLOCK_CLOCK_INTERRUPTS(); return(rv); } #endif /* * These are also implemented in pratom.c using NSPR locks. Any reason * this might be better or worse? If you like this better, define * _PR_HAVE_ATOMIC_OPS in include/md/unixware.h */ #ifdef _PR_HAVE_ATOMIC_OPS /* Atomic operations */ #include <stdio.h> static FILE *_uw_semf; void _MD_INIT_ATOMIC(void) { /* Sigh. Sure wish SYSV semaphores weren't such a pain to use */ if ((_uw_semf = tmpfile()) == NULL) PR_ASSERT(0); return; } void _MD_ATOMIC_INCREMENT(PRInt32 *val) { flockfile(_uw_semf); (*val)++; unflockfile(_uw_semf); } void _MD_ATOMIC_DECREMENT(PRInt32 *val) { flockfile(_uw_semf); (*val)--; unflockfile(_uw_semf); } void _MD_ATOMIC_SET(PRInt32 *val, PRInt32 newval) { flockfile(_uw_semf); *val = newval; unflockfile(_uw_semf); } #endif 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 A/UX */ void _MD_YIELD(void) { PR_NOT_REACHED("_MD_YIELD should not be called for A/UX."); } PRStatus _MD_CREATE_THREAD( PRThread *thread, void (*start) (void *), PRUintn priority, PRThreadScope scope, PRThreadState state, PRUint32 stackSize) { PR_NOT_REACHED("_MD_CREATE_THREAD should not be called for A/UX."); return PR_FAILURE; } /* This is temp. replacement for localtime_r. Normally PR_ExplodeTime should be used as to my understanding */ /* ** $$$$$ THEN WHY ARE WE DOING THIS? - AOF $$$$$ */ #define NEED_LOCALTIME_R #define NEED_GMTIME_R #define NEED_ASCTIME_R #define NEED_STRTOK_R #define NEED_CTIME_R #if defined (NEED_LOCALTIME_R) || defined (NEED_CTIME_R) || defined (NEED_ASCTIME_R) || defined (NEED_GMTIME_R) || defined (NEED_STRTOK_R) #include "prlock.h" #endif #if defined (NEED_LOCALTIME_R) static PRLock *localtime_r_monitor = NULL; struct tm *localtime_r (const time_t *clock, struct tm *result) { struct tm *tmPtr; int needLock = PR_Initialized(); /* We need to use a lock to protect * against NSPR threads only when the * NSPR thread system is activated. */ if (needLock) { if (localtime_r_monitor == NULL) { localtime_r_monitor = PR_NewLock(); } PR_Lock(localtime_r_monitor); } /* * On Windows, localtime() returns a NULL pointer if 'clock' * represents a time before midnight January 1, 1970. In * that case, we also return a NULL pointer and the struct tm * object pointed to by 'result' is not modified. */ tmPtr = localtime(clock); if (tmPtr) { *result = *tmPtr; } else { result = NULL; } if (needLock) PR_Unlock(localtime_r_monitor); return result; } #endif #if defined (NEED_GMTIME_R) static PRLock *gmtime_r_monitor = NULL; struct tm *gmtime_r (const time_t *clock, struct tm *result) { struct tm *tmPtr; int needLock = PR_Initialized(); /* We need to use a lock to protect * against NSPR threads only when the * NSPR thread system is activated. */ if (needLock) { if (gmtime_r_monitor == NULL) { gmtime_r_monitor = PR_NewLock(); } PR_Lock(gmtime_r_monitor); } tmPtr = gmtime(clock); if (tmPtr) { *result = *tmPtr; } else { result = NULL; } if (needLock) PR_Unlock(gmtime_r_monitor); return result; } #endif #if defined (NEED_CTIME_R) static PRLock *ctime_r_monitor = NULL; char *ctime_r (const time_t *clock, char *buf, int buflen) { char *cbuf; int needLock = PR_Initialized(); /* We need to use a lock to protect * against NSPR threads only when the * NSPR thread system is activated. */ if (needLock) { if (ctime_r_monitor == NULL) { ctime_r_monitor = PR_NewLock(); } PR_Lock(ctime_r_monitor); } cbuf = ctime (clock); if (cbuf) { strncpy (buf, cbuf, buflen - 1); buf[buflen - 1] = 0; } if (needLock) PR_Unlock(ctime_r_monitor); return cbuf; } #endif #if defined (NEED_ASCTIME_R) static PRLock *asctime_r_monitor = NULL; char *asctime_r (const struct tm *tm, char *buf, int buflen) { char *cbuf; int needLock = PR_Initialized(); /* We need to use a lock to protect * against NSPR threads only when the * NSPR thread system is activated. */ if (needLock) { if (asctime_r_monitor == NULL) { asctime_r_monitor = PR_NewLock(); } PR_Lock(asctime_r_monitor); } cbuf = asctime (tm); if (cbuf) { strncpy (buf, cbuf, buflen - 1); buf[buflen - 1] = 0; } if (needLock) PR_Unlock(asctime_r_monitor); return cbuf; } #endif #if defined (NEED_STRTOK_R) char * strtok_r (s, delim, last) register char *s; register const char *delim; register char **last; { register char *spanp; register int c, sc; char *tok; if (s == NULL && (s = *last) == NULL) return (NULL); /* * Skip (span) leading delimiters (s += strspn(s, delim), sort of). */ cont: c = *s++; for (spanp = (char *)delim; (sc = *spanp++) != 0;) { if (c == sc) goto cont; } if (c == 0) { /* no non-delimiter characters */ *last = NULL; return (NULL); } tok = s - 1; /* * Scan token (scan for delimiters: s += strcspn(s, delim), sort of). * Note that delim must have one NUL; we stop if we see that, too. */ for (;;) { c = *s++; spanp = (char *)delim; do { if ((sc = *spanp++) == c) { if (c == 0) s = NULL; else s[-1] = 0; *last = s; return (tok); } } while (sc != 0); } /* NOTREACHED */ } #endif