summaryrefslogtreecommitdiff
path: root/pr/src/pthreads
diff options
context:
space:
mode:
authorwchang0222%aol.com <devnull@localhost>2004-11-22 21:24:53 +0000
committerwchang0222%aol.com <devnull@localhost>2004-11-22 21:24:53 +0000
commitd7dcb6611b1deb49b56014ca2df3edd81fa55319 (patch)
tree7f8e43326b62953320d2fb0cf1a760ff6b983e45 /pr/src/pthreads
parentd8a463ea5d1ccadae92907535603319ce4427e1a (diff)
downloadnspr-hg-d7dcb6611b1deb49b56014ca2df3edd81fa55319.tar.gz
Bugzilla bug 266981: fixed NSPR support for FreeBSD and added additional
FreeBSD platform (ia64 and amd64) support. The patch is contributed by Joe Marcus Clarke <marcus@freebsd.org>. r=wtc. Modified Files: _darwin.h, _freebsd.cfg, _freebsd.h, _pth.h, ptio.c, ptsynch.c
Diffstat (limited to 'pr/src/pthreads')
-rw-r--r--pr/src/pthreads/ptio.c10
-rw-r--r--pr/src/pthreads/ptsynch.c13
2 files changed, 16 insertions, 7 deletions
diff --git a/pr/src/pthreads/ptio.c b/pr/src/pthreads/ptio.c
index 94721aac..301dc59d 100644
--- a/pr/src/pthreads/ptio.c
+++ b/pr/src/pthreads/ptio.c
@@ -195,12 +195,8 @@ static ssize_t (*pt_aix_sendfile_fptr)() = NULL;
#endif
#endif
-#ifdef DARWIN
+#ifdef _PR_IPV6_V6ONLY_PROBE
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)
@@ -1160,7 +1156,7 @@ 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
+#ifdef _PR_IPV6_V6ONLY_PROBE
/* 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
@@ -3480,7 +3476,7 @@ 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
+#ifdef _PR_IPV6_V6ONLY_PROBE
if ((domain == AF_INET6) && _pr_ipv6_v6only_on_by_default)
{
int on = 0;
diff --git a/pr/src/pthreads/ptsynch.c b/pr/src/pthreads/ptsynch.c
index b318cab0..cc8bb1b0 100644
--- a/pr/src/pthreads/ptsynch.c
+++ b/pr/src/pthreads/ptsynch.c
@@ -62,6 +62,19 @@ static pthread_t pt_zero_tid; /* a null pthread_t (pthread_t is a struct
#endif /* defined(_PR_DCETHREADS) */
#endif /* defined(DEBUG) */
+#if defined(FREEBSD)
+/*
+ * On older versions of FreeBSD, pthread_mutex_trylock returns EDEADLK.
+ * Newer versions return EBUSY. We still need to support both.
+ */
+static int
+pt_pthread_mutex_is_locked(pthread_mutex_t *m)
+{
+ int rv = pthread_mutex_trylock(m);
+ return (EBUSY == rv || EDEADLK == rv);
+}
+#endif
+
/**************************************************************/
/**************************************************************/
/*****************************LOCKS****************************/