summaryrefslogtreecommitdiffstats
path: root/nsprpub
diff options
context:
space:
mode:
Diffstat (limited to 'nsprpub')
-rw-r--r--nsprpub/TAG-INFO1
-rwxr-xr-xnsprpub/configure2
-rw-r--r--nsprpub/configure.in6
-rw-r--r--nsprpub/lib/ds/plarena.h15
-rw-r--r--nsprpub/pr/include/md/_linux.cfg92
-rw-r--r--nsprpub/pr/include/md/_linux.h4
-rw-r--r--nsprpub/pr/include/md/_win95.cfg49
-rw-r--r--nsprpub/pr/include/md/_win95.h2
-rw-r--r--nsprpub/pr/include/prinit.h4
-rw-r--r--nsprpub/pr/src/misc/prnetdb.c16
-rw-r--r--nsprpub/pr/src/pthreads/ptio.c7
-rw-r--r--nsprpub/pr/src/pthreads/ptsynch.c3
-rw-r--r--nsprpub/pr/tests/Makefile.in1
-rw-r--r--nsprpub/pr/tests/abstract.c157
-rwxr-xr-xnsprpub/pr/tests/runtests.pl1
-rwxr-xr-xnsprpub/pr/tests/runtests.sh1
-rw-r--r--nsprpub/pr/tests/vercheck.c6
17 files changed, 354 insertions, 13 deletions
diff --git a/nsprpub/TAG-INFO b/nsprpub/TAG-INFO
deleted file mode 100644
index ed713edea..000000000
--- a/nsprpub/TAG-INFO
+++ /dev/null
@@ -1 +0,0 @@
-NSPR_4_19_RTM
diff --git a/nsprpub/configure b/nsprpub/configure
index 619d193ae..ce2543ed7 100755
--- a/nsprpub/configure
+++ b/nsprpub/configure
@@ -2488,7 +2488,7 @@ test -n "$target_alias" &&
program_prefix=${target_alias}-
MOD_MAJOR_VERSION=4
-MOD_MINOR_VERSION=19
+MOD_MINOR_VERSION=20
MOD_PATCH_VERSION=0
NSPR_MODNAME=nspr20
_HAVE_PTHREADS=
diff --git a/nsprpub/configure.in b/nsprpub/configure.in
index ea0ae7f8e..cbd22b42e 100644
--- a/nsprpub/configure.in
+++ b/nsprpub/configure.in
@@ -15,7 +15,7 @@ dnl ========================================================
dnl = Defaults
dnl ========================================================
MOD_MAJOR_VERSION=4
-MOD_MINOR_VERSION=19
+MOD_MINOR_VERSION=20
MOD_PATCH_VERSION=0
NSPR_MODNAME=nspr20
_HAVE_PTHREADS=
@@ -2106,6 +2106,10 @@ tools are selected during the Xcode/Developer Tools installation.])
AC_DEFINE(_AMD64_)
USE_64=1
;;
+ aarch64)
+ AC_DEFINE(_ARM64_)
+ USE_64=1
+ ;;
ia64)
AC_DEFINE(_IA64_)
USE_64=1
diff --git a/nsprpub/lib/ds/plarena.h b/nsprpub/lib/ds/plarena.h
index 5336a0e4d..0ca00c0ac 100644
--- a/nsprpub/lib/ds/plarena.h
+++ b/nsprpub/lib/ds/plarena.h
@@ -95,13 +95,24 @@ struct PLArenaPool {
#if defined(PL_SANITIZE_ADDRESS)
+#if defined(_MSC_VER)
+/* We can't use dllimport due to DLL linkage mismatch with
+ * sanitizer/asan_interface.h.
+ */
+#define PL_ASAN_VISIBILITY(type_) type_
+#else
+#define PL_ASAN_VISIBILITY(type_) PR_IMPORT(type_)
+#endif
+
/* These definitions are usually provided through the
* sanitizer/asan_interface.h header installed by ASan.
* See https://github.com/google/sanitizers/wiki/AddressSanitizerManualPoisoning
*/
-PR_IMPORT(void) __asan_poison_memory_region(void const volatile *addr, size_t size);
-PR_IMPORT(void) __asan_unpoison_memory_region(void const volatile *addr, size_t size);
+PL_ASAN_VISIBILITY(void) __asan_poison_memory_region(
+ void const volatile *addr, size_t size);
+PL_ASAN_VISIBILITY(void) __asan_unpoison_memory_region(
+ void const volatile *addr, size_t size);
#define PL_MAKE_MEM_NOACCESS(addr, size) \
__asan_poison_memory_region((addr), (size))
diff --git a/nsprpub/pr/include/md/_linux.cfg b/nsprpub/pr/include/md/_linux.cfg
index b4c0ed427..afc407c47 100644
--- a/nsprpub/pr/include/md/_linux.cfg
+++ b/nsprpub/pr/include/md/_linux.cfg
@@ -1020,6 +1020,98 @@
#define PR_BYTES_PER_WORD_LOG2 2
#define PR_BYTES_PER_DWORD_LOG2 3
+#elif defined(__riscv) && (__riscv_xlen == 32)
+
+#undef IS_BIG_ENDIAN
+#define IS_LITTLE_ENDIAN 1
+#undef 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 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 8
+#define PR_ALIGN_OF_FLOAT 4
+#define PR_ALIGN_OF_DOUBLE 8
+#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(__riscv) && (__riscv_xlen == 64)
+
+#undef IS_BIG_ENDIAN
+#define IS_LITTLE_ENDIAN 1
+#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/nsprpub/pr/include/md/_linux.h b/nsprpub/pr/include/md/_linux.h
index b4b298b71..2370ab831 100644
--- a/nsprpub/pr/include/md/_linux.h
+++ b/nsprpub/pr/include/md/_linux.h
@@ -57,6 +57,10 @@
#define _PR_SI_ARCHITECTURE "m32r"
#elif defined(__or1k__)
#define _PR_SI_ARCHITECTURE "or1k"
+#elif defined(__riscv) && (__riscv_xlen == 32)
+#define _PR_SI_ARCHITECTURE "riscv32"
+#elif defined(__riscv) && (__riscv_xlen == 64)
+#define _PR_SI_ARCHITECTURE "riscv64"
#else
#error "Unknown CPU architecture"
#endif
diff --git a/nsprpub/pr/include/md/_win95.cfg b/nsprpub/pr/include/md/_win95.cfg
index 1e693cc68..7c379fce7 100644
--- a/nsprpub/pr/include/md/_win95.cfg
+++ b/nsprpub/pr/include/md/_win95.cfg
@@ -214,6 +214,55 @@
#define PR_BYTES_PER_WORD_LOG2 2
#define PR_BYTES_PER_DWORD_LOG2 3
+#elif defined(_M_ARM64) || defined(_ARM64_)
+
+#define IS_LITTLE_ENDIAN 1
+#undef IS_BIG_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 4
+#define PR_BYTES_PER_FLOAT 4
+#define PR_BYTES_PER_WORD 8
+#define PR_BYTES_PER_DWORD 8
+#define PR_BYTES_PER_DOUBLE 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_WORD 64
+#define PR_BITS_PER_DWORD 64
+#define PR_BITS_PER_DOUBLE 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 5
+#define PR_BITS_PER_FLOAT_LOG2 5
+#define PR_BITS_PER_WORD_LOG2 6
+#define PR_BITS_PER_DWORD_LOG2 6
+#define PR_BITS_PER_DOUBLE_LOG2 6
+
+#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_WORD 8
+#define PR_ALIGN_OF_DWORD 8
+#define PR_ALIGN_OF_DOUBLE 8
+#define PR_ALIGN_OF_POINTER 8
+
+#define PR_BYTES_PER_WORD_LOG2 3
+#define PR_BYTES_PER_DWORD_LOG2 3
+
#else /* defined(_M_IX86) || defined(_X86_) */
#error unknown processor architecture
diff --git a/nsprpub/pr/include/md/_win95.h b/nsprpub/pr/include/md/_win95.h
index 04f811d37..24e537bb7 100644
--- a/nsprpub/pr/include/md/_win95.h
+++ b/nsprpub/pr/include/md/_win95.h
@@ -26,6 +26,8 @@
#define _PR_SI_ARCHITECTURE "ia64"
#elif defined(_M_ARM) || defined(_ARM_)
#define _PR_SI_ARCHITECTURE "arm"
+#elif defined(_M_ARM64)
+#define _PR_SI_ARCHITECTURE "aarch64"
#else
#error unknown processor architecture
#endif
diff --git a/nsprpub/pr/include/prinit.h b/nsprpub/pr/include/prinit.h
index ab3aba208..5f6b4e3de 100644
--- a/nsprpub/pr/include/prinit.h
+++ b/nsprpub/pr/include/prinit.h
@@ -31,9 +31,9 @@ PR_BEGIN_EXTERN_C
** The format of the version string is
** "<major version>.<minor version>[.<patch level>] [<Beta>]"
*/
-#define PR_VERSION "4.19"
+#define PR_VERSION "4.20"
#define PR_VMAJOR 4
-#define PR_VMINOR 19
+#define PR_VMINOR 20
#define PR_VPATCH 0
#define PR_BETA PR_FALSE
diff --git a/nsprpub/pr/src/misc/prnetdb.c b/nsprpub/pr/src/misc/prnetdb.c
index affebf6ac..c482e8e4a 100644
--- a/nsprpub/pr/src/misc/prnetdb.c
+++ b/nsprpub/pr/src/misc/prnetdb.c
@@ -7,6 +7,10 @@
#include <string.h>
+#if defined(LINUX)
+#include <sys/un.h>
+#endif
+
/*
* On Unix, the error code for gethostbyname() and gethostbyaddr()
* is returned in the global variable h_errno, instead of the usual
@@ -1366,7 +1370,17 @@ PRUintn _PR_NetAddrSize(const PRNetAddr* addr)
#endif
#if defined(XP_UNIX) || defined(XP_OS2)
else if (AF_UNIX == addr->raw.family)
- addrsize = sizeof(addr->local);
+ {
+#if defined(LINUX)
+ if (addr->local.path[0] == 0)
+ /* abstract socket address is supported on Linux only */
+ addrsize = strnlen(addr->local.path + 1,
+ sizeof(addr->local.path)) +
+ offsetof(struct sockaddr_un, sun_path) + 1;
+ else
+#endif
+ addrsize = sizeof(addr->local);
+ }
#endif
else addrsize = 0;
diff --git a/nsprpub/pr/src/pthreads/ptio.c b/nsprpub/pr/src/pthreads/ptio.c
index f6aa56741..1549a905f 100644
--- a/nsprpub/pr/src/pthreads/ptio.c
+++ b/nsprpub/pr/src/pthreads/ptio.c
@@ -1750,7 +1750,12 @@ static PRStatus pt_Bind(PRFileDesc *fd, const PRNetAddr *addr)
if (addr->raw.family == AF_UNIX)
{
/* Disallow relative pathnames */
- if (addr->local.path[0] != '/')
+ if (addr->local.path[0] != '/'
+#if defined(LINUX)
+ /* Linux has abstract socket address support */
+ && addr->local.path[0] != 0
+#endif
+ )
{
PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
return PR_FAILURE;
diff --git a/nsprpub/pr/src/pthreads/ptsynch.c b/nsprpub/pr/src/pthreads/ptsynch.c
index a93b74795..126bed670 100644
--- a/nsprpub/pr/src/pthreads/ptsynch.c
+++ b/nsprpub/pr/src/pthreads/ptsynch.c
@@ -911,7 +911,8 @@ PR_IMPLEMENT(PRStatus) PR_DeleteSemaphore(const char *name)
* From the semctl(2) man page in glibc 2.0
*/
#if (defined(__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED)) \
- || defined(FREEBSD) || defined(OPENBSD) || defined(BSDI) \
+ || (defined(FREEBSD) && __FreeBSD_version < 1200059) \
+ || defined(OPENBSD) || defined(BSDI) \
|| defined(DARWIN) || defined(SYMBIAN)
/* union semun is defined by including <sys/sem.h> */
#else
diff --git a/nsprpub/pr/tests/Makefile.in b/nsprpub/pr/tests/Makefile.in
index 79a67f09c..f1cfba9cc 100644
--- a/nsprpub/pr/tests/Makefile.in
+++ b/nsprpub/pr/tests/Makefile.in
@@ -18,6 +18,7 @@ include $(topsrcdir)/config/config.mk
DIRS = dll
CSRCS = \
+ abstract.c \
accept.c \
acceptread.c \
acceptreademu.c \
diff --git a/nsprpub/pr/tests/abstract.c b/nsprpub/pr/tests/abstract.c
new file mode 100644
index 000000000..6be5610c0
--- /dev/null
+++ b/nsprpub/pr/tests/abstract.c
@@ -0,0 +1,157 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include <stdio.h>
+
+#if defined(LINUX)
+
+#include <string.h>
+#include "nspr.h"
+
+static const char abstractSocketName[] = "\0testsocket";
+
+static void
+ClientThread(void* aArg)
+{
+ PRFileDesc* socket;
+ PRNetAddr addr;
+ PRUint8 buf[1024];
+ PRInt32 len;
+ PRInt32 total;
+
+ addr.local.family = PR_AF_LOCAL;
+ memcpy(addr.local.path, abstractSocketName, sizeof(abstractSocketName));
+
+ socket = PR_OpenTCPSocket(addr.raw.family);
+ if (!socket) {
+ fprintf(stderr, "PR_OpenTCPSokcet failed\n");
+ exit(1);
+ }
+
+ if (PR_Connect(socket, &addr, PR_INTERVAL_NO_TIMEOUT) == PR_FAILURE) {
+ fprintf(stderr, "PR_Connect failed\n");
+ exit(1);
+ }
+
+ total = 0;
+ while (total < sizeof(buf)) {
+ len = PR_Recv(socket, buf + total, sizeof(buf) - total, 0,
+ PR_INTERVAL_NO_TIMEOUT);
+ if (len < 1) {
+ fprintf(stderr, "PR_Recv failed\n");
+ exit(1);
+ }
+ total += len;
+ }
+
+ total = 0;
+ while (total < sizeof(buf)) {
+ len = PR_Send(socket, buf + total, sizeof(buf) - total, 0,
+ PR_INTERVAL_NO_TIMEOUT);
+ if (len < 1) {
+ fprintf(stderr, "PR_Send failed\n");
+ exit(1);
+ }
+ total += len;
+ }
+
+ if (PR_Close(socket) == PR_FAILURE) {
+ fprintf(stderr, "PR_Close failed\n");
+ exit(1);
+ }
+}
+
+int
+main()
+{
+ PRFileDesc* socket;
+ PRFileDesc* acceptSocket;
+ PRThread* thread;
+ PRNetAddr addr;
+ PRUint8 buf[1024];
+ PRInt32 len;
+ PRInt32 total;
+
+ addr.local.family = PR_AF_LOCAL;
+ memcpy(addr.local.path, abstractSocketName, sizeof(abstractSocketName));
+
+ socket = PR_OpenTCPSocket(addr.raw.family);
+ if (!socket) {
+ fprintf(stderr, "PR_OpenTCPSocket failed\n");
+ exit(1);
+ }
+ if (PR_Bind(socket, &addr) == PR_FAILURE) {
+ fprintf(stderr, "PR_Bind failed\n");
+ exit(1);
+ }
+
+ if (PR_Listen(socket, 5) == PR_FAILURE) {
+ fprintf(stderr, "PR_Listen failed\n");
+ exit(1);
+ }
+
+ thread = PR_CreateThread(PR_USER_THREAD, ClientThread, 0, PR_PRIORITY_NORMAL,
+ PR_GLOBAL_THREAD, PR_JOINABLE_THREAD, 0);
+ if (!thread) {
+ fprintf(stderr, "PR_CreateThread failed");
+ exit(1);
+ }
+
+ acceptSocket = PR_Accept(socket, NULL, PR_INTERVAL_NO_TIMEOUT);
+ if (!acceptSocket) {
+ fprintf(stderr, "PR_Accept failed\n");
+ exit(1);
+ }
+
+ memset(buf, 'A', sizeof(buf));
+
+ total = 0;
+ while (total < sizeof(buf)) {
+ len = PR_Send(acceptSocket, buf + total, sizeof(buf) - total, 0,
+ PR_INTERVAL_NO_TIMEOUT);
+ if (len < 1) {
+ fprintf(stderr, "PR_Send failed\n");
+ exit(1);
+ }
+ total += len;
+ }
+
+ total = 0;
+ while (total < sizeof(buf)) {
+ len = PR_Recv(acceptSocket, buf + total, sizeof(buf) - total, 0,
+ PR_INTERVAL_NO_TIMEOUT);
+ if (len < 1) {
+ fprintf(stderr, "PR_Recv failed\n");
+ exit(1);
+ }
+ total += len;
+ }
+
+ if (PR_Close(acceptSocket) == PR_FAILURE) {
+ fprintf(stderr, "PR_Close failed\n");
+ exit(1);
+ }
+
+ if (PR_JoinThread(thread) == PR_FAILURE) {
+ fprintf(stderr, "PR_JoinThread failed\n");
+ exit(1);
+ }
+
+ if (PR_Close(socket) == PR_FAILURE) {
+ fprintf(stderr, "PR_Close failed\n");
+ exit(1);
+ }
+ printf("PASS\n");
+ return 0;
+}
+
+#else
+int
+main()
+{
+ prinf("PASS\n");
+ return 0;
+}
+#endif
diff --git a/nsprpub/pr/tests/runtests.pl b/nsprpub/pr/tests/runtests.pl
index 5dbc649bf..f1ab7647e 100755
--- a/nsprpub/pr/tests/runtests.pl
+++ b/nsprpub/pr/tests/runtests.pl
@@ -241,6 +241,7 @@ $prog = shift; # Program to test
# MAIN ---------------
@progs = (
+"abstract",
"accept",
"acceptread",
"acceptreademu",
diff --git a/nsprpub/pr/tests/runtests.sh b/nsprpub/pr/tests/runtests.sh
index 760f03292..d021287b8 100755
--- a/nsprpub/pr/tests/runtests.sh
+++ b/nsprpub/pr/tests/runtests.sh
@@ -71,6 +71,7 @@ LOGFILE=${NSPR_TEST_LOGFILE:-$NULL_DEVICE}
#
TESTS="
+abstract
accept
acceptread
acceptreademu
diff --git a/nsprpub/pr/tests/vercheck.c b/nsprpub/pr/tests/vercheck.c
index 43b0abc4b..5e6588f9d 100644
--- a/nsprpub/pr/tests/vercheck.c
+++ b/nsprpub/pr/tests/vercheck.c
@@ -40,7 +40,7 @@ static char *compatible_version[] = {
"4.10", "4.10.1", "4.10.2", "4.10.3", "4.10.4",
"4.10.5", "4.10.6", "4.10.7", "4.10.8", "4.10.9",
"4.10.10", "4.11", "4.12", "4.13", "4.14", "4.15",
- "4.16", "4.17", "4.18",
+ "4.16", "4.17", "4.18", "4.19",
PR_VERSION
};
@@ -56,8 +56,8 @@ static char *incompatible_version[] = {
"3.0", "3.0.1",
"3.1", "3.1.1", "3.1.2", "3.1.3",
"3.5", "3.5.1",
- "4.19.1",
- "4.20", "4.20.1",
+ "4.20.1",
+ "4.21", "4.21.1",
"10.0", "11.1", "12.14.20"
};