diff options
author | wtc%netscape.com <devnull@localhost> | 2003-07-14 22:12:19 +0000 |
---|---|---|
committer | wtc%netscape.com <devnull@localhost> | 2003-07-14 22:12:19 +0000 |
commit | 4762daae412786390dbf47848a3a430f1eb801ba (patch) | |
tree | c3ceca9b1a67fcaaba4978509a7b1450f512eebe | |
parent | cdee56d778a9aee0f84e0bf64acb94fe4892bc8b (diff) | |
parent | 86a60768d2dd2b8e638d9cd1d5f5796e94f58db9 (diff) | |
download | nspr-hg-4762daae412786390dbf47848a3a430f1eb801ba.tar.gz |
Bug 212566: _pr_ipv6_v6only_on_by_default needs to be defined for DARWIN
under all cases, not just when _PR_INET6_PROBE is defined, because
_PR_INET6_PROBE is only defined when Mac OS X deployment target is 10.1.
Bug 211512: defined IPV6_V6ONLY if it's not defined so that we can build on
Mac OS X 10.1, where this macro is not defined.
-rw-r--r-- | pr/include/md/Makefile.in | 10 | ||||
-rw-r--r-- | pr/include/prtypes.h | 21 | ||||
-rw-r--r-- | pr/src/io/prfile.c | 22 | ||||
-rw-r--r-- | pr/src/md/unix/uxpoll.c | 1 | ||||
-rw-r--r-- | pr/src/pthreads/ptio.c | 49 | ||||
-rw-r--r-- | pr/tests/sockping.c | 3 |
6 files changed, 81 insertions, 25 deletions
diff --git a/pr/include/md/Makefile.in b/pr/include/md/Makefile.in index 680e8d12..5f8f0f71 100644 --- a/pr/include/md/Makefile.in +++ b/pr/include/md/Makefile.in @@ -46,9 +46,17 @@ 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 + $(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 -f $(dist_includedir)/$(MDCPUCFG_H) $(dist_includedir)/prcpucfg.h +endif real_install:: $(NSINSTALL) -D $(DESTDIR)$(includedir)/md diff --git a/pr/include/prtypes.h b/pr/include/prtypes.h index b6836108..b7ee24f4 100644 --- a/pr/include/prtypes.h +++ b/pr/include/prtypes.h @@ -79,20 +79,15 @@ ***********************************************************************/ #if defined(WIN32) -#if defined(__GNUC__) -#undef _declspec -#define _declspec(x) __declspec(x) -#endif - -#define PR_EXPORT(__type) extern _declspec(dllexport) __type -#define PR_EXPORT_DATA(__type) extern _declspec(dllexport) __type -#define PR_IMPORT(__type) _declspec(dllimport) __type -#define PR_IMPORT_DATA(__type) _declspec(dllimport) __type +#define PR_EXPORT(__type) extern __declspec(dllexport) __type +#define PR_EXPORT_DATA(__type) extern __declspec(dllexport) __type +#define PR_IMPORT(__type) __declspec(dllimport) __type +#define PR_IMPORT_DATA(__type) __declspec(dllimport) __type -#define PR_EXTERN(__type) extern _declspec(dllexport) __type -#define PR_IMPLEMENT(__type) _declspec(dllexport) __type -#define PR_EXTERN_DATA(__type) extern _declspec(dllexport) __type -#define PR_IMPLEMENT_DATA(__type) _declspec(dllexport) __type +#define PR_EXTERN(__type) extern __declspec(dllexport) __type +#define PR_IMPLEMENT(__type) __declspec(dllexport) __type +#define PR_EXTERN_DATA(__type) extern __declspec(dllexport) __type +#define PR_IMPLEMENT_DATA(__type) __declspec(dllexport) __type #define PR_CALLBACK #define PR_CALLBACK_DECL diff --git a/pr/src/io/prfile.c b/pr/src/io/prfile.c index 1b3acaec..25354453 100644 --- a/pr/src/io/prfile.c +++ b/pr/src/io/prfile.c @@ -422,14 +422,18 @@ PRInt32 PR_GetSysfdTableMax(void) return rlim.rlim_max; #elif defined(AIX) || defined(NEXTSTEP) || defined(QNX) return sysconf(_SC_OPEN_MAX); -#elif defined(WIN32) || defined(OS2) +#elif defined(WIN32) /* * There is a systemwide limit of 65536 user handles. - * Not sure on OS/2, but sounds good. */ return 16384; #elif defined (WIN16) return FOPEN_MAX; +#elif defined(XP_OS2) + ULONG ulReqCount = 0; + ULONG ulCurMaxFH = 0; + DosSetRelMaxFH(&ulReqCount, &ulCurMaxFH); + return ulCurMaxFH; #elif defined (XP_MAC) || defined(XP_BEOS) PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); return -1; @@ -464,9 +468,19 @@ PRInt32 PR_SetSysfdTableSize(int table_size) } return rlim.rlim_cur; +#elif defined(XP_OS2) + PRInt32 tableMax = PR_GetSysfdTableMax(); + if (table_size > tableMax) { + APIRET rc = NO_ERROR; + rc = DosSetMaxFH(table_size); + if (rc == NO_ERROR) + return table_size; + else + return -1; + } + return tableMax; #elif defined(AIX) || defined(NEXTSTEP) || defined(QNX) \ - || defined(WIN32) || defined(WIN16) || defined(OS2) \ - || defined(XP_BEOS) + || defined(WIN32) || defined(WIN16) || defined(XP_BEOS) PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); return -1; #elif defined (XP_MAC) diff --git a/pr/src/md/unix/uxpoll.c b/pr/src/md/unix/uxpoll.c index c504cd4d..a95e4558 100644 --- a/pr/src/md/unix/uxpoll.c +++ b/pr/src/md/unix/uxpoll.c @@ -173,6 +173,7 @@ static PRInt32 NativeThreadPoll( { /* make poll() ignore this entry */ syspoll[index].fd = -1; + syspoll[index].events = 0; pds[index].out_flags = 0; } } diff --git a/pr/src/pthreads/ptio.c b/pr/src/pthreads/ptio.c index 8267148b..6222b722 100644 --- a/pr/src/pthreads/ptio.c +++ b/pr/src/pthreads/ptio.c @@ -189,6 +189,14 @@ static ssize_t (*pt_aix_sendfile_fptr)() = NULL; #endif #endif +#ifdef DARWIN +static PRBool _pr_ipv6_v6only_on_by_default; +/* The IPV6_V6ONLY socket option is not defined on Mac OS X 10.1. */ +#ifndef IPV6_V6ONLY +#define IPV6_V6ONLY 27 +#endif +#endif + #if defined(SOLARIS) #define _PRSockOptVal_t char * #elif defined(IRIX) || defined(OSF1) || defined(AIX) || defined(HPUX) \ @@ -1146,6 +1154,26 @@ void _PR_InitIO(void) _pr_stderr = pt_SetMethods(2, PR_DESC_FILE, PR_FALSE, PR_TRUE); PR_ASSERT(_pr_stdin && _pr_stdout && _pr_stderr); +#ifdef DARWIN + /* In Mac OS X v10.3 Panther Beta the IPV6_V6ONLY socket option + * is turned on by default, contrary to what RFC 3493, Section + * 5.3 says. So we have to turn it off. Find out whether we + * are running on such a system. + */ + { + int osfd; + osfd = socket(AF_INET6, SOCK_STREAM, 0); + if (osfd != -1) { + int on; + int optlen = sizeof(on); + if (getsockopt(osfd, IPPROTO_IPV6, IPV6_V6ONLY, + &on, &optlen) == 0) { + _pr_ipv6_v6only_on_by_default = on; + } + close(osfd); + } + } +#endif } /* _PR_InitIO */ void _PR_CleanupIO(void) @@ -3380,12 +3408,12 @@ PRInt32 osfd; * whether IPv6 APIs and the IPv6 stack are on the system. * Our portable test below seems to work fine, so I am using it. */ - osfd = socket(AF_INET6, SOCK_STREAM, 0); - if (osfd != -1) { - close(osfd); - return PR_TRUE; - } - return PR_FALSE; + osfd = socket(AF_INET6, SOCK_STREAM, 0); + if (osfd != -1) { + close(osfd); + return PR_TRUE; + } + return PR_FALSE; } #endif /* _PR_INET6_PROBE */ #endif @@ -3434,6 +3462,14 @@ PR_IMPLEMENT(PRFileDesc*) PR_Socket(PRInt32 domain, PRInt32 type, PRInt32 proto) if (osfd == -1) pt_MapError(_PR_MD_MAP_SOCKET_ERROR, errno); else { +#ifdef DARWIN + if ((domain == AF_INET6) && _pr_ipv6_v6only_on_by_default) + { + int on = 0; + (void)setsockopt(osfd, IPPROTO_IPV6, IPV6_V6ONLY, + &on, sizeof(on)); + } +#endif fd = pt_SetMethods(osfd, ftype, PR_FALSE, PR_FALSE); if (fd == NULL) close(osfd); } @@ -3832,6 +3868,7 @@ static PRInt32 _pr_poll_with_poll( { /* make poll() ignore this entry */ syspoll[index].fd = -1; + syspoll[index].events = 0; pds[index].out_flags = 0; } } diff --git a/pr/tests/sockping.c b/pr/tests/sockping.c index fb377903..477851c2 100644 --- a/pr/tests/sockping.c +++ b/pr/tests/sockping.c @@ -124,7 +124,8 @@ int main() memset(buf, 0, sizeof(buf)); nBytes = PR_Read(sock[0], buf, sizeof(buf)); if (nBytes == -1) { - fprintf(stderr, "PR_Read failed\n"); + fprintf(stderr, "PR_Read failed: (%d, %d)\n", + PR_GetError(), PR_GetOSError()); exit(1); } printf("ping process: received \"%s\"\n", buf); |