summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwtc%netscape.com <devnull@localhost>2002-02-22 04:23:30 +0000
committerwtc%netscape.com <devnull@localhost>2002-02-22 04:23:30 +0000
commitfba0cb7cce8309791498a5241901f8ada1292a2a (patch)
treeaf3987441254ffef8aad38e3f28cd4269a1bb46f
parente998145c716afe30077b7f07098267dba6d96367 (diff)
downloadnss-hg-fba0cb7cce8309791498a5241901f8ada1292a2a.tar.gz
Bugzilla bug 70217: ported NSS to BeOS. The patch is contributed by
Christopher Seawood <seawood@netscape.com>.
-rw-r--r--security/coreconf/BeOS.mk79
-rw-r--r--security/coreconf/config.mk2
-rw-r--r--security/coreconf/nsinstall/nsinstall.c12
-rw-r--r--security/nss/lib/fortcrypt/fpkmem.h2
-rw-r--r--security/nss/lib/fortcrypt/genci.h2
-rw-r--r--security/nss/lib/fortcrypt/swfort/swflib.c2
-rw-r--r--security/nss/lib/fortcrypt/swfort/swfutl.c6
-rw-r--r--security/nss/lib/freebl/sysrand.c2
-rw-r--r--security/nss/lib/freebl/unix_rand.c44
-rw-r--r--security/nss/lib/jar/jar.h2
-rw-r--r--security/nss/lib/jar/jarfile.c6
-rw-r--r--security/nss/lib/nss/nssinit.c2
-rw-r--r--security/nss/lib/ssl/config.mk4
-rw-r--r--security/nss/lib/ssl/emulate.c12
-rw-r--r--security/nss/lib/ssl/sslimpl.h4
-rw-r--r--security/nss/lib/ssl/sslmutex.c2
-rw-r--r--security/nss/lib/ssl/sslmutex.h2
-rw-r--r--security/nss/lib/ssl/sslnonce.c4
-rw-r--r--security/nss/lib/ssl/sslsecur.c2
-rw-r--r--security/nss/lib/ssl/sslsnce.c16
-rw-r--r--security/nss/lib/ssl/sslsock.c2
-rw-r--r--security/nss/lib/ssl/unix_err.c2
-rw-r--r--security/nss/lib/util/secport.c2
-rw-r--r--security/nss/lib/util/secport.h8
24 files changed, 183 insertions, 38 deletions
diff --git a/security/coreconf/BeOS.mk b/security/coreconf/BeOS.mk
new file mode 100644
index 000000000..4e8f3b239
--- /dev/null
+++ b/security/coreconf/BeOS.mk
@@ -0,0 +1,79 @@
+#
+# 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 security libraries.
+#
+# The Initial Developer of the Original Code is Netscape
+# Communications Corporation. Portions created by Netscape are
+# Copyright (C) 2002 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.
+#
+# Config stuff for BeOS
+#
+
+include $(CORE_DEPTH)/coreconf/UNIX.mk
+
+XP_DEFINE := $(XP_DEFINE:-DXP_UNIX=-DXP_BEOS)
+
+USE_PTHREADS =
+
+ifeq ($(USE_PTHREADS),1)
+ IMPL_STRATEGY = _PTH
+endif
+
+CC = gcc
+CCC = g++
+RANLIB = ranlib
+
+DEFAULT_COMPILER = gcc
+
+ifeq ($(OS_TEST),ppc)
+ OS_REL_CFLAGS = -Dppc
+ CPU_ARCH = ppc
+else
+ OS_REL_CFLAGS = -Di386
+ CPU_ARCH = x86
+endif
+
+MKSHLIB = $(CC) -nostart -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so)
+ifdef BUILD_OPT
+ OPTIMIZER = -O2
+endif
+
+OS_CFLAGS = $(DSO_CFLAGS) $(OS_REL_CFLAGS) -Wall -pipe
+OS_LIBS = -lbe
+
+DEFINES += -DBEOS
+
+ifdef USE_PTHREADS
+ DEFINES += -D_REENTRANT
+endif
+
+ARCH = beos
+
+DSO_CFLAGS = -fPIC
+DSO_LDOPTS =
+DSO_LDFLAGS =
+
diff --git a/security/coreconf/config.mk b/security/coreconf/config.mk
index 97c4c7724..7ad0d1e16 100644
--- a/security/coreconf/config.mk
+++ b/security/coreconf/config.mk
@@ -58,7 +58,7 @@ endif
# one for each OS release. #
#######################################################################
-TARGET_OSES = FreeBSD BSD_OS NetBSD OpenUNIX OS2 QNX Darwin
+TARGET_OSES = FreeBSD BSD_OS NetBSD OpenUNIX OS2 QNX Darwin BeOS
ifeq (,$(filter-out $(TARGET_OSES),$(OS_TARGET)))
include $(CORE_DEPTH)/coreconf/$(OS_TARGET).mk
diff --git a/security/coreconf/nsinstall/nsinstall.c b/security/coreconf/nsinstall/nsinstall.c
index 759a41746..f1d52cac4 100644
--- a/security/coreconf/nsinstall/nsinstall.c
+++ b/security/coreconf/nsinstall/nsinstall.c
@@ -55,10 +55,16 @@ typedef unsigned int mode_t;
#define HAVE_LCHOWN
-#if defined(AIX) || defined(BSDI) || defined(HPUX) || defined(LINUX) || defined(SUNOS4) || defined(SCO) || defined(UNIXWARE) || defined(VMS) || defined(NTO) || defined(DARWIN)
+#if defined(AIX) || defined(BSDI) || defined(HPUX) || defined(LINUX) || defined(SUNOS4) || defined(SCO) || defined(UNIXWARE) || defined(VMS) || defined(NTO) || defined(DARWIN) || defined(BEOS)
#undef HAVE_LCHOWN
#endif
+#define HAVE_FCHMOD
+
+#if defined(BEOS)
+#undef HAVE_FCHMOD
+#endif
+
#ifdef LINUX
#include <getopt.h>
#endif
@@ -403,7 +409,11 @@ retry:
if (utime(toname, &utb) < 0)
fail("cannot set times of %s", toname);
}
+#ifdef HAVE_FCHMOD
if (fchmod(tofd, mode) < 0)
+#else
+ if (chmod(toname, mode) < 0)
+#endif
fail("cannot change mode of %s", toname);
if ((owner || group) && fchown(tofd, uid, gid) < 0)
fail("cannot change owner of %s", toname);
diff --git a/security/nss/lib/fortcrypt/fpkmem.h b/security/nss/lib/fortcrypt/fpkmem.h
index c35370be0..5097828c6 100644
--- a/security/nss/lib/fortcrypt/fpkmem.h
+++ b/security/nss/lib/fortcrypt/fpkmem.h
@@ -41,7 +41,7 @@
#define NUM_SLOTS 32
-#if !defined (XP_UNIX) && !defined (_WINDOWS) && !defined(XP_OS2)
+#if !defined (XP_UNIX) && !defined (_WINDOWS) && !defined (XP_OS2) && !defined (XP_BEOS)
#define XP_MAC 1 /*Make sure we get this define in for Mac builds*/
#endif
diff --git a/security/nss/lib/fortcrypt/genci.h b/security/nss/lib/fortcrypt/genci.h
index f12ec9a77..6a44cd7a7 100644
--- a/security/nss/lib/fortcrypt/genci.h
+++ b/security/nss/lib/fortcrypt/genci.h
@@ -39,7 +39,7 @@
#define _GENCI_H_ 1
#include "seccomon.h"
-#if defined (XP_UNIX) || defined (XP_WIN32) || defined (XP_OS2)
+#if defined (XP_UNIX) || defined (XP_WIN32) || defined (XP_OS2) || defined (XP_BEOS)
/*
* On unix, NT, Windows '95, and OS/2 we use full maci
diff --git a/security/nss/lib/fortcrypt/swfort/swflib.c b/security/nss/lib/fortcrypt/swfort/swflib.c
index c7970ddd0..c41a878fb 100644
--- a/security/nss/lib/fortcrypt/swfort/swflib.c
+++ b/security/nss/lib/fortcrypt/swfort/swflib.c
@@ -54,7 +54,7 @@
/*#include "keylow.h" */
#include "secder.h"
-#ifdef XP_UNIX
+#if defined(XP_UNIX) || defined(XP_BEOS)
#include <unistd.h>
#endif
diff --git a/security/nss/lib/fortcrypt/swfort/swfutl.c b/security/nss/lib/fortcrypt/swfort/swfutl.c
index f6927c841..eee677f65 100644
--- a/security/nss/lib/fortcrypt/swfort/swfutl.c
+++ b/security/nss/lib/fortcrypt/swfort/swfutl.c
@@ -406,8 +406,8 @@ fort_GenerateRandom(unsigned char *buf, int bytes)
/*
* NOTE: that MAC is missing below.
*/
-#if defined (XP_UNIX) || defined (XP_OS2)
-#ifdef XP_UNIX
+#if defined (XP_UNIX) || defined (XP_OS2) || defined (XP_BEOS)
+#if defined (XP_UNIX) || defined (XP_BEOS)
#define NS_PATH_SEP ':'
#define NS_DIR_SEP '/'
#define NS_DEFAULT_PATH ".:/bin/netscape:/etc/netscape/:/etc"
@@ -448,7 +448,7 @@ local_getFileInfo(const char *fn, PRFileInfo *info)
}
return rv;
}
-#endif /* UNIX & OS/2 */
+#endif /* UNIX, OS/2, and BEOS */
#ifdef XP_WIN
#define NS_PATH_SEP ';'
diff --git a/security/nss/lib/freebl/sysrand.c b/security/nss/lib/freebl/sysrand.c
index 2f647041a..410ab9cc7 100644
--- a/security/nss/lib/freebl/sysrand.c
+++ b/security/nss/lib/freebl/sysrand.c
@@ -32,7 +32,7 @@
*/
#include "seccomon.h"
-#ifdef XP_UNIX
+#if defined(XP_UNIX) || defined(XP_BEOS)
#include "unix_rand.c"
#endif
#ifdef XP_WIN
diff --git a/security/nss/lib/freebl/unix_rand.c b/security/nss/lib/freebl/unix_rand.c
index 21af5fdc6..aa64c8866 100644
--- a/security/nss/lib/freebl/unix_rand.c
+++ b/security/nss/lib/freebl/unix_rand.c
@@ -550,6 +550,39 @@ GetHighResClock(void *buf, size_t maxbytes)
#endif /* VMS */
+#ifdef BEOS
+#include <be/kernel/OS.h>
+
+static size_t
+GetHighResClock(void *buf, size_t maxbytes)
+{
+ bigtime_t bigtime; /* Actually an int64 */
+
+ bigtime = real_time_clock_usecs();
+ return CopyLowBits(buf, maxbytes, &bigtime, sizeof(bigtime));
+}
+
+static void
+GiveSystemInfo(void)
+{
+ system_info *info = NULL;
+ int32 val;
+ get_system_info(info);
+ if (info) {
+ val = info->boot_time;
+ RNG_RandomUpdate(&val, sizeof(val));
+ val = info->used_pages;
+ RNG_RandomUpdate(&val, sizeof(val));
+ val = info->used_ports;
+ RNG_RandomUpdate(&val, sizeof(val));
+ val = info->used_threads;
+ RNG_RandomUpdate(&val, sizeof(val));
+ val = info->used_teams;
+ RNG_RandomUpdate(&val, sizeof(val));
+ }
+}
+#endif /* BEOS */
+
#if defined(nec_ews)
#include <sys/systeminfo.h>
@@ -735,6 +768,16 @@ void RNG_SystemInfoForRNG(void)
#else
extern char **environ;
#endif
+#ifdef BEOS
+ static const char * const files[] = {
+ "/boot/var/swap",
+ "/boot/var/log/syslog",
+ "/boot/var/tmp",
+ "/boot/home/config/settings",
+ "/boot/home",
+ 0
+ };
+#else
static const char * const files[] = {
"/etc/passwd",
"/etc/utmp",
@@ -743,6 +786,7 @@ void RNG_SystemInfoForRNG(void)
"/usr/tmp",
0
};
+#endif
#ifdef DO_PS
For now it is considered that it is too expensive to run the ps command
diff --git a/security/nss/lib/jar/jar.h b/security/nss/lib/jar/jar.h
index 4308e7a95..d132f2579 100644
--- a/security/nss/lib/jar/jar.h
+++ b/security/nss/lib/jar/jar.h
@@ -203,7 +203,7 @@ typedef struct JAR_Physical_
unsigned long offset;
unsigned long length;
unsigned long uncompressed_length;
-#ifdef XP_UNIX
+#if defined(XP_UNIX) || defined(XP_BEOS)
uint16 mode;
#endif
}
diff --git a/security/nss/lib/jar/jarfile.c b/security/nss/lib/jar/jarfile.c
index 315ec0d69..19a3eaa02 100644
--- a/security/nss/lib/jar/jarfile.c
+++ b/security/nss/lib/jar/jarfile.c
@@ -47,7 +47,7 @@
/* commercial compression */
#include "jzlib.h"
-#ifdef XP_UNIX
+#if defined(XP_UNIX) || defined(XP_BEOS)
#include "sys/stat.h"
#endif
@@ -252,7 +252,7 @@ int JAR_extract
(unsigned int) phy->compression);
}
-#ifdef XP_UNIX
+#if defined(XP_UNIX) || defined(XP_BEOS)
if (phy->mode)
chmod (outpath, 0400 | (mode_t) phy->mode);
#endif
@@ -891,7 +891,7 @@ static int jar_listzip (JAR *jar, JAR_FILE fp)
goto loser;
}
-#ifdef XP_UNIX
+#if defined(XP_UNIX) || defined(XP_BEOS)
/* with unix we need to locate any bits from
the protection mask in the external attributes. */
{
diff --git a/security/nss/lib/nss/nssinit.c b/security/nss/lib/nss/nssinit.c
index d6ce45ee8..c069119f7 100644
--- a/security/nss/lib/nss/nssinit.c
+++ b/security/nss/lib/nss/nssinit.c
@@ -261,7 +261,7 @@ static const char *dllname =
"nssckbi.dll";
#elif defined(HPUX)
"libnssckbi.sl";
-#elif defined(XP_UNIX)
+#elif defined(XP_UNIX) || defined(XP_BEOS)
"libnssckbi.so";
#elif defined(XP_MAC)
"NSS Builtin Root Certs";
diff --git a/security/nss/lib/ssl/config.mk b/security/nss/lib/ssl/config.mk
index 530dcde39..e6f9123f6 100644
--- a/security/nss/lib/ssl/config.mk
+++ b/security/nss/lib/ssl/config.mk
@@ -59,6 +59,10 @@ EXTRA_SHARED_LIBS += \
-lnspr4 \
$(NULL)
+ifeq ($(OS_ARCH), BeOS)
+EXTRA_SHARED_LIBS += -lbe
+endif
+
ifeq ($(OS_ARCH), Darwin)
EXTRA_SHARED_LIBS += -dylib_file @executable_path/libsoftokn3.dylib:$(DIST)/lib/libsoftokn3.dylib
endif
diff --git a/security/nss/lib/ssl/emulate.c b/security/nss/lib/ssl/emulate.c
index 40286fe5e..9d5734e5a 100644
--- a/security/nss/lib/ssl/emulate.c
+++ b/security/nss/lib/ssl/emulate.c
@@ -39,7 +39,7 @@
#include "nspr.h"
-#if defined( XP_UNIX )
+#if defined( XP_UNIX ) || defined( XP_BEOS )
#include <fcntl.h>
#endif
#if defined(WIN32)
@@ -95,7 +95,7 @@ ssl_EmulateAcceptRead( PRFileDesc * sd,
}
-#if !defined( XP_UNIX ) && !defined( WIN32 )
+#if !defined( XP_UNIX ) && !defined( WIN32 ) && !defined( XP_BEOS )
/*
* _PR_EmulateTransmitFile
*
@@ -293,12 +293,12 @@ done:
PR_CloseFileMap(mapHandle);
return count;
}
-#endif /* XP_UNIX */
+#endif /* XP_UNIX || WIN32 || XP_BEOS */
-#if !defined( XP_UNIX ) && !defined( WIN32 )
+#if !defined( XP_UNIX ) && !defined( WIN32 ) && !defined( XP_BEOS )
/*
* _PR_EmulateSendFile
*
@@ -442,7 +442,7 @@ done:
return rv;
}
-#else /* UNIX and NT handled below */
+#else /* UNIX, NT, and BEOS handled below */
/*
* _PR_UnixSendFile
@@ -630,4 +630,4 @@ done:
PR_Close(sd);
return count;
}
-#endif /* UNIX and NT */
+#endif /* UNIX, NT, and BEOS */
diff --git a/security/nss/lib/ssl/sslimpl.h b/security/nss/lib/ssl/sslimpl.h
index c940a7d9e..a6d063959 100644
--- a/security/nss/lib/ssl/sslimpl.h
+++ b/security/nss/lib/ssl/sslimpl.h
@@ -53,7 +53,7 @@
#include "hasht.h"
#include "nssilock.h"
#include "pkcs11t.h"
-#ifdef XP_UNIX
+#if defined(XP_UNIX) || defined(XP_BEOS)
#include "unistd.h"
#endif
#include "nssrwlk.h"
@@ -1273,7 +1273,7 @@ SEC_END_PROTOS
#include <process.h>
#endif
-#if defined(XP_UNIX) || defined(XP_OS2)
+#if defined(XP_UNIX) || defined(XP_OS2) || defined(XP_BEOS)
#define SSL_GETPID() getpid()
#elif defined(WIN32)
diff --git a/security/nss/lib/ssl/sslmutex.c b/security/nss/lib/ssl/sslmutex.c
index a6ecc1cc6..71fe41712 100644
--- a/security/nss/lib/ssl/sslmutex.c
+++ b/security/nss/lib/ssl/sslmutex.c
@@ -83,7 +83,7 @@ static SECStatus single_process_sslMutex_Lock(sslMutex* pMutex)
return SECSuccess;
}
-#if defined(LINUX) || defined(AIX) || defined(VMS)
+#if defined(LINUX) || defined(AIX) || defined(VMS) || defined(BEOS)
#include <unistd.h>
#include <fcntl.h>
diff --git a/security/nss/lib/ssl/sslmutex.h b/security/nss/lib/ssl/sslmutex.h
index 6ba7c3643..09dcfef2f 100644
--- a/security/nss/lib/ssl/sslmutex.h
+++ b/security/nss/lib/ssl/sslmutex.h
@@ -77,7 +77,7 @@ typedef struct
typedef int sslPID;
-#elif defined(LINUX) || defined(AIX) || defined(VMS)
+#elif defined(LINUX) || defined(AIX) || defined(VMS) || defined(BEOS)
#include <sys/types.h>
#include "prtypes.h"
diff --git a/security/nss/lib/ssl/sslnonce.c b/security/nss/lib/ssl/sslnonce.c
index 9029fef21..2aed0f287 100644
--- a/security/nss/lib/ssl/sslnonce.c
+++ b/security/nss/lib/ssl/sslnonce.c
@@ -44,7 +44,7 @@
#include "sslproto.h"
#include "nssilock.h"
#include "nsslocks.h"
-#if defined(XP_UNIX) || defined(XP_WIN) || defined(_WINDOWS)
+#if defined(XP_UNIX) || defined(XP_WIN) || defined(_WINDOWS) || defined(XP_BEOS)
#include <time.h>
#endif
@@ -348,7 +348,7 @@ PRUint32
ssl_Time(void)
{
PRUint32 myTime;
-#if defined(XP_UNIX) || defined(XP_WIN) || defined(_WINDOWS)
+#if defined(XP_UNIX) || defined(XP_WIN) || defined(_WINDOWS) || defined(XP_BEOS)
myTime = time(NULL); /* accurate until the year 2038. */
#else
/* portable, but possibly slower */
diff --git a/security/nss/lib/ssl/sslsecur.c b/security/nss/lib/ssl/sslsecur.c
index a5ace5560..9fabf5e6b 100644
--- a/security/nss/lib/ssl/sslsecur.c
+++ b/security/nss/lib/ssl/sslsecur.c
@@ -47,6 +47,8 @@
#include "winsock.h" /* for MSG_PEEK */
#elif defined(XP_MAC)
#include "macsocket.h"
+#elif defined(BEOS)
+#define MSG_PEEK 0x2
#else
#include <sys/socket.h> /* for MSG_PEEK */
#endif
diff --git a/security/nss/lib/ssl/sslsnce.c b/security/nss/lib/ssl/sslsnce.c
index c9b3bc85c..f69f3fd42 100644
--- a/security/nss/lib/ssl/sslsnce.c
+++ b/security/nss/lib/ssl/sslsnce.c
@@ -69,7 +69,7 @@
#include "nssrenam.h"
#include "seccomon.h"
-#if defined(XP_UNIX) || defined(XP_WIN32) || defined (XP_OS2)
+#if defined(XP_UNIX) || defined(XP_WIN32) || defined (XP_OS2) || defined(XP_BEOS)
#include "cert.h"
#include "ssl.h"
@@ -80,7 +80,7 @@
#include <stdio.h>
-#ifdef XP_UNIX
+#if defined(XP_UNIX) || defined(XP_BEOS)
#include <syslog.h>
#include <fcntl.h>
@@ -282,11 +282,11 @@ typedef struct inheritanceStr inheritance;
#endif /* _win32 */
-#ifdef XP_UNIX
+#if defined(XP_UNIX) || defined(XP_BEOS)
#define DEFAULT_CACHE_DIRECTORY "/tmp"
-#endif /* XP_UNIX */
+#endif /* XP_UNIX || XP_BEOS */
/************************************************************************/
@@ -294,7 +294,7 @@ typedef struct inheritanceStr inheritance;
static void
IOError(int rv, char *type)
{
-#ifdef XP_UNIX
+#if defined(XP_UNIX) || defined(XP_BEOS)
syslog(LOG_ALERT,
"SSL: %s error with session-id cache, pid=%d, rv=%d, error='%m'",
type, myPid, rv);
@@ -992,7 +992,7 @@ InitCache(cacheDesc *cache, int maxCacheEntries, PRUint32 ssl2_timeout,
}
/* Create file names */
-#ifdef XP_UNIX
+#if defined(XP_UNIX) || defined(XP_BEOS)
/* there's some confusion here about whether PR_OpenAnonFileMap wants
** a directory name or a file name for its first argument.
cfn = PR_smprintf("%s/.sslsvrcache.%d", directory, myPid);
@@ -1206,7 +1206,7 @@ SSL_ConfigMPServerSIDCache( int maxCacheEntries,
result = SECFailure;
}
-#if defined(XP_UNIX)
+#if defined(XP_UNIX) || defined(XP_BEOS)
/* Launch thread to poll cache for expired locks on Unix */
LaunchLockPoller(cache);
#endif
@@ -1359,7 +1359,7 @@ SSL_InheritMPServerSIDCache(const char * envString)
return SSL_InheritMPServerSIDCacheInstance(&globalCache, envString);
}
-#if defined(XP_UNIX)
+#if defined(XP_UNIX) || defined(XP_BEOS)
#define SID_LOCK_EXPIRATION_TIMEOUT 30 /* seconds */
diff --git a/security/nss/lib/ssl/sslsock.c b/security/nss/lib/ssl/sslsock.c
index 6a0160f17..7486dadf2 100644
--- a/security/nss/lib/ssl/sslsock.c
+++ b/security/nss/lib/ssl/sslsock.c
@@ -1800,7 +1800,7 @@ ssl_NewSocket(void)
#endif
#ifdef DEBUG
-#if defined(XP_UNIX) || defined(XP_WIN32)
+#if defined(XP_UNIX) || defined(XP_WIN32) || defined(XP_BEOS)
if (firsttime) {
firsttime = 0;
diff --git a/security/nss/lib/ssl/unix_err.c b/security/nss/lib/ssl/unix_err.c
index 874db9353..7e125c880 100644
--- a/security/nss/lib/ssl/unix_err.c
+++ b/security/nss/lib/ssl/unix_err.c
@@ -48,7 +48,7 @@
#include "prerror.h"
#endif
-#if defined (__bsdi__) || defined(NTO) || defined(DARWIN)
+#if defined (__bsdi__) || defined(NTO) || defined(DARWIN) || defined(BEOS)
#undef _PR_POLL_AVAILABLE
#endif
diff --git a/security/nss/lib/util/secport.c b/security/nss/lib/util/secport.c
index f512e38e3..6216df3da 100644
--- a/security/nss/lib/util/secport.c
+++ b/security/nss/lib/util/secport.c
@@ -60,7 +60,7 @@
#include "prthread.h"
#endif /* THREADMARK */
-#if defined(XP_UNIX) || defined(XP_MAC) || defined(XP_OS2)
+#if defined(XP_UNIX) || defined(XP_MAC) || defined(XP_OS2) || defined(XP_BEOS)
#include <stdlib.h>
#else
#include "wtypes.h"
diff --git a/security/nss/lib/util/secport.h b/security/nss/lib/util/secport.h
index 3c92676a2..245754390 100644
--- a/security/nss/lib/util/secport.h
+++ b/security/nss/lib/util/secport.h
@@ -45,7 +45,7 @@
#define _SECPORT_H_
/*
- * define XP_MAC, XP_WIN, or XP_UNIX, in case they are not defined
+ * define XP_MAC, XP_WIN, XP_BEOS, or XP_UNIX, in case they are not defined
* by anyone else
*/
#ifdef macintosh
@@ -69,6 +69,12 @@
#endif
#endif
+#ifdef __BEOS__
+# ifndef XP_BEOS
+# define XP_BEOS
+# endif
+#endif
+
#ifdef unix
# ifndef XP_UNIX
# define XP_UNIX