diff options
Diffstat (limited to 'pr/include/md')
30 files changed, 426 insertions, 246 deletions
diff --git a/pr/include/md/Makefile.in b/pr/include/md/Makefile.in index 316c4540..5f8f0f71 100644 --- a/pr/include/md/Makefile.in +++ b/pr/include/md/Makefile.in @@ -46,21 +46,22 @@ CONFIGS = $(wildcard $(srcdir)/*.cfg) include $(topsrcdir)/config/rules.mk export:: $(MDCPUCFG_H) - $(INSTALL) -m 444 $(srcdir)/$(MDCPUCFG_H) $(dist_includedir) $(INSTALL) -m 444 $(CONFIGS) $(HEADERS) $(dist_includedir)/md -ifneq ($(OS_ARCH),OpenVMS) - mv -f $(dist_includedir)/$(MDCPUCFG_H) $(dist_includedir)/prcpucfg.h + $(INSTALL) -m 444 $(srcdir)/$(MDCPUCFG_H) $(dist_includedir) +ifeq ($(OS_ARCH),OpenVMS) +# On OpenVMS mv updates the file's modified time, so we create a hard link. + cd $(dist_includedir); \ + if test ! -f prcpucfg.h; then \ + dcl set file /enter=prcpucfg.h $(MDCPUCFG_H); \ + fi else -# mv'ing a link causes the file itself to move, not the link. - rm -f $(dist_includedir)/$(MDCPUCFG_H) - rm -f $(dist_includedir)/prcpucfg.h - ln -fs $(srcdir)/$(MDCPUCFG_H) $(dist_includedir)/prcpucfg.h + mv -f $(dist_includedir)/$(MDCPUCFG_H) $(dist_includedir)/prcpucfg.h endif real_install:: $(NSINSTALL) -D $(DESTDIR)$(includedir)/md cp $(srcdir)/$(MDCPUCFG_H) $(DESTDIR)$(includedir)/prcpucfg.h - $(NSINSTALL) -t -m 644 $(CONFIG) $(HEADERS) $(DESTDIR)$(includedir)/md + $(NSINSTALL) -t -m 644 $(HEADERS) $(DESTDIR)$(includedir)/md release:: export @echo "Copying machine-dependent prcpucfg.h" diff --git a/pr/include/md/_aix.h b/pr/include/md/_aix.h index d8d79eeb..2ef0fc1d 100644 --- a/pr/include/md/_aix.h +++ b/pr/include/md/_aix.h @@ -57,7 +57,8 @@ #define _PR_VMBASE 0x30000000 #define _PR_STACK_VMBASE 0x50000000 -#define _MD_DEFAULT_STACK_SIZE 65536L +#define _MD_DEFAULT_STACK_SIZE (2*65536L) +#define _MD_MINIMUM_STACK_SIZE (2*65536L) #define _MD_MMAP_FLAGS MAP_PRIVATE #define NEED_TIME_R @@ -71,6 +72,7 @@ #define _PR_USE_POLL #define _PR_STAT_HAS_ONLY_ST_ATIME #ifdef _PR_INET6 +#define _PR_HAVE_INET_NTOP #define _PR_HAVE_GETHOSTBYNAME2 #endif #define _PR_HAVE_SYSV_SEMAPHORES @@ -243,4 +245,6 @@ struct _MDCPU { #define _MD_POLL poll #endif +extern void _MD_aix_map_sendfile_error(int err); + #endif /* nspr_aix_defs_h___ */ diff --git a/pr/include/md/_aix32.cfg b/pr/include/md/_aix32.cfg index 8047bb98..0bf01957 100644 --- a/pr/include/md/_aix32.cfg +++ b/pr/include/md/_aix32.cfg @@ -134,6 +134,9 @@ #define BYTES_PER_DWORD_LOG2 PR_BYTES_PER_DWORD_LOG2 #define WORDS_PER_DWORD_LOG2 PR_WORDS_PER_DWORD_LOG2 +/* used by protypes.h only */ +#define _PR_AIX_HAVE_BSD_INT_TYPES + #endif /* NO_NSPR_10_SUPPORT */ #endif /* nspr_cpucfg___ */ diff --git a/pr/include/md/_aix32in6.cfg b/pr/include/md/_aix32in6.cfg deleted file mode 100644 index 0bf01957..00000000 --- a/pr/include/md/_aix32in6.cfg +++ /dev/null @@ -1,142 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* - * The contents of this file are subject to the Mozilla Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is the Netscape Portable Runtime (NSPR). - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998-2000 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the - * terms of the GNU General Public License Version 2 or later (the - * "GPL"), in which case the provisions of the GPL are applicable - * instead of those above. If you wish to allow use of your - * version of this file only under the terms of the GPL and not to - * allow others to use your version of this file under the MPL, - * indicate your decision by deleting the provisions above and - * replace them with the notice and other provisions required by - * the GPL. If you do not delete the provisions above, a recipient - * may use your version of this file under either the MPL or the - * GPL. - */ - -#ifndef nspr_cpucfg___ -#define nspr_cpucfg___ - -#ifndef XP_UNIX -#define XP_UNIX -#endif - -#ifndef AIX -#define AIX -#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_BYTES_PER_WORD_LOG2 2 -#define PR_BYTES_PER_DWORD_LOG2 3 - -#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 4 -#define PR_ALIGN_OF_LONG 4 -#define PR_ALIGN_OF_INT64 8 -#define PR_ALIGN_OF_FLOAT 4 -#define PR_ALIGN_OF_DOUBLE 4 -#define PR_ALIGN_OF_POINTER 4 - -#define HAVE_LONG_LONG -#undef HAVE_ALIGNED_DOUBLES -#undef HAVE_ALIGNED_LONGLONGS - -#define PR_AF_INET6 24 /* same as AF_INET6 */ - -#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 - -/* used by protypes.h only */ -#define _PR_AIX_HAVE_BSD_INT_TYPES - -#endif /* NO_NSPR_10_SUPPORT */ - -#endif /* nspr_cpucfg___ */ diff --git a/pr/include/md/_beos.h b/pr/include/md/_beos.h index 232fea3c..1f69bd66 100644 --- a/pr/include/md/_beos.h +++ b/pr/include/md/_beos.h @@ -51,6 +51,10 @@ * Internal configuration macros */ +#ifdef BONE_VERSION +#define _PR_HAVE_SOCKADDR_LEN +#endif + #define PR_LINKER_ARCH "beos" #define _PR_SI_SYSNAME "BEOS" #ifdef __powerpc__ @@ -87,6 +91,7 @@ #define _PR_HAVE_PEEK_BUFFER #define _PR_PEEK_BUFFER_MAX (16 * 1024) #define _PR_FD_NEED_EMULATE_MSG_PEEK(fd) 1 +#define _PR_CONNECT_DOES_NOT_BIND /* Define threading functions and objects as native BeOS */ struct _MDThread { @@ -141,17 +146,21 @@ struct _MDSegment { ** File- and directory-related definitions */ +#ifndef BONE_VERSION #define BE_SOCK_SHUTDOWN_READ 0x01 #define BE_SOCK_SHUTDOWN_WRITE 0x02 +#endif struct _MDFileDesc { PRInt32 osfd; PRInt32 sock_state; PRBool accepted_socket; PRNetAddr peer_addr; +#ifndef BONE_VERSION PRBool connectValueValid; int connectReturnValue; int connectReturnError; +#endif }; struct _MDDir { @@ -175,14 +184,17 @@ struct _MDFileMap { * Network related definitions. */ +#ifndef BONE_VERSION #define IPPROTO_IP 0 #define AF_UNIX 2 #define TCP_NODELAY SO_NONBLOCK #define SO_LINGER -1 #define SO_ERROR 4 +#endif #define _PR_INTERRUPT_CHECK_INTERVAL_SECS 5 +#ifndef BONE_VERSION /* these aren't actually used. if they are, we're screwed */ struct protoent { char *p_name; /* official protocol name */ @@ -192,6 +204,7 @@ struct protoent { struct protoent* getprotobyname(const char* name); struct protoent* getprotobynumber(int number); +#endif /* * malloc() related definitions. @@ -304,6 +317,7 @@ struct protoent* getprotobynumber(int number); #define _MD_READ_DIR _MD_read_dir #define _MD_CLOSE_DIR _MD_close_dir #define _MD_MAKE_NONBLOCK _MD_make_nonblock +#define _MD_SET_FD_INHERITABLE _MD_set_fd_inheritable #define _MD_INIT_FD_INHERITABLE _MD_init_fd_inheritable #define _MD_QUERY_FD_INHERITABLE _MD_query_fd_inheritable #define _MD_OPEN _MD_open @@ -509,7 +523,7 @@ NSPR_API(PRInt32) _MD_open(const char *name, PRIntn osflags, PRIntn mode); NSPR_API(PRInt32) _MD_close_file(PRInt32 osfd); NSPR_API(PRInt32) _MD_read(PRFileDesc *fd, void *buf, PRInt32 amount); NSPR_API(PRInt32) _MD_write(PRFileDesc *fd, const void *buf, PRInt32 amount); -NSPR_API(PRInt32) _MD_writev(PRFileDesc *fd, struct PRIOVec *iov, PRInt32 iov_size, PRIntervalTime timeout); +NSPR_API(PRInt32) _MD_writev(PRFileDesc *fd, const PRIOVec *iov, PRInt32 iov_size, PRIntervalTime timeout); NSPR_API(PRInt32) _MD_lseek(PRFileDesc *fd, PRInt32 offset, int whence); NSPR_API(PRInt64) _MD_lseek64(PRFileDesc *fd, PRInt64 offset, int whence); NSPR_API(PRInt32) _MD_fsync(PRFileDesc *fd); diff --git a/pr/include/md/_bsdi.h b/pr/include/md/_bsdi.h index c529649f..346f1049 100644 --- a/pr/include/md/_bsdi.h +++ b/pr/include/md/_bsdi.h @@ -39,6 +39,8 @@ * Internal configuration macros */ +#include <sys/param.h> /* for _BSDI_VERSION */ + #define PR_LINKER_ARCH "bsdi" #define _PR_SI_SYSNAME "BSDI" #if defined(__i386__) @@ -61,6 +63,15 @@ #define USE_SETJMP +/* BSD/OS 4.3 and newer all have IPv6 support */ +#if _BSDI_VERSION >= 200105 +#define _PR_INET6 +#define _PR_HAVE_INET_NTOP +#define _PR_HAVE_GETIPNODEBYNAME +#define _PR_HAVE_GETIPNODEBYADDR +#define _PR_INET6_PROBE +#endif + #ifndef _PR_PTHREADS #include <setjmp.h> diff --git a/pr/include/md/_darwin.cfg b/pr/include/md/_darwin.cfg index d06492b8..22fc1083 100644 --- a/pr/include/md/_darwin.cfg +++ b/pr/include/md/_darwin.cfg @@ -39,10 +39,6 @@ #define XP_UNIX #endif -#ifndef DARWIN -#define DARWIN -#endif - #define PR_AF_INET6 30 /* same as AF_INET6 */ #if defined(i386) diff --git a/pr/include/md/_darwin.h b/pr/include/md/_darwin.h index d262849c..bad90a65 100644 --- a/pr/include/md/_darwin.h +++ b/pr/include/md/_darwin.h @@ -61,6 +61,40 @@ #define _PR_NO_LARGE_FILES #define PR_HAVE_SYSV_NAMED_SHARED_MEMORY +#define _PR_INET6 +/* + * I'd prefer to use getipnodebyname and getipnodebyaddr but the + * getipnodebyname(3) man page on Mac OS X 10.2 says they are not + * thread-safe. AI_V4MAPPED|AI_ADDRCONFIG doesn't work either. + */ +#define _PR_HAVE_GETHOSTBYNAME2 +/* + * On Mac OS X 10.2, gethostbyaddr fails with h_errno=NO_RECOVERY + * if you pass an IPv4-mapped IPv6 address to it. + */ +#define _PR_GHBA_DISALLOW_V4MAPPED +/* socket(AF_INET6) fails with EPROTONOSUPPORT on Mac OS X 10.1. */ +#if MACOS_DEPLOYMENT_TARGET < 100200 +#define _PR_INET6_PROBE +#endif +/* Mac OS X 10.2 has inet_ntop and inet_pton. */ +#if MACOS_DEPLOYMENT_TARGET >= 100200 +#define _PR_HAVE_INET_NTOP +#endif + +#if defined(__ppc__) +#define _PR_HAVE_ATOMIC_OPS +#define _MD_INIT_ATOMIC() +extern PRInt32 _PR_DarwinPPC_AtomicIncrement(PRInt32 *val); +#define _MD_ATOMIC_INCREMENT(val) _PR_DarwinPPC_AtomicIncrement(val) +extern PRInt32 _PR_DarwinPPC_AtomicDecrement(PRInt32 *val); +#define _MD_ATOMIC_DECREMENT(val) _PR_DarwinPPC_AtomicDecrement(val) +extern PRInt32 _PR_DarwinPPC_AtomicSet(PRInt32 *val, PRInt32 newval); +#define _MD_ATOMIC_SET(val, newval) _PR_DarwinPPC_AtomicSet(val, newval) +extern PRInt32 _PR_DarwinPPC_AtomicAdd(PRInt32 *ptr, PRInt32 val); +#define _MD_ATOMIC_ADD(ptr, val) _PR_DarwinPPC_AtomicAdd(ptr, val) +#endif /* __ppc__ */ + #define USE_SETJMP #if !defined(_PR_PTHREADS) diff --git a/pr/include/md/_freebsd.cfg b/pr/include/md/_freebsd.cfg index ad04ca20..7177478d 100644 --- a/pr/include/md/_freebsd.cfg +++ b/pr/include/md/_freebsd.cfg @@ -43,16 +43,16 @@ #define FREEBSD #endif +#define PR_AF_INET6 28 /* same as AF_INET6 */ + +#if defined(__i386__) + #define IS_LITTLE_ENDIAN 1 #undef IS_BIG_ENDIAN #define HAVE_LONG_LONG #undef HAVE_ALIGNED_DOUBLES #undef HAVE_ALIGNED_LONGLONGS -#define PR_AF_INET6 28 /* same as AF_INET6 */ - -#if defined(__i386__) - #define PR_BYTES_PER_BYTE 1 #define PR_BYTES_PER_SHORT 2 #define PR_BYTES_PER_INT 4 @@ -98,6 +98,7 @@ #define HAVE_LONG_LONG #define HAVE_ALIGNED_DOUBLES #define HAVE_ALIGNED_LONGLONGS +#define IS_64 #define PR_BYTES_PER_BYTE 1 #define PR_BYTES_PER_SHORT 2 diff --git a/pr/include/md/_freebsd.h b/pr/include/md/_freebsd.h index 0671b60f..68542336 100644 --- a/pr/include/md/_freebsd.h +++ b/pr/include/md/_freebsd.h @@ -37,6 +37,9 @@ #include "prthread.h" +#if __FreeBSD__ >= 2 +#include <osreldate.h> /* for __FreeBSD_version */ +#endif #include <sys/syscall.h> #define PR_LINKER_ARCH "freebsd" @@ -65,19 +68,33 @@ #define _PR_HAVE_SOCKADDR_LEN #define _PR_STAT_HAS_ST_ATIMESPEC #define _PR_NO_LARGE_FILES -#if ( __FreeBSD__ > 2 ) -#if !defined(_PR_PTHREADS) + +#if defined(_PR_PTHREADS) +#if __FreeBSD_version >= 400008 /* - * libc_r doesn't have poll(). Although libc has poll(), it is not - * thread-safe so we can't use it in the pthreads version. + * libc_r before this version of FreeBSD doesn't have poll(). + * Although libc has poll(), it is not thread-safe so we can't + * use it in the pthreads version. */ #define _PR_POLL_AVAILABLE +#endif +#else +#if __FreeBSD_version >= 300000 +#define _PR_POLL_AVAILABLE #define _PR_USE_POLL #endif #endif + #define _PR_HAVE_SYSV_SEMAPHORES #define PR_HAVE_SYSV_NAMED_SHARED_MEMORY +#if __FreeBSD_version >= 400014 +#define _PR_INET6 +#define _PR_HAVE_INET_NTOP +#define _PR_HAVE_GETHOSTBYNAME2 +#define _PR_INET6_PROBE +#endif + #define USE_SETJMP #ifndef _PR_PTHREADS diff --git a/pr/include/md/_hpux.h b/pr/include/md/_hpux.h index c83e7c3c..2341d973 100644 --- a/pr/include/md/_hpux.h +++ b/pr/include/md/_hpux.h @@ -46,7 +46,14 @@ #define _PR_VMBASE 0x30000000 #define _PR_STACK_VMBASE 0x50000000 -#define _MD_DEFAULT_STACK_SIZE 65536L +/* + * _USE_BIG_FDS increases the size of fd_set from 256 bytes to + * about 7500 bytes. PR_Poll allocates three fd_sets on the + * stack, so it is safer to also increase the default thread + * stack size. + */ +#define _MD_DEFAULT_STACK_SIZE (2*65536L) +#define _MD_MINIMUM_STACK_SIZE (2*65536L) #define _MD_MMAP_FLAGS MAP_PRIVATE #define NEED_TIME_R @@ -55,19 +62,16 @@ #undef HAVE_WEAK_IO_SYMBOLS #undef HAVE_WEAK_MALLOC_SYMBOLS #define HAVE_DLL +#ifdef IS_64 +#define USE_DLFCN +#else #define USE_HPSHL +#endif #ifndef HAVE_STRERROR #define HAVE_STRERROR #endif #define _PR_POLL_AVAILABLE #define _PR_USE_POLL -/* - * OSF1 and HPUX report the POLLHUP event for a socket when the - * shutdown(SHUT_WR) operation is called for the remote end, even though - * the socket is still writeable. Use select(), instead of poll(), to - * workaround this problem. - */ -#define _PR_POLL_WITH_SELECT #define _PR_STAT_HAS_ONLY_ST_ATIME #define _PR_HAVE_POSIX_SEMAPHORES #define PR_HAVE_POSIX_NAMED_SHARED_MEMORY @@ -75,6 +79,13 @@ #undef _PR_HAVE_ATOMIC_OPS +#ifdef _PR_INET6 +#define _PR_HAVE_INET_NTOP +#define _PR_HAVE_GETIPNODEBYNAME +#define _PR_HAVE_GETIPNODEBYADDR +#define _PR_INET6_PROBE +#endif + #if !defined(_PR_PTHREADS) #include <syscall.h> diff --git a/pr/include/md/_hpux64.cfg b/pr/include/md/_hpux64.cfg index bacd0272..338e3016 100644 --- a/pr/include/md/_hpux64.cfg +++ b/pr/include/md/_hpux64.cfg @@ -82,8 +82,8 @@ #define PR_ALIGN_OF_SHORT 2 #define PR_ALIGN_OF_INT 4 -#define PR_ALIGN_OF_LONG 4 -#define PR_ALIGN_OF_INT64 4 +#define PR_ALIGN_OF_LONG 8 +#define PR_ALIGN_OF_INT64 8 #define PR_ALIGN_OF_FLOAT 4 #define PR_ALIGN_OF_DOUBLE 8 #define PR_ALIGN_OF_POINTER 8 diff --git a/pr/include/md/_irix.h b/pr/include/md/_irix.h index 09067002..5e7b624c 100644 --- a/pr/include/md/_irix.h +++ b/pr/include/md/_irix.h @@ -78,6 +78,12 @@ #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 +#endif + /* Initialization entry points */ NSPR_API(void) _MD_EarlyInit(void); #define _MD_EARLY_INIT _MD_EarlyInit diff --git a/pr/include/md/_linux.cfg b/pr/include/md/_linux.cfg index 301f4590..70f1f9d7 100644 --- a/pr/include/md/_linux.cfg +++ b/pr/include/md/_linux.cfg @@ -414,6 +414,97 @@ #define PR_BYTES_PER_WORD_LOG2 2 #define PR_BYTES_PER_DWORD_LOG2 3 +#elif defined(__s390__) + +#define IS_BIG_ENDIAN 1 +#undef IS_LITTLE_ENDIAN + +#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 4 +#define PR_ALIGN_OF_LONG 4 +#define PR_ALIGN_OF_INT64 4 +#define PR_ALIGN_OF_FLOAT 4 +#define PR_ALIGN_OF_DOUBLE 4 +#define PR_ALIGN_OF_POINTER 4 +#define PR_ALIGN_OF_WORD 4 + +#define PR_BYTES_PER_WORD_LOG2 2 +#define PR_BYTES_PER_DWORD_LOG2 3 + +#elif defined(__s390x__) + +#define IS_BIG_ENDIAN 1 +#undef IS_LITTLE_ENDIAN +#define IS_64 + +#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_ALIGN_OF_SHORT 2 +#define PR_ALIGN_OF_INT 4 +#define PR_ALIGN_OF_LONG 8 +#define PR_ALIGN_OF_INT64 8 +#define PR_ALIGN_OF_FLOAT 4 +#define PR_ALIGN_OF_DOUBLE 8 +#define PR_ALIGN_OF_POINTER 8 +#define PR_ALIGN_OF_WORD 8 + +#define PR_BYTES_PER_WORD_LOG2 3 +#define PR_BYTES_PER_DWORD_LOG2 3 + #else #error "Unknown CPU architecture" diff --git a/pr/include/md/_linux.h b/pr/include/md/_linux.h index 86ea248c..df2cfd40 100644 --- a/pr/include/md/_linux.h +++ b/pr/include/md/_linux.h @@ -59,6 +59,10 @@ #define _PR_SI_ARCHITECTURE "mips" #elif defined(__arm__) #define _PR_SI_ARCHITECTURE "arm" +#elif defined(__s390__) +#define _PR_SI_ARCHITECTURE "s390" +#elif defined(__s390x__) +#define _PR_SI_ARCHITECTURE "s390x" #else #error "Unknown CPU architecture" #endif @@ -118,6 +122,7 @@ extern PRInt32 _PR_ia64_AtomicSet(PRInt32 *val, PRInt32 newval); #endif #if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) #define _PR_INET6 +#define _PR_HAVE_INET_NTOP #define _PR_HAVE_GETHOSTBYNAME2 #define _PR_INET6_PROBE #endif @@ -470,4 +475,6 @@ extern int __syscall_poll(struct pollfd *ufds, unsigned long int nfds, /* For writev() */ #include <sys/uio.h> +extern void _MD_linux_map_sendfile_error(int err); + #endif /* nspr_linux_defs_h___ */ diff --git a/pr/include/md/_macos.h b/pr/include/md/_macos.h index f1f0f8aa..90eb07db 100644 --- a/pr/include/md/_macos.h +++ b/pr/include/md/_macos.h @@ -65,6 +65,7 @@ #include <Errors.h> #include <OpenTransport.h> +#include <DriverServices.h> #define _PR_HAVE_PEEK_BUFFER #define _PR_PEEK_BUFFER_MAX (16 * 1024) @@ -105,7 +106,9 @@ struct _MDSegment { }; struct _MDCPU { - PRInt8 notused; + AbsoluteTime lastThreadSwitch; + AbsoluteTime lastWakeUpProcess; + PRBool trackScheduling; }; typedef struct _MDSocketCallerInfo { @@ -114,19 +117,22 @@ typedef struct _MDSocketCallerInfo { } _MDSocketCallerInfo; struct _MDFileDesc { - PRInt32 osfd; - PRBool orderlyDisconnect; - PRBool readReady; - PRBool writeReady; - PRBool exceptReady; - PRLock * miscLock; - - /* Server sockets: listen bit tells the notifier func what to do */ - PRBool doListen; - - _MDSocketCallerInfo misc; - _MDSocketCallerInfo read; - _MDSocketCallerInfo write; + PRInt32 osfd; + PRPackedBool orderlyDisconnect; + PRPackedBool readReady; + PRPackedBool writeReady; + PRPackedBool exceptReady; + PRLock * miscLock; + + /* Server sockets: listen bit tells the notifier func what to do */ + PRBool doListen; + + /* stored error for non-blocking connects, as a Unix-style error code */ + OTReason disconnectError; + + _MDSocketCallerInfo misc; + _MDSocketCallerInfo read; + _MDSocketCallerInfo write; }; /* @@ -172,7 +178,7 @@ extern void _MD_SetIntsOff(PRInt32 ints); #define _MD_CLEANUP_BEFORE_EXIT() #define _MD_EXIT(status) exit(status) #define _MD_INIT_CPUS() -#define _MD_INIT_RUNNING_CPU(cpu) +#define _MD_INIT_RUNNING_CPU(cpu) _MD_InitRunningCPU(cpu) /* ** Process Related definitions @@ -296,16 +302,20 @@ extern PRStatus _MD_InitThread(PRThread *thread); ** context switch because it might have changed. */ /* ResetTimer(); before _PR_Schedule() */ -#define _MD_SWITCH_CONTEXT(_thread) \ - PR_BEGIN_MACRO \ - PR_ASSERT(_thread->no_sched); \ - if (!setjmp(_thread->md.jb)) { \ - _MD_SET_LAST_THREAD(_thread); \ - _PR_Schedule(); \ - } else { \ - PR_ASSERT(_MD_LAST_THREAD() !=_MD_CURRENT_THREAD()); \ - _MD_LAST_THREAD()->no_sched = 0; \ - } \ + + +#define _MD_SWITCH_CONTEXT(_thread) \ + PR_BEGIN_MACRO \ + PR_ASSERT(_thread->no_sched); \ + if (!setjmp(_thread->md.jb)) { \ + _MD_SET_LAST_THREAD(_thread); \ + if (_PR_MD_CURRENT_CPU()->md.trackScheduling) \ + _PR_MD_CURRENT_CPU()->md.lastThreadSwitch = UpTime(); \ + _PR_Schedule(); \ + } else { \ + PR_ASSERT(_MD_LAST_THREAD() !=_MD_CURRENT_THREAD()); \ + _MD_LAST_THREAD()->no_sched = 0; \ + } \ PR_END_MACRO /* @@ -473,6 +483,7 @@ extern PRStatus _MD_setsockopt(PRFileDesc *fd, PRInt32 level, PRInt32 optname, c */ extern PRStatus _MD_gethostname(char *name, int namelen); #define _MD_GETHOSTNAME _MD_gethostname +#define _PR_GET_HOST_ADDR_AS_NAME /* XXX _MD_WRITEV, _MD_SHUTDOWN & _MD_GETPEERNAME not done yet!!! @@ -514,7 +525,6 @@ extern PRStatus _MD_gethostname(char *name, int namelen); ** Time Related definitions */ -#define kMacTimerInMiliSecs 8L #define _MD_GET_INTERVAL _MD_GetInterval #define _MD_INTERVAL_PER_SEC() PR_MSEC_PER_SEC #define _MD_INTERVAL_INIT() @@ -647,7 +657,7 @@ extern PRStatus _MD_CloseFileMap(struct PRFileMap *fmap); #define _MD_CLOSE_FILE_MAP _MD_CloseFileMap extern void SetLogFileTypeCreator(const char *logFile); -extern int _MD_mac_get_nonblocking_connect_error(PRInt32 osfd); +extern int _MD_mac_get_nonblocking_connect_error(PRFileDesc* fd); /* @@ -681,6 +691,18 @@ extern void LeaveCritialRegion(); #endif + +/* + * CPU Idle support + */ + +extern void InitIdleSemaphore(); +extern void TermIdleSemaphore(); + +extern void WaitOnIdleSemaphore(); +extern void SignalIdleSemaphore(); + + /* * Atomic operations */ diff --git a/pr/include/md/_netbsd.h b/pr/include/md/_netbsd.h index 1e70994d..0ccc2399 100644 --- a/pr/include/md/_netbsd.h +++ b/pr/include/md/_netbsd.h @@ -80,6 +80,7 @@ #if __NetBSD_Version__ >= 105000000 #define _PR_INET6 +#define _PR_HAVE_INET_NTOP #define _PR_HAVE_GETHOSTBYNAME2 #define _PR_INET6_PROBE #endif diff --git a/pr/include/md/_nto.h b/pr/include/md/_nto.h index de6b8033..cd6213bf 100644 --- a/pr/include/md/_nto.h +++ b/pr/include/md/_nto.h @@ -212,4 +212,6 @@ struct _MDCPU { */ #define _MD_SELECT select +#define SA_RESTART 0 + #endif /* nspr_nto_defs_h___ */ diff --git a/pr/include/md/_openvms.h b/pr/include/md/_openvms.h index b0a2af6f..4b3fb92a 100644 --- a/pr/include/md/_openvms.h +++ b/pr/include/md/_openvms.h @@ -97,6 +97,7 @@ struct ip_mreq { #define _PR_USE_POLL #define _PR_STAT_HAS_ONLY_ST_ATIME #define _PR_NO_LARGE_FILES +#define _PR_STRICT_ADDR_LEN /* IPv6 support */ #ifdef _SOCKADDR_LEN @@ -105,7 +106,9 @@ struct ip_mreq { #define _PR_HAVE_GETIPNODEBYNAME #define _PR_HAVE_GETIPNODEBYADDR #define _PR_INET6_PROBE -#ifndef _PR_INET6 +#ifdef _PR_INET6 +#define _PR_HAVE_INET_NTOP +#else #define AF_INET6 26 #define AI_V4MAPPED 0x00000010 #define AI_ALL 0x00000008 diff --git a/pr/include/md/_os2.h b/pr/include/md/_os2.h index d98262d1..dc50982a 100644 --- a/pr/include/md/_os2.h +++ b/pr/include/md/_os2.h @@ -47,18 +47,45 @@ #include <errno.h> +#ifdef XP_OS2_VACPP +/* TODO RAMSEMs need to be written for GCC/EMX */ +#define USE_RAMSEM +#endif + +#ifdef USE_RAMSEM +#pragma pack(4) + +#pragma pack(2) +typedef struct _RAMSEM +{ + ULONG ulTIDPID; + ULONG hevSem; + ULONG cLocks; + USHORT cWaiting; + USHORT cPosts; +} RAMSEM, *PRAMSEM; + +typedef struct _CRITICAL_SECTION +{ + ULONG ulReserved[4]; /* Same size as RAMSEM */ +} CRITICAL_SECTION, *PCRITICAL_SECTION, *LPCRITICAL_SECTION; +#pragma pack(4) + +APIRET _Optlink SemRequest486(PRAMSEM, ULONG); +APIRET _Optlink SemReleasex86(PRAMSEM, ULONG); +#endif + #ifdef XP_OS2_EMX /* * EMX-specific tweaks: - * o Use stricmp instead of strcmpi. * o Use errno rather than sock_errno() * o Use close rather than soclose * o Ignore sock_init calls. */ -#define strcmpi stricmp #define sock_errno() errno #define soclose close #define sock_init() +#include <string.h> #endif /* @@ -162,7 +189,11 @@ struct _MDNotified { }; struct _MDLock { - HMTX mutex; /* this is recursive on NT */ +#ifdef USE_RAMSEM + CRITICAL_SECTION mutex; /* this is recursive on NT */ +#else + HMTX mutex; /* this is recursive on NT */ +#endif /* * When notifying cvars, there is no point in actually @@ -258,7 +289,7 @@ extern void _MD_MakeNonblock(PRFileDesc *f); #define _MD_INIT_FD_INHERITABLE (_PR_MD_INIT_FD_INHERITABLE) #define _MD_QUERY_FD_INHERITABLE (_PR_MD_QUERY_FD_INHERITABLE) #define _MD_SHUTDOWN (_PR_MD_SHUTDOWN) -#define _MD_LISTEN(s, backlog) listen(s->secret->md.osfd,backlog) +#define _MD_LISTEN _PR_MD_LISTEN extern PRInt32 _MD_CloseSocket(PRInt32 osfd); #define _MD_CLOSE_SOCKET _MD_CloseSocket #define _MD_SENDTO (_PR_MD_SENDTO) @@ -279,11 +310,13 @@ extern PRInt32 _MD_SELECT(int nfds, fd_set *readfds, fd_set *writefds, #define _MD_FSYNC _PR_MD_FSYNC #define _MD_SET_FD_INHERITABLE (_PR_MD_SET_FD_INHERITABLE) +#ifdef _PR_HAVE_ATOMIC_OPS #define _MD_INIT_ATOMIC() #define _MD_ATOMIC_INCREMENT _PR_MD_ATOMIC_INCREMENT #define _MD_ATOMIC_ADD _PR_MD_ATOMIC_ADD #define _MD_ATOMIC_DECREMENT _PR_MD_ATOMIC_DECREMENT #define _MD_ATOMIC_SET _PR_MD_ATOMIC_SET +#endif #define _MD_INIT_IO (_PR_MD_INIT_IO) #define _MD_PR_POLL (_PR_MD_PR_POLL) @@ -349,11 +382,33 @@ extern PRInt32 _MD_Accept(PRFileDesc *fd, PRNetAddr *raddr, PRUint32 *rlen, #define _PR_LOCK _MD_LOCK #define _PR_UNLOCK _MD_UNLOCK +#ifdef USE_RAMSEM #define _MD_NEW_LOCK (_PR_MD_NEW_LOCK) -#define _MD_FREE_LOCK (_PR_MD_FREE_LOCK) -#define _MD_LOCK (_PR_MD_LOCK) -#define _MD_TEST_AND_LOCK (_PR_MD_TEST_AND_LOCK) -#define _MD_UNLOCK (_PR_MD_UNLOCK) +#define _MD_FREE_LOCK(lock) (DosCloseEventSem(((PRAMSEM)(&((lock)->mutex)))->hevSem)) +#define _MD_LOCK(lock) (SemRequest486(&((lock)->mutex), -1)) +#define _MD_TEST_AND_LOCK(lock) (SemRequest486(&((lock)->mutex), -1),0) +#define _MD_UNLOCK(lock) \ + PR_BEGIN_MACRO \ + if (0 != (lock)->notified.length) { \ + md_UnlockAndPostNotifies((lock), NULL, NULL); \ + } else { \ + SemReleasex86( &(lock)->mutex, 0 ); \ + } \ + PR_END_MACRO +#else +#define _MD_NEW_LOCK (_PR_MD_NEW_LOCK) +#define _MD_FREE_LOCK(lock) (DosCloseMutexSem((lock)->mutex)) +#define _MD_LOCK(lock) (DosRequestMutexSem((lock)->mutex, SEM_INDEFINITE_WAIT)) +#define _MD_TEST_AND_LOCK(lock) (DosRequestMutexSem((lock)->mutex, SEM_INDEFINITE_WAIT),0) +#define _MD_UNLOCK(lock) \ + PR_BEGIN_MACRO \ + if (0 != (lock)->notified.length) { \ + md_UnlockAndPostNotifies((lock), NULL, NULL); \ + } else { \ + DosReleaseMutexSem((lock)->mutex); \ + } \ + PR_END_MACRO +#endif /* --- lock and cv waiting --- */ #define _MD_WAIT (_PR_MD_WAIT) @@ -431,7 +486,8 @@ typedef struct __NSPR_TLS extern _NSPR_TLS* pThreadLocalStorage; NSPR_API(void) _PR_MD_ENSURE_TLS(void); -#define _MD_CURRENT_THREAD() pThreadLocalStorage->_pr_currentThread +#define _MD_GET_ATTACHED_THREAD() pThreadLocalStorage->_pr_currentThread +extern struct PRThread * _MD_CURRENT_THREAD(void); #define _MD_SET_CURRENT_THREAD(_thread) _PR_MD_ENSURE_TLS(); pThreadLocalStorage->_pr_currentThread = (_thread) #define _MD_LAST_THREAD() pThreadLocalStorage->_pr_thread_last_run @@ -537,4 +593,6 @@ unsigned long _System _DLL_InitTerm( unsigned long mod_handle, unsigned long fla #define FreeLibrary(x) DosFreeModule((HMODULE)x) #define OutputDebugString(x) +extern int _MD_os2_get_nonblocking_connect_error(int osfd); + #endif /* nspr_os2_defs_h___ */ diff --git a/pr/include/md/_os2_errors.h b/pr/include/md/_os2_errors.h index f77e8f6e..f196a201 100644 --- a/pr/include/md/_os2_errors.h +++ b/pr/include/md/_os2_errors.h @@ -40,14 +40,17 @@ #include <assert.h> #endif +NSPR_API(void) _MD_os2_map_default_error(PRInt32 err); +#define _PR_MD_MAP_DEFAULT_ERROR _MD_os2_map_default_error + NSPR_API(void) _MD_os2_map_opendir_error(PRInt32 err); #define _PR_MD_MAP_OPENDIR_ERROR _MD_os2_map_opendir_error NSPR_API(void) _MD_os2_map_closedir_error(PRInt32 err); #define _PR_MD_MAP_CLOSEDIR_ERROR _MD_os2_map_closedir_error -NSPR_API(void) _MD_unix_readdir_error(PRInt32 err); -#define _PR_MD_MAP_READDIR_ERROR _MD_unix_readdir_error +NSPR_API(void) _MD_os2_readdir_error(PRInt32 err); +#define _PR_MD_MAP_READDIR_ERROR _MD_os2_readdir_error NSPR_API(void) _MD_os2_map_delete_error(PRInt32 err); #define _PR_MD_MAP_DELETE_ERROR _MD_os2_map_delete_error @@ -103,6 +106,9 @@ NSPR_API(void) _MD_os2_map_send_error(PRInt32 err); NSPR_API(void) _MD_os2_map_sendto_error(PRInt32 err); #define _PR_MD_MAP_SENDTO_ERROR _MD_os2_map_sendto_error +NSPR_API(void) _MD_os2_map_writev_error(int err); +#define _PR_MD_MAP_WRITEV_ERROR _MD_os2_map_writev_error + NSPR_API(void) _MD_os2_map_accept_error(PRInt32 err); #define _PR_MD_MAP_ACCEPT_ERROR _MD_os2_map_accept_error diff --git a/pr/include/md/_osf1.h b/pr/include/md/_osf1.h index edf2fa3d..a098a0db 100644 --- a/pr/include/md/_osf1.h +++ b/pr/include/md/_osf1.h @@ -60,19 +60,14 @@ #define _PR_POLL_AVAILABLE #define _PR_USE_POLL -/* - * OSF1 and HPUX report the POLLHUP event for a socket when the - * shutdown(SHUT_WR) operation is called for the remote end, even though - * the socket is still writeable. Use select(), instead of poll(), to - * workaround this problem. - */ -#define _PR_POLL_WITH_SELECT #define _PR_STAT_HAS_ONLY_ST_ATIME #define _PR_HAVE_LARGE_OFF_T #define _PR_HAVE_GETIPNODEBYNAME #define _PR_HAVE_GETIPNODEBYADDR #define _PR_INET6_PROBE -#ifndef _PR_INET6 +#ifdef _PR_INET6 +#define _PR_HAVE_INET_NTOP +#else #define AF_INET6 26 #define AI_V4MAPPED 0x00000010 #define AI_ALL 0x00000008 diff --git a/pr/include/md/_pth.h b/pr/include/md/_pth.h index faa50377..3a50899c 100644 --- a/pr/include/md/_pth.h +++ b/pr/include/md/_pth.h @@ -91,7 +91,11 @@ #define _PT_PTHREAD_MUTEXATTR_DESTROY pthread_mutexattr_destroy #define _PT_PTHREAD_MUTEX_INIT(m, a) pthread_mutex_init(&(m), &(a)) #define _PT_PTHREAD_MUTEX_IS_LOCKED(m) (EBUSY == pthread_mutex_trylock(&(m))) +#if defined(DARWIN) +#define _PT_PTHREAD_CONDATTR_INIT(x) 0 +#else #define _PT_PTHREAD_CONDATTR_INIT pthread_condattr_init +#endif #define _PT_PTHREAD_CONDATTR_DESTROY pthread_condattr_destroy #define _PT_PTHREAD_COND_INIT(m, a) pthread_cond_init(&(m), &(a)) #endif @@ -182,21 +186,20 @@ #endif /* - * These platforms don't have pthread_atfork() + * These platforms don't have sigtimedwait() */ -#if defined(_PR_DCETHREADS) || defined(FREEBSD) \ - || (defined(LINUX) && defined(__alpha)) \ - || defined(NETBSD) || defined(OPENBSD) -#define PT_NO_ATFORK +#if (defined(AIX) && !defined(AIX4_3_PLUS)) || defined(LINUX) \ + || defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD) \ + || defined(BSDI) || defined(VMS) || defined(UNIXWARE) \ + || defined(DARWIN) +#define PT_NO_SIGTIMEDWAIT #endif /* - * These platforms don't have sigtimedwait() + * These platforms don't have pthread_kill() */ -#if (defined(AIX) && !defined(AIX4_3)) || defined(LINUX) \ - || defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD) \ - || defined(BSDI) || defined(VMS) || defined(UNIXWARE) -#define PT_NO_SIGTIMEDWAIT +#if defined(DARWIN) +#define pthread_kill(thread, sig) ENOSYS #endif #if defined(OSF1) || defined(VMS) @@ -225,7 +228,7 @@ #define PT_PRIO_MAX sched_get_priority_max(SCHED_OTHER) #endif /* defined(_PR_DCETHREADS) */ -#elif defined(LINUX) +#elif defined(LINUX) || defined(FREEBSD) #define PT_PRIO_MIN sched_get_priority_min(SCHED_OTHER) #define PT_PRIO_MAX sched_get_priority_max(SCHED_OTHER) #elif defined(NTO) @@ -245,7 +248,7 @@ */ #define PT_PRIO_MIN 1 #define PT_PRIO_MAX 127 -#elif defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD) \ +#elif defined(NETBSD) || defined(OPENBSD) \ || defined(BSDI) || defined(DARWIN) || defined(UNIXWARE) /* XXX */ #define PT_PRIO_MIN 0 #define PT_PRIO_MAX 126 diff --git a/pr/include/md/_solaris.h b/pr/include/md/_solaris.h index a6412b69..01b5fed4 100644 --- a/pr/include/md/_solaris.h +++ b/pr/include/md/_solaris.h @@ -41,7 +41,13 @@ #define PR_LINKER_ARCH "solaris" #define _PR_SI_SYSNAME "SOLARIS" +#ifdef sparc #define _PR_SI_ARCHITECTURE "sparc" +#elif defined(i386) +#define _PR_SI_ARCHITECTURE "x86" +#else +#error unknown processor +#endif #define PR_DLL_SUFFIX ".so" #define _PR_VMBASE 0x30000000 @@ -105,7 +111,9 @@ #define _PR_HAVE_GETIPNODEBYADDR #define _PR_INET6_PROBE #define _PR_ACCEPT_INHERIT_NONBLOCK -#ifndef _PR_INET6 +#ifdef _PR_INET6 +#define _PR_HAVE_INET_NTOP +#else #define AF_INET6 26 #define AI_V4MAPPED 0x0001 #define AI_ALL 0x0002 @@ -784,5 +792,7 @@ PR_END_EXTERN_C #endif /* _PR_GLOBAL_THREADS_ONLY */ +extern void _MD_solaris_map_sendfile_error(int err); + #endif /* nspr_solaris_defs_h___ */ diff --git a/pr/include/md/_solaris32.cfg b/pr/include/md/_solaris32.cfg index 10cb3364..ec19c4d3 100644 --- a/pr/include/md/_solaris32.cfg +++ b/pr/include/md/_solaris32.cfg @@ -43,12 +43,12 @@ #define SOLARIS #endif -#ifdef sparc +#if defined(sparc) || defined(__sparc) #undef IS_LITTLE_ENDIAN #define IS_BIG_ENDIAN 1 #define PR_ALIGN_OF_INT64 8 #define PR_ALIGN_OF_DOUBLE 8 -#elif defined(i386) +#elif defined(i386) || defined(__i386) #define IS_LITTLE_ENDIAN 1 #undef IS_BIG_ENDIAN #define PR_ALIGN_OF_INT64 4 diff --git a/pr/include/md/_solaris64.cfg b/pr/include/md/_solaris64.cfg index 8318b74b..54331c51 100644 --- a/pr/include/md/_solaris64.cfg +++ b/pr/include/md/_solaris64.cfg @@ -43,12 +43,12 @@ #define SOLARIS #endif -#ifdef sparc +#if defined(sparc) || defined(__sparc) #undef IS_LITTLE_ENDIAN #define IS_BIG_ENDIAN 1 #define PR_ALIGN_OF_INT64 8 #define PR_ALIGN_OF_DOUBLE 8 -#elif defined(i386) +#elif defined(i386) || defined(__i386) #define IS_LITTLE_ENDIAN 1 #undef IS_BIG_ENDIAN #define PR_ALIGN_OF_INT64 4 diff --git a/pr/include/md/_unixos.h b/pr/include/md/_unixos.h index 345c48d5..25ae239c 100644 --- a/pr/include/md/_unixos.h +++ b/pr/include/md/_unixos.h @@ -145,6 +145,9 @@ extern PRUint32 _pr_md_ioq_timeout; struct _MDFileDesc { int osfd; +#if defined(LINUX) && defined(_PR_PTHREADS) + int tcp_nodelay; /* used by pt_LinuxSendFile */ +#endif }; struct _MDDir { diff --git a/pr/include/md/_win16.h b/pr/include/md/_win16.h index 147ef77a..15edc7db 100644 --- a/pr/include/md/_win16.h +++ b/pr/include/md/_win16.h @@ -443,13 +443,6 @@ NSPR_API(void) _PR_UserDestroyThread(PRThread *thread); /* - * _PR_ShutdownLinker unloads all dlls loaded by the application via - * calls to PR_LoadLibrary - */ -void _PR_ShutdownLinker(void); - - -/* ** If thread emulation is used, then setjmp/longjmp stores the register ** state of each thread. ** diff --git a/pr/include/md/_win95.h b/pr/include/md/_win95.h index 6a9bb271..5307a881 100644 --- a/pr/include/md/_win95.h +++ b/pr/include/md/_win95.h @@ -112,6 +112,16 @@ struct _MDDir { PRUint32 magic; /* for debugging */ }; +#ifdef MOZ_UNICODE +struct _MDDirUTF16 { + HANDLE d_hdl; + WIN32_FIND_DATAW d_entry; + PRBool firstEntry; /* Is this the entry returned + * by FindFirstFileW()? */ + PRUint32 magic; /* for debugging */ +}; +#endif /* MOZ_UNICODE */ + struct _MDCVar { PRUint32 magic; struct PRThread *waitHead, *waitTail; /* the wait queue: a doubly- @@ -213,6 +223,15 @@ extern PRInt32 _MD_CloseFile(PRInt32 osfd); #define _MD_TLOCKFILE _PR_MD_TLOCKFILE #define _MD_UNLOCKFILE _PR_MD_UNLOCKFILE +#ifdef MOZ_UNICODE +/* --- UTF16 IO stuff --- */ +#define _MD_OPEN_FILE_UTF16 _PR_MD_OPEN_FILE_UTF16 +#define _MD_OPEN_DIR_UTF16 _PR_MD_OPEN_DIR_UTF16 +#define _MD_READ_DIR_UTF16 _PR_MD_READ_DIR_UTF16 +#define _MD_CLOSE_DIR_UTF16 _PR_MD_CLOSE_DIR_UTF16 +#define _MD_GETFILEINFO64_UTF16 _PR_MD_GETFILEINFO64_UTF16 +#endif /* MOZ_UNICODE */ + /* --- Socket IO stuff --- */ #define _MD_EACCES WSAEACCES #define _MD_EADDRINUSE WSAEADDRINUSE @@ -243,7 +262,7 @@ extern void _MD_MakeNonblock(PRFileDesc *f); #define _MD_INIT_FD_INHERITABLE _PR_MD_INIT_FD_INHERITABLE #define _MD_QUERY_FD_INHERITABLE _PR_MD_QUERY_FD_INHERITABLE #define _MD_SHUTDOWN _PR_MD_SHUTDOWN -#define _MD_LISTEN(s, backlog) listen(s->secret->md.osfd,backlog) +#define _MD_LISTEN _PR_MD_LISTEN extern PRInt32 _MD_CloseSocket(PRInt32 osfd); #define _MD_CLOSE_SOCKET _MD_CloseSocket #define _MD_SENDTO _PR_MD_SENDTO @@ -405,6 +424,9 @@ extern PRStatus _PR_KillWindowsProcess(struct PRProcess *process); #define _MD_INTERVAL_PER_MILLISEC() (_PR_MD_INTERVAL_PER_SEC() / 1000) #define _MD_INTERVAL_PER_MICROSEC() (_PR_MD_INTERVAL_PER_SEC() / 1000000) +/* --- Time --- */ +extern void _PR_FileTimeToPRTime(const FILETIME *filetime, PRTime *prtm); + /* --- Native-Thread Specific Definitions ------------------------------- */ extern struct PRThread * _MD_CURRENT_THREAD(void); diff --git a/pr/include/md/_winnt.h b/pr/include/md/_winnt.h index de8a2cf7..efc60edd 100644 --- a/pr/include/md/_winnt.h +++ b/pr/include/md/_winnt.h @@ -47,6 +47,9 @@ #include <windows.h> #include <winsock.h> +#ifdef __MINGW32__ +#include <mswsock.h> +#endif #include <errno.h> #include "prio.h" @@ -346,6 +349,8 @@ extern int _PR_NTFiberSafeSelect(int, fd_set *, fd_set *, fd_set *, #define _MD_INIT_THREAD _PR_MD_INIT_THREAD #define _MD_INIT_ATTACHED_THREAD _PR_MD_INIT_THREAD #define _MD_CREATE_THREAD _PR_MD_CREATE_THREAD +#define _MD_JOIN_THREAD _PR_MD_JOIN_THREAD +#define _MD_END_THREAD _PR_MD_END_THREAD #define _MD_YIELD _PR_MD_YIELD #define _MD_SET_PRIORITY _PR_MD_SET_PRIORITY #define _MD_CLEAN_THREAD _PR_MD_CLEAN_THREAD @@ -449,6 +454,9 @@ extern PRStatus _PR_KillWindowsProcess(struct PRProcess *process); #define _MD_INTERVAL_PER_MILLISEC() (_PR_MD_INTERVAL_PER_SEC() / 1000) #define _MD_INTERVAL_PER_MICROSEC() (_PR_MD_INTERVAL_PER_SEC() / 1000000) +/* --- Time --- */ +extern void _PR_FileTimeToPRTime(const FILETIME *filetime, PRTime *prtm); + /* --- Native-Thread Specific Definitions ------------------------------- */ extern BOOL _pr_use_static_tls; |