Bug 1477680, land NSPR 4.20 beta snapshot 607196c7ef66, r=me

UPGRADE_NSPR_RELEASE
This commit is contained in:
Kai Engert
2018-07-23 16:05:53 +02:00
parent 7b3f3fd841
commit 074714864d
15 changed files with 288 additions and 13 deletions

View File

@@ -1 +1 @@
NSPR_4_19_RTM
607196c7ef66

View File

@@ -10,4 +10,3 @@
*/
#error "Do not include this header file."

2
nsprpub/configure vendored
View File

@@ -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=

View File

@@ -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=

View File

@@ -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"

View File

@@ -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

View File

@@ -31,11 +31,11 @@ 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 Beta"
#define PR_VMAJOR 4
#define PR_VMINOR 19
#define PR_VMINOR 20
#define PR_VPATCH 0
#define PR_BETA PR_FALSE
#define PR_BETA PR_TRUE
/*
** PRVersionCheck

View File

@@ -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;

View File

@@ -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;

View File

@@ -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

View File

@@ -18,6 +18,7 @@ include $(topsrcdir)/config/config.mk
DIRS = dll
CSRCS = \
abstract.c \
accept.c \
acceptread.c \
acceptreademu.c \

157
nsprpub/pr/tests/abstract.c Executable file
View File

@@ -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

View File

@@ -241,6 +241,7 @@ $prog = shift; # Program to test
# MAIN ---------------
@progs = (
"abstract",
"accept",
"acceptread",
"acceptreademu",

View File

@@ -71,6 +71,7 @@ LOGFILE=${NSPR_TEST_LOGFILE:-$NULL_DEVICE}
#
TESTS="
abstract
accept
acceptread
acceptreademu

View File

@@ -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"
};