зеркало из https://github.com/mozilla/pjs.git
Bugzilla bug #31697: Mac OS X (Rhapsody) port, based on the patch that
Stuart Parmenter <pavlov@netscape.com> sent to me. Modified files: Rhapsody.mk, arch.mk, _pth.h, _rhapsody.h, prlink.c, rhapsody.c, uxproces.c, uxrng.c, ptio.c, pr/tests/Makefile, pr/tests/Makefile.in
This commit is contained in:
Родитель
355929f21a
Коммит
10e70e307b
|
@ -21,6 +21,17 @@
|
|||
|
||||
include $(MOD_DEPTH)/config/UNIX.mk
|
||||
|
||||
#
|
||||
# The default implementation strategy for Rhapsody is pthreads.
|
||||
#
|
||||
ifeq ($(CLASSIC_NSPR),1)
|
||||
IMPL_STRATEGY = _EMU
|
||||
DEFINES += -D_PR_LOCAL_THREADS_ONLY
|
||||
else
|
||||
USE_PTHREADS = 1
|
||||
IMPL_STRATEGY = _PTH
|
||||
endif
|
||||
|
||||
CC = cc
|
||||
ifeq ($(OS_RELEASE),5.0)
|
||||
CCC = cc++
|
||||
|
@ -49,8 +60,6 @@ endif
|
|||
|
||||
OS_CFLAGS = $(DSO_CFLAGS) $(OS_REL_CFLAGS) -Wmost -fno-common -pipe -DRHAPSODY -DHAVE_STRERROR -DHAVE_BSD_FLOCK
|
||||
|
||||
DEFINES += -D_PR_LOCAL_THREADS_ONLY
|
||||
|
||||
ARCH = rhapsody
|
||||
|
||||
# May override this with -bundle to create a loadable module.
|
||||
|
|
|
@ -50,6 +50,9 @@ OS_ARCH := UNIXWARE
|
|||
OS_RELEASE := $(shell uname -v)
|
||||
endif
|
||||
endif
|
||||
ifeq ($(OS_ARCH),Mac OS)
|
||||
OS_ARCH := Rhapsody
|
||||
endif
|
||||
ifeq ($(OS_ARCH),ncr)
|
||||
OS_ARCH := NCR
|
||||
endif
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
#define USE_MACH_DYLD
|
||||
#define _PR_HAVE_SOCKADDR_LEN
|
||||
#define _PR_STAT_HAS_ST_ATIMESPEC
|
||||
#define _PR_TIMESPEC_HAS_TS_SEC
|
||||
#define _PR_NO_LARGE_FILES
|
||||
|
||||
#define USE_SETJMP
|
||||
|
|
|
@ -93,7 +93,7 @@
|
|||
#elif defined(IRIX) || defined(OSF1) || defined(AIX) || defined(SOLARIS) \
|
||||
|| defined(HPUX) || defined(LINUX) || defined(FREEBSD) \
|
||||
|| defined(NETBSD) || defined(OPENBSD) || defined(BSDI) \
|
||||
|| defined(VMS) || defined(NTO)
|
||||
|| defined(VMS) || defined(NTO) || defined(RHAPSODY)
|
||||
#define _PT_PTHREAD_ZERO_THR_HANDLE(t) (t) = 0
|
||||
#define _PT_PTHREAD_THR_HANDLE_IS_ZERO(t) (t) == 0
|
||||
#define _PT_PTHREAD_COPY_THR_HANDLE(st, dt) (dt) = (st)
|
||||
|
@ -204,7 +204,7 @@
|
|||
#define PT_PRIO_MIN 1
|
||||
#define PT_PRIO_MAX 127
|
||||
#elif defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD) \
|
||||
|| defined(BSDI) /* XXX */
|
||||
|| defined(BSDI) || defined(RHAPSODY) /* XXX */
|
||||
#define PT_PRIO_MIN 0
|
||||
#define PT_PRIO_MAX 126
|
||||
#else
|
||||
|
@ -237,7 +237,7 @@ extern int (*_PT_aix_yield_fcn)();
|
|||
PR_END_MACRO
|
||||
#elif defined(HPUX) || defined(LINUX) || defined(SOLARIS) \
|
||||
|| defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD) \
|
||||
|| defined(BSDI) || defined(NTO)
|
||||
|| defined(BSDI) || defined(NTO) || defined(RHAPSODY)
|
||||
#define _PT_PTHREAD_YIELD() sched_yield()
|
||||
#else
|
||||
#error "Need to define _PT_PTHREAD_YIELD for this platform"
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
#define USE_MACH_DYLD
|
||||
#define _PR_HAVE_SOCKADDR_LEN
|
||||
#define _PR_STAT_HAS_ST_ATIMESPEC
|
||||
#define _PR_TIMESPEC_HAS_TS_SEC
|
||||
#define _PR_NO_LARGE_FILES
|
||||
|
||||
#define USE_SETJMP
|
||||
|
|
|
@ -734,7 +734,7 @@ pr_LoadLibraryByPathname(const char *name, PRIntn flags)
|
|||
NSModule h = NULL;
|
||||
if (NSCreateObjectFileImageFromFile(name, &ofi)
|
||||
== NSObjectFileImageSuccess) {
|
||||
h = NSLinkModule(ofi, name, TRUE);
|
||||
h = NSLinkModule(ofi, name, NSLINKMODULE_OPTION_PRIVATE);
|
||||
}
|
||||
#else
|
||||
#error Configuration error
|
||||
|
@ -1083,7 +1083,14 @@ pr_FindSymbolInLib(PRLibrary *lm, const char *name)
|
|||
f = NULL;
|
||||
}
|
||||
#elif defined(USE_MACH_DYLD)
|
||||
f = NSAddressOfSymbol(NSLookupAndBindSymbol(name));
|
||||
{
|
||||
NSSymbol symbol;
|
||||
symbol = NSLookupSymbolInModule(lm->dlh, name);
|
||||
if (symbol != NULL)
|
||||
f = NSAddressOfSymbol(symbol);
|
||||
else
|
||||
f = NULL;
|
||||
}
|
||||
#endif
|
||||
#endif /* HAVE_DLL */
|
||||
#endif /* XP_UNIX */
|
||||
|
|
|
@ -87,13 +87,32 @@ _MD_CREATE_THREAD(
|
|||
}
|
||||
#endif /* ! _PR_PTHREADS */
|
||||
|
||||
#if defined(_PR_PTHREADS)
|
||||
|
||||
/*
|
||||
** Whoops, we don't have a syscall stub for this
|
||||
** Stubs for unimplemented functions
|
||||
*/
|
||||
int mprotect (caddr_t addr, size_t size, int prot)
|
||||
|
||||
int pthread_condattr_init(pthread_condattr_t *attr)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pthread_kill(pthread_t thread, int sig)
|
||||
{
|
||||
return ENOSYS;
|
||||
}
|
||||
|
||||
typedef struct siginfo_t siginfo_t;
|
||||
|
||||
int sigtimedwait(const sigset_t *set, siginfo_t *info,
|
||||
const struct timespec *timeout)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif /* _PR_PTHREADS */
|
||||
|
||||
/* rhapsody.c */
|
||||
|
||||
|
|
|
@ -87,13 +87,32 @@ _MD_CREATE_THREAD(
|
|||
}
|
||||
#endif /* ! _PR_PTHREADS */
|
||||
|
||||
#if defined(_PR_PTHREADS)
|
||||
|
||||
/*
|
||||
** Whoops, we don't have a syscall stub for this
|
||||
** Stubs for unimplemented functions
|
||||
*/
|
||||
int mprotect (caddr_t addr, size_t size, int prot)
|
||||
|
||||
int pthread_condattr_init(pthread_condattr_t *attr)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pthread_kill(pthread_t thread, int sig)
|
||||
{
|
||||
return ENOSYS;
|
||||
}
|
||||
|
||||
typedef struct siginfo_t siginfo_t;
|
||||
|
||||
int sigtimedwait(const sigset_t *set, siginfo_t *info,
|
||||
const struct timespec *timeout)
|
||||
{
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif /* _PR_PTHREADS */
|
||||
|
||||
/* rhapsody.c */
|
||||
|
||||
|
|
|
@ -27,7 +27,11 @@
|
|||
#include <dlfcn.h> /* For dlopen, dlsym, dlclose */
|
||||
#endif
|
||||
|
||||
#if defined(RHAPSODY)
|
||||
#include <crt_externs.h>
|
||||
#else
|
||||
extern char **environ;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* HP-UX 9 doesn't have the SA_RESTART flag.
|
||||
|
@ -156,7 +160,11 @@ ForkAndExec(
|
|||
childEnvp = envp;
|
||||
if (attr && attr->fdInheritBuffer) {
|
||||
if (NULL == childEnvp) {
|
||||
#ifdef RHAPSODY
|
||||
childEnvp = *(_NSGetEnviron());
|
||||
#else
|
||||
childEnvp = environ;
|
||||
#endif
|
||||
}
|
||||
for (nEnv = 0; childEnvp[nEnv]; nEnv++) {
|
||||
}
|
||||
|
|
|
@ -261,7 +261,8 @@ GetHighResClock(void *buf, size_t maxbytes)
|
|||
{
|
||||
return 0;
|
||||
}
|
||||
#elif defined(SCO) || defined(UNIXWARE) || defined(BSDI) || defined(NTO) || defined(QNX)
|
||||
#elif defined(SCO) || defined(UNIXWARE) || defined(BSDI) || defined(NTO) \
|
||||
|| defined(QNX) || defined(RHAPSODY)
|
||||
#include <sys/times.h>
|
||||
|
||||
static size_t
|
||||
|
|
|
@ -123,7 +123,7 @@ static ssize_t (*pt_aix_sendfile_fptr)() = NULL;
|
|||
#define _PRSockOptVal_t char *
|
||||
#elif defined(IRIX) || defined(OSF1) || defined(AIX) || defined(HPUX) \
|
||||
|| defined(LINUX) || defined(FREEBSD) || defined(BSDI) || defined(VMS) \
|
||||
|| defined(NTO) || defined(OPENBSD)
|
||||
|| defined(NTO) || defined(OPENBSD) || defined(RHAPSODY)
|
||||
#define _PRSockOptVal_t void *
|
||||
#else
|
||||
#error "Cannot determine architecture"
|
||||
|
@ -137,7 +137,7 @@ static ssize_t (*pt_aix_sendfile_fptr)() = NULL;
|
|||
|| defined(OSF1) || defined(SOLARIS) \
|
||||
|| defined(HPUX10_30) || defined(HPUX11) || defined(LINUX) \
|
||||
|| defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD) \
|
||||
|| defined(BSDI) || defined(VMS) || defined(NTO)
|
||||
|| defined(BSDI) || defined(VMS) || defined(NTO) || defined(RHAPSODY)
|
||||
#define _PRSelectFdSetArg_t fd_set *
|
||||
#else
|
||||
#error "Cannot determine architecture"
|
||||
|
@ -2440,7 +2440,8 @@ static PRIOMethods _pr_socketpollfd_methods = {
|
|||
|
||||
#if defined(HPUX) || defined(OSF1) || defined(SOLARIS) || defined (IRIX) \
|
||||
|| defined(AIX) || defined(LINUX) || defined(FREEBSD) || defined(NETBSD) \
|
||||
|| defined(OPENBSD) || defined(BSDI) || defined(VMS) || defined(NTO)
|
||||
|| defined(OPENBSD) || defined(BSDI) || defined(VMS) || defined(NTO) \
|
||||
|| defined(RHAPSODY)
|
||||
#define _PR_FCNTL_FLAGS O_NONBLOCK
|
||||
#else
|
||||
#error "Can't determine architecture"
|
||||
|
|
|
@ -426,7 +426,7 @@ LIBPTHREAD = -lpthread
|
|||
ifeq ($(OS_ARCH),AIX)
|
||||
LIBPTHREAD = -lpthreads
|
||||
endif
|
||||
ifeq (,$(filter-out FreeBSD OpenBSD BSD_OS NTO,$(OS_ARCH)))
|
||||
ifeq (,$(filter-out FreeBSD OpenBSD BSD_OS NTO Rhapsody,$(OS_ARCH)))
|
||||
LIBPTHREAD =
|
||||
endif
|
||||
ifeq ($(OS_ARCH)$(basename $(OS_RELEASE)),HP-UXB.10)
|
||||
|
|
|
@ -428,7 +428,7 @@ LIBPTHREAD = -lpthread
|
|||
ifeq ($(OS_ARCH),AIX)
|
||||
LIBPTHREAD = -lpthreads
|
||||
endif
|
||||
ifeq (,$(filter-out FreeBSD OpenBSD BSD_OS NTO,$(OS_ARCH)))
|
||||
ifeq (,$(filter-out FreeBSD OpenBSD BSD_OS NTO Rhapsody,$(OS_ARCH)))
|
||||
LIBPTHREAD =
|
||||
endif
|
||||
ifeq ($(OS_ARCH)$(basename $(OS_RELEASE)),HP-UXB.10)
|
||||
|
|
Загрузка…
Ссылка в новой задаче