diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2018-04-25 21:33:57 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-04-25 21:33:57 +0200 |
commit | 7c4d50dccf3080965c202f63aa56439e3824eaf3 (patch) | |
tree | 59026bd0f554a24878db82841a508c8fa7ca8356 /nsprpub/pr/tests | |
parent | fba28f19754f62b5227650143d5441fc86d4c7d7 (diff) | |
download | uxp-7c4d50dccf3080965c202f63aa56439e3824eaf3.tar.gz |
Revert "Update NSPR to 4.18"
This reverts commit 8781f745556be5d7402d0f3adc67ecfe32fe04a0.
Diffstat (limited to 'nsprpub/pr/tests')
-rw-r--r-- | nsprpub/pr/tests/Makefile.in | 3 | ||||
-rw-r--r-- | nsprpub/pr/tests/attach.c | 12 | ||||
-rw-r--r-- | nsprpub/pr/tests/dceemu.c | 9 | ||||
-rw-r--r-- | nsprpub/pr/tests/foreign.c | 8 | ||||
-rw-r--r-- | nsprpub/pr/tests/forktest.c | 47 | ||||
-rw-r--r-- | nsprpub/pr/tests/provider.c | 12 | ||||
-rw-r--r-- | nsprpub/pr/tests/socket.c | 6 | ||||
-rw-r--r-- | nsprpub/pr/tests/testfile.c | 6 | ||||
-rw-r--r-- | nsprpub/pr/tests/thrpool_client.c | 2 | ||||
-rw-r--r-- | nsprpub/pr/tests/thrpool_server.c | 2 | ||||
-rw-r--r-- | nsprpub/pr/tests/vercheck.c | 7 |
11 files changed, 91 insertions, 23 deletions
diff --git a/nsprpub/pr/tests/Makefile.in b/nsprpub/pr/tests/Makefile.in index 79a67f09cb..df1f1f2ddc 100644 --- a/nsprpub/pr/tests/Makefile.in +++ b/nsprpub/pr/tests/Makefile.in @@ -373,6 +373,9 @@ endif ifeq (,$(filter-out FreeBSD OpenBSD BSD_OS QNX Darwin OpenUNIX,$(OS_ARCH))) LIBPTHREAD = endif +ifeq ($(OS_ARCH)$(basename $(OS_RELEASE)),HP-UXB.10) +LIBPTHREAD = -ldce +endif endif ifeq ($(OS_TARGET),Android) diff --git a/nsprpub/pr/tests/attach.c b/nsprpub/pr/tests/attach.c index a1493b8ec5..a5daf9d969 100644 --- a/nsprpub/pr/tests/attach.c +++ b/nsprpub/pr/tests/attach.c @@ -111,6 +111,16 @@ static int32 threadStartFunc(void *arg) static void * threadStartFunc(void *arg) #endif { +#ifdef _PR_DCETHREADS + { + int rv; + pthread_t self = pthread_self(); + rv = pthread_detach(&self); + if (debug_mode) PR_ASSERT(0 == rv); + else if (0 != rv) failed_already=1; + } +#endif + Measure(AttachDetach, "Attach/Detach"); #ifndef IRIX @@ -196,12 +206,14 @@ int main(int argc, char **argv) goto exit_now; } +#ifndef _PR_DCETHREADS rv = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); if (debug_mode) PR_ASSERT(0 == rv); else if (0 != rv) { failed_already=1; goto exit_now; } +#endif /* !_PR_DCETHREADS */ rv = _PT_PTHREAD_CREATE(&threadID, attr, threadStartFunc, NULL); if (rv != 0) { fprintf(stderr, "thread creation failed: error code %d\n", rv); diff --git a/nsprpub/pr/tests/dceemu.c b/nsprpub/pr/tests/dceemu.c index 99fd6cb7c1..b06b49e3a7 100644 --- a/nsprpub/pr/tests/dceemu.c +++ b/nsprpub/pr/tests/dceemu.c @@ -29,6 +29,8 @@ #include <stdio.h> #include <stdlib.h> +#if defined(_PR_DCETHREADS) + PRIntn failed_already=0; PRIntn debug_mode=0; @@ -78,13 +80,20 @@ static PRIntn prmain(PRIntn argc, char **argv) } /* prmain */ +#endif /* #if defined(_PR_DCETHREADS) */ + int main(int argc, char **argv) { + +#if defined(_PR_DCETHREADS) PR_Initialize(prmain, argc, argv, 0); if(failed_already) return 1; else return 0; +#else + return 0; +#endif } /* main */ diff --git a/nsprpub/pr/tests/foreign.c b/nsprpub/pr/tests/foreign.c index cfb2e56eff..637f419d11 100644 --- a/nsprpub/pr/tests/foreign.c +++ b/nsprpub/pr/tests/foreign.c @@ -52,7 +52,7 @@ static int _debug_on = 0; #define DPRINTF(arg) if (_debug_on) PR_fprintf arg -#if defined(_PR_PTHREADS) +#if defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS) #include <pthread.h> #include "md/_pth.h" static void *pthread_start(void *arg) @@ -63,7 +63,7 @@ static void *pthread_start(void *arg) start(data); return NULL; } /* pthread_start */ -#endif /* defined(_PR_PTHREADS) */ +#endif /* defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS) */ #if defined(IRIX) && !defined(_PR_PTHREADS) #include <sys/types.h> @@ -109,7 +109,7 @@ static PRStatus NSPRPUB_TESTS_CreateThread(StartFn start, void *arg) } break; case thread_pthread: -#if defined(_PR_PTHREADS) +#if defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS) { int rv; pthread_t id; @@ -137,7 +137,7 @@ static PRStatus NSPRPUB_TESTS_CreateThread(StartFn start, void *arg) PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); rv = PR_FAILURE; break; -#endif /* defined(_PR_PTHREADS) */ +#endif /* defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS) */ case thread_sproc: #if defined(IRIX) && !defined(_PR_PTHREADS) diff --git a/nsprpub/pr/tests/forktest.c b/nsprpub/pr/tests/forktest.c index 66dc64575e..a389fa479c 100644 --- a/nsprpub/pr/tests/forktest.c +++ b/nsprpub/pr/tests/forktest.c @@ -196,6 +196,51 @@ finish: return; } +#ifdef _PR_DCETHREADS + +#include <syscall.h> + +pid_t PR_UnixFork1(void) +{ + pid_t parent = getpid(); + int rv = syscall(SYS_fork); + + if (rv == -1) { + return (pid_t) -1; + } else { + /* For each process, rv is the pid of the other process */ + if (rv == parent) { + /* the child */ + return 0; + } else { + /* the parent */ + return rv; + } + } +} + +#elif defined(SOLARIS) + +/* + * It seems like that in Solaris 2.4 one must call fork1() if the + * the child process is going to use thread functions. Solaris 2.5 + * doesn't have this problem. Calling fork() also works. + */ + +pid_t PR_UnixFork1(void) +{ + return fork1(); +} + +#else + +pid_t PR_UnixFork1(void) +{ + return fork(); +} + +#endif /* PR_DCETHREADS */ + int main(int argc, char **argv) { pid_t pid; @@ -205,7 +250,7 @@ int main(int argc, char **argv) DoIO(); - pid = fork(); + pid = PR_UnixFork1(); if (pid == (pid_t) -1) { fprintf(stderr, "Fork failed: errno %d\n", errno); diff --git a/nsprpub/pr/tests/provider.c b/nsprpub/pr/tests/provider.c index 932241ec3b..0e6569d66b 100644 --- a/nsprpub/pr/tests/provider.c +++ b/nsprpub/pr/tests/provider.c @@ -606,7 +606,7 @@ typedef struct StartObject void *arg; } StartObject; -#if defined(_PR_PTHREADS) +#if defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS) #include "md/_pth.h" #include <pthread.h> @@ -619,7 +619,7 @@ static void *pthread_start(void *arg) start(data); return NULL; } /* pthread_start */ -#endif /* defined(_PR_PTHREADS) */ +#endif /* defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS) */ #if defined(IRIX) && !defined(_PR_PTHREADS) #include <sys/types.h> @@ -657,10 +657,10 @@ static PRStatus JoinThread(PRThread *thread) rv = PR_JoinThread(thread); break; case thread_pthread: -#if defined(_PR_PTHREADS) +#if defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS) rv = PR_SUCCESS; break; -#endif /* defined(_PR_PTHREADS) */ +#endif /* defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS) */ case thread_win32: #if defined(WIN32) rv = PR_SUCCESS; @@ -690,7 +690,7 @@ static PRStatus NewThread( } break; case thread_pthread: -#if defined(_PR_PTHREADS) +#if defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS) { int rv; pthread_t id; @@ -717,7 +717,7 @@ static PRStatus NewThread( #else PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); rv = PR_FAILURE; -#endif /* defined(_PR_PTHREADS) */ +#endif /* defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS) */ break; case thread_sproc: diff --git a/nsprpub/pr/tests/socket.c b/nsprpub/pr/tests/socket.c index 92f019d018..5ee2b78f38 100644 --- a/nsprpub/pr/tests/socket.c +++ b/nsprpub/pr/tests/socket.c @@ -21,7 +21,7 @@ #ifdef XP_UNIX #include <sys/mman.h> #endif -#if defined(_PR_PTHREADS) +#if defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS) #include <pthread.h> #endif @@ -313,7 +313,7 @@ PRThread* create_new_thread(PRThreadType type, PRInt32 native_thread = 0; PR_ASSERT(state == PR_UNJOINABLE_THREAD); -#if defined(_PR_PTHREADS) || defined(WIN32) +#if (defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS)) || defined(WIN32) switch(index % 4) { case 0: scope = (PR_LOCAL_THREAD); @@ -332,7 +332,7 @@ PRInt32 native_thread = 0; break; } if (native_thread) { -#if defined(_PR_PTHREADS) +#if defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS) pthread_t tid; if (!pthread_create(&tid, NULL, (void * (*)(void *)) start, arg)) return((PRThread *) tid); diff --git a/nsprpub/pr/tests/testfile.c b/nsprpub/pr/tests/testfile.c index 1191bfe944..23659876ef 100644 --- a/nsprpub/pr/tests/testfile.c +++ b/nsprpub/pr/tests/testfile.c @@ -13,7 +13,7 @@ #include <windows.h> #include <process.h> #endif -#if defined(_PR_PTHREADS) +#if defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS) #include <pthread.h> #endif #ifdef SYMBIAN @@ -104,7 +104,7 @@ PRInt32 native_thread = 0; PR_ASSERT(state == PR_UNJOINABLE_THREAD); -#if defined(_PR_PTHREADS) || defined(WIN32) || defined(XP_OS2) +#if (defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS)) || defined(WIN32) || defined(XP_OS2) switch(index % 4) { case 0: @@ -124,7 +124,7 @@ PRInt32 native_thread = 0; break; } if (native_thread) { -#if defined(_PR_PTHREADS) +#if defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS) pthread_t tid; if (!pthread_create(&tid, NULL, start, arg)) return((PRThread *) tid); diff --git a/nsprpub/pr/tests/thrpool_client.c b/nsprpub/pr/tests/thrpool_client.c index 7f3df32715..a0e1e4c24d 100644 --- a/nsprpub/pr/tests/thrpool_client.c +++ b/nsprpub/pr/tests/thrpool_client.c @@ -21,7 +21,7 @@ #ifdef XP_UNIX #include <sys/mman.h> #endif -#if defined(_PR_PTHREADS) +#if defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS) #include <pthread.h> #endif diff --git a/nsprpub/pr/tests/thrpool_server.c b/nsprpub/pr/tests/thrpool_server.c index ef09f23b51..9665829a1a 100644 --- a/nsprpub/pr/tests/thrpool_server.c +++ b/nsprpub/pr/tests/thrpool_server.c @@ -21,7 +21,7 @@ #ifdef XP_UNIX #include <sys/mman.h> #endif -#if defined(_PR_PTHREADS) +#if defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS) #include <pthread.h> #endif diff --git a/nsprpub/pr/tests/vercheck.c b/nsprpub/pr/tests/vercheck.c index da2f7b1de6..6170125dea 100644 --- a/nsprpub/pr/tests/vercheck.c +++ b/nsprpub/pr/tests/vercheck.c @@ -39,8 +39,7 @@ static char *compatible_version[] = { "4.9.6", "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.10.10", "4.11", "4.12", "4.13", "4.14", "4.15" PR_VERSION }; @@ -56,8 +55,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.18.1", - "4.19", "4.19.1", + "4.16.1", + "4.17", "4.17.1", "10.0", "11.1", "12.14.20" }; |