Initial community commit
This commit is contained in:
254
Src/nprt_plugin/gecko/1.8/win/include/md/_aix.h
Normal file
254
Src/nprt_plugin/gecko/1.8/win/include/md/_aix.h
Normal file
@@ -0,0 +1,254 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Portable Runtime (NSPR).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998-2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nspr_aix_defs_h___
|
||||
#define nspr_aix_defs_h___
|
||||
|
||||
#include <sys/types.h>
|
||||
#if defined(_PR_PTHREADS) || defined(PTHREADS_USER)
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* To pick up fd_set and the poll events.
|
||||
*/
|
||||
#include <sys/select.h>
|
||||
#include <sys/poll.h>
|
||||
|
||||
/*
|
||||
* Internal configuration macros
|
||||
*/
|
||||
|
||||
#define PR_LINKER_ARCH "aix"
|
||||
#define _PR_SI_SYSNAME "AIX"
|
||||
#define _PR_SI_ARCHITECTURE "rs6000"
|
||||
#define PR_DLL_SUFFIX ".so"
|
||||
|
||||
#define _PR_VMBASE 0x30000000
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
#define _MD_DEFAULT_STACK_SIZE (2*65536L)
|
||||
#define _MD_MINIMUM_STACK_SIZE (2*65536L)
|
||||
#define _MD_MMAP_FLAGS MAP_PRIVATE
|
||||
|
||||
#define NEED_TIME_R
|
||||
#undef HAVE_STACK_GROWING_UP
|
||||
#undef HAVE_WEAK_IO_SYMBOLS
|
||||
#undef HAVE_WEAK_MALLOC_SYMBOLS
|
||||
#define HAVE_DLL
|
||||
#define USE_DLFCN
|
||||
#define _PR_HAVE_SOCKADDR_LEN
|
||||
#define _PR_POLL_AVAILABLE
|
||||
#define _PR_USE_POLL
|
||||
#define _PR_STAT_HAS_ONLY_ST_ATIME
|
||||
#ifdef _PR_INET6
|
||||
#define _PR_HAVE_INET_NTOP
|
||||
#define _PR_HAVE_GETHOSTBYNAME2
|
||||
#define _PR_HAVE_GETADDRINFO
|
||||
#endif
|
||||
#define _PR_HAVE_SYSV_SEMAPHORES
|
||||
#define PR_HAVE_SYSV_NAMED_SHARED_MEMORY
|
||||
#define _PR_ACCEPT_INHERIT_NONBLOCK
|
||||
|
||||
/* Timer operations */
|
||||
#if defined(AIX_TIMERS)
|
||||
extern PRIntervalTime _MD_AixGetInterval(void);
|
||||
#define _MD_GET_INTERVAL _MD_AixGetInterval
|
||||
|
||||
extern PRIntervalTime _MD_AixIntervalPerSec(void);
|
||||
#define _MD_INTERVAL_PER_SEC _MD_AixIntervalPerSec
|
||||
|
||||
#else /* defined(AIX_TIMERS) */
|
||||
#define _MD_GET_INTERVAL _PR_UNIX_GetInterval
|
||||
#define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond
|
||||
#endif /* defined(AIX_TIMERS) */
|
||||
|
||||
#ifdef AIX_HAVE_ATOMIC_OP_H
|
||||
/* The atomic operations */
|
||||
#include <sys/atomic_op.h>
|
||||
#define _PR_HAVE_ATOMIC_OPS
|
||||
#ifndef IS_64
|
||||
#define _PR_HAVE_ATOMIC_CAS
|
||||
#endif
|
||||
#define _MD_INIT_ATOMIC()
|
||||
#define _MD_ATOMIC_INCREMENT(val) ((PRInt32)fetch_and_add((atomic_p)val, 1) + 1)
|
||||
#define _MD_ATOMIC_ADD(ptr, val) ((PRInt32)fetch_and_add((atomic_p)ptr, val) + val)
|
||||
#define _MD_ATOMIC_DECREMENT(val) ((PRInt32)fetch_and_add((atomic_p)val, -1) - 1)
|
||||
#define _MD_ATOMIC_SET(val, newval) _AIX_AtomicSet(val, newval)
|
||||
#endif /* AIX_HAVE_ATOMIC_OP_H */
|
||||
|
||||
#define USE_SETJMP
|
||||
|
||||
#include <setjmp.h>
|
||||
|
||||
#define _MD_GET_SP(_t) (_t)->md.jb[3]
|
||||
#define _MD_SET_THR_SP(_t, _sp) ((_t)->md.jb[3] = (int) (_sp - 2 * 64))
|
||||
#define PR_NUM_GCREGS _JBLEN
|
||||
|
||||
#define CONTEXT(_th) ((_th)->md.jb)
|
||||
#define SAVE_CONTEXT(_th) _setjmp(CONTEXT(_th))
|
||||
#define GOTO_CONTEXT(_th) _longjmp(CONTEXT(_th), 1)
|
||||
|
||||
#ifdef PTHREADS_USER
|
||||
#include "_nspr_pthread.h"
|
||||
#else
|
||||
|
||||
/*
|
||||
** Initialize the thread context preparing it to execute _main.
|
||||
*/
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
PR_BEGIN_MACRO \
|
||||
*status = PR_TRUE; \
|
||||
if (setjmp(CONTEXT(_thread))) { \
|
||||
(*_main)(); \
|
||||
} \
|
||||
_MD_GET_SP(_thread) = (int) (_sp - 2 * 64); \
|
||||
PR_END_MACRO
|
||||
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
if (!setjmp(CONTEXT(_thread))) { \
|
||||
(_thread)->md.errcode = errno; \
|
||||
_PR_Schedule(); \
|
||||
}
|
||||
|
||||
/*
|
||||
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
|
||||
*/
|
||||
#define _MD_RESTORE_CONTEXT(_thread) \
|
||||
{ \
|
||||
errno = (_thread)->md.errcode; \
|
||||
_MD_SET_CURRENT_THREAD(_thread); \
|
||||
longjmp(CONTEXT(_thread), 1); \
|
||||
}
|
||||
|
||||
/* Machine-dependent (MD) data structures */
|
||||
|
||||
struct _MDThread {
|
||||
jmp_buf jb;
|
||||
int id;
|
||||
int errcode;
|
||||
};
|
||||
|
||||
struct _MDThreadStack {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDLock {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSemaphore {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDCVar {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSegment {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
/*
|
||||
* md-specific cpu structure field
|
||||
*/
|
||||
#define _PR_MD_MAX_OSFD FD_SETSIZE
|
||||
|
||||
struct _MDCPU_Unix {
|
||||
PRCList ioQ;
|
||||
PRUint32 ioq_timeout;
|
||||
PRInt32 ioq_max_osfd;
|
||||
PRInt32 ioq_osfd_cnt;
|
||||
#ifndef _PR_USE_POLL
|
||||
fd_set fd_read_set, fd_write_set, fd_exception_set;
|
||||
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
|
||||
fd_exception_cnt[_PR_MD_MAX_OSFD];
|
||||
#else
|
||||
struct pollfd *ioq_pollfds;
|
||||
int ioq_pollfds_size;
|
||||
#endif /* _PR_USE_POLL */
|
||||
};
|
||||
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
|
||||
struct _MDCPU {
|
||||
struct _MDCPU_Unix md_unix;
|
||||
};
|
||||
|
||||
#if !defined(_PR_PTHREADS)
|
||||
#define _MD_INIT_LOCKS()
|
||||
#endif
|
||||
|
||||
#define _MD_NEW_LOCK(lock) PR_SUCCESS
|
||||
#define _MD_FREE_LOCK(lock)
|
||||
#define _MD_LOCK(lock)
|
||||
#define _MD_UNLOCK(lock)
|
||||
#define _MD_INIT_IO()
|
||||
#define _MD_IOQ_LOCK()
|
||||
#define _MD_IOQ_UNLOCK()
|
||||
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
|
||||
#define _MD_INIT_THREAD _MD_InitializeThread
|
||||
#define _MD_EXIT_THREAD(thread)
|
||||
#define _MD_SUSPEND_THREAD(thread)
|
||||
#define _MD_RESUME_THREAD(thread)
|
||||
#define _MD_CLEAN_THREAD(_thread)
|
||||
#endif /* PTHREADS_USER */
|
||||
|
||||
#ifdef AIX_RENAME_SELECT
|
||||
#define _MD_SELECT select
|
||||
#define _MD_POLL poll
|
||||
#endif
|
||||
|
||||
extern void _MD_aix_map_sendfile_error(int err);
|
||||
|
||||
#endif /* nspr_aix_defs_h___ */
|
||||
613
Src/nprt_plugin/gecko/1.8/win/include/md/_beos.h
Normal file
613
Src/nprt_plugin/gecko/1.8/win/include/md/_beos.h
Normal file
@@ -0,0 +1,613 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Portable Runtime (NSPR).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998-2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nspr_beos_defs_h___
|
||||
#define nspr_beos_defs_h___
|
||||
|
||||
#include "prtypes.h"
|
||||
#include "prio.h"
|
||||
#include "prthread.h"
|
||||
#include "prproces.h"
|
||||
#include "prmem.h"
|
||||
#include "obsolete/prsem.h"
|
||||
#include <errno.h>
|
||||
|
||||
#include <support/SupportDefs.h>
|
||||
#include <kernel/OS.h>
|
||||
#include <dirent.h>
|
||||
|
||||
/*
|
||||
* Internal configuration macros
|
||||
*/
|
||||
|
||||
#ifdef BONE_VERSION
|
||||
#define _PR_HAVE_SOCKADDR_LEN
|
||||
#endif
|
||||
|
||||
#define PR_LINKER_ARCH "beos"
|
||||
#define _PR_SI_SYSNAME "BEOS"
|
||||
#ifdef __powerpc__
|
||||
#define _PR_SI_ARCHITECTURE "ppc"
|
||||
#else
|
||||
#define _PR_SI_ARCHITECTURE "x86"
|
||||
#endif
|
||||
#define PR_DLL_SUFFIX ".so"
|
||||
|
||||
#define _PR_VMBASE 0x30000000
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
#define _MD_DEFAULT_STACK_SIZE 65536L
|
||||
#define _MD_MMAP_FLAGS MAP_PRIVATE
|
||||
|
||||
#undef HAVE_STACK_GROWING_UP
|
||||
#define HAVE_DLL
|
||||
#define _PR_NO_CLOCK_TIMER
|
||||
|
||||
/*
|
||||
* The Atomic operations
|
||||
*/
|
||||
|
||||
#define _PR_HAVE_ATOMIC_OPS
|
||||
#define _MD_INIT_ATOMIC _MD_AtomicInit
|
||||
#define _MD_ATOMIC_INCREMENT _MD_AtomicIncrement
|
||||
#define _MD_ATOMIC_ADD _MD_AtomicAdd
|
||||
#define _MD_ATOMIC_DECREMENT _MD_AtomicDecrement
|
||||
#define _MD_ATOMIC_SET _MD_AtomicSet
|
||||
|
||||
#define HAVE_CVAR_BUILT_ON_SEM
|
||||
#define _PR_GLOBAL_THREADS_ONLY
|
||||
#define _PR_BTHREADS
|
||||
#define _PR_NEED_FAKE_POLL
|
||||
#define _PR_HAVE_PEEK_BUFFER
|
||||
#define _PR_PEEK_BUFFER_MAX (16 * 1024)
|
||||
#define _PR_FD_NEED_EMULATE_MSG_PEEK(fd) 1
|
||||
#define _PR_CONNECT_DOES_NOT_BIND
|
||||
#define _PR_HAVE_O_APPEND
|
||||
|
||||
/* Define threading functions and objects as native BeOS */
|
||||
struct _MDThread {
|
||||
thread_id tid; /* BeOS thread handle */
|
||||
sem_id joinSem; /* sems used to synchronzie joining */
|
||||
PRBool is_joining; /* TRUE if someone is currently waiting to
|
||||
join this thread */
|
||||
};
|
||||
|
||||
struct _MDThreadStack {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
/*
|
||||
* Lock and Semaphore related definitions
|
||||
*/
|
||||
|
||||
struct _MDLock {
|
||||
sem_id semaphoreID;
|
||||
int32 benaphoreCount;
|
||||
};
|
||||
|
||||
struct _MDCVar {
|
||||
sem_id sem1;
|
||||
sem_id sem2;
|
||||
int16 count;
|
||||
};
|
||||
|
||||
struct _MDSemaphore {
|
||||
sem_id sid;
|
||||
};
|
||||
|
||||
/*
|
||||
** CPU-related definitions
|
||||
*/
|
||||
struct _MDCPU {
|
||||
int8 unused;
|
||||
};
|
||||
|
||||
/*
|
||||
** Process-related definitions
|
||||
*/
|
||||
struct _MDProcess {
|
||||
pid_t pid;
|
||||
};
|
||||
|
||||
struct _MDSegment {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
/*
|
||||
** File- and directory-related definitions
|
||||
*/
|
||||
|
||||
#ifndef BONE_VERSION
|
||||
#define BE_SOCK_SHUTDOWN_READ 0x01
|
||||
#define BE_SOCK_SHUTDOWN_WRITE 0x02
|
||||
#endif
|
||||
|
||||
struct _MDFileDesc {
|
||||
PRInt32 osfd;
|
||||
PRInt32 sock_state;
|
||||
PRBool accepted_socket;
|
||||
PRNetAddr peer_addr;
|
||||
#ifndef BONE_VERSION
|
||||
PRBool connectValueValid;
|
||||
int connectReturnValue;
|
||||
int connectReturnError;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct _MDDir {
|
||||
DIR *d;
|
||||
};
|
||||
|
||||
#define PR_DIRECTORY_SEPARATOR '/'
|
||||
#define PR_DIRECTORY_SEPARATOR_STR "/"
|
||||
#define PR_PATH_SEPARATOR ':'
|
||||
#define PR_PATH_SEPARATOR_STR ":"
|
||||
|
||||
#define GETTIMEOFDAY(tp) gettimeofday((tp), NULL)
|
||||
|
||||
/* --- Memory-mapped files stuff --- not implemented on BeOS */
|
||||
|
||||
struct _MDFileMap {
|
||||
PRInt8 unused;
|
||||
};
|
||||
|
||||
/*
|
||||
* Network related definitions.
|
||||
*/
|
||||
|
||||
#ifndef BONE_VERSION
|
||||
#define IPPROTO_IP 0
|
||||
#define AF_UNIX 2
|
||||
#define TCP_NODELAY SO_NONBLOCK
|
||||
#define SO_LINGER -1
|
||||
#define SO_ERROR 4
|
||||
#endif
|
||||
|
||||
#define _PR_INTERRUPT_CHECK_INTERVAL_SECS 5
|
||||
|
||||
#ifndef BONE_VERSION
|
||||
/* these aren't actually used. if they are, we're screwed */
|
||||
struct protoent {
|
||||
char *p_name; /* official protocol name */
|
||||
char **p_aliases; /* alias list */
|
||||
int p_proto; /* protocol # */
|
||||
};
|
||||
|
||||
struct protoent* getprotobyname(const char* name);
|
||||
struct protoent* getprotobynumber(int number);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* malloc() related definitions.
|
||||
*/
|
||||
|
||||
#undef _PR_OVERRIDE_MALLOC
|
||||
|
||||
/* Miscellaneous */
|
||||
|
||||
#define _MD_ERRNO() (errno)
|
||||
|
||||
#define _MD_CLEANUP_BEFORE_EXIT _MD_cleanup_before_exit
|
||||
#define _MD_EXIT _MD_exit
|
||||
|
||||
#define _MD_GET_ENV getenv
|
||||
#define _MD_PUT_ENV putenv
|
||||
|
||||
#define _MD_EARLY_INIT _MD_early_init
|
||||
#define _MD_FINAL_INIT _MD_final_init
|
||||
|
||||
/* CPU Stuff */
|
||||
|
||||
#define _MD_INIT_CPUS _MD_init_cpus
|
||||
#define _MD_WAKEUP_CPUS _MD_wakeup_cpus
|
||||
#define _MD_START_INTERRUPTS _MD_start_interrupts
|
||||
#define _MD_STOP_INTERRUPTS _MD_stop_interrupts
|
||||
#define _MD_DISABLE_CLOCK_INTERRUPTS _MD_disable_clock_interrupts
|
||||
#define _MD_BLOCK_CLOCK_INTERRUPTS _MD_block_clock_interrupts
|
||||
#define _MD_UNBLOCK_CLOCK_INTERRUPTS _MD_unblock_clock_interrupts
|
||||
#define _MD_CLOCK_INTERRUPT _MD_clock_interrupt
|
||||
#define _MD_INIT_STACK _MD_init_stack
|
||||
#define _MD_CLEAR_STACK _MD_clear_stack
|
||||
// #define _MD_GET_INTSOFF _MD_get_intsoff
|
||||
// #define _MD_SET_INTSOFF _MD_set_intsoff
|
||||
#define _MD_CURRENT_CPU _MD_current_cpu
|
||||
#define _MD_SET_CURRENT_CPU _MD_set_current_cpu
|
||||
#define _MD_INIT_RUNNING_CPU _MD_init_running_cpu
|
||||
#define _MD_PAUSE_CPU _MD_pause_cpu
|
||||
|
||||
/* Thread stuff */
|
||||
|
||||
#define _MD_CURRENT_THREAD() PR_GetCurrentThread()
|
||||
// #define _MD_GET_ATTACHED_THREAD _MD_get_attached_thread
|
||||
#define _MD_LAST_THREAD _MD_last_thread
|
||||
#define _MD_SET_CURRENT_THREAD _MD_set_current_THREAD
|
||||
#define _MD_SET_LAST_THREAD _MD_set_last_thread
|
||||
#define _MD_INIT_THREAD _MD_init_thread
|
||||
#define _MD_EXIT_THREAD _MD_exit_thread
|
||||
#define _MD_INIT_ATTACHED_THREAD _MD_init_attached_thread
|
||||
|
||||
#define _MD_SUSPEND_THREAD _MD_suspend_thread
|
||||
#define _MD_RESUME_THREAD _MD_resume_thread
|
||||
#define _MD_SUSPEND_CPU _MD_suspend_cpu
|
||||
#define _MD_RESUME_CPU _MD_resume_cpu
|
||||
#define _MD_BEGIN_SUSPEND_ALL _MD_begin_suspend_all
|
||||
#define _MD_END_SUSPEND_ALL _MD_end_suspend_all
|
||||
#define _MD_BEGIN_RESUME_ALL _MD_begin_resume_all
|
||||
#define _MD_END_RESUME_ALL _MD_end_resume_all
|
||||
|
||||
#define _MD_GET_SP _MD_get_sp
|
||||
|
||||
#define _MD_CLEAN_THREAD _MD_clean_thread
|
||||
#define _MD_CREATE_PRIMORDIAL_USER_THREAD _MD_create_primordial_user_thread
|
||||
#define _MD_CREATE_USER_THREAD _MD_create_user_thread
|
||||
#define _MD_INIT_PRIMORDIAL_THREAD _MD_init_primordial_thread
|
||||
#define _MD_CREATE_THREAD _MD_create_thread
|
||||
#define _MD_YIELD _MD_yield
|
||||
#define _MD_SET_PRIORITY _MD_set_priority
|
||||
|
||||
#define _MD_SUSPENDALL _MD_suspendall
|
||||
#define _MD_RESUMEALL _MD_resumeall
|
||||
|
||||
#define _MD_SWITCH_CONTEXT _MD_switch_context
|
||||
#define _MD_RESTORE_CONTEXT _MD_restore_context
|
||||
|
||||
#define _MD_WAIT _MD_wait
|
||||
#define _MD_WAKEUP_WAITER _MD_wakeup_waiter
|
||||
|
||||
#define _MD_SETTHREADAFFINITYMASK _MD_setthreadaffinitymask
|
||||
#define _MD_GETTHREADAFFINITYMASK _MD_getthreadaffinitymask
|
||||
|
||||
/* Thread Synchronization */
|
||||
|
||||
#define _MD_INIT_LOCKS _MD_init_locks
|
||||
#define _MD_NEW_LOCK _MD_new_lock
|
||||
#define _MD_FREE_LOCK _MD_free_lock
|
||||
#define _MD_LOCK _MD_lock
|
||||
#define _MD_TEST_AND_LOCK _MD_test_and_lock
|
||||
#define _MD_UNLOCK _MD_unlock
|
||||
#define _MD_IOQ_LOCK _MD_ioq_lock
|
||||
#define _MD_IOQ_UNLOCK _MD_ioq_unlock
|
||||
#define _MD_NEW_SEM _MD_new_sem
|
||||
#define _MD_DESTROY_SEM _MD_destroy_sem
|
||||
#define _MD_TIMED_WAIT_SEM _MD_timed_wait_sem
|
||||
#define _MD_WAIT_SEM _MD_wait_sem
|
||||
#define _MD_POST_SEM _MD_post_sem
|
||||
// #define _MD_NEW_CV _MD_new_cv
|
||||
// #define _MD_FREE_CV _MD_free_cv
|
||||
// #define _MD_WAIT_CV _MD_wait_cv
|
||||
// #define _MD_NOTIFY_CV _MD_notify_cv
|
||||
// #define _MD_NOTIFYALL_CV _MD_notifyall_cv
|
||||
|
||||
/* File I/O */
|
||||
|
||||
/* don't need any I/O initializations */
|
||||
#define _MD_INIT_IO()
|
||||
#define _MD_INIT_FILEDESC(fd)
|
||||
|
||||
#define _MD_OPEN_DIR _MD_open_dir
|
||||
#define _MD_READ_DIR _MD_read_dir
|
||||
#define _MD_CLOSE_DIR _MD_close_dir
|
||||
#define _MD_MAKE_NONBLOCK _MD_make_nonblock
|
||||
#define _MD_SET_FD_INHERITABLE _MD_set_fd_inheritable
|
||||
#define _MD_INIT_FD_INHERITABLE _MD_init_fd_inheritable
|
||||
#define _MD_QUERY_FD_INHERITABLE _MD_query_fd_inheritable
|
||||
#define _MD_OPEN _MD_open
|
||||
#define _MD_OPEN_FILE _MD_open
|
||||
#define _MD_CLOSE_FILE _MD_close_file
|
||||
#define _MD_READ _MD_read
|
||||
#define _MD_WRITE _MD_write
|
||||
#define _MD_WRITEV _MD_writev
|
||||
#define _MD_LSEEK _MD_lseek
|
||||
#define _MD_LSEEK64 _MD_lseek64
|
||||
#define _MD_FSYNC _MD_fsync
|
||||
#define _MD_DELETE _MD_delete
|
||||
#define _MD_GETFILEINFO _MD_getfileinfo
|
||||
#define _MD_GETFILEINFO64 _MD_getfileinfo64
|
||||
#define _MD_GETOPENFILEINFO _MD_getopenfileinfo
|
||||
#define _MD_GETOPENFILEINFO64 _MD_getopenfileinfo64
|
||||
#define _MD_RENAME _MD_rename
|
||||
#define _MD_ACCESS _MD_access
|
||||
#define _MD_STAT stat
|
||||
#define _MD_MKDIR _MD_mkdir
|
||||
#define _MD_MAKE_DIR _MD_mkdir
|
||||
#define _MD_RMDIR _MD_rmdir
|
||||
#define _MD_PR_POLL _MD_pr_poll
|
||||
|
||||
/* Network I/O */
|
||||
|
||||
#define _MD_CLOSE_SOCKET _MD_close_socket
|
||||
#define _MD_CONNECT _MD_connect
|
||||
#define _MD_ACCEPT _MD_accept
|
||||
#define _MD_BIND _MD_bind
|
||||
#define _MD_LISTEN _MD_listen
|
||||
#define _MD_SHUTDOWN _MD_shutdown
|
||||
#define _MD_RECV _MD_recv
|
||||
#define _MD_SEND _MD_send
|
||||
#define _MD_ACCEPT_READ _MD_accept_read
|
||||
#define _MD_GETSOCKNAME _MD_getsockname
|
||||
#define _MD_GETPEERNAME _MD_getpeername
|
||||
#define _MD_GETSOCKOPT _MD_getsockopt
|
||||
#define _MD_SETSOCKOPT _MD_setsockopt
|
||||
#define _MD_RECVFROM _MD_recvfrom
|
||||
#define _MD_SENDTO _MD_sendto
|
||||
#define _MD_SOCKETPAIR _MD_socketpair
|
||||
#define _MD_SOCKET _MD_socket
|
||||
#define _MD_SOCKETAVAILABLE _MD_socketavailable
|
||||
#define _MD_PIPEAVAILABLE _MD_socketavailable
|
||||
|
||||
#define _MD_GET_SOCKET_ERROR() (errno)
|
||||
#define _MD_GETHOSTNAME _MD_gethostname
|
||||
|
||||
#define _MD_SELECT select
|
||||
|
||||
/* Process management */
|
||||
|
||||
#define _MD_CREATE_PROCESS _MD_create_process
|
||||
#define _MD_DETACH_PROCESS _MD_detach_process
|
||||
#define _MD_WAIT_PROCESS _MD_wait_process
|
||||
#define _MD_KILL_PROCESS _MD_kill_process
|
||||
|
||||
/* Atomic data operations */
|
||||
|
||||
// #define _MD_INIT_ATOMIC _MD_init_atomic
|
||||
// #define _MD_ATOMIC_INCREMENT _MD_atomic_increment
|
||||
// #define _MD_ATOMIC_DECREMENT _MD_atomic_decrement
|
||||
// #define _MD_ATOMIC_SET _MD_atomic_set
|
||||
|
||||
/* memory management */
|
||||
|
||||
#define _MD_INIT_SEGS _MD_init_segs
|
||||
#define _MD_ALLOC_SEGMENT _MD_alloc_segment
|
||||
#define _MD_FREE_SEGMENT _MD_free_segment
|
||||
|
||||
/* Memory mapped file I/O */
|
||||
|
||||
#define _MD_CREATE_FILE_MAP _MD_create_file_map
|
||||
#define _MD_GET_MEM_MAP_ALIGNMENT _MD_get_mem_map_alignment
|
||||
#define _MD_MEM_MAP _MD_mem_map
|
||||
#define _MD_MEM_UNMAP _MD_mem_unmap
|
||||
#define _MD_CLOSE_FILE_MAP _MD_close_file_map
|
||||
|
||||
/* Time related */
|
||||
|
||||
#define _MD_NOW _MD_now
|
||||
#define _MD_INTERVAL_INIT _MD_interval_init
|
||||
#define _MD_GET_INTERVAL _MD_get_interval
|
||||
#define _MD_INTERVAL_PER_SEC _MD_interval_per_sec
|
||||
|
||||
/* File locking */
|
||||
|
||||
#define _MD_LOCKFILE _MD_lockfile
|
||||
#define _MD_TLOCKFILE _MD_tlockfile
|
||||
#define _MD_UNLOCKFILE _MD_unlockfile
|
||||
|
||||
/**
|
||||
* Prototypes for machine dependent function implementations. (Too bad
|
||||
* NSPR's MD system blows so much that we have to reiterate every stinking
|
||||
* thing we implement here in our MD header file.)
|
||||
*/
|
||||
|
||||
/* Miscellaneous */
|
||||
|
||||
NSPR_API(void) _MD_cleanup_before_exit(void);
|
||||
NSPR_API(void) _MD_exit(PRIntn status);
|
||||
|
||||
NSPR_API(char*) _MD_get_env(const char *name);
|
||||
NSPR_API(PRIntn) _MD_put_env(const char *name);
|
||||
|
||||
NSPR_API(void) _MD_early_init(void);
|
||||
NSPR_API(void) _MD_final_init(void);
|
||||
|
||||
/* CPU Stuff */
|
||||
|
||||
NSPR_API(void) _MD_init_cpus();
|
||||
NSPR_API(void) _MD_wakeup_cpus();
|
||||
NSPR_API(void) _MD_start_interrupts(void);
|
||||
NSPR_API(void) _MD_stop_interrupts(void);
|
||||
NSPR_API(void) _MD_disable_clock_interrupts(void);
|
||||
NSPR_API(void) _MD_block_clock_interrupts(void);
|
||||
NSPR_API(void) _MD_unblock_clock_interrupts(void);
|
||||
NSPR_API(void) _MD_clock_interrupt(void);
|
||||
// NSPR_API(void) _MD_init_stack(PRThreadStack *ts, PRIntn redzone);
|
||||
// NSPR_API(void) _MD_clear_stack(PRThreadStack* ts);
|
||||
// NSPR_API(PRInt32) _MD_get_intsoff(void);
|
||||
// NSPR_API(void) _MD_set_intsoff(PRInt32 _val);
|
||||
// NSPR_API(_PRCPU*) _MD_current_cpu(void);
|
||||
// NSPR_API(void) _MD_set_current_cpu(_PRCPU *cpu);
|
||||
// NSPR_API(void) _MD_init_running_cpu(_PRCPU *cpu);
|
||||
NSPR_API(PRInt32) _MD_pause_cpu(PRIntervalTime timeout);
|
||||
|
||||
/* Thread stuff */
|
||||
|
||||
// NSPR_API(PRThread*) _MD_current_thread(void);
|
||||
NSPR_API(PRThread*) _MD_get_attached_thread(void);
|
||||
NSPR_API(PRThread*) _MD_last_thread(void);
|
||||
NSPR_API(void) _MD_set_current_thread(PRThread *thread);
|
||||
NSPR_API(void) _MD_set_last_thread(PRThread *thread);
|
||||
NSPR_API(PRStatus) _MD_init_thread(PRThread *thread);
|
||||
NSPR_API(void) _MD_exit_thread(PRThread *thread);
|
||||
NSPR_API(PRStatus) _MD_init_attached_thread(PRThread *thread);
|
||||
|
||||
NSPR_API(void) _MD_suspend_thread(PRThread *thread);
|
||||
NSPR_API(void) _MD_resume_thread(PRThread *thread);
|
||||
// NSPR_API(void) _MD_suspend_cpu(_PRCPU *cpu);
|
||||
// NSPR_API(void) _MD_resume_cpu(_PRCPU *cpu);
|
||||
NSPR_API(void) _MD_begin_suspend_all(void);
|
||||
NSPR_API(void) _MD_end_suspend_all(void);
|
||||
NSPR_API(void) _MD_begin_resume_all(void);
|
||||
NSPR_API(void) _MD_end_resume_all(void);
|
||||
|
||||
NSPR_API(void *) _MD_get_sp(PRThread *thread);
|
||||
|
||||
NSPR_API(void) _MD_clean_thread(PRThread *thread);
|
||||
NSPR_API(void) _MD_create_primordial_user_thread(PRThread *);
|
||||
NSPR_API(PRThread*) _MD_create_user_thread(PRUint32 stacksize, void (*start)(void *), void *arg);
|
||||
NSPR_API(void) _MD_init_primordial_thread(PRThread *thread);
|
||||
NSPR_API(PRStatus) _MD_create_thread(PRThread *thread, void (*start)(void *), PRThreadPriority priority, PRThreadScope scope, PRThreadState state, PRUint32 stackSize);
|
||||
NSPR_API(void) _MD_yield(void);
|
||||
NSPR_API(void) _MD_set_priority(struct _MDThread *md, PRThreadPriority newPri);
|
||||
|
||||
NSPR_API(void) _MD_suspendall(void);
|
||||
NSPR_API(void) _MD_resumeall(void);
|
||||
|
||||
NSPR_API(void) _MD_init_context(PRThread *thread, char *top, void (*start) (void), PRBool *status);
|
||||
NSPR_API(void) _MD_switch_context(PRThread *thread);
|
||||
NSPR_API(void) _MD_restore_context(PRThread *thread);
|
||||
|
||||
NSPR_API(PRStatus) _MD_wait(PRThread *, PRIntervalTime timeout);
|
||||
NSPR_API(PRStatus) _MD_wakeup_waiter(PRThread *);
|
||||
|
||||
NSPR_API(PRInt32) _MD_setthreadaffinitymask(PRThread *thread, PRUint32 mask );
|
||||
NSPR_API(PRInt32) _MD_getthreadaffinitymask(PRThread *thread, PRUint32 *mask);
|
||||
|
||||
/* Thread Synchronization */
|
||||
|
||||
NSPR_API(void) _MD_init_locks(void);
|
||||
NSPR_API(PRStatus) _MD_new_lock(struct _MDLock *md);
|
||||
NSPR_API(void) _MD_free_lock(struct _MDLock *md);
|
||||
NSPR_API(void) _MD_lock(struct _MDLock *md);
|
||||
NSPR_API(PRIntn) _MD_test_and_lock(struct _MDLock *md);
|
||||
NSPR_API(void) _MD_unlock(struct _MDLock *md);
|
||||
NSPR_API(void) _MD_ioq_lock(void);
|
||||
NSPR_API(void) _MD_ioq_unlock(void);
|
||||
NSPR_API(void) _MD_new_sem(struct _MDSemaphore *md, PRUintn value);
|
||||
NSPR_API(void) _MD_destroy_sem(struct _MDSemaphore *md);
|
||||
NSPR_API(PRStatus) _MD_timed_wait_sem(struct _MDSemaphore *md, PRIntervalTime timeout);
|
||||
NSPR_API(PRStatus) _MD_wait_sem(struct _MDSemaphore *md);
|
||||
NSPR_API(void) _MD_post_sem(struct _MDSemaphore *md);
|
||||
// NSPR_API(PRInt32) _MD_new_cv(struct _MDCVar *md);
|
||||
// NSPR_API(void) _MD_free_cv(struct _MDCVar *md);
|
||||
// NSPR_API(void) _MD_wait_cv(struct _MDCVar *mdCVar, struct _MDLock *mdLock, PRIntervalTime timeout);
|
||||
// NSPR_API(void) _MD_notify_cv(struct _MDCVar *md, struct _MDLock *lock);
|
||||
// NSPR_API(void) _MD_notifyall_cv(struct _MDCVar *md, struct _MDLock *lock);
|
||||
|
||||
/* File I/O */
|
||||
|
||||
// NSPR_API(void) _MD_init_io(void);
|
||||
NSPR_API(PRStatus) _MD_open_dir(struct _MDDir *md,const char *name);
|
||||
NSPR_API(char *) _MD_read_dir(struct _MDDir *md, PRIntn flags);
|
||||
NSPR_API(PRInt32) _MD_close_dir(struct _MDDir *md);
|
||||
NSPR_API(void) _MD_make_nonblock(PRFileDesc *fd);
|
||||
NSPR_API(void) _MD_init_fd_inheritable(PRFileDesc *fd, PRBool imported);
|
||||
NSPR_API(void) _MD_query_fd_inheritable(PRFileDesc *fd);
|
||||
NSPR_API(PRInt32) _MD_open(const char *name, PRIntn osflags, PRIntn mode);
|
||||
NSPR_API(PRInt32) _MD_close_file(PRInt32 osfd);
|
||||
NSPR_API(PRInt32) _MD_read(PRFileDesc *fd, void *buf, PRInt32 amount);
|
||||
NSPR_API(PRInt32) _MD_write(PRFileDesc *fd, const void *buf, PRInt32 amount);
|
||||
NSPR_API(PRInt32) _MD_writev(PRFileDesc *fd, const PRIOVec *iov, PRInt32 iov_size, PRIntervalTime timeout);
|
||||
NSPR_API(PRInt32) _MD_lseek(PRFileDesc *fd, PRInt32 offset, int whence);
|
||||
NSPR_API(PRInt64) _MD_lseek64(PRFileDesc *fd, PRInt64 offset, int whence);
|
||||
NSPR_API(PRInt32) _MD_fsync(PRFileDesc *fd);
|
||||
NSPR_API(PRInt32) _MD_delete(const char *name);
|
||||
NSPR_API(PRInt32) _MD_getfileinfo(const char *fn, PRFileInfo *info);
|
||||
NSPR_API(PRInt32) _MD_getfileinfo64(const char *fn, PRFileInfo64 *info);
|
||||
NSPR_API(PRInt32) _MD_getopenfileinfo(const PRFileDesc *fd, PRFileInfo *info);
|
||||
NSPR_API(PRInt32) _MD_getopenfileinfo64(const PRFileDesc *fd, PRFileInfo64 *info);
|
||||
NSPR_API(PRInt32) _MD_rename(const char *from, const char *to);
|
||||
NSPR_API(PRInt32) _MD_access(const char *name, PRIntn how);
|
||||
NSPR_API(PRInt32) _MD_stat(const char *name, struct stat *buf);
|
||||
NSPR_API(PRInt32) _MD_mkdir(const char *name, PRIntn mode);
|
||||
NSPR_API(PRInt32) _MD_rmdir(const char *name);
|
||||
NSPR_API(PRInt32) _MD_pr_poll(PRPollDesc *pds, PRIntn npds, PRIntervalTime timeout);
|
||||
|
||||
/* Network I/O */
|
||||
NSPR_API(PRInt32) _MD_close_socket(PRInt32 osfd);
|
||||
NSPR_API(PRInt32) _MD_connect(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen, PRIntervalTime timeout);
|
||||
NSPR_API(PRInt32) _MD_accept(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen, PRIntervalTime timeout);
|
||||
NSPR_API(PRInt32) _MD_bind(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen);
|
||||
NSPR_API(PRInt32) _MD_listen(PRFileDesc *fd, PRIntn backlog);
|
||||
NSPR_API(PRInt32) _MD_shutdown(PRFileDesc *fd, PRIntn how);
|
||||
NSPR_API(PRInt32) _MD_recv(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, PRIntervalTime timeout);
|
||||
NSPR_API(PRInt32) _MD_send(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, PRIntervalTime timeout);
|
||||
NSPR_API(PRInt32) _MD_accept_read(PRFileDesc *sd, PRInt32 *newSock, PRNetAddr **raddr, void *buf, PRInt32 amount, PRIntervalTime timeout);
|
||||
// NSPR_API(PRInt32) _MD_fast_accept(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen, PRIntervalTime timeout, PRBool fast, _PR_AcceptTimeoutCallback callback, void *callbackArg);
|
||||
// NSPR_API(PRInt32) _MD_fast_accept_read(PRFileDesc *sd, PRInt32 *newSock, PRNetAddr **raddr, void *buf, PRInt32 amount, PRIntervalTime timeout, PRBool fast, _PR_AcceptTimeoutCallback callback, void *callbackArg);
|
||||
// NSPR_API(void) _MD_update_accept_context(PRInt32 s, PRInt32 ls);
|
||||
NSPR_API(PRStatus) _MD_getsockname(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen);
|
||||
NSPR_API(PRStatus) _MD_getpeername(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen);
|
||||
NSPR_API(PRStatus) _MD_getsockopt(PRFileDesc *fd, PRInt32 level, PRInt32 optname, char* optval, PRInt32* optlen);
|
||||
NSPR_API(PRStatus) _MD_setsockopt(PRFileDesc *fd, PRInt32 level, PRInt32 optname, const char* optval, PRInt32 optlen);
|
||||
NSPR_API(PRInt32) _MD_recvfrom(PRFileDesc *fd, void *buf, PRInt32 amount, PRIntn flags, PRNetAddr *addr, PRUint32 *addrlen, PRIntervalTime timeout);
|
||||
NSPR_API(PRInt32) _MD_sendto(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, const PRNetAddr *addr, PRUint32 addrlen, PRIntervalTime timeout);
|
||||
NSPR_API(PRInt32) _MD_socketpair(int af, int type, int flags, PRInt32 *osfd);
|
||||
NSPR_API(PRInt32) _MD_socket(int af, int type, int flags);
|
||||
NSPR_API(PRInt32) _MD_socketavailable(PRFileDesc *fd);
|
||||
|
||||
// NSPR_API(PRInt32) _MD_get_socket_error(void);
|
||||
NSPR_API(PRStatus) _MD_gethostname(char *name, PRUint32 namelen);
|
||||
|
||||
/* Process management */
|
||||
|
||||
NSPR_API(PRProcess *) _MD_create_process(const char *path, char *const *argv, char *const *envp, const PRProcessAttr *attr);
|
||||
NSPR_API(PRStatus) _MD_detach_process(PRProcess *process);
|
||||
NSPR_API(PRStatus) _MD_wait_process(PRProcess *process, PRInt32 *exitCode);
|
||||
NSPR_API(PRStatus) _MD_kill_process(PRProcess *process);
|
||||
|
||||
/* Atomic data operations */
|
||||
|
||||
// NSPR_API(void) _MD_init_atomic(void);
|
||||
// NSPR_API(PRInt32) _MD_atomic_increment(PRInt32 *);
|
||||
// NSPR_API(PRInt32) _MD_atomic_decrement(PRInt32 *);
|
||||
// NSPR_API(PRInt32) _MD_atomic_set(PRInt32 *, PRInt32);
|
||||
|
||||
/* Memory management */
|
||||
|
||||
NSPR_API(void) _MD_init_segs(void);
|
||||
NSPR_API(PRStatus) _MD_alloc_segment(PRSegment *seg, PRUint32 size, void *vaddr);
|
||||
NSPR_API(void) _MD_free_segment(PRSegment *seg);
|
||||
|
||||
/* Memory mapped file I/O */
|
||||
|
||||
NSPR_API(PRStatus) _MD_create_file_map(PRFileMap *fmap, PRInt64 size);
|
||||
NSPR_API(PRInt32) _MD_get_mem_map_alignment(void);
|
||||
NSPR_API(void *) _MD_mem_map(PRFileMap *fmap, PRInt64 offset, PRUint32 len);
|
||||
NSPR_API(PRStatus) _MD_mem_unmap(void *addr, PRUint32 size);
|
||||
NSPR_API(PRStatus) _MD_close_file_map(PRFileMap *fmap);
|
||||
|
||||
/* Time related */
|
||||
|
||||
NSPR_API(PRTime) _MD_now(void);
|
||||
NSPR_API(void) _MD_interval_init(void);
|
||||
NSPR_API(PRIntervalTime) _MD_get_interval(void);
|
||||
NSPR_API(PRIntervalTime) _MD_interval_per_sec(void);
|
||||
|
||||
/* File locking */
|
||||
|
||||
NSPR_API(PRStatus) _MD_lockfile(PRInt32 osfd);
|
||||
NSPR_API(PRStatus) _MD_tlockfile(PRInt32 osfd);
|
||||
NSPR_API(PRStatus) _MD_unlockfile(PRInt32 osfd);
|
||||
|
||||
#endif /* _nspr_beos_defs_h___*/
|
||||
214
Src/nprt_plugin/gecko/1.8/win/include/md/_bsdi.h
Normal file
214
Src/nprt_plugin/gecko/1.8/win/include/md/_bsdi.h
Normal file
@@ -0,0 +1,214 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Portable Runtime (NSPR).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998-2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nspr_bsdi_defs_h___
|
||||
#define nspr_bsdi_defs_h___
|
||||
|
||||
/*
|
||||
* Internal configuration macros
|
||||
*/
|
||||
|
||||
#include <sys/param.h> /* for _BSDI_VERSION */
|
||||
|
||||
#define PR_LINKER_ARCH "bsdi"
|
||||
#define _PR_SI_SYSNAME "BSDI"
|
||||
#if defined(__i386__)
|
||||
#define _PR_SI_ARCHITECTURE "x86"
|
||||
#elif defined(__sparc__)
|
||||
#define _PR_SI_ARCHITECTURE "sparc"
|
||||
#else
|
||||
#error "Unknown CPU architecture"
|
||||
#endif
|
||||
#define PR_DLL_SUFFIX ".so"
|
||||
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
#define _MD_DEFAULT_STACK_SIZE 65536L
|
||||
#define _MD_MMAP_FLAGS MAP_PRIVATE
|
||||
|
||||
#define HAVE_BSD_FLOCK
|
||||
#define NEED_TIME_R
|
||||
#define _PR_HAVE_SOCKADDR_LEN
|
||||
#define _PR_NO_LARGE_FILES
|
||||
|
||||
#define USE_SETJMP
|
||||
|
||||
/* BSD/OS 4.3 and newer all have IPv6 support */
|
||||
#if _BSDI_VERSION >= 200105
|
||||
#define _PR_INET6
|
||||
#define _PR_HAVE_INET_NTOP
|
||||
#define _PR_HAVE_GETIPNODEBYNAME
|
||||
#define _PR_HAVE_GETIPNODEBYADDR
|
||||
#define _PR_HAVE_GETADDRINFO
|
||||
#define _PR_INET6_PROBE
|
||||
#endif
|
||||
|
||||
#ifndef _PR_PTHREADS
|
||||
|
||||
#include <setjmp.h>
|
||||
|
||||
#if defined(_PR_BSDI_JMPBUF_IS_ARRAY)
|
||||
#define _MD_GET_SP(_t) (_t)->md.context[2]
|
||||
#elif defined(_PR_BSDI_JMPBUF_IS_STRUCT)
|
||||
#define _MD_GET_SP(_t) (_t)->md.context[0].jb_esp
|
||||
#else
|
||||
#error "Unknown BSDI jmp_buf type"
|
||||
#endif
|
||||
|
||||
#define PR_NUM_GCREGS _JBLEN
|
||||
#define PR_CONTEXT_TYPE jmp_buf
|
||||
|
||||
#define CONTEXT(_th) ((_th)->md.context)
|
||||
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
{ \
|
||||
*status = PR_TRUE; \
|
||||
if (setjmp(CONTEXT(_thread))) { \
|
||||
_main(); \
|
||||
} \
|
||||
_MD_GET_SP(_thread) = (int) (_sp - 64); \
|
||||
}
|
||||
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
if (!setjmp(CONTEXT(_thread))) { \
|
||||
(_thread)->md.errcode = errno; \
|
||||
_PR_Schedule(); \
|
||||
}
|
||||
|
||||
/*
|
||||
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
|
||||
*/
|
||||
#define _MD_RESTORE_CONTEXT(_thread) \
|
||||
{ \
|
||||
errno = (_thread)->md.errcode; \
|
||||
_MD_SET_CURRENT_THREAD(_thread); \
|
||||
longjmp(CONTEXT(_thread), 1); \
|
||||
}
|
||||
|
||||
/* Machine-dependent (MD) data structures */
|
||||
|
||||
struct _MDThread {
|
||||
PR_CONTEXT_TYPE context;
|
||||
int id;
|
||||
int errcode;
|
||||
};
|
||||
|
||||
struct _MDThreadStack {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDLock {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSemaphore {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDCVar {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSegment {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
/*
|
||||
* md-specific cpu structure field
|
||||
*/
|
||||
#define _PR_MD_MAX_OSFD FD_SETSIZE
|
||||
|
||||
struct _MDCPU_Unix {
|
||||
PRCList ioQ;
|
||||
PRUint32 ioq_timeout;
|
||||
PRInt32 ioq_max_osfd;
|
||||
PRInt32 ioq_osfd_cnt;
|
||||
#ifndef _PR_USE_POLL
|
||||
fd_set fd_read_set, fd_write_set, fd_exception_set;
|
||||
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
|
||||
fd_exception_cnt[_PR_MD_MAX_OSFD];
|
||||
#else
|
||||
struct pollfd *ioq_pollfds;
|
||||
int ioq_pollfds_size;
|
||||
#endif /* _PR_USE_POLL */
|
||||
};
|
||||
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
|
||||
struct _MDCPU {
|
||||
struct _MDCPU_Unix md_unix;
|
||||
};
|
||||
|
||||
#define _MD_INIT_LOCKS()
|
||||
#define _MD_NEW_LOCK(lock) PR_SUCCESS
|
||||
#define _MD_FREE_LOCK(lock)
|
||||
#define _MD_LOCK(lock)
|
||||
#define _MD_UNLOCK(lock)
|
||||
#define _MD_INIT_IO()
|
||||
#define _MD_IOQ_LOCK()
|
||||
#define _MD_IOQ_UNLOCK()
|
||||
|
||||
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
|
||||
#define _MD_INIT_THREAD _MD_InitializeThread
|
||||
#define _MD_EXIT_THREAD(thread)
|
||||
#define _MD_CLEAN_THREAD(_thread)
|
||||
|
||||
#endif /* ! _PR_PTHREADS */
|
||||
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
|
||||
#include <sys/syscall.h>
|
||||
#define _MD_SELECT(nfds,r,w,e,tv) syscall(SYS_select,nfds,r,w,e,tv)
|
||||
|
||||
#define _MD_GET_INTERVAL _PR_UNIX_GetInterval
|
||||
#define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond
|
||||
|
||||
#endif /* nspr_bsdi_defs_h___ */
|
||||
276
Src/nprt_plugin/gecko/1.8/win/include/md/_darwin.h
Normal file
276
Src/nprt_plugin/gecko/1.8/win/include/md/_darwin.h
Normal file
@@ -0,0 +1,276 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Portable Runtime (NSPR).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998-2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nspr_darwin_defs_h___
|
||||
#define nspr_darwin_defs_h___
|
||||
|
||||
#include "prthread.h"
|
||||
|
||||
#include <sys/syscall.h>
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
#include <AvailabilityMacros.h>
|
||||
#endif
|
||||
|
||||
#define PR_LINKER_ARCH "darwin"
|
||||
#define _PR_SI_SYSNAME "DARWIN"
|
||||
#ifdef i386
|
||||
#define _PR_SI_ARCHITECTURE "x86"
|
||||
#else
|
||||
#define _PR_SI_ARCHITECTURE "ppc"
|
||||
#endif
|
||||
#define PR_DLL_SUFFIX ".dylib"
|
||||
|
||||
#define _PR_VMBASE 0x30000000
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
#define _MD_DEFAULT_STACK_SIZE 65536L
|
||||
#define _MD_MMAP_FLAGS MAP_PRIVATE
|
||||
|
||||
#undef HAVE_STACK_GROWING_UP
|
||||
#define HAVE_DLL
|
||||
#define USE_MACH_DYLD
|
||||
#define _PR_HAVE_SOCKADDR_LEN
|
||||
#define _PR_STAT_HAS_ST_ATIMESPEC
|
||||
#define _PR_NO_LARGE_FILES
|
||||
#define PR_HAVE_SYSV_NAMED_SHARED_MEMORY
|
||||
|
||||
#define _PR_INET6
|
||||
/*
|
||||
* I'd prefer to use getipnodebyname and getipnodebyaddr but the
|
||||
* getipnodebyname(3) man page on Mac OS X 10.2 says they are not
|
||||
* thread-safe. AI_V4MAPPED|AI_ADDRCONFIG doesn't work either.
|
||||
*/
|
||||
#define _PR_HAVE_GETHOSTBYNAME2
|
||||
#define _PR_HAVE_GETADDRINFO
|
||||
/*
|
||||
* On Mac OS X 10.2, gethostbyaddr fails with h_errno=NO_RECOVERY
|
||||
* if you pass an IPv4-mapped IPv6 address to it.
|
||||
*/
|
||||
#define _PR_GHBA_DISALLOW_V4MAPPED
|
||||
#ifdef XP_MACOSX
|
||||
#if !defined(MAC_OS_X_VERSION_10_3) || \
|
||||
MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_3
|
||||
/*
|
||||
* socket(AF_INET6) fails with EPROTONOSUPPORT on Mac OS X 10.1.
|
||||
* IPv6 under OS X 10.2 and below is not complete (see bug 222031).
|
||||
*/
|
||||
#define _PR_INET6_PROBE
|
||||
#endif /* DT < 10.3 */
|
||||
#if defined(MAC_OS_X_VERSION_10_2) && \
|
||||
MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_2
|
||||
/* Mac OS X 10.2 has inet_ntop and inet_pton. */
|
||||
#define _PR_HAVE_INET_NTOP
|
||||
#endif /* DT >= 10.2 */
|
||||
#endif /* XP_MACOSX */
|
||||
#define _PR_IPV6_V6ONLY_PROBE
|
||||
/* The IPV6_V6ONLY socket option is not defined on Mac OS X 10.1. */
|
||||
#ifndef IPV6_V6ONLY
|
||||
#define IPV6_V6ONLY 27
|
||||
#endif
|
||||
|
||||
#if defined(__ppc__)
|
||||
#define _PR_HAVE_ATOMIC_OPS
|
||||
#define _MD_INIT_ATOMIC()
|
||||
extern PRInt32 _PR_DarwinPPC_AtomicIncrement(PRInt32 *val);
|
||||
#define _MD_ATOMIC_INCREMENT(val) _PR_DarwinPPC_AtomicIncrement(val)
|
||||
extern PRInt32 _PR_DarwinPPC_AtomicDecrement(PRInt32 *val);
|
||||
#define _MD_ATOMIC_DECREMENT(val) _PR_DarwinPPC_AtomicDecrement(val)
|
||||
extern PRInt32 _PR_DarwinPPC_AtomicSet(PRInt32 *val, PRInt32 newval);
|
||||
#define _MD_ATOMIC_SET(val, newval) _PR_DarwinPPC_AtomicSet(val, newval)
|
||||
extern PRInt32 _PR_DarwinPPC_AtomicAdd(PRInt32 *ptr, PRInt32 val);
|
||||
#define _MD_ATOMIC_ADD(ptr, val) _PR_DarwinPPC_AtomicAdd(ptr, val)
|
||||
#endif /* __ppc__ */
|
||||
|
||||
#define USE_SETJMP
|
||||
|
||||
#if !defined(_PR_PTHREADS)
|
||||
|
||||
#include <setjmp.h>
|
||||
|
||||
#define PR_CONTEXT_TYPE jmp_buf
|
||||
|
||||
#define CONTEXT(_th) ((_th)->md.context)
|
||||
#define _MD_GET_SP(_th) (((struct sigcontext *) (_th)->md.context)->sc_onstack)
|
||||
#define PR_NUM_GCREGS _JBLEN
|
||||
|
||||
/*
|
||||
** Initialize a thread context to run "_main()" when started
|
||||
*/
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
{ \
|
||||
*status = PR_TRUE; \
|
||||
if (setjmp(CONTEXT(_thread))) { \
|
||||
_main(); \
|
||||
} \
|
||||
_MD_GET_SP(_thread) = (unsigned char*) ((_sp) - 64); \
|
||||
}
|
||||
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
if (!setjmp(CONTEXT(_thread))) { \
|
||||
(_thread)->md.errcode = errno; \
|
||||
_PR_Schedule(); \
|
||||
}
|
||||
|
||||
/*
|
||||
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
|
||||
*/
|
||||
#define _MD_RESTORE_CONTEXT(_thread) \
|
||||
{ \
|
||||
errno = (_thread)->md.errcode; \
|
||||
_MD_SET_CURRENT_THREAD(_thread); \
|
||||
longjmp(CONTEXT(_thread), 1); \
|
||||
}
|
||||
|
||||
/* Machine-dependent (MD) data structures */
|
||||
|
||||
struct _MDThread {
|
||||
PR_CONTEXT_TYPE context;
|
||||
int id;
|
||||
int errcode;
|
||||
};
|
||||
|
||||
struct _MDThreadStack {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDLock {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSemaphore {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDCVar {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSegment {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
/*
|
||||
* md-specific cpu structure field
|
||||
*/
|
||||
#define _PR_MD_MAX_OSFD FD_SETSIZE
|
||||
|
||||
struct _MDCPU_Unix {
|
||||
PRCList ioQ;
|
||||
PRUint32 ioq_timeout;
|
||||
PRInt32 ioq_max_osfd;
|
||||
PRInt32 ioq_osfd_cnt;
|
||||
#ifndef _PR_USE_POLL
|
||||
fd_set fd_read_set, fd_write_set, fd_exception_set;
|
||||
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
|
||||
fd_exception_cnt[_PR_MD_MAX_OSFD];
|
||||
#else
|
||||
struct pollfd *ioq_pollfds;
|
||||
int ioq_pollfds_size;
|
||||
#endif /* _PR_USE_POLL */
|
||||
};
|
||||
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
|
||||
struct _MDCPU {
|
||||
struct _MDCPU_Unix md_unix;
|
||||
};
|
||||
|
||||
#define _MD_INIT_LOCKS()
|
||||
#define _MD_NEW_LOCK(lock) PR_SUCCESS
|
||||
#define _MD_FREE_LOCK(lock)
|
||||
#define _MD_LOCK(lock)
|
||||
#define _MD_UNLOCK(lock)
|
||||
#define _MD_INIT_IO()
|
||||
#define _MD_IOQ_LOCK()
|
||||
#define _MD_IOQ_UNLOCK()
|
||||
|
||||
extern PRStatus _MD_InitializeThread(PRThread *thread);
|
||||
|
||||
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
|
||||
#define _MD_INIT_THREAD _MD_InitializeThread
|
||||
#define _MD_EXIT_THREAD(thread)
|
||||
#define _MD_SUSPEND_THREAD(thread) _MD_suspend_thread
|
||||
#define _MD_RESUME_THREAD(thread) _MD_resume_thread
|
||||
#define _MD_CLEAN_THREAD(_thread)
|
||||
|
||||
extern PRStatus _MD_CREATE_THREAD(
|
||||
PRThread *thread,
|
||||
void (*start) (void *),
|
||||
PRThreadPriority priority,
|
||||
PRThreadScope scope,
|
||||
PRThreadState state,
|
||||
PRUint32 stackSize);
|
||||
extern void _MD_SET_PRIORITY(struct _MDThread *thread, PRUintn newPri);
|
||||
extern PRStatus _MD_WAIT(PRThread *, PRIntervalTime timeout);
|
||||
extern PRStatus _MD_WAKEUP_WAITER(PRThread *);
|
||||
extern void _MD_YIELD(void);
|
||||
|
||||
#endif /* ! _PR_PTHREADS */
|
||||
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
#define _MD_GET_INTERVAL _PR_UNIX_GetInterval
|
||||
#define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond
|
||||
|
||||
extern void _MD_EarlyInit(void);
|
||||
extern PRIntervalTime _PR_UNIX_GetInterval(void);
|
||||
extern PRIntervalTime _PR_UNIX_TicksPerSecond(void);
|
||||
|
||||
/*
|
||||
* We wrapped the select() call. _MD_SELECT refers to the built-in,
|
||||
* unwrapped version.
|
||||
*/
|
||||
#define _MD_SELECT(nfds,r,w,e,tv) syscall(SYS_select,nfds,r,w,e,tv)
|
||||
|
||||
/* For writev() */
|
||||
#include <sys/uio.h>
|
||||
|
||||
#endif /* nspr_darwin_defs_h___ */
|
||||
221
Src/nprt_plugin/gecko/1.8/win/include/md/_dgux.h
Normal file
221
Src/nprt_plugin/gecko/1.8/win/include/md/_dgux.h
Normal file
@@ -0,0 +1,221 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Portable Runtime (NSPR).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998-2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nspr_dgux_defs_h___
|
||||
#define nspr_dgux_defs_h___
|
||||
|
||||
/*
|
||||
* Internal configuration macros
|
||||
*/
|
||||
|
||||
#define PR_LINKER_ARCH "dgux"
|
||||
#define _PR_SI_SYSNAME "DGUX"
|
||||
#define _PR_SI_ARCHITECTURE "x86"
|
||||
#define PR_DLL_SUFFIX ".so"
|
||||
|
||||
#define _PR_VMBASE 0x30000000
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
#define _MD_DEFAULT_STACK_SIZE 65536L
|
||||
#define _MD_MMAP_FLAGS MAP_PRIVATE
|
||||
|
||||
#ifndef HAVE_WEAK_IO_SYMBOLS
|
||||
#define HAVE_WEAK_IO_SYMBOLS
|
||||
#endif
|
||||
|
||||
#undef HAVE_STACK_GROWING_UP
|
||||
#define HAVE_NETCONFIG
|
||||
#define HAVE_DLL
|
||||
#define USE_DLFCN
|
||||
#define NEED_STRFTIME_LOCK
|
||||
#define NEED_TIME_R
|
||||
#define _PR_NEED_STRCASECMP
|
||||
#define _PR_POLL_AVAILABLE
|
||||
#define _PR_USE_POLL
|
||||
#define _PR_NO_LARGE_FILES
|
||||
#define _PR_STAT_HAS_ONLY_ST_ATIME
|
||||
|
||||
#define USE_SETJMP
|
||||
|
||||
#include <setjmp.h>
|
||||
|
||||
#define _SETJMP setjmp
|
||||
#define _LONGJMP longjmp
|
||||
#define _PR_CONTEXT_TYPE jmp_buf
|
||||
#define _MD_GET_SP(_t) (_t)->md.context[4]
|
||||
#define _PR_NUM_GCREGS _JBLEN
|
||||
|
||||
#define CONTEXT(_th) ((_th)->md.context)
|
||||
|
||||
/*
|
||||
** Initialize the thread context preparing it to execute _main.
|
||||
*/
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
{ \
|
||||
*status = PR_TRUE; \
|
||||
if(_SETJMP(CONTEXT(_thread))) (*_main)(); \
|
||||
_MD_GET_SP(_thread) = (int) ((_sp) - 128); \
|
||||
}
|
||||
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
if (!_SETJMP(CONTEXT(_thread))) { \
|
||||
(_thread)->md.errcode = errno; \
|
||||
_PR_Schedule(); \
|
||||
}
|
||||
|
||||
/*
|
||||
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
|
||||
*/
|
||||
#define _MD_RESTORE_CONTEXT(_thread) \
|
||||
{ \
|
||||
errno = (_thread)->md.errcode; \
|
||||
_MD_SET_CURRENT_THREAD(_thread); \
|
||||
_LONGJMP(CONTEXT(_thread), 1); \
|
||||
}
|
||||
|
||||
/* Machine-dependent (MD) data structures.
|
||||
* Don't use SVR4 native threads (yet).
|
||||
*/
|
||||
|
||||
struct _MDThread {
|
||||
_PR_CONTEXT_TYPE context;
|
||||
int id;
|
||||
int errcode;
|
||||
};
|
||||
|
||||
struct _MDThreadStack {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDLock {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSemaphore {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDCVar {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSegment {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
/*
|
||||
* md-specific cpu structure field
|
||||
*/
|
||||
#define _PR_MD_MAX_OSFD FD_SETSIZE
|
||||
|
||||
struct _MDCPU_Unix {
|
||||
PRCList ioQ;
|
||||
PRUint32 ioq_timeout;
|
||||
PRInt32 ioq_max_osfd;
|
||||
PRInt32 ioq_osfd_cnt;
|
||||
#ifndef _PR_USE_POLL
|
||||
fd_set fd_read_set, fd_write_set, fd_exception_set;
|
||||
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
|
||||
fd_exception_cnt[_PR_MD_MAX_OSFD];
|
||||
#else
|
||||
struct pollfd *ioq_pollfds;
|
||||
int ioq_pollfds_size;
|
||||
#endif /* _PR_USE_POLL */
|
||||
};
|
||||
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
|
||||
struct _MDCPU {
|
||||
struct _MDCPU_Unix md_unix;
|
||||
};
|
||||
|
||||
#define _MD_INIT_LOCKS()
|
||||
#define _MD_NEW_LOCK(lock) PR_SUCCESS
|
||||
#define _MD_FREE_LOCK(lock)
|
||||
#define _MD_LOCK(lock)
|
||||
#define _MD_UNLOCK(lock)
|
||||
#define _MD_INIT_IO()
|
||||
#define _MD_IOQ_LOCK()
|
||||
#define _MD_IOQ_UNLOCK()
|
||||
|
||||
/*
|
||||
* The following are copied from _sunos.h, _aix.h. This means
|
||||
* some of them should probably be moved into _unixos.h. But
|
||||
* _irix.h seems to be quite different in regard to these macros.
|
||||
*/
|
||||
#define _MD_GET_INTERVAL _PR_UNIX_GetInterval
|
||||
#define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond
|
||||
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
|
||||
#define _MD_INIT_THREAD _MD_InitializeThread
|
||||
#define _MD_EXIT_THREAD(thread)
|
||||
#define _MD_SUSPEND_THREAD(thread)
|
||||
#define _MD_RESUME_THREAD(thread)
|
||||
#define _MD_CLEAN_THREAD(_thread)
|
||||
|
||||
/*
|
||||
* We wrapped the select() call. _MD_SELECT refers to the built-in,
|
||||
* unwrapped version.
|
||||
*/
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
extern int _select(int nfds, fd_set *readfds, fd_set *writefds,
|
||||
fd_set *execptfds, struct timeval *timeout);
|
||||
#define _MD_SELECT _select
|
||||
|
||||
#define _MD_POLL _poll
|
||||
#include <poll.h>
|
||||
#include <stropts.h>
|
||||
extern int _poll(struct pollfd *fds, unsigned long nfds, int timeout);
|
||||
|
||||
#endif /* nspr_dgux_defs_h___ */
|
||||
278
Src/nprt_plugin/gecko/1.8/win/include/md/_freebsd.h
Normal file
278
Src/nprt_plugin/gecko/1.8/win/include/md/_freebsd.h
Normal file
@@ -0,0 +1,278 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Portable Runtime (NSPR).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998-2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nspr_freebsd_defs_h___
|
||||
#define nspr_freebsd_defs_h___
|
||||
|
||||
#include "prthread.h"
|
||||
|
||||
#if __FreeBSD__ >= 2
|
||||
#include <osreldate.h> /* for __FreeBSD_version */
|
||||
#endif
|
||||
#include <sys/syscall.h>
|
||||
|
||||
#define PR_LINKER_ARCH "freebsd"
|
||||
#define _PR_SI_SYSNAME "FREEBSD"
|
||||
#if defined(__i386__)
|
||||
#define _PR_SI_ARCHITECTURE "x86"
|
||||
#elif defined(__alpha__)
|
||||
#define _PR_SI_ARCHITECTURE "alpha"
|
||||
#elif defined(__sparc__)
|
||||
#define _PR_SI_ARCHITECTURE "sparc"
|
||||
#elif defined(__ia64__)
|
||||
#define _PR_SI_ARCHITECTURE "ia64"
|
||||
#elif defined(__amd64__)
|
||||
#define _PR_SI_ARCHITECTURE "amd64"
|
||||
#else
|
||||
#error "Unknown CPU architecture"
|
||||
#endif
|
||||
#if defined(__ELF__)
|
||||
#define PR_DLL_SUFFIX ".so"
|
||||
#else
|
||||
#define PR_DLL_SUFFIX ".so.1.0"
|
||||
#endif
|
||||
|
||||
#define _PR_VMBASE 0x30000000
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
#define _MD_DEFAULT_STACK_SIZE 65536L
|
||||
#define _MD_MMAP_FLAGS MAP_PRIVATE
|
||||
|
||||
#undef HAVE_STACK_GROWING_UP
|
||||
#define HAVE_DLL
|
||||
#define USE_DLFCN
|
||||
#define _PR_HAVE_SOCKADDR_LEN
|
||||
#define _PR_STAT_HAS_ST_ATIMESPEC
|
||||
#define _PR_NO_LARGE_FILES
|
||||
|
||||
#if defined(_PR_PTHREADS)
|
||||
#if __FreeBSD_version >= 400008
|
||||
/*
|
||||
* libc_r before this version of FreeBSD doesn't have poll().
|
||||
* Although libc has poll(), it is not thread-safe so we can't
|
||||
* use it in the pthreads version.
|
||||
*/
|
||||
#define _PR_POLL_AVAILABLE
|
||||
#endif
|
||||
#else
|
||||
#if __FreeBSD_version >= 300000
|
||||
#define _PR_POLL_AVAILABLE
|
||||
#define _PR_USE_POLL
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define _PR_HAVE_SYSV_SEMAPHORES
|
||||
#define PR_HAVE_SYSV_NAMED_SHARED_MEMORY
|
||||
|
||||
#if __FreeBSD_version >= 400014
|
||||
#define _PR_INET6
|
||||
#define _PR_HAVE_INET_NTOP
|
||||
#define _PR_HAVE_GETHOSTBYNAME2
|
||||
#define _PR_HAVE_GETADDRINFO
|
||||
#define _PR_INET6_PROBE
|
||||
#define _PR_IPV6_V6ONLY_PROBE
|
||||
#endif
|
||||
|
||||
#define USE_SETJMP
|
||||
|
||||
#ifndef _PR_PTHREADS
|
||||
#include <setjmp.h>
|
||||
|
||||
#define PR_CONTEXT_TYPE sigjmp_buf
|
||||
|
||||
#define CONTEXT(_th) ((_th)->md.context)
|
||||
|
||||
#define _MD_GET_SP(_th) (_th)->md.context[0]._sjb[2]
|
||||
#define PR_NUM_GCREGS _JBLEN
|
||||
|
||||
/*
|
||||
** Initialize a thread context to run "_main()" when started
|
||||
*/
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
{ \
|
||||
*status = PR_TRUE; \
|
||||
if (sigsetjmp(CONTEXT(_thread), 1)) { \
|
||||
_main(); \
|
||||
} \
|
||||
_MD_GET_SP(_thread) = (unsigned char*) ((_sp) - 64); \
|
||||
}
|
||||
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
if (!sigsetjmp(CONTEXT(_thread), 1)) { \
|
||||
(_thread)->md.errcode = errno; \
|
||||
_PR_Schedule(); \
|
||||
}
|
||||
|
||||
/*
|
||||
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
|
||||
*/
|
||||
#define _MD_RESTORE_CONTEXT(_thread) \
|
||||
{ \
|
||||
errno = (_thread)->md.errcode; \
|
||||
_MD_SET_CURRENT_THREAD(_thread); \
|
||||
siglongjmp(CONTEXT(_thread), 1); \
|
||||
}
|
||||
|
||||
/* Machine-dependent (MD) data structures */
|
||||
|
||||
struct _MDThread {
|
||||
PR_CONTEXT_TYPE context;
|
||||
int id;
|
||||
int errcode;
|
||||
};
|
||||
|
||||
struct _MDThreadStack {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDLock {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSemaphore {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDCVar {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSegment {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
/*
|
||||
* md-specific cpu structure field
|
||||
*/
|
||||
#define _PR_MD_MAX_OSFD FD_SETSIZE
|
||||
|
||||
struct _MDCPU_Unix {
|
||||
PRCList ioQ;
|
||||
PRUint32 ioq_timeout;
|
||||
PRInt32 ioq_max_osfd;
|
||||
PRInt32 ioq_osfd_cnt;
|
||||
#ifndef _PR_USE_POLL
|
||||
fd_set fd_read_set, fd_write_set, fd_exception_set;
|
||||
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
|
||||
fd_exception_cnt[_PR_MD_MAX_OSFD];
|
||||
#else
|
||||
struct pollfd *ioq_pollfds;
|
||||
int ioq_pollfds_size;
|
||||
#endif /* _PR_USE_POLL */
|
||||
};
|
||||
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
|
||||
struct _MDCPU {
|
||||
struct _MDCPU_Unix md_unix;
|
||||
};
|
||||
|
||||
#define _MD_INIT_LOCKS()
|
||||
#define _MD_NEW_LOCK(lock) PR_SUCCESS
|
||||
#define _MD_FREE_LOCK(lock)
|
||||
#define _MD_LOCK(lock)
|
||||
#define _MD_UNLOCK(lock)
|
||||
#define _MD_INIT_IO()
|
||||
#define _MD_IOQ_LOCK()
|
||||
#define _MD_IOQ_UNLOCK()
|
||||
|
||||
extern PRStatus _MD_InitializeThread(PRThread *thread);
|
||||
|
||||
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
|
||||
#define _MD_INIT_THREAD _MD_InitializeThread
|
||||
#define _MD_EXIT_THREAD(thread)
|
||||
#define _MD_SUSPEND_THREAD(thread) _MD_suspend_thread
|
||||
#define _MD_RESUME_THREAD(thread) _MD_resume_thread
|
||||
#define _MD_CLEAN_THREAD(_thread)
|
||||
|
||||
extern PRStatus _MD_CREATE_THREAD(
|
||||
PRThread *thread,
|
||||
void (*start) (void *),
|
||||
PRThreadPriority priority,
|
||||
PRThreadScope scope,
|
||||
PRThreadState state,
|
||||
PRUint32 stackSize);
|
||||
extern void _MD_SET_PRIORITY(struct _MDThread *thread, PRUintn newPri);
|
||||
extern PRStatus _MD_WAIT(PRThread *, PRIntervalTime timeout);
|
||||
extern PRStatus _MD_WAKEUP_WAITER(PRThread *);
|
||||
extern void _MD_YIELD(void);
|
||||
|
||||
#endif /* ! _PR_PTHREADS */
|
||||
|
||||
extern void _MD_EarlyInit(void);
|
||||
extern PRIntervalTime _PR_UNIX_GetInterval(void);
|
||||
extern PRIntervalTime _PR_UNIX_TicksPerSecond(void);
|
||||
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
#define _MD_GET_INTERVAL _PR_UNIX_GetInterval
|
||||
#define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond
|
||||
|
||||
/*
|
||||
* We wrapped the select() call. _MD_SELECT refers to the built-in,
|
||||
* unwrapped version.
|
||||
*/
|
||||
#define _MD_SELECT(nfds,r,w,e,tv) syscall(SYS_select,nfds,r,w,e,tv)
|
||||
|
||||
#if defined(_PR_POLL_AVAILABLE)
|
||||
#include <poll.h>
|
||||
#define _MD_POLL(fds,nfds,timeout) syscall(SYS_poll,fds,nfds,timeout)
|
||||
#endif
|
||||
|
||||
/* freebsd has INADDR_LOOPBACK defined, but in /usr/include/rpc/types.h, and I didn't
|
||||
want to be including that.. */
|
||||
#ifndef INADDR_LOOPBACK
|
||||
#define INADDR_LOOPBACK (u_long)0x7F000001
|
||||
#endif
|
||||
|
||||
/* For writev() */
|
||||
#include <sys/uio.h>
|
||||
|
||||
#endif /* nspr_freebsd_defs_h___ */
|
||||
257
Src/nprt_plugin/gecko/1.8/win/include/md/_hpux.h
Normal file
257
Src/nprt_plugin/gecko/1.8/win/include/md/_hpux.h
Normal file
@@ -0,0 +1,257 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Portable Runtime (NSPR).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998-2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nspr_xhppa_defs_h___
|
||||
#define nspr_xhppa_defs_h___
|
||||
|
||||
/*
|
||||
* Internal configuration macros
|
||||
*/
|
||||
|
||||
#define PR_LINKER_ARCH "hpux"
|
||||
#define _PR_SI_SYSNAME "HPUX"
|
||||
#define _PR_SI_ARCHITECTURE "hppa1.1"
|
||||
#define PR_DLL_SUFFIX ".sl"
|
||||
|
||||
#define _PR_VMBASE 0x30000000
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
/*
|
||||
* _USE_BIG_FDS increases the size of fd_set from 256 bytes to
|
||||
* about 7500 bytes. PR_Poll allocates three fd_sets on the
|
||||
* stack, so it is safer to also increase the default thread
|
||||
* stack size.
|
||||
*/
|
||||
#define _MD_DEFAULT_STACK_SIZE (2*65536L)
|
||||
#define _MD_MINIMUM_STACK_SIZE (2*65536L)
|
||||
#define _MD_MMAP_FLAGS MAP_PRIVATE
|
||||
|
||||
#define NEED_TIME_R
|
||||
|
||||
#define HAVE_STACK_GROWING_UP
|
||||
#undef HAVE_WEAK_IO_SYMBOLS
|
||||
#undef HAVE_WEAK_MALLOC_SYMBOLS
|
||||
#define HAVE_DLL
|
||||
#ifdef IS_64
|
||||
#define USE_DLFCN
|
||||
#else
|
||||
#define USE_HPSHL
|
||||
#endif
|
||||
#ifndef HAVE_STRERROR
|
||||
#define HAVE_STRERROR
|
||||
#endif
|
||||
#define _PR_POLL_AVAILABLE
|
||||
#define _PR_USE_POLL
|
||||
#define _PR_STAT_HAS_ONLY_ST_ATIME
|
||||
#define _PR_HAVE_POSIX_SEMAPHORES
|
||||
#define PR_HAVE_POSIX_NAMED_SHARED_MEMORY
|
||||
#define _PR_ACCEPT_INHERIT_NONBLOCK
|
||||
|
||||
#undef _PR_HAVE_ATOMIC_OPS
|
||||
|
||||
#ifdef _PR_INET6
|
||||
#define _PR_HAVE_INET_NTOP
|
||||
#define _PR_HAVE_GETIPNODEBYNAME
|
||||
#define _PR_HAVE_GETIPNODEBYADDR
|
||||
#define _PR_HAVE_GETADDRINFO
|
||||
#define _PR_INET6_PROBE
|
||||
#endif
|
||||
|
||||
#if !defined(_PR_PTHREADS)
|
||||
|
||||
#include <syscall.h>
|
||||
#include <setjmp.h>
|
||||
|
||||
#define USE_SETJMP
|
||||
|
||||
#define _MD_GET_SP(_t) (*((int *)((_t)->md.jb) + 1))
|
||||
#define PR_NUM_GCREGS _JBLEN
|
||||
/* Caveat: This makes jmp_buf full of doubles. */
|
||||
#define CONTEXT(_th) ((_th)->md.jb)
|
||||
|
||||
/* Stack needs two frames (64 bytes) at the bottom */ \
|
||||
#define _MD_SET_THR_SP(_t, _sp) ((_MD_GET_SP(_t)) = (int) (_sp + 64 *2))
|
||||
#define SAVE_CONTEXT(_th) _setjmp(CONTEXT(_th))
|
||||
#define GOTO_CONTEXT(_th) _longjmp(CONTEXT(_th), 1)
|
||||
|
||||
#if !defined(PTHREADS_USER)
|
||||
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
{ \
|
||||
*(status) = PR_TRUE; \
|
||||
if (_setjmp(CONTEXT(_thread))) (*_main)(); \
|
||||
/* Stack needs two frames (64 bytes) at the bottom */ \
|
||||
(_MD_GET_SP(_thread)) = (int) ((_sp) + 64*2); \
|
||||
}
|
||||
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
if (!_setjmp(CONTEXT(_thread))) { \
|
||||
(_thread)->md.errcode = errno; \
|
||||
_PR_Schedule(); \
|
||||
}
|
||||
|
||||
/*
|
||||
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
|
||||
*/
|
||||
#define _MD_RESTORE_CONTEXT(_thread) \
|
||||
{ \
|
||||
errno = (_thread)->md.errcode; \
|
||||
_MD_SET_CURRENT_THREAD(_thread); \
|
||||
_longjmp(CONTEXT(_thread), 1); \
|
||||
}
|
||||
|
||||
/* Machine-dependent (MD) data structures. HP-UX has no native threads. */
|
||||
|
||||
struct _MDThread {
|
||||
jmp_buf jb;
|
||||
int id;
|
||||
int errcode;
|
||||
};
|
||||
|
||||
struct _MDThreadStack {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDLock {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSemaphore {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDCVar {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSegment {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
/*
|
||||
* md-specific cpu structure field
|
||||
*/
|
||||
#define _PR_MD_MAX_OSFD FD_SETSIZE
|
||||
|
||||
struct _MDCPU_Unix {
|
||||
PRCList ioQ;
|
||||
PRUint32 ioq_timeout;
|
||||
PRInt32 ioq_max_osfd;
|
||||
PRInt32 ioq_osfd_cnt;
|
||||
#ifndef _PR_USE_POLL
|
||||
fd_set fd_read_set, fd_write_set, fd_exception_set;
|
||||
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
|
||||
fd_exception_cnt[_PR_MD_MAX_OSFD];
|
||||
#else
|
||||
struct pollfd *ioq_pollfds;
|
||||
int ioq_pollfds_size;
|
||||
#endif /* _PR_USE_POLL */
|
||||
};
|
||||
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
|
||||
struct _MDCPU {
|
||||
struct _MDCPU_Unix md_unix;
|
||||
};
|
||||
|
||||
#define _MD_INIT_LOCKS()
|
||||
#define _MD_NEW_LOCK(lock) PR_SUCCESS
|
||||
#define _MD_FREE_LOCK(lock)
|
||||
#define _MD_LOCK(lock)
|
||||
#define _MD_UNLOCK(lock)
|
||||
#define _MD_INIT_IO()
|
||||
#define _MD_IOQ_LOCK()
|
||||
#define _MD_IOQ_UNLOCK()
|
||||
|
||||
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
|
||||
#define _MD_INIT_THREAD _MD_InitializeThread
|
||||
#define _MD_EXIT_THREAD(thread)
|
||||
#define _MD_SUSPEND_THREAD(thread) _MD_suspend_thread
|
||||
#define _MD_RESUME_THREAD(thread) _MD_resume_thread
|
||||
#define _MD_CLEAN_THREAD(_thread)
|
||||
|
||||
#else /* PTHREADS_USER */
|
||||
|
||||
#include "_nspr_pthread.h"
|
||||
|
||||
#endif /* PTHREADS_USER */
|
||||
|
||||
#endif /* !defined(_PR_PTHREADS) */
|
||||
|
||||
#if !defined(PTHREADS_USER)
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
#endif
|
||||
|
||||
#if defined(HPUX_LW_TIMER)
|
||||
extern void _PR_HPUX_LW_IntervalInit(void);
|
||||
extern PRIntervalTime _PR_HPUX_LW_GetInterval(void);
|
||||
#define _MD_INTERVAL_INIT _PR_HPUX_LW_IntervalInit
|
||||
#define _MD_GET_INTERVAL _PR_HPUX_LW_GetInterval
|
||||
#define _MD_INTERVAL_PER_SEC() 1000
|
||||
#else
|
||||
#define _MD_GET_INTERVAL _PR_UNIX_GetInterval
|
||||
#define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond
|
||||
#endif
|
||||
|
||||
/*
|
||||
* We wrapped the select() call. _MD_SELECT refers to the built-in,
|
||||
* unwrapped version.
|
||||
*/
|
||||
#define _MD_SELECT(nfds,r,w,e,tv) syscall(SYS_select,nfds,r,w,e,tv)
|
||||
|
||||
#include <poll.h>
|
||||
#define _MD_POLL(fds,nfds,timeout) syscall(SYS_poll,fds,nfds,timeout)
|
||||
|
||||
#ifdef HPUX11
|
||||
extern void _MD_hpux_map_sendfile_error(int err);
|
||||
#endif /* HPUX11 */
|
||||
|
||||
#endif /* nspr_xhppa_defs_h___ */
|
||||
470
Src/nprt_plugin/gecko/1.8/win/include/md/_irix.h
Normal file
470
Src/nprt_plugin/gecko/1.8/win/include/md/_irix.h
Normal file
@@ -0,0 +1,470 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Portable Runtime (NSPR).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998-2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nspr_irix_defs_h___
|
||||
#define nspr_irix_defs_h___
|
||||
|
||||
#define _PR_HAVE_ATOMIC_CAS
|
||||
|
||||
/*
|
||||
* MipsPro assembler defines _LANGUAGE_ASSEMBLY
|
||||
*/
|
||||
#ifndef _LANGUAGE_ASSEMBLY
|
||||
|
||||
#include "prclist.h"
|
||||
#include "prthread.h"
|
||||
#include <sys/ucontext.h>
|
||||
|
||||
/*
|
||||
* Internal configuration macros
|
||||
*/
|
||||
|
||||
#define PR_LINKER_ARCH "irix"
|
||||
#define _PR_SI_SYSNAME "IRIX"
|
||||
#define _PR_SI_ARCHITECTURE "mips"
|
||||
#define PR_DLL_SUFFIX ".so"
|
||||
|
||||
#define _PR_VMBASE 0x30000000
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
#define _PR_NUM_GCREGS 9
|
||||
#define _MD_MMAP_FLAGS MAP_PRIVATE
|
||||
|
||||
#define _MD_DEFAULT_STACK_SIZE 65536L
|
||||
#define _MD_MIN_STACK_SIZE 16384L
|
||||
|
||||
#undef HAVE_STACK_GROWING_UP
|
||||
#define HAVE_WEAK_IO_SYMBOLS
|
||||
#define HAVE_WEAK_MALLOC_SYMBOLS
|
||||
#define HAVE_DLL
|
||||
#define USE_DLFCN
|
||||
#define _PR_HAVE_ATOMIC_OPS
|
||||
#define _PR_POLL_AVAILABLE
|
||||
#define _PR_USE_POLL
|
||||
#define _PR_STAT_HAS_ST_ATIM
|
||||
#define _PR_HAVE_OFF64_T
|
||||
#define HAVE_POINTER_LOCALTIME_R
|
||||
#define _PR_HAVE_POSIX_SEMAPHORES
|
||||
#define PR_HAVE_POSIX_NAMED_SHARED_MEMORY
|
||||
#define _PR_ACCEPT_INHERIT_NONBLOCK
|
||||
|
||||
#ifdef _PR_INET6
|
||||
#define _PR_HAVE_INET_NTOP
|
||||
#define _PR_HAVE_GETIPNODEBYNAME
|
||||
#define _PR_HAVE_GETIPNODEBYADDR
|
||||
#define _PR_HAVE_GETADDRINFO
|
||||
#endif
|
||||
|
||||
/* Initialization entry points */
|
||||
NSPR_API(void) _MD_EarlyInit(void);
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
|
||||
NSPR_API(void) _MD_IrixInit(void);
|
||||
#define _MD_FINAL_INIT _MD_IrixInit
|
||||
|
||||
#define _MD_INIT_IO()
|
||||
|
||||
/* Timer operations */
|
||||
NSPR_API(PRIntervalTime) _MD_IrixGetInterval(void);
|
||||
#define _MD_GET_INTERVAL _MD_IrixGetInterval
|
||||
|
||||
NSPR_API(PRIntervalTime) _MD_IrixIntervalPerSec(void);
|
||||
#define _MD_INTERVAL_PER_SEC _MD_IrixIntervalPerSec
|
||||
|
||||
/* GC operations */
|
||||
NSPR_API(void *) _MD_GetSP(PRThread *thread);
|
||||
#define _MD_GET_SP _MD_GetSP
|
||||
|
||||
/* The atomic operations */
|
||||
#include <mutex.h>
|
||||
#define _MD_INIT_ATOMIC()
|
||||
#define _MD_ATOMIC_INCREMENT(val) add_then_test((unsigned long*)val, 1)
|
||||
#define _MD_ATOMIC_ADD(ptr, val) add_then_test((unsigned long*)ptr, (unsigned long)val)
|
||||
#define _MD_ATOMIC_DECREMENT(val) add_then_test((unsigned long*)val, 0xffffffff)
|
||||
#define _MD_ATOMIC_SET(val, newval) test_and_set((unsigned long*)val, newval)
|
||||
|
||||
#if defined(_PR_PTHREADS)
|
||||
#else /* defined(_PR_PTHREADS) */
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
#include <setjmp.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <bstring.h>
|
||||
#include <sys/time.h>
|
||||
#include <ulocks.h>
|
||||
#include <sys/prctl.h>
|
||||
|
||||
|
||||
/*
|
||||
* Data region private to each sproc. This region is setup by calling
|
||||
* mmap(...,MAP_LOCAL,...). The private data is mapped at the same
|
||||
* address in every sproc, but every sproc gets a private mapping.
|
||||
*
|
||||
* Just make sure that this structure fits in a page, as only one page
|
||||
* is allocated for the private region.
|
||||
*/
|
||||
struct sproc_private_data {
|
||||
struct PRThread *me;
|
||||
struct _PRCPU *cpu;
|
||||
struct PRThread *last;
|
||||
PRUintn intsOff;
|
||||
int sproc_pid;
|
||||
};
|
||||
|
||||
extern char *_nspr_sproc_private;
|
||||
|
||||
#define _PR_PRDA() ((struct sproc_private_data *) _nspr_sproc_private)
|
||||
#define _MD_SET_CURRENT_THREAD(_thread) _PR_PRDA()->me = (_thread)
|
||||
#define _MD_THIS_THREAD() (_PR_PRDA()->me)
|
||||
#define _MD_LAST_THREAD() (_PR_PRDA()->last)
|
||||
#define _MD_SET_LAST_THREAD(_thread) _PR_PRDA()->last = (_thread)
|
||||
#define _MD_CURRENT_CPU() (_PR_PRDA()->cpu)
|
||||
#define _MD_SET_CURRENT_CPU(_cpu) _PR_PRDA()->cpu = (_cpu)
|
||||
#define _MD_SET_INTSOFF(_val) (_PR_PRDA()->intsOff = _val)
|
||||
#define _MD_GET_INTSOFF() (_PR_PRDA()->intsOff)
|
||||
|
||||
#define _MD_SET_SPROC_PID(_val) (_PR_PRDA()->sproc_pid = _val)
|
||||
#define _MD_GET_SPROC_PID() (_PR_PRDA()->sproc_pid)
|
||||
|
||||
NSPR_API(struct PRThread*) _MD_get_attached_thread(void);
|
||||
NSPR_API(struct PRThread*) _MD_get_current_thread(void);
|
||||
#define _MD_GET_ATTACHED_THREAD() _MD_get_attached_thread()
|
||||
#define _MD_CURRENT_THREAD() _MD_get_current_thread()
|
||||
|
||||
#define _MD_CHECK_FOR_EXIT() { \
|
||||
if (_pr_irix_exit_now) { \
|
||||
_PR_POST_SEM(_pr_irix_exit_sem); \
|
||||
_MD_Wakeup_CPUs(); \
|
||||
_exit(0); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define _MD_ATTACH_THREAD(threadp)
|
||||
|
||||
#define _MD_SAVE_ERRNO(_thread) (_thread)->md.errcode = errno;
|
||||
#define _MD_RESTORE_ERRNO(_thread) errno = (_thread)->md.errcode;
|
||||
|
||||
extern struct _PRCPU *_pr_primordialCPU;
|
||||
extern usema_t *_pr_irix_exit_sem;
|
||||
extern PRInt32 _pr_irix_exit_now;
|
||||
extern int _pr_irix_primoridal_cpu_fd[];
|
||||
extern PRInt32 _pr_irix_process_exit;
|
||||
extern PRInt32 _pr_irix_process_exit_code;
|
||||
|
||||
/* Thread operations */
|
||||
#define _PR_LOCK_HEAP() { \
|
||||
PRIntn _is; \
|
||||
if (_pr_primordialCPU) { \
|
||||
if (_MD_GET_ATTACHED_THREAD() && \
|
||||
!_PR_IS_NATIVE_THREAD( \
|
||||
_MD_GET_ATTACHED_THREAD())) \
|
||||
_PR_INTSOFF(_is); \
|
||||
_PR_LOCK(_pr_heapLock); \
|
||||
}
|
||||
|
||||
#define _PR_UNLOCK_HEAP() if (_pr_primordialCPU) { \
|
||||
_PR_UNLOCK(_pr_heapLock); \
|
||||
if (_MD_GET_ATTACHED_THREAD() && \
|
||||
!_PR_IS_NATIVE_THREAD( \
|
||||
_MD_GET_ATTACHED_THREAD())) \
|
||||
_PR_INTSON(_is); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define _PR_OPEN_POLL_SEM(_sem) usopenpollsema(_sem, 0666)
|
||||
#define _PR_WAIT_SEM(_sem) uspsema(_sem)
|
||||
#define _PR_POST_SEM(_sem) usvsema(_sem)
|
||||
|
||||
#define _MD_CVAR_POST_SEM(threadp) usvsema((threadp)->md.cvar_pollsem)
|
||||
|
||||
#define _MD_IOQ_LOCK()
|
||||
#define _MD_IOQ_UNLOCK()
|
||||
|
||||
struct _MDLock {
|
||||
ulock_t lock;
|
||||
usptr_t *arena;
|
||||
};
|
||||
|
||||
/*
|
||||
* disable pre-emption for the LOCAL threads when calling the arena lock
|
||||
* routines
|
||||
*/
|
||||
|
||||
#define _PR_LOCK(lock) { \
|
||||
PRIntn _is; \
|
||||
PRThread *me = _MD_GET_ATTACHED_THREAD(); \
|
||||
if (me && !_PR_IS_NATIVE_THREAD(me)) \
|
||||
_PR_INTSOFF(_is); \
|
||||
ussetlock(lock); \
|
||||
if (me && !_PR_IS_NATIVE_THREAD(me)) \
|
||||
_PR_FAST_INTSON(_is); \
|
||||
}
|
||||
|
||||
#define _PR_UNLOCK(lock) { \
|
||||
PRIntn _is; \
|
||||
PRThread *me = _MD_GET_ATTACHED_THREAD(); \
|
||||
if (me && !_PR_IS_NATIVE_THREAD(me)) \
|
||||
_PR_INTSOFF(_is); \
|
||||
usunsetlock(lock); \
|
||||
if (me && !_PR_IS_NATIVE_THREAD(me)) \
|
||||
_PR_FAST_INTSON(_is); \
|
||||
}
|
||||
|
||||
NSPR_API(PRStatus) _MD_NEW_LOCK(struct _MDLock *md);
|
||||
NSPR_API(void) _MD_FREE_LOCK(struct _MDLock *lockp);
|
||||
|
||||
#define _MD_LOCK(_lockp) _PR_LOCK((_lockp)->lock)
|
||||
#define _MD_UNLOCK(_lockp) _PR_UNLOCK((_lockp)->lock)
|
||||
#define _MD_TEST_AND_LOCK(_lockp) (uscsetlock((_lockp)->lock, 1) == 0)
|
||||
|
||||
extern ulock_t _pr_heapLock;
|
||||
|
||||
struct _MDThread {
|
||||
jmp_buf jb;
|
||||
usptr_t *pollsem_arena;
|
||||
usema_t *cvar_pollsem;
|
||||
PRInt32 cvar_pollsemfd;
|
||||
PRInt32 cvar_pollsem_select; /* acquire sem by calling select */
|
||||
PRInt32 cvar_wait; /* if 1, thread is waiting on cvar Q */
|
||||
PRInt32 id;
|
||||
PRInt32 suspending_id;
|
||||
int errcode;
|
||||
};
|
||||
|
||||
struct _MDThreadStack {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSemaphore {
|
||||
usema_t *sem;
|
||||
};
|
||||
|
||||
struct _MDCVar {
|
||||
ulock_t mdcvar_lock;
|
||||
};
|
||||
|
||||
struct _MDSegment {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
/*
|
||||
* md-specific cpu structure field
|
||||
*/
|
||||
#define _PR_MD_MAX_OSFD FD_SETSIZE
|
||||
|
||||
struct _MDCPU_Unix {
|
||||
PRCList ioQ;
|
||||
PRUint32 ioq_timeout;
|
||||
PRInt32 ioq_max_osfd;
|
||||
PRInt32 ioq_osfd_cnt;
|
||||
#ifndef _PR_USE_POLL
|
||||
fd_set fd_read_set, fd_write_set, fd_exception_set;
|
||||
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
|
||||
fd_exception_cnt[_PR_MD_MAX_OSFD];
|
||||
#else
|
||||
struct pollfd *ioq_pollfds;
|
||||
int ioq_pollfds_size;
|
||||
#endif /* _PR_USE_POLL */
|
||||
};
|
||||
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
|
||||
|
||||
struct _MDCPU {
|
||||
PRInt32 id;
|
||||
PRInt32 suspending_id;
|
||||
struct _MDCPU_Unix md_unix;
|
||||
};
|
||||
|
||||
/*
|
||||
** Initialize the thread context preparing it to execute _main.
|
||||
*/
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
PR_BEGIN_MACRO \
|
||||
int *jb = (_thread)->md.jb; \
|
||||
*status = PR_TRUE; \
|
||||
(void) setjmp(jb); \
|
||||
(_thread)->md.jb[JB_SP] = (int) ((_sp) - 64); \
|
||||
(_thread)->md.jb[JB_PC] = (int) _main; \
|
||||
_thread->no_sched = 0; \
|
||||
PR_END_MACRO
|
||||
|
||||
/*
|
||||
** Switch away from the current thread context by saving its state and
|
||||
** calling the thread scheduler. Reload cpu when we come back from the
|
||||
** context switch because it might have changed.
|
||||
*
|
||||
* XXX RUNQ lock needed before clearing _PR_NO_SCHED flag, because the
|
||||
* thread may be unr RUNQ?
|
||||
*/
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
PR_BEGIN_MACRO \
|
||||
PR_ASSERT(_thread->no_sched); \
|
||||
if (!setjmp(_thread->md.jb)) { \
|
||||
_MD_SAVE_ERRNO(_thread) \
|
||||
_MD_SET_LAST_THREAD(_thread); \
|
||||
_PR_Schedule(); \
|
||||
} else { \
|
||||
PR_ASSERT(_MD_LAST_THREAD() !=_MD_CURRENT_THREAD()); \
|
||||
_MD_LAST_THREAD()->no_sched = 0; \
|
||||
} \
|
||||
PR_END_MACRO
|
||||
|
||||
/*
|
||||
** Restore a thread context that was saved by _MD_SWITCH_CONTEXT or
|
||||
** initialized by _MD_INIT_CONTEXT.
|
||||
*/
|
||||
#define _MD_RESTORE_CONTEXT(_newThread) \
|
||||
PR_BEGIN_MACRO \
|
||||
int *jb = (_newThread)->md.jb; \
|
||||
_MD_RESTORE_ERRNO(_newThread) \
|
||||
_MD_SET_CURRENT_THREAD(_newThread); \
|
||||
_newThread->no_sched = 1; \
|
||||
longjmp(jb, 1); \
|
||||
PR_END_MACRO
|
||||
|
||||
NSPR_API(PRStatus) _MD_InitThread(struct PRThread *thread,
|
||||
PRBool wakeup_parent);
|
||||
NSPR_API(PRStatus) _MD_InitAttachedThread(struct PRThread *thread,
|
||||
PRBool wakeup_parent);
|
||||
#define _MD_INIT_THREAD(thread) _MD_InitThread(thread, PR_TRUE)
|
||||
#define _MD_INIT_ATTACHED_THREAD(thread) \
|
||||
_MD_InitAttachedThread(thread, PR_FALSE)
|
||||
|
||||
NSPR_API(void) _MD_ExitThread(struct PRThread *thread);
|
||||
#define _MD_EXIT_THREAD _MD_ExitThread
|
||||
|
||||
NSPR_API(void) _MD_SuspendThread(struct PRThread *thread);
|
||||
#define _MD_SUSPEND_THREAD _MD_SuspendThread
|
||||
|
||||
NSPR_API(void) _MD_ResumeThread(struct PRThread *thread);
|
||||
#define _MD_RESUME_THREAD _MD_ResumeThread
|
||||
|
||||
NSPR_API(void) _MD_SuspendCPU(struct _PRCPU *thread);
|
||||
#define _MD_SUSPEND_CPU _MD_SuspendCPU
|
||||
|
||||
NSPR_API(void) _MD_ResumeCPU(struct _PRCPU *thread);
|
||||
#define _MD_RESUME_CPU _MD_ResumeCPU
|
||||
|
||||
#define _MD_BEGIN_SUSPEND_ALL()
|
||||
#define _MD_END_SUSPEND_ALL()
|
||||
#define _MD_BEGIN_RESUME_ALL()
|
||||
#define _MD_END_RESUME_ALL()
|
||||
|
||||
NSPR_API(void) _MD_InitLocks(void);
|
||||
#define _MD_INIT_LOCKS _MD_InitLocks
|
||||
|
||||
NSPR_API(void) _MD_CleanThread(struct PRThread *thread);
|
||||
#define _MD_CLEAN_THREAD _MD_CleanThread
|
||||
|
||||
#define _MD_YIELD() sginap(0)
|
||||
|
||||
/* The _PR_MD_WAIT_LOCK and _PR_MD_WAKEUP_WAITER functions put to sleep and
|
||||
* awaken a thread which is waiting on a lock or cvar.
|
||||
*/
|
||||
NSPR_API(PRStatus) _MD_wait(struct PRThread *, PRIntervalTime timeout);
|
||||
#define _MD_WAIT _MD_wait
|
||||
|
||||
NSPR_API(void) _PR_MD_primordial_cpu();
|
||||
NSPR_API(void) _PR_MD_WAKEUP_PRIMORDIAL_CPU();
|
||||
|
||||
NSPR_API(PRStatus) _MD_WakeupWaiter(struct PRThread *);
|
||||
#define _MD_WAKEUP_WAITER _MD_WakeupWaiter
|
||||
|
||||
NSPR_API(void ) _MD_exit(PRIntn status);
|
||||
#define _MD_EXIT _MD_exit
|
||||
|
||||
#include "prthread.h"
|
||||
|
||||
NSPR_API(void) _MD_SetPriority(struct _MDThread *thread,
|
||||
PRThreadPriority newPri);
|
||||
#define _MD_SET_PRIORITY _MD_SetPriority
|
||||
|
||||
NSPR_API(PRStatus) _MD_CreateThread(
|
||||
struct PRThread *thread,
|
||||
void (*start) (void *),
|
||||
PRThreadPriority priority,
|
||||
PRThreadScope scope,
|
||||
PRThreadState state,
|
||||
PRUint32 stackSize);
|
||||
#define _MD_CREATE_THREAD _MD_CreateThread
|
||||
|
||||
extern void _MD_CleanupBeforeExit(void);
|
||||
#define _MD_CLEANUP_BEFORE_EXIT _MD_CleanupBeforeExit
|
||||
|
||||
NSPR_API(void) _PR_MD_PRE_CLEANUP(PRThread *me);
|
||||
|
||||
|
||||
/* The following defines the unwrapped versions of select() and poll(). */
|
||||
extern int _select(int nfds, fd_set *readfds, fd_set *writefds,
|
||||
fd_set *exceptfds, struct timeval *timeout);
|
||||
#define _MD_SELECT _select
|
||||
|
||||
#include <stropts.h>
|
||||
#include <poll.h>
|
||||
#define _MD_POLL _poll
|
||||
extern int _poll(struct pollfd *fds, unsigned long nfds, int timeout);
|
||||
|
||||
|
||||
#define HAVE_THREAD_AFFINITY 1
|
||||
|
||||
NSPR_API(PRInt32) _MD_GetThreadAffinityMask(PRThread *unused, PRUint32 *mask);
|
||||
#define _MD_GETTHREADAFFINITYMASK _MD_GetThreadAffinityMask
|
||||
|
||||
NSPR_API(void) _MD_InitRunningCPU(struct _PRCPU *cpu);
|
||||
#define _MD_INIT_RUNNING_CPU _MD_InitRunningCPU
|
||||
|
||||
#endif /* defined(_PR_PTHREADS) */
|
||||
|
||||
#endif /* _LANGUAGE_ASSEMBLY */
|
||||
|
||||
#endif /* nspr_irix_defs_h___ */
|
||||
559
Src/nprt_plugin/gecko/1.8/win/include/md/_linux.h
Normal file
559
Src/nprt_plugin/gecko/1.8/win/include/md/_linux.h
Normal file
@@ -0,0 +1,559 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Portable Runtime (NSPR).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998-2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nspr_linux_defs_h___
|
||||
#define nspr_linux_defs_h___
|
||||
|
||||
#include "prthread.h"
|
||||
|
||||
/*
|
||||
* Internal configuration macros
|
||||
*/
|
||||
|
||||
#define PR_LINKER_ARCH "linux"
|
||||
#define _PR_SI_SYSNAME "LINUX"
|
||||
#ifdef __powerpc64__
|
||||
#define _PR_SI_ARCHITECTURE "ppc64"
|
||||
#elif defined(__powerpc__)
|
||||
#define _PR_SI_ARCHITECTURE "ppc"
|
||||
#elif defined(__alpha)
|
||||
#define _PR_SI_ARCHITECTURE "alpha"
|
||||
#elif defined(__ia64__)
|
||||
#define _PR_SI_ARCHITECTURE "ia64"
|
||||
#elif defined(__x86_64__)
|
||||
#define _PR_SI_ARCHITECTURE "x86-64"
|
||||
#elif defined(__mc68000__)
|
||||
#define _PR_SI_ARCHITECTURE "m68k"
|
||||
#elif defined(__sparc__)
|
||||
#define _PR_SI_ARCHITECTURE "sparc"
|
||||
#elif defined(__i386__)
|
||||
#define _PR_SI_ARCHITECTURE "x86"
|
||||
#elif defined(__mips__)
|
||||
#define _PR_SI_ARCHITECTURE "mips"
|
||||
#elif defined(__arm__)
|
||||
#define _PR_SI_ARCHITECTURE "arm"
|
||||
#elif defined(__hppa__)
|
||||
#define _PR_SI_ARCHITECTURE "hppa"
|
||||
#elif defined(__s390x__)
|
||||
#define _PR_SI_ARCHITECTURE "s390x"
|
||||
#elif defined(__s390__)
|
||||
#define _PR_SI_ARCHITECTURE "s390"
|
||||
#else
|
||||
#error "Unknown CPU architecture"
|
||||
#endif
|
||||
#define PR_DLL_SUFFIX ".so"
|
||||
|
||||
#define _PR_VMBASE 0x30000000
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
#define _MD_DEFAULT_STACK_SIZE 65536L
|
||||
#define _MD_MMAP_FLAGS MAP_PRIVATE
|
||||
|
||||
#undef HAVE_STACK_GROWING_UP
|
||||
|
||||
/*
|
||||
* Elf linux supports dl* functions
|
||||
*/
|
||||
#define HAVE_DLL
|
||||
#define USE_DLFCN
|
||||
|
||||
#if defined(__i386__)
|
||||
#define _PR_HAVE_ATOMIC_OPS
|
||||
#define _MD_INIT_ATOMIC()
|
||||
extern PRInt32 _PR_x86_AtomicIncrement(PRInt32 *val);
|
||||
#define _MD_ATOMIC_INCREMENT _PR_x86_AtomicIncrement
|
||||
extern PRInt32 _PR_x86_AtomicDecrement(PRInt32 *val);
|
||||
#define _MD_ATOMIC_DECREMENT _PR_x86_AtomicDecrement
|
||||
extern PRInt32 _PR_x86_AtomicAdd(PRInt32 *ptr, PRInt32 val);
|
||||
#define _MD_ATOMIC_ADD _PR_x86_AtomicAdd
|
||||
extern PRInt32 _PR_x86_AtomicSet(PRInt32 *val, PRInt32 newval);
|
||||
#define _MD_ATOMIC_SET _PR_x86_AtomicSet
|
||||
#endif
|
||||
|
||||
#if defined(__ia64__)
|
||||
#define _PR_HAVE_ATOMIC_OPS
|
||||
#define _MD_INIT_ATOMIC()
|
||||
extern PRInt32 _PR_ia64_AtomicIncrement(PRInt32 *val);
|
||||
#define _MD_ATOMIC_INCREMENT _PR_ia64_AtomicIncrement
|
||||
extern PRInt32 _PR_ia64_AtomicDecrement(PRInt32 *val);
|
||||
#define _MD_ATOMIC_DECREMENT _PR_ia64_AtomicDecrement
|
||||
extern PRInt32 _PR_ia64_AtomicAdd(PRInt32 *ptr, PRInt32 val);
|
||||
#define _MD_ATOMIC_ADD _PR_ia64_AtomicAdd
|
||||
extern PRInt32 _PR_ia64_AtomicSet(PRInt32 *val, PRInt32 newval);
|
||||
#define _MD_ATOMIC_SET _PR_ia64_AtomicSet
|
||||
#endif
|
||||
|
||||
#if defined(__x86_64__)
|
||||
#define _PR_HAVE_ATOMIC_OPS
|
||||
#define _MD_INIT_ATOMIC()
|
||||
extern PRInt32 _PR_x86_64_AtomicIncrement(PRInt32 *val);
|
||||
#define _MD_ATOMIC_INCREMENT _PR_x86_64_AtomicIncrement
|
||||
extern PRInt32 _PR_x86_64_AtomicDecrement(PRInt32 *val);
|
||||
#define _MD_ATOMIC_DECREMENT _PR_x86_64_AtomicDecrement
|
||||
extern PRInt32 _PR_x86_64_AtomicAdd(PRInt32 *ptr, PRInt32 val);
|
||||
#define _MD_ATOMIC_ADD _PR_x86_64_AtomicAdd
|
||||
extern PRInt32 _PR_x86_64_AtomicSet(PRInt32 *val, PRInt32 newval);
|
||||
#define _MD_ATOMIC_SET _PR_x86_64_AtomicSet
|
||||
#endif
|
||||
|
||||
#if defined(__alpha)
|
||||
#define _PR_HAVE_ATOMIC_OPS
|
||||
#define _MD_INIT_ATOMIC()
|
||||
#define _MD_ATOMIC_ADD(ptr, i) ({ \
|
||||
PRInt32 __atomic_tmp, __atomic_ret; \
|
||||
__asm__ __volatile__( \
|
||||
"1: ldl_l %[ret], %[val] \n" \
|
||||
" addl %[ret], %[inc], %[tmp] \n" \
|
||||
" addl %[ret], %[inc], %[ret] \n" \
|
||||
" stl_c %[tmp], %[val] \n" \
|
||||
" beq %[tmp], 2f \n" \
|
||||
".subsection 2 \n" \
|
||||
"2: br 1b \n" \
|
||||
".previous" \
|
||||
: [ret] "=&r" (__atomic_ret), \
|
||||
[tmp] "=&r" (__atomic_tmp), \
|
||||
[val] "=m" (*ptr) \
|
||||
: [inc] "Ir" (i), "m" (*ptr)); \
|
||||
__atomic_ret; \
|
||||
})
|
||||
#define _MD_ATOMIC_INCREMENT(ptr) _MD_ATOMIC_ADD(ptr, 1)
|
||||
#define _MD_ATOMIC_DECREMENT(ptr) ({ \
|
||||
PRInt32 __atomic_tmp, __atomic_ret; \
|
||||
__asm__ __volatile__( \
|
||||
"1: ldl_l %[ret], %[val] \n" \
|
||||
" subl %[ret], 1, %[tmp] \n" \
|
||||
" subl %[ret], 1, %[ret] \n" \
|
||||
" stl_c %[tmp], %[val] \n" \
|
||||
" beq %[tmp], 2f \n" \
|
||||
".subsection 2 \n" \
|
||||
"2: br 1b \n" \
|
||||
".previous" \
|
||||
: [ret] "=&r" (__atomic_ret), \
|
||||
[tmp] "=&r" (__atomic_tmp), \
|
||||
[val] "=m" (*ptr) \
|
||||
: "m" (*ptr)); \
|
||||
__atomic_ret; \
|
||||
})
|
||||
#define _MD_ATOMIC_SET(ptr, n) ({ \
|
||||
PRInt32 __atomic_tmp, __atomic_ret; \
|
||||
__asm__ __volatile__( \
|
||||
"1: ldl_l %[ret], %[val] \n" \
|
||||
" mov %[newval], %[tmp] \n" \
|
||||
" stl_c %[tmp], %[val] \n" \
|
||||
" beq %[tmp], 2f \n" \
|
||||
".subsection 2 \n" \
|
||||
"2: br 1b \n" \
|
||||
".previous" \
|
||||
: [ret] "=&r" (__atomic_ret), \
|
||||
[tmp] "=&r"(__atomic_tmp), \
|
||||
[val] "=m" (*ptr) \
|
||||
: [newval] "Ir" (n), "m" (*ptr)); \
|
||||
__atomic_ret; \
|
||||
})
|
||||
#endif
|
||||
|
||||
#define USE_SETJMP
|
||||
#if defined(__GLIBC__) && __GLIBC__ >= 2
|
||||
#define _PR_POLL_AVAILABLE
|
||||
#endif
|
||||
#undef _PR_USE_POLL
|
||||
#define _PR_STAT_HAS_ONLY_ST_ATIME
|
||||
#if defined(__alpha) || defined(__ia64__)
|
||||
#define _PR_HAVE_LARGE_OFF_T
|
||||
#elif (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1)
|
||||
#define _PR_HAVE_OFF64_T
|
||||
#else
|
||||
#define _PR_NO_LARGE_FILES
|
||||
#endif
|
||||
#if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1)
|
||||
#define _PR_INET6
|
||||
#define _PR_HAVE_INET_NTOP
|
||||
#define _PR_HAVE_GETHOSTBYNAME2
|
||||
#define _PR_HAVE_GETADDRINFO
|
||||
#define _PR_INET6_PROBE
|
||||
#endif
|
||||
#define _PR_HAVE_SYSV_SEMAPHORES
|
||||
#define PR_HAVE_SYSV_NAMED_SHARED_MEMORY
|
||||
#if (__GLIBC__ >= 2) && defined(_PR_PTHREADS)
|
||||
#define _PR_HAVE_GETHOST_R
|
||||
#define _PR_HAVE_GETHOST_R_INT
|
||||
#endif
|
||||
|
||||
#ifdef _PR_PTHREADS
|
||||
|
||||
extern void _MD_CleanupBeforeExit(void);
|
||||
#define _MD_CLEANUP_BEFORE_EXIT _MD_CleanupBeforeExit
|
||||
|
||||
#else /* ! _PR_PTHREADS */
|
||||
|
||||
#include <setjmp.h>
|
||||
|
||||
#define PR_CONTEXT_TYPE sigjmp_buf
|
||||
|
||||
#define CONTEXT(_th) ((_th)->md.context)
|
||||
|
||||
#ifdef __powerpc__
|
||||
/*
|
||||
* PowerPC based MkLinux
|
||||
*
|
||||
* On the PowerPC, the new style jmp_buf isn't used until glibc
|
||||
* 2.1.
|
||||
*/
|
||||
#if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1)
|
||||
#define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[JB_GPR1]
|
||||
#else
|
||||
#define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[0].__misc[0]
|
||||
#endif /* glibc 2.1 or later */
|
||||
#define _MD_SET_FP(_t, val)
|
||||
#define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
|
||||
#define _MD_GET_FP_PTR(_t) ((void *) 0)
|
||||
/* aix = 64, macos = 70 */
|
||||
#define PR_NUM_GCREGS 64
|
||||
|
||||
#elif defined(__alpha)
|
||||
/* Alpha based Linux */
|
||||
|
||||
#if defined(__GLIBC__) && __GLIBC__ >= 2
|
||||
#define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[JB_SP]
|
||||
#define _MD_SET_FP(_t, val)
|
||||
#define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
|
||||
#define _MD_GET_FP_PTR(_t) ((void *) 0)
|
||||
#define _MD_SP_TYPE long int
|
||||
#else
|
||||
#define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[0].__sp
|
||||
#define _MD_SET_FP(_t, val)
|
||||
#define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
|
||||
#define _MD_GET_FP_PTR(_t) ((void *) 0)
|
||||
#define _MD_SP_TYPE __ptr_t
|
||||
#endif /* defined(__GLIBC__) && __GLIBC__ >= 2 */
|
||||
|
||||
/* XXX not sure if this is correct, or maybe it should be 17? */
|
||||
#define PR_NUM_GCREGS 9
|
||||
|
||||
#elif defined(__ia64__)
|
||||
|
||||
#define _MD_GET_SP(_t) ((long *)((_t)->md.context[0].__jmpbuf)[0])
|
||||
#define _MD_SET_FP(_t, val)
|
||||
#define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
|
||||
#define _MD_GET_FP_PTR(_t) ((void *) 0)
|
||||
#define _MD_SP_TYPE long int
|
||||
|
||||
#define PR_NUM_GCREGS _JBLEN
|
||||
|
||||
#elif defined(__mc68000__)
|
||||
/* m68k based Linux */
|
||||
|
||||
/*
|
||||
* On the m68k, glibc still uses the old style sigjmp_buf, even
|
||||
* in glibc 2.0.7.
|
||||
*/
|
||||
#if defined(__GLIBC__) && __GLIBC__ >= 2
|
||||
#define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[0].__sp
|
||||
#define _MD_SET_FP(_t, val)
|
||||
#define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
|
||||
#define _MD_GET_FP_PTR(_t) ((void *) 0)
|
||||
#define _MD_SP_TYPE int
|
||||
#else
|
||||
#define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[0].__sp
|
||||
#define _MD_SET_FP(_t, val)
|
||||
#define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
|
||||
#define _MD_GET_FP_PTR(_t) ((void *) 0)
|
||||
#define _MD_SP_TYPE __ptr_t
|
||||
#endif /* defined(__GLIBC__) && __GLIBC__ >= 2 */
|
||||
|
||||
/* XXX not sure if this is correct, or maybe it should be 17? */
|
||||
#define PR_NUM_GCREGS 9
|
||||
|
||||
#elif defined(__sparc__)
|
||||
/* Sparc */
|
||||
#if defined(__GLIBC__) && __GLIBC__ >= 2
|
||||
/*
|
||||
* You need glibc2-2.0.7-25 or later. The libraries that came with
|
||||
* Red Hat 5.1 are not new enough, but they are in 5.2.
|
||||
*/
|
||||
#define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[JB_SP]
|
||||
#define _MD_SET_FP(_t, val) ((_t)->md.context[0].__jmpbuf[JB_FP] = val)
|
||||
#define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
|
||||
#define _MD_GET_FP_PTR(_t) (&(_t)->md.context[0].__jmpbuf[JB_FP])
|
||||
#define _MD_SP_TYPE int
|
||||
#else
|
||||
#define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[0].__fp
|
||||
#define _MD_SET_FP(_t, val)
|
||||
#define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
|
||||
#define _MD_GET_FP_PTR(_t) ((void *) 0)
|
||||
#define _MD_SP_TYPE __ptr_t
|
||||
#endif /* defined(__GLIBC__) && __GLIBC__ >= 2 */
|
||||
|
||||
#elif defined(__i386__)
|
||||
/* Intel based Linux */
|
||||
#if defined(__GLIBC__) && __GLIBC__ >= 2
|
||||
#define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[JB_SP]
|
||||
#define _MD_SET_FP(_t, val) ((_t)->md.context[0].__jmpbuf[JB_BP] = val)
|
||||
#define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
|
||||
#define _MD_GET_FP_PTR(_t) (&(_t)->md.context[0].__jmpbuf[JB_BP])
|
||||
#define _MD_SP_TYPE int
|
||||
#else
|
||||
#define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[0].__sp
|
||||
#define _MD_SET_FP(_t, val) ((_t)->md.context[0].__jmpbuf[0].__bp = val)
|
||||
#define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
|
||||
#define _MD_GET_FP_PTR(_t) &((_t)->md.context[0].__jmpbuf[0].__bp)
|
||||
#define _MD_SP_TYPE __ptr_t
|
||||
#endif /* defined(__GLIBC__) && __GLIBC__ >= 2 */
|
||||
#define PR_NUM_GCREGS 6
|
||||
|
||||
#elif defined(__mips__)
|
||||
/* Linux/MIPS */
|
||||
#if defined(__GLIBC__) && __GLIBC__ >= 2
|
||||
#define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[0].__sp
|
||||
#define _MD_SET_FP(_t, val) ((_t)->md.context[0].__jmpbuf[0].__fp = (val))
|
||||
#define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
|
||||
#define _MD_GET_FP_PTR(_t) (&(_t)->md.context[0].__jmpbuf[0].__fp)
|
||||
#define _MD_SP_TYPE __ptr_t
|
||||
#else
|
||||
#error "Linux/MIPS pre-glibc2 not supported yet"
|
||||
#endif /* defined(__GLIBC__) && __GLIBC__ >= 2 */
|
||||
|
||||
#elif defined(__arm__)
|
||||
/* ARM/Linux */
|
||||
#if defined(__GLIBC__) && __GLIBC__ >= 2
|
||||
#define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[20]
|
||||
#define _MD_SET_FP(_t, val) ((_t)->md.context[0].__jmpbuf[19] = (val))
|
||||
#define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
|
||||
#define _MD_GET_FP_PTR(_t) (&(_t)->md.context[0].__jmpbuf[19])
|
||||
#define _MD_SP_TYPE __ptr_t
|
||||
#else
|
||||
#error "ARM/Linux pre-glibc2 not supported yet"
|
||||
#endif /* defined(__GLIBC__) && __GLIBC__ >= 2 */
|
||||
|
||||
#else
|
||||
|
||||
#error "Unknown CPU architecture"
|
||||
|
||||
#endif /*__powerpc__*/
|
||||
|
||||
/*
|
||||
** Initialize a thread context to run "_main()" when started
|
||||
*/
|
||||
#ifdef __powerpc__
|
||||
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
{ \
|
||||
*status = PR_TRUE; \
|
||||
if (sigsetjmp(CONTEXT(_thread), 1)) { \
|
||||
_main(); \
|
||||
} \
|
||||
_MD_GET_SP(_thread) = (unsigned char*) ((_sp) - 128); \
|
||||
_thread->md.sp = _MD_GET_SP_PTR(_thread); \
|
||||
_thread->md.fp = _MD_GET_FP_PTR(_thread); \
|
||||
_MD_SET_FP(_thread, 0); \
|
||||
}
|
||||
|
||||
#elif defined(__mips__)
|
||||
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
{ \
|
||||
*status = PR_TRUE; \
|
||||
(void) sigsetjmp(CONTEXT(_thread), 1); \
|
||||
_thread->md.context[0].__jmpbuf[0].__pc = (__ptr_t) _main; \
|
||||
_MD_GET_SP(_thread) = (_MD_SP_TYPE) ((_sp) - 64); \
|
||||
_thread->md.sp = _MD_GET_SP_PTR(_thread); \
|
||||
_thread->md.fp = _MD_GET_FP_PTR(_thread); \
|
||||
_MD_SET_FP(_thread, 0); \
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
{ \
|
||||
*status = PR_TRUE; \
|
||||
if (sigsetjmp(CONTEXT(_thread), 1)) { \
|
||||
_main(); \
|
||||
} \
|
||||
_MD_GET_SP(_thread) = (_MD_SP_TYPE) ((_sp) - 64); \
|
||||
_thread->md.sp = _MD_GET_SP_PTR(_thread); \
|
||||
_thread->md.fp = _MD_GET_FP_PTR(_thread); \
|
||||
_MD_SET_FP(_thread, 0); \
|
||||
}
|
||||
|
||||
#endif /*__powerpc__*/
|
||||
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
if (!sigsetjmp(CONTEXT(_thread), 1)) { \
|
||||
(_thread)->md.errcode = errno; \
|
||||
_PR_Schedule(); \
|
||||
}
|
||||
|
||||
/*
|
||||
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
|
||||
*/
|
||||
#define _MD_RESTORE_CONTEXT(_thread) \
|
||||
{ \
|
||||
errno = (_thread)->md.errcode; \
|
||||
_MD_SET_CURRENT_THREAD(_thread); \
|
||||
siglongjmp(CONTEXT(_thread), 1); \
|
||||
}
|
||||
|
||||
/* Machine-dependent (MD) data structures */
|
||||
|
||||
struct _MDThread {
|
||||
PR_CONTEXT_TYPE context;
|
||||
void *sp;
|
||||
void *fp;
|
||||
int id;
|
||||
int errcode;
|
||||
};
|
||||
|
||||
struct _MDThreadStack {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDLock {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSemaphore {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDCVar {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSegment {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
/*
|
||||
* md-specific cpu structure field
|
||||
*/
|
||||
#include <sys/time.h> /* for FD_SETSIZE */
|
||||
#define _PR_MD_MAX_OSFD FD_SETSIZE
|
||||
|
||||
struct _MDCPU_Unix {
|
||||
PRCList ioQ;
|
||||
PRUint32 ioq_timeout;
|
||||
PRInt32 ioq_max_osfd;
|
||||
PRInt32 ioq_osfd_cnt;
|
||||
#ifndef _PR_USE_POLL
|
||||
fd_set fd_read_set, fd_write_set, fd_exception_set;
|
||||
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
|
||||
fd_exception_cnt[_PR_MD_MAX_OSFD];
|
||||
#else
|
||||
struct pollfd *ioq_pollfds;
|
||||
int ioq_pollfds_size;
|
||||
#endif /* _PR_USE_POLL */
|
||||
};
|
||||
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
|
||||
struct _MDCPU {
|
||||
struct _MDCPU_Unix md_unix;
|
||||
};
|
||||
|
||||
#define _MD_INIT_LOCKS()
|
||||
#define _MD_NEW_LOCK(lock) PR_SUCCESS
|
||||
#define _MD_FREE_LOCK(lock)
|
||||
#define _MD_LOCK(lock)
|
||||
#define _MD_UNLOCK(lock)
|
||||
#define _MD_INIT_IO()
|
||||
#define _MD_IOQ_LOCK()
|
||||
#define _MD_IOQ_UNLOCK()
|
||||
|
||||
extern PRStatus _MD_InitializeThread(PRThread *thread);
|
||||
|
||||
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
|
||||
#define _MD_INIT_THREAD _MD_InitializeThread
|
||||
#define _MD_EXIT_THREAD(thread)
|
||||
#define _MD_SUSPEND_THREAD(thread) _MD_suspend_thread
|
||||
#define _MD_RESUME_THREAD(thread) _MD_resume_thread
|
||||
#define _MD_CLEAN_THREAD(_thread)
|
||||
|
||||
extern PRStatus _MD_CREATE_THREAD(
|
||||
PRThread *thread,
|
||||
void (*start) (void *),
|
||||
PRThreadPriority priority,
|
||||
PRThreadScope scope,
|
||||
PRThreadState state,
|
||||
PRUint32 stackSize);
|
||||
extern void _MD_SET_PRIORITY(struct _MDThread *thread, PRUintn newPri);
|
||||
extern PRStatus _MD_WAIT(PRThread *, PRIntervalTime timeout);
|
||||
extern PRStatus _MD_WAKEUP_WAITER(PRThread *);
|
||||
extern void _MD_YIELD(void);
|
||||
|
||||
#endif /* ! _PR_PTHREADS */
|
||||
|
||||
extern void _MD_EarlyInit(void);
|
||||
extern PRIntervalTime _PR_UNIX_GetInterval(void);
|
||||
extern PRIntervalTime _PR_UNIX_TicksPerSecond(void);
|
||||
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
#define _MD_GET_INTERVAL _PR_UNIX_GetInterval
|
||||
#define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond
|
||||
|
||||
/*
|
||||
* We wrapped the select() call. _MD_SELECT refers to the built-in,
|
||||
* unwrapped version.
|
||||
*/
|
||||
#define _MD_SELECT __select
|
||||
|
||||
#ifdef _PR_POLL_AVAILABLE
|
||||
#include <sys/poll.h>
|
||||
extern int __syscall_poll(struct pollfd *ufds, unsigned long int nfds,
|
||||
int timeout);
|
||||
#define _MD_POLL __syscall_poll
|
||||
#endif
|
||||
|
||||
/* For writev() */
|
||||
#include <sys/uio.h>
|
||||
|
||||
extern void _MD_linux_map_sendfile_error(int err);
|
||||
|
||||
#endif /* nspr_linux_defs_h___ */
|
||||
725
Src/nprt_plugin/gecko/1.8/win/include/md/_macos.h
Normal file
725
Src/nprt_plugin/gecko/1.8/win/include/md/_macos.h
Normal file
@@ -0,0 +1,725 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Portable Runtime (NSPR).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998-2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef prmacos_h___
|
||||
#define prmacos_h___
|
||||
|
||||
//
|
||||
// This file contains all changes and additions which need to be made to the NSPR runtime
|
||||
// for the Macintosh platform (specifically the Metrowerks environment). This file should
|
||||
// only be incluced in Macintosh builds.
|
||||
//
|
||||
|
||||
#define PR_DLL_SUFFIX ""
|
||||
#define _PR_LOCAL_THREADS_ONLY
|
||||
#define _PR_NO_PREEMPT 1
|
||||
#define _PR_HAVE_ATOMIC_OPS 1
|
||||
|
||||
#include "prinit.h"
|
||||
#include "prio.h"
|
||||
#include "prlong.h"
|
||||
#include "prlock.h"
|
||||
#include "prcvar.h"
|
||||
#include "prsem.h"
|
||||
#include "prthread.h"
|
||||
#include "prtime.h"
|
||||
#include "prproces.h"
|
||||
|
||||
#if !defined(MAC_NSPR_STANDALONE)
|
||||
#include "macstdlibextras.h"
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
#include <setjmp.h>
|
||||
|
||||
#include <Errors.h>
|
||||
#include <OpenTransport.h>
|
||||
#include <DriverServices.h>
|
||||
|
||||
#define _PR_HAVE_PEEK_BUFFER
|
||||
#define _PR_PEEK_BUFFER_MAX (16 * 1024)
|
||||
#define _PR_FD_NEED_EMULATE_MSG_PEEK(fd) 1
|
||||
|
||||
struct _MDProcess {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDThread {
|
||||
jmp_buf jb;
|
||||
int osErrCode;
|
||||
PRLock * asyncIOLock;
|
||||
PRCondVar * asyncIOCVar;
|
||||
PRBool missedIONotify;
|
||||
PRBool missedAsyncNotify;
|
||||
PRBool asyncNotifyPending;
|
||||
};
|
||||
|
||||
struct _MDThreadStack {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDLock {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDCVar {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSemaphore {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSegment {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDCPU {
|
||||
AbsoluteTime lastThreadSwitch;
|
||||
AbsoluteTime lastWakeUpProcess;
|
||||
PRBool trackScheduling;
|
||||
};
|
||||
|
||||
typedef struct _MDSocketCallerInfo {
|
||||
PRThread * thread;
|
||||
void * cookie;
|
||||
} _MDSocketCallerInfo;
|
||||
|
||||
struct _MDFileDesc {
|
||||
PRInt32 osfd;
|
||||
PRPackedBool orderlyDisconnect;
|
||||
PRPackedBool readReady;
|
||||
PRPackedBool writeReady;
|
||||
PRPackedBool exceptReady;
|
||||
PRLock * miscLock;
|
||||
|
||||
/* Server sockets: listen bit tells the notifier func what to do */
|
||||
PRBool doListen;
|
||||
|
||||
/* stored error for non-blocking connects, as a Unix-style error code */
|
||||
OTReason disconnectError;
|
||||
|
||||
_MDSocketCallerInfo misc;
|
||||
_MDSocketCallerInfo read;
|
||||
_MDSocketCallerInfo write;
|
||||
};
|
||||
|
||||
/*
|
||||
** Iinitialization Related definitions
|
||||
*/
|
||||
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _MD_FinalInit
|
||||
|
||||
/*
|
||||
** Interrupts Related definitions
|
||||
*/
|
||||
|
||||
#define _MD_GET_INTSOFF() (_pr_intsOff)
|
||||
|
||||
#define _MD_INTSOFF(_is) \
|
||||
PR_BEGIN_MACRO \
|
||||
ENTER_CRITICAL_REGION(); \
|
||||
(_is) = _PR_MD_GET_INTSOFF(); \
|
||||
_PR_MD_SET_INTSOFF(1); \
|
||||
LEAVE_CRITICAL_REGION(); \
|
||||
PR_END_MACRO
|
||||
|
||||
#if TARGET_CARBON
|
||||
extern void _MD_SetIntsOff(PRInt32 ints);
|
||||
#define _MD_SET_INTSOFF(_val) _MD_SetIntsOff(_val)
|
||||
#else /* not TARGET_CARBON */
|
||||
#define _MD_SET_INTSOFF(_val) (_pr_intsOff = _val)
|
||||
#endif /* TARGET_CARBON */
|
||||
|
||||
#define _MD_START_INTERRUPTS _MD_StartInterrupts
|
||||
#define _MD_STOP_INTERRUPTS _MD_StopInterrupts
|
||||
#define _MD_BLOCK_CLOCK_INTERRUPTS()
|
||||
#define _MD_UNBLOCK_CLOCK_INTERRUPTS()
|
||||
#define _MD_DISABLE_CLOCK_INTERRUPTS()
|
||||
#define _MD_ENABLE_CLOCK_INTERRUPTS()
|
||||
|
||||
/*
|
||||
** CPU Related definitions
|
||||
*/
|
||||
|
||||
#define _MD_PAUSE_CPU _MD_PauseCPU
|
||||
#define _MD_CLEANUP_BEFORE_EXIT()
|
||||
#define _MD_EXIT(status) exit(status)
|
||||
#define _MD_INIT_CPUS()
|
||||
#define _MD_INIT_RUNNING_CPU(cpu) _MD_InitRunningCPU(cpu)
|
||||
|
||||
/*
|
||||
** Process Related definitions
|
||||
*/
|
||||
|
||||
extern struct PRProcess * _MD_CreateProcess(
|
||||
const char *path,
|
||||
char *const *argv,
|
||||
char *const *envp,
|
||||
const PRProcessAttr *attr);
|
||||
#define _MD_CREATE_PROCESS _MD_CreateProcess
|
||||
|
||||
extern PRStatus _MD_DetachProcess(PRProcess *process);
|
||||
#define _MD_DETACH_PROCESS _MD_DetachProcess
|
||||
|
||||
extern PRStatus _MD_WaitProcess(PRProcess *process, PRInt32 *exitCode);
|
||||
#define _MD_WAIT_PROCESS _MD_WaitProcess
|
||||
|
||||
extern PRStatus _MD_KillProcess(PRProcess *process);
|
||||
#define _MD_KILL_PROCESS _MD_KillProcess
|
||||
|
||||
/*
|
||||
** Memory Segments Related definitions
|
||||
*/
|
||||
|
||||
#define _MD_INIT_SEGS()
|
||||
|
||||
/*
|
||||
** Thread Stacks Debugging Related definitions
|
||||
*/
|
||||
|
||||
#define _MD_INIT_STACK _MD_InitStack
|
||||
#define _MD_CLEAR_STACK _MD_ClearStack
|
||||
|
||||
/*
|
||||
** Locks Related definitions
|
||||
*/
|
||||
|
||||
#define _MD_INIT_LOCKS()
|
||||
#define _MD_NEW_LOCK(lock) (PR_SUCCESS)
|
||||
#define _MD_FREE_LOCK(lock)
|
||||
#define _MD_LOCK(lock)
|
||||
#define _MD_UNLOCK(lock)
|
||||
|
||||
/*
|
||||
** Thread Related definitions
|
||||
*/
|
||||
|
||||
NSPR_API(PRThread *) PR_GetPrimaryThread();
|
||||
|
||||
#if defined(powerc) || defined(__powerc)
|
||||
#define _MD_GET_PC(_t) (*((PRUint32 *)((_t)->md.jb)))
|
||||
#define _MD_GET_SP(_t) (*((PRUint32 *)((_t)->md.jb) + 2))
|
||||
#define _MD_GET_TOC(_t) (*((PRUint32 *)((_t)->md.jb) + 3))
|
||||
#define INIT_STACKPTR(stackTop) ((unsigned char*)stackTop - 128)
|
||||
#define PR_NUM_GCREGS 70
|
||||
#else
|
||||
#define _MD_GET_PC(_t) (*((PRUint32 *)((_t)->md.jb) + 6))
|
||||
#define _MD_GET_SP(_t) (*((PRUint32 *)((_t)->md.jb) + 12))
|
||||
#define INIT_STACKPTR(stackTop) ((unsigned char*)stackTop - 4)
|
||||
#define PR_NUM_GCREGS 13
|
||||
#endif
|
||||
|
||||
#define _MD_DEFAULT_STACK_SIZE (58 * 1024)
|
||||
#define _MD_MINIMUM_STACK_SIZE (58 * 1024)
|
||||
|
||||
/*
|
||||
** Initialize the thread machine dependent data structure
|
||||
*/
|
||||
extern PRStatus _MD_InitThread(PRThread *thread);
|
||||
#define _MD_INIT_THREAD _MD_InitThread
|
||||
|
||||
/*
|
||||
** Clean-up the thread machine dependent data structure
|
||||
*/
|
||||
#define _MD_CLEAN_THREAD(_thread) \
|
||||
PR_BEGIN_MACRO \
|
||||
PR_DestroyCondVar(_thread->md.asyncIOCVar); \
|
||||
PR_DestroyLock(_thread->md.asyncIOLock); \
|
||||
PR_END_MACRO
|
||||
|
||||
|
||||
/*
|
||||
** Initialize the thread context preparing it to execute _main.
|
||||
** *sp = 0 zeros out the sp for the first stack frame so that
|
||||
** stack walking code can find the top of the stack.
|
||||
*/
|
||||
#if defined(powerc) || defined(__powerc)
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, _status) \
|
||||
PR_BEGIN_MACRO \
|
||||
unsigned char *sp; \
|
||||
unsigned long *tvect; \
|
||||
long **jb = (_thread)->md.jb; \
|
||||
*((PRBool *)_status) = PR_TRUE; \
|
||||
(void) setjmp(jb); \
|
||||
sp = INIT_STACKPTR(_sp); \
|
||||
*sp = 0; \
|
||||
(_MD_GET_SP(_thread)) = (long) sp; \
|
||||
tvect = (unsigned long *)_main; \
|
||||
(_MD_GET_PC(_thread)) = (int) *tvect; \
|
||||
(_MD_GET_TOC(_thread)) = (int) *(tvect+1); \
|
||||
_thread->no_sched = 0; \
|
||||
PR_END_MACRO
|
||||
#else
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, _status) \
|
||||
PR_BEGIN_MACRO \
|
||||
unsigned char *sp; \
|
||||
long **jb = (_thread)->md.jb; \
|
||||
*((PRBool *)_status) = PR_TRUE; \
|
||||
(void) setjmp(jb); \
|
||||
sp = INIT_STACKPTR(_sp); \
|
||||
(_MD_GET_SP(_thread)) = (long) sp; \
|
||||
(_MD_GET_PC(_thread)) = (int) _main; \
|
||||
_thread->no_sched = 0; \
|
||||
PR_END_MACRO
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Switch away from the current thread context by saving its state and
|
||||
** calling the thread scheduler. Reload cpu when we come back from the
|
||||
** context switch because it might have changed.
|
||||
*/
|
||||
/* ResetTimer(); before _PR_Schedule() */
|
||||
|
||||
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
PR_BEGIN_MACRO \
|
||||
PR_ASSERT(_thread->no_sched); \
|
||||
if (!setjmp(_thread->md.jb)) { \
|
||||
_MD_SET_LAST_THREAD(_thread); \
|
||||
if (_PR_MD_CURRENT_CPU()->md.trackScheduling) \
|
||||
_PR_MD_CURRENT_CPU()->md.lastThreadSwitch = UpTime(); \
|
||||
_PR_Schedule(); \
|
||||
} else { \
|
||||
PR_ASSERT(_MD_LAST_THREAD() !=_MD_CURRENT_THREAD()); \
|
||||
_MD_LAST_THREAD()->no_sched = 0; \
|
||||
} \
|
||||
PR_END_MACRO
|
||||
|
||||
/*
|
||||
** Restore a thread context that was saved by _MD_SWITCH_CONTEXT or
|
||||
** initialized by _MD_INIT_CONTEXT.
|
||||
*/
|
||||
#define _MD_RESTORE_CONTEXT(_newThread) \
|
||||
PR_BEGIN_MACRO \
|
||||
long **jb = (_newThread)->md.jb; \
|
||||
_MD_SET_CURRENT_THREAD(_newThread); \
|
||||
_newThread->no_sched = 1; \
|
||||
longjmp(jb, 1); \
|
||||
PR_END_MACRO
|
||||
|
||||
|
||||
#define _MD_ERRNO() _MD_CURRENT_THREAD()->md.osErrCode
|
||||
|
||||
extern PRStatus _MD_wait(PRThread *thread, PRIntervalTime timeout);
|
||||
#define _MD_WAIT _MD_wait
|
||||
|
||||
/*
|
||||
** Combined thread model related definitions
|
||||
*/
|
||||
|
||||
#define _MD_CREATE_THREAD(a,b,c,d,e,f) (PR_SUCCESS)
|
||||
#define _MD_WAKEUP_WAITER(a)
|
||||
#define _MD_SET_PRIORITY(a,b)
|
||||
|
||||
/*
|
||||
** File I/O Related definitions
|
||||
*/
|
||||
|
||||
extern PRInt32 _PR_MD_WRITE_SYNC(PRFileDesc *fd, void *buf, PRInt32 amount);
|
||||
#define _PR_MD_WRITE_SYNC _MD_WRITE_SYNC
|
||||
|
||||
struct _MDDir {
|
||||
short ioVRefNum;
|
||||
long ioDirID;
|
||||
short ioFDirIndex;
|
||||
char *currentEntryName;
|
||||
};
|
||||
|
||||
#define PR_DIRECTORY_SEPARATOR '/'
|
||||
#define PR_DIRECTORY_SEPARATOR_STR "/"
|
||||
#define PR_PATH_SEPARATOR ':'
|
||||
#define PR_PATH_SEPARATOR_STR ":"
|
||||
|
||||
typedef enum IOOperation {
|
||||
READ_ASYNC,
|
||||
WRITE_ASYNC
|
||||
} IOOperation;
|
||||
|
||||
|
||||
#define _MD_INIT_IO()
|
||||
|
||||
#define _MD_OPEN _MD_Open
|
||||
#define _MD_OPEN_FILE _MD_Open
|
||||
#define _MD_CLOSE_FILE FSClose
|
||||
#define _MD_READ(fd,buf,amount) ReadWriteProc(fd,buf,amount,READ_ASYNC)
|
||||
#define _MD_WRITE(fd,buf,amount) ReadWriteProc(fd,buf,amount,WRITE_ASYNC)
|
||||
#define _MD_WRITE_SYNC(fd,buf,amount) WriteSyncProc(fd,buf,amount)
|
||||
#define _MD_GET_FILE_ERROR() _PR_MD_CURRENT_THREAD()->md.osErrCode
|
||||
#define _MD_LSEEK _MD_LSeek
|
||||
#define _MD_FSYNC _MD_FSync
|
||||
|
||||
/* to be implemented */
|
||||
#define _MD_LSEEK64(a,b,c) LL_ZERO
|
||||
#define _MD_GETOPENFILEINFO64(fd,info) -1
|
||||
#define _MD_GETFILEINFO64(fd,info) -1
|
||||
|
||||
#define _MD_IOQ_LOCK()
|
||||
#define _MD_IOQ_UNLOCK()
|
||||
|
||||
/*
|
||||
** File Manipulation definitions
|
||||
*/
|
||||
|
||||
#define _MD_RENAME _MD_Rename
|
||||
#define _MD_ACCESS _MD_Access
|
||||
|
||||
#define _MD_GETFILEINFO _MD_GetFileInfo
|
||||
#define _MD_GETOPENFILEINFO _MD_GetOpenFileInfo
|
||||
|
||||
#define _MD_STAT _MD_Stat
|
||||
|
||||
#define _MD_DELETE _MD_Delete
|
||||
|
||||
extern PRStatus _MD_LockFile(PRInt32 osfd);
|
||||
#define _MD_LOCKFILE _MD_LockFile
|
||||
extern PRStatus _MD_TLockFile(PRInt32 osfd);
|
||||
#define _MD_TLOCKFILE _MD_TLockFile
|
||||
extern PRStatus _MD_UnlockFile(PRInt32 osfd);
|
||||
#define _MD_UNLOCKFILE _MD_UnlockFile
|
||||
|
||||
/*
|
||||
** Directory enumeration related definitions
|
||||
*/
|
||||
|
||||
extern PRStatus _MD_OpenDir(struct _MDDir *md,const char *name);
|
||||
#define _MD_OPEN_DIR _MD_OpenDir
|
||||
|
||||
extern char* _MD_ReadDir(struct _MDDir *md,PRIntn flags);
|
||||
#define _MD_READ_DIR _MD_ReadDir
|
||||
|
||||
#define _MD_CLOSE_DIR _MD_CloseDir
|
||||
|
||||
#define _MD_MKDIR _MD_MkDir
|
||||
#define _MD_MAKE_DIR _MD_MkDir
|
||||
#define _MD_RMDIR _MD_Delete
|
||||
|
||||
/*
|
||||
** Pipe I/O Related definitions (not implemented)
|
||||
*/
|
||||
|
||||
#define _MD_PIPEAVAILABLE(fd) -1
|
||||
|
||||
/*
|
||||
** Socket I/O Related definitions
|
||||
*/
|
||||
|
||||
#if UNIVERSAL_INTERFACES_VERSION >= 0x0330
|
||||
/* In Universal Interfaces 3.3 and later, these are enums. */
|
||||
#define IP_TTL IP_TTL
|
||||
#define IP_TOS IP_TOS
|
||||
#define IP_ADD_MEMBERSHIP IP_ADD_MEMBERSHIP
|
||||
#define IP_DROP_MEMBERSHIP IP_DROP_MEMBERSHIP
|
||||
#define IP_MULTICAST_IF IP_MULTICAST_IF
|
||||
#define IP_MULTICAST_TTL IP_MULTICAST_TTL
|
||||
#define IP_MULTICAST_LOOP IP_MULTICAST_LOOP
|
||||
#define TCP_NODELAY TCP_NODELAY
|
||||
#define TCP_MAXSEG TCP_MAXSEG
|
||||
#endif
|
||||
|
||||
#define _MD_SOCKET _MD_socket
|
||||
#define _MD_BIND _MD_bind
|
||||
#define _MD_LISTEN _MD_listen
|
||||
#define _MD_GETSOCKNAME _MD_getsockname
|
||||
|
||||
extern PRStatus _MD_getsockopt(PRFileDesc *fd, PRInt32 level, PRInt32 optname, char* optval, PRInt32* optlen);
|
||||
#define _MD_GETSOCKOPT _MD_getsockopt
|
||||
|
||||
extern PRStatus _MD_setsockopt(PRFileDesc *fd, PRInt32 level, PRInt32 optname, const char* optval, PRInt32 optlen);
|
||||
#define _MD_SETSOCKOPT _MD_setsockopt
|
||||
|
||||
#define _MD_SOCKETAVAILABLE _MD_socketavailable
|
||||
#define _MD_ACCEPT _MD_accept
|
||||
#define _MD_CONNECT _MD_connect
|
||||
#define _MD_SEND _MD_send
|
||||
#define _MD_RECV _MD_recv
|
||||
#define _MD_CLOSE_SOCKET _MD_closesocket
|
||||
#define _MD_SENDTO _MD_sendto
|
||||
#define _MD_RECVFROM _MD_recvfrom
|
||||
#define _MD_PR_POLL _MD_poll
|
||||
#define _MD_INIT_FILEDESC _MD_initfiledesc
|
||||
#define _MD_FREE_FILEDESC _MD_freefiledesc
|
||||
#define _MD_MAKE_NONBLOCK _MD_makenonblock
|
||||
#define _MD_INIT_FD_INHERITABLE _MD_initfdinheritable
|
||||
#define _MD_QUERY_FD_INHERITABLE _MD_queryfdinheritable
|
||||
|
||||
#define _MD_GET_SOCKET_ERROR() _PR_MD_CURRENT_THREAD()->md.osErrCode
|
||||
|
||||
#define _PR_MD_MAP_SELECT_ERROR(x) (x)
|
||||
/*
|
||||
** Netdb Related definitions
|
||||
*/
|
||||
extern PRStatus _MD_gethostname(char *name, int namelen);
|
||||
#define _MD_GETHOSTNAME _MD_gethostname
|
||||
#define _PR_GET_HOST_ADDR_AS_NAME
|
||||
|
||||
/*
|
||||
XXX _MD_WRITEV, _MD_SHUTDOWN & _MD_GETPEERNAME not done yet!!!
|
||||
*/
|
||||
#define _MD_WRITEV _MD_writev
|
||||
#define _MD_SHUTDOWN _MD_shutdown
|
||||
#define _MD_GETPEERNAME _MD_getpeername
|
||||
|
||||
|
||||
#ifdef OLD_MACSOCK_LIBRARY
|
||||
#define _MD_SOCKET macsock_socket
|
||||
#define _MD_LISTEN macsock_listen
|
||||
#define _MD_SEND(fd,buf,amount,flags,timeout) macsock_send(fd->secret->md.osfd,buf,amount,flags)
|
||||
#define _MD_SENDTO(fd,buf,amount,flags,addr,addrlen,timeout) macsock_sendto(fd->secret->md.osfd,buf,amount,flags,(struct sockaddr *)addr,addrlen)
|
||||
#define _MD_RECV(fd,buf,amount,flags,timeout) macsock_recv(fd->secret->md.osfd,buf,amount,flags)
|
||||
#define _MD_RECVFROM(fd,buf,amount,flags,addr,addrlen,timeout) macsock_recvfrom(fd->secret->md.osfd,buf,amount,flags,(struct sockaddr *)addr,addrlen)
|
||||
#define _MD_CLOSE_SOCKET macsock_close
|
||||
#define _MD_SHUTDOWN(a,b) (0)
|
||||
|
||||
#define _MD_ACCEPT(fd,addr,addrlen,timeout) macsock_accept(fd->secret->md.osfd,(struct sockaddr *)addr,addrlen)
|
||||
#define _MD_CONNECT(fd,name,namelen,timeout) macsock_connect(fd->secret->md.osfd,(struct sockaddr *)name,namelen)
|
||||
#define _MD_BIND(fd,name,namelen) macsock_bind(fd->secret->md.osfd,(struct sockaddr *)name,namelen)
|
||||
#define _MD_GETSOCKNAME(fd,name,namelen) macsock_getsockname(fd->secret->md.osfd,(struct sockaddr *)name,namelen)
|
||||
#define _MD_GETPEERNAME(fd,name,namelen) macsock_getpeername(fd->secret->md.osfd,(struct sockaddr *)name,namelen)
|
||||
#define _MD_GETSOCKOPT(fd,level,optname,optval,optlen) macsock_getsockopt(fd->secret->md.osfd,level,optname,optval,optlen)
|
||||
#define _MD_SETSOCKOPT(fd,level,optname,optval,optlen) macsock_setsockopt(fd->secret->md.osfd,level,optname,optval,optlen)
|
||||
#define _MD_SOCKETAVAILABLE(fd,bytes) macsock_socketavailable(fd->secret->md.osfd,bytes)
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Memory Segements Related definitions
|
||||
*/
|
||||
|
||||
#define _MD_INIT_SEGS()
|
||||
#define _MD_ALLOC_SEGMENT _MD_AllocSegment
|
||||
#define _MD_FREE_SEGMENT _MD_FreeSegment
|
||||
|
||||
/*
|
||||
** Time Related definitions
|
||||
*/
|
||||
|
||||
#define _MD_GET_INTERVAL _MD_GetInterval
|
||||
#define _MD_INTERVAL_PER_SEC() PR_MSEC_PER_SEC
|
||||
#define _MD_INTERVAL_INIT()
|
||||
|
||||
/*
|
||||
** Environemnt Related definitions
|
||||
*/
|
||||
|
||||
extern char *_MD_GetEnv(const char *name);
|
||||
#define _MD_GET_ENV _MD_GetEnv
|
||||
|
||||
extern int _MD_PutEnv(const char *variableCopy);
|
||||
#define _MD_PUT_ENV _MD_PutEnv
|
||||
|
||||
/*
|
||||
** Following is old stuff to be looked at.
|
||||
*/
|
||||
|
||||
#define GCPTR
|
||||
#define CALLBACK
|
||||
typedef int (*FARPROC)();
|
||||
|
||||
|
||||
#define MAX_NON_PRIMARY_TIME_SLICES 6
|
||||
|
||||
extern long gTimeSlicesOnNonPrimaryThread;
|
||||
extern struct PRThread *gPrimaryThread;
|
||||
|
||||
// Errors not found in the Mac StdCLib
|
||||
#define EACCES 13 // Permission denied
|
||||
#define ENOENT -43 // No such file or directory
|
||||
#define _OS_INVALID_FD_VALUE -1
|
||||
|
||||
#define STDERR_FILENO 2
|
||||
|
||||
#if !defined(MAC_NSPR_STANDALONE)
|
||||
#define PATH_SEPARATOR ':'
|
||||
#define PATH_SEPARATOR_STR ":"
|
||||
#define DIRECTORY_SEPARATOR '/'
|
||||
#define DIRECTORY_SEPARATOR_STR "/"
|
||||
#endif
|
||||
|
||||
#define UNIX_THIS_DIRECTORY_STR "./"
|
||||
#define UNIX_PARENT_DIRECTORY_STR "../"
|
||||
|
||||
|
||||
// Alias a few names
|
||||
#define getenv PR_GetEnv
|
||||
#define putenv _MD_PutEnv
|
||||
|
||||
#if defined(MAC_NSPR_STANDALONE)
|
||||
typedef unsigned char (*MemoryCacheFlusherProc)(size_t size);
|
||||
typedef void (*PreAllocationHookProc)(void);
|
||||
|
||||
extern char *strdup(const char *source);
|
||||
|
||||
extern void InstallPreAllocationHook(PreAllocationHookProc newHook);
|
||||
extern void InstallMemoryCacheFlusher(MemoryCacheFlusherProc newFlusher);
|
||||
#endif
|
||||
|
||||
extern char *PR_GetDLLSearchPath(void);
|
||||
|
||||
#if defined(MAC_NSPR_STANDALONE)
|
||||
extern int strcmp(const char *str1, const char *str2);
|
||||
extern int strcasecmp(const char *str1, const char *str2);
|
||||
#endif
|
||||
|
||||
extern void MapFullToPartialMacFile(char *);
|
||||
extern char *MapPartialToFullMacFile(const char *);
|
||||
|
||||
extern void ResetTimer(void);
|
||||
extern void PR_PeriodicIdle(void);
|
||||
extern void ActivateTimer(void);
|
||||
extern void DeactivateTimer(void);
|
||||
extern void PR_InitMemory(void);
|
||||
|
||||
extern struct hostent *gethostbyaddr(const void *addr, int addrlen, int type);
|
||||
|
||||
extern short GetVolumeRefNumFromName(const char *);
|
||||
|
||||
#include <stdio.h> // Needed to get FILE typedef
|
||||
extern FILE *_OS_FOPEN(const char *filename, const char *mode);
|
||||
//
|
||||
// Macintosh only private parts.
|
||||
//
|
||||
|
||||
#define dprintTrace ";dprintf;doTrace"
|
||||
#define dprintNoTrace ";dprintf"
|
||||
extern void dprintf(const char *format, ...);
|
||||
|
||||
|
||||
// Entry into the memory system's cache flushing
|
||||
#if defined(MAC_NSPR_STANDALONE)
|
||||
extern PRUint8 CallCacheFlushers(size_t blockSize);
|
||||
#endif
|
||||
|
||||
#if defined(MAC_NSPR_STANDALONE)
|
||||
extern void* reallocSmaller(void* block, size_t newSize);
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
** PR_GetSystemInfo related definitions
|
||||
*/
|
||||
#define _PR_SI_SYSNAME "MacOS"
|
||||
#define _PR_SI_ARCHITECTURE "PowerPC"
|
||||
|
||||
/*
|
||||
* Memory-mapped files
|
||||
*/
|
||||
|
||||
struct _MDFileMap {
|
||||
PRInt8 unused;
|
||||
};
|
||||
|
||||
extern PRStatus _MD_CreateFileMap(struct PRFileMap *fmap, PRInt64 size);
|
||||
#define _MD_CREATE_FILE_MAP _MD_CreateFileMap
|
||||
|
||||
extern PRInt32 _MD_GetMemMapAlignment(void);
|
||||
#define _MD_GET_MEM_MAP_ALIGNMENT _MD_GetMemMapAlignment
|
||||
|
||||
extern void * _MD_MemMap(struct PRFileMap *fmap, PRInt64 offset,
|
||||
PRUint32 len);
|
||||
#define _MD_MEM_MAP _MD_MemMap
|
||||
|
||||
extern PRStatus _MD_MemUnmap(void *addr, PRUint32 size);
|
||||
#define _MD_MEM_UNMAP _MD_MemUnmap
|
||||
|
||||
extern PRStatus _MD_CloseFileMap(struct PRFileMap *fmap);
|
||||
#define _MD_CLOSE_FILE_MAP _MD_CloseFileMap
|
||||
|
||||
extern void SetLogFileTypeCreator(const char *logFile);
|
||||
extern int _MD_mac_get_nonblocking_connect_error(PRFileDesc* fd);
|
||||
|
||||
|
||||
/*
|
||||
* Critical section support
|
||||
*/
|
||||
|
||||
#define MAC_CRITICAL_REGIONS TARGET_CARBON
|
||||
|
||||
#if MAC_CRITICAL_REGIONS
|
||||
|
||||
extern void InitCriticalRegion();
|
||||
extern void TermCriticalRegion();
|
||||
|
||||
extern void EnterCritialRegion();
|
||||
extern void LeaveCritialRegion();
|
||||
|
||||
#define INIT_CRITICAL_REGION() InitCriticalRegion()
|
||||
#define TERM_CRITICAL_REGION() TermCriticalRegion()
|
||||
|
||||
#define ENTER_CRITICAL_REGION() EnterCritialRegion()
|
||||
#define LEAVE_CRITICAL_REGION() LeaveCritialRegion()
|
||||
|
||||
#else
|
||||
|
||||
#define INIT_CRITICAL_REGION()
|
||||
#define TERM_CRITICAL_REGION()
|
||||
|
||||
#define ENTER_CRITICAL_REGION()
|
||||
#define LEAVE_CRITICAL_REGION()
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* CPU Idle support
|
||||
*/
|
||||
|
||||
extern void InitIdleSemaphore();
|
||||
extern void TermIdleSemaphore();
|
||||
|
||||
extern void WaitOnIdleSemaphore();
|
||||
extern void SignalIdleSemaphore();
|
||||
|
||||
|
||||
/*
|
||||
* Atomic operations
|
||||
*/
|
||||
#ifdef _PR_HAVE_ATOMIC_OPS
|
||||
|
||||
extern PRInt32 _MD_AtomicSet(PRInt32 *val, PRInt32 newval);
|
||||
|
||||
#define _MD_INIT_ATOMIC()
|
||||
#define _MD_ATOMIC_INCREMENT(val) OTAtomicAdd32(1, (SInt32 *)val)
|
||||
#define _MD_ATOMIC_ADD(ptr, val) OTAtomicAdd32(val, (SInt32 *)ptr)
|
||||
#define _MD_ATOMIC_DECREMENT(val) OTAtomicAdd32(-1, (SInt32 *)val)
|
||||
#define _MD_ATOMIC_SET(val, newval) _MD_AtomicSet(val, newval)
|
||||
|
||||
#endif /* _PR_HAVE_ATOMIC_OPS */
|
||||
|
||||
|
||||
#endif /* prmacos_h___ */
|
||||
230
Src/nprt_plugin/gecko/1.8/win/include/md/_ncr.h
Normal file
230
Src/nprt_plugin/gecko/1.8/win/include/md/_ncr.h
Normal file
@@ -0,0 +1,230 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Portable Runtime (NSPR).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998-2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nspr_unixware_defs_h___
|
||||
#define nspr_unixware_defs_h___
|
||||
|
||||
/*
|
||||
* Internal configuration macros
|
||||
*/
|
||||
|
||||
#define PR_LINKER_ARCH "ncr"
|
||||
#define _PR_SI_SYSNAME "NCR"
|
||||
#define _PR_SI_ARCHITECTURE "x86"
|
||||
#define PR_DLL_SUFFIX ".so"
|
||||
|
||||
#define _PR_VMBASE 0x30000000
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
#define _MD_DEFAULT_STACK_SIZE 65536L
|
||||
#define _MD_MMAP_FLAGS MAP_PRIVATE
|
||||
|
||||
#define HAVE_DLL
|
||||
#define USE_DLFCN
|
||||
#define _PR_RECV_BROKEN /* recv doesn't work on Unix Domain Sockets */
|
||||
|
||||
#if !defined (HAVE_STRERROR)
|
||||
#define HAVE_STRERROR
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_WEAK_IO_SYMBOLS
|
||||
#define HAVE_WEAK_IO_SYMBOLS
|
||||
#endif
|
||||
|
||||
#define _PR_POLL_AVAILABLE
|
||||
#define _PR_USE_POLL
|
||||
#define _PR_NO_LARGE_FILES
|
||||
|
||||
#undef HAVE_STACK_GROWING_UP
|
||||
#define HAVE_NETCONFIG
|
||||
#define NEED_STRFTIME_LOCK
|
||||
#define NEED_TIME_R
|
||||
#define NEED_LOCALTIME_R
|
||||
#define NEED_GMTIME_R
|
||||
#define NEED_ASCTIME_R
|
||||
#define NEED_STRTOK_R
|
||||
#define NEED_CTIME_R
|
||||
#define _PR_NEED_STRCASECMP
|
||||
|
||||
#define USE_SETJMP
|
||||
|
||||
#include <setjmp.h>
|
||||
|
||||
#define _SETJMP setjmp
|
||||
#define _LONGJMP longjmp
|
||||
#define _PR_CONTEXT_TYPE jmp_buf
|
||||
#define _MD_GET_SP(_t) (_t)->md.context[4]
|
||||
#define _PR_NUM_GCREGS _JBLEN
|
||||
|
||||
#define CONTEXT(_th) ((_th)->md.context)
|
||||
|
||||
/*
|
||||
** Initialize the thread context preparing it to execute _main.
|
||||
*/
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
{ \
|
||||
*status = PR_TRUE; \
|
||||
if(_SETJMP(CONTEXT(_thread))) (*_main)(); \
|
||||
_MD_GET_SP(_thread) = (int) ((_sp) - 128); \
|
||||
}
|
||||
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
if (!_SETJMP(CONTEXT(_thread))) { \
|
||||
(_thread)->md.errcode = errno; \
|
||||
_PR_Schedule(); \
|
||||
}
|
||||
|
||||
/*
|
||||
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
|
||||
*/
|
||||
#define _MD_RESTORE_CONTEXT(_thread) \
|
||||
{ \
|
||||
errno = (_thread)->md.errcode; \
|
||||
_MD_SET_CURRENT_THREAD(_thread); \
|
||||
_LONGJMP(CONTEXT(_thread), 1); \
|
||||
}
|
||||
|
||||
/* Machine-dependent (MD) data structures.
|
||||
* Don't use SVR4 native threads (yet).
|
||||
*/
|
||||
|
||||
struct _MDThread {
|
||||
_PR_CONTEXT_TYPE context;
|
||||
int id;
|
||||
int errcode;
|
||||
};
|
||||
|
||||
struct _MDThreadStack {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDLock {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSemaphore {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDCVar {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSegment {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
/*
|
||||
* md-specific cpu structure field
|
||||
*/
|
||||
#define _PR_MD_MAX_OSFD FD_SETSIZE
|
||||
|
||||
struct _MDCPU_Unix {
|
||||
PRCList ioQ;
|
||||
PRUint32 ioq_timeout;
|
||||
PRInt32 ioq_max_osfd;
|
||||
PRInt32 ioq_osfd_cnt;
|
||||
#ifndef _PR_USE_POLL
|
||||
fd_set fd_read_set, fd_write_set, fd_exception_set;
|
||||
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
|
||||
fd_exception_cnt[_PR_MD_MAX_OSFD];
|
||||
#else
|
||||
struct pollfd *ioq_pollfds;
|
||||
int ioq_pollfds_size;
|
||||
#endif /* _PR_USE_POLL */
|
||||
};
|
||||
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
|
||||
struct _MDCPU {
|
||||
struct _MDCPU_Unix md_unix;
|
||||
};
|
||||
|
||||
#define _MD_INIT_LOCKS()
|
||||
#define _MD_NEW_LOCK(lock) PR_SUCCESS
|
||||
#define _MD_FREE_LOCK(lock)
|
||||
#define _MD_LOCK(lock)
|
||||
#define _MD_UNLOCK(lock)
|
||||
#define _MD_INIT_IO()
|
||||
#define _MD_IOQ_LOCK()
|
||||
#define _MD_IOQ_UNLOCK()
|
||||
|
||||
/*
|
||||
* The following are copied from _sunos.h, _aix.h. This means
|
||||
* some of them should probably be moved into _unixos.h. But
|
||||
* _irix.h seems to be quite different in regard to these macros.
|
||||
*/
|
||||
#define _MD_GET_INTERVAL _PR_UNIX_GetInterval
|
||||
#define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond
|
||||
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
|
||||
#define _MD_INIT_THREAD _MD_InitializeThread
|
||||
#define _MD_EXIT_THREAD(thread)
|
||||
#define _MD_SUSPEND_THREAD(thread)
|
||||
#define _MD_RESUME_THREAD(thread)
|
||||
#define _MD_CLEAN_THREAD(_thread)
|
||||
|
||||
/*
|
||||
* We wrapped the select() call. _MD_SELECT refers to the built-in,
|
||||
* unwrapped version.
|
||||
*/
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/select.h>
|
||||
extern int _select(int nfds, fd_set *readfds, fd_set *writefds,
|
||||
fd_set *execptfds, struct timeval *timeout);
|
||||
#define _MD_SELECT _select
|
||||
|
||||
#define _MD_POLL _poll
|
||||
extern int _poll(struct pollfd *fds, unsigned long nfds, int timeout);
|
||||
|
||||
#endif /* nspr_ncr_defs_h */
|
||||
196
Src/nprt_plugin/gecko/1.8/win/include/md/_nec.h
Normal file
196
Src/nprt_plugin/gecko/1.8/win/include/md/_nec.h
Normal file
@@ -0,0 +1,196 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Portable Runtime (NSPR).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998-2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nspr_nec_defs_h___
|
||||
#define nspr_nec_defs_h___
|
||||
|
||||
/*
|
||||
* Internal configuration macros
|
||||
*/
|
||||
|
||||
#define PR_LINKER_ARCH "nec"
|
||||
#define _PR_SI_SYSNAME "NEC"
|
||||
#define _PR_SI_ARCHITECTURE "mips"
|
||||
#define PR_DLL_SUFFIX ".so"
|
||||
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
#define _MD_DEFAULT_STACK_SIZE 65536L
|
||||
#define _MD_MMAP_FLAGS MAP_PRIVATE
|
||||
|
||||
#undef HAVE_STACK_GROWING_UP
|
||||
#define HAVE_DLL
|
||||
#define USE_DLFCN
|
||||
#define NEED_TIME_R
|
||||
#define NEED_STRFTIME_LOCK
|
||||
#define _PR_POLL_AVAILABLE
|
||||
#define _PR_USE_POLL
|
||||
#define _PR_NO_LARGE_FILES
|
||||
#define _PR_STAT_HAS_ST_ATIM_UNION
|
||||
|
||||
#include <ucontext.h>
|
||||
#include <sys/regset.h>
|
||||
|
||||
#define PR_NUM_GCREGS NGREG
|
||||
#define PR_CONTEXT_TYPE ucontext_t
|
||||
|
||||
#define CONTEXT(_thread) (&(_thread)->md.context)
|
||||
|
||||
#define _MD_GET_SP(_t) (_t)->md.context.uc_mcontext.gregs[CXT_SP]
|
||||
|
||||
/*
|
||||
** Initialize the thread context preparing it to execute "e(o,a)"
|
||||
*/
|
||||
#define _MD_INIT_CONTEXT(thread, _sp, _main, status) \
|
||||
{ \
|
||||
*status = PR_TRUE; \
|
||||
getcontext(CONTEXT(thread)); \
|
||||
CONTEXT(thread)->uc_stack.ss_sp = (char*) (thread)->stack->stackBottom; \
|
||||
CONTEXT(thread)->uc_stack.ss_size = (thread)->stack->stackSize; \
|
||||
_MD_GET_SP(thread) = (greg_t) _sp - 64; \
|
||||
makecontext(CONTEXT(thread), _main, 0); \
|
||||
}
|
||||
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
if (!getcontext(CONTEXT(_thread))) { \
|
||||
(_thread)->md.errcode = errno; \
|
||||
_PR_Schedule(); \
|
||||
}
|
||||
|
||||
/*
|
||||
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
|
||||
*/
|
||||
#define _MD_RESTORE_CONTEXT(_thread) \
|
||||
{ \
|
||||
ucontext_t *uc = CONTEXT(_thread); \
|
||||
uc->uc_mcontext.gregs[CXT_V0] = 1; \
|
||||
uc->uc_mcontext.gregs[CXT_A3] = 0; \
|
||||
errno = (_thread)->md.errcode; \
|
||||
_MD_SET_CURRENT_THREAD(_thread); \
|
||||
setcontext(uc); \
|
||||
}
|
||||
|
||||
/* Machine-dependent (MD) data structures */
|
||||
|
||||
struct _MDThread {
|
||||
PR_CONTEXT_TYPE context;
|
||||
int id;
|
||||
int errcode;
|
||||
};
|
||||
|
||||
struct _MDThreadStack {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDLock {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSemaphore {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDCVar {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSegment {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
/*
|
||||
* md-specific cpu structure field
|
||||
*/
|
||||
#define _PR_MD_MAX_OSFD FD_SETSIZE
|
||||
|
||||
struct _MDCPU_Unix {
|
||||
PRCList ioQ;
|
||||
PRUint32 ioq_timeout;
|
||||
PRInt32 ioq_max_osfd;
|
||||
PRInt32 ioq_osfd_cnt;
|
||||
#ifndef _PR_USE_POLL
|
||||
fd_set fd_read_set, fd_write_set, fd_exception_set;
|
||||
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
|
||||
fd_exception_cnt[_PR_MD_MAX_OSFD];
|
||||
#else
|
||||
struct pollfd *ioq_pollfds;
|
||||
int ioq_pollfds_size;
|
||||
#endif /* _PR_USE_POLL */
|
||||
};
|
||||
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
|
||||
struct _MDCPU {
|
||||
struct _MDCPU_Unix md_unix;
|
||||
};
|
||||
|
||||
#define _MD_INIT_LOCKS()
|
||||
#define _MD_NEW_LOCK(lock) PR_SUCCESS
|
||||
#define _MD_FREE_LOCK(lock)
|
||||
#define _MD_LOCK(lock)
|
||||
#define _MD_UNLOCK(lock)
|
||||
#define _MD_INIT_IO()
|
||||
#define _MD_IOQ_LOCK()
|
||||
#define _MD_IOQ_UNLOCK()
|
||||
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
|
||||
#define _MD_INIT_THREAD _MD_InitializeThread
|
||||
#define _MD_EXIT_THREAD(thread)
|
||||
#define _MD_CLEAN_THREAD(_thread)
|
||||
|
||||
#define _MD_SELECT _select
|
||||
#define _MD_POLL _poll
|
||||
|
||||
#define _MD_GET_INTERVAL _PR_UNIX_GetInterval
|
||||
#define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond
|
||||
|
||||
#endif /* nspr_nec_defs_h___ */
|
||||
322
Src/nprt_plugin/gecko/1.8/win/include/md/_netbsd.h
Normal file
322
Src/nprt_plugin/gecko/1.8/win/include/md/_netbsd.h
Normal file
@@ -0,0 +1,322 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* 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 Portable Runtime (NSPR).
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998-2000 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.
|
||||
*/
|
||||
|
||||
#ifndef nspr_netbsd_defs_h___
|
||||
#define nspr_netbsd_defs_h___
|
||||
|
||||
#include <sys/syscall.h>
|
||||
#include <sys/param.h> /* for __NetBSD_Version__ */
|
||||
|
||||
#define PR_LINKER_ARCH "netbsd"
|
||||
#define _PR_SI_SYSNAME "NetBSD"
|
||||
#if defined(__i386__)
|
||||
#define _PR_SI_ARCHITECTURE "x86"
|
||||
#elif defined(__alpha__)
|
||||
#define _PR_SI_ARCHITECTURE "alpha"
|
||||
#elif defined(__m68k__)
|
||||
#define _PR_SI_ARCHITECTURE "m68k"
|
||||
#elif defined(__powerpc__)
|
||||
#define _PR_SI_ARCHITECTURE "powerpc"
|
||||
#elif defined(__sparc_v9__)
|
||||
#define _PR_SI_ARCHITECTURE "sparc64"
|
||||
#elif defined(__sparc__)
|
||||
#define _PR_SI_ARCHITECTURE "sparc"
|
||||
#elif defined(__mips__)
|
||||
#define _PR_SI_ARCHITECTURE "mips"
|
||||
#elif defined(__arm32__) || defined(__arm__) || defined(__armel__) \
|
||||
|| defined(__armeb__)
|
||||
#define _PR_SI_ARCHITECTURE "arm"
|
||||
#endif
|
||||
|
||||
#if defined(__ELF__)
|
||||
#define PR_DLL_SUFFIX ".so"
|
||||
#else
|
||||
#define PR_DLL_SUFFIX ".so.1.0"
|
||||
#endif
|
||||
|
||||
#define _PR_VMBASE 0x30000000
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
#define _MD_DEFAULT_STACK_SIZE 65536L
|
||||
#define _MD_MMAP_FLAGS MAP_PRIVATE
|
||||
|
||||
#undef HAVE_STACK_GROWING_UP
|
||||
#define HAVE_DLL
|
||||
#define USE_DLFCN
|
||||
#define _PR_HAVE_SOCKADDR_LEN
|
||||
#define _PR_NO_LARGE_FILES
|
||||
#define _PR_STAT_HAS_ST_ATIMESPEC
|
||||
#define _PR_POLL_AVAILABLE
|
||||
#define _PR_USE_POLL
|
||||
#define _PR_HAVE_SYSV_SEMAPHORES
|
||||
#define PR_HAVE_SYSV_NAMED_SHARED_MEMORY
|
||||
|
||||
#if __NetBSD_Version__ >= 105000000
|
||||
#define _PR_INET6
|
||||
#define _PR_HAVE_INET_NTOP
|
||||
#define _PR_HAVE_GETHOSTBYNAME2
|
||||
#define _PR_HAVE_GETADDRINFO
|
||||
#define _PR_INET6_PROBE
|
||||
#endif
|
||||
|
||||
#if __NetBSD_Version__ >= 106370000
|
||||
/* NetBSD 1.6ZK */
|
||||
#define _PR_HAVE_GETPROTO_R
|
||||
#define _PR_HAVE_GETPROTO_R_INT
|
||||
#endif
|
||||
|
||||
#define USE_SETJMP
|
||||
|
||||
#ifndef _PR_PTHREADS
|
||||
#include <setjmp.h>
|
||||
|
||||
#define PR_CONTEXT_TYPE sigjmp_buf
|
||||
|
||||
#define CONTEXT(_th) ((_th)->md.context)
|
||||
|
||||
/*
|
||||
** Initialize a thread context to run "_main()" when started
|
||||
*/
|
||||
#ifdef __i386__
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
{ \
|
||||
sigsetjmp(CONTEXT(_thread), 1); \
|
||||
CONTEXT(_thread)[2] = (unsigned char*) ((_sp) - 128); \
|
||||
CONTEXT(_thread)[0] = (int) _main; \
|
||||
*status = PR_TRUE; \
|
||||
}
|
||||
#define _MD_GET_SP(_thread) CONTEXT(_thread)[2]
|
||||
#endif
|
||||
#ifdef __sparc_v9__
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
{ \
|
||||
sigsetjmp(CONTEXT(_thread), 1); \
|
||||
CONTEXT(_thread)[1] = (unsigned char*) ((_sp) - 176 - 0x7ff); \
|
||||
CONTEXT(_thread)[2] = (long) _main; \
|
||||
CONTEXT(_thread)[3] = (long) _main + 4; \
|
||||
*status = PR_TRUE; \
|
||||
}
|
||||
#define _MD_GET_SP(_thread) (CONTEXT(_thread)[2]+0x7ff)
|
||||
#elif defined(__sparc__)
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
{ \
|
||||
sigsetjmp(CONTEXT(_thread), 1); \
|
||||
CONTEXT(_thread)[2] = (unsigned char*) ((_sp) - 128); \
|
||||
CONTEXT(_thread)[3] = (int) _main; \
|
||||
CONTEXT(_thread)[4] = (int) _main + 4; \
|
||||
*status = PR_TRUE; \
|
||||
}
|
||||
#define _MD_GET_SP(_thread) CONTEXT(_thread)[2]
|
||||
#endif
|
||||
#ifdef __powerpc__
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
{ \
|
||||
sigsetjmp(CONTEXT(_thread), 1); \
|
||||
CONTEXT(_thread)[3] = (unsigned char*) ((_sp) - 128); \
|
||||
CONTEXT(_thread)[4] = (int) _main; \
|
||||
*status = PR_TRUE; \
|
||||
}
|
||||
#define _MD_GET_SP(_thread) CONTEXT(_thread)[3]
|
||||
#endif
|
||||
#ifdef __m68k__
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
{ \
|
||||
sigsetjmp(CONTEXT(_thread), 1); \
|
||||
CONTEXT(_thread)[2] = (unsigned char*) ((_sp) - 128); \
|
||||
CONTEXT(_thread)[5] = (int) _main; \
|
||||
*status = PR_TRUE; \
|
||||
}
|
||||
#define _MD_GET_SP(_thread) CONTEXT(_thread)[2]
|
||||
#endif
|
||||
#ifdef __mips__
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
{ \
|
||||
sigsetjmp(CONTEXT(_thread), 1); \
|
||||
CONTEXT(_thread)[32] = (unsigned char*) ((_sp) - 128); \
|
||||
CONTEXT(_thread)[2] = (int) _main; \
|
||||
CONTEXT(_thread)[28] = (int) _main; \
|
||||
*status = PR_TRUE; \
|
||||
}
|
||||
#define _MD_GET_SP(_thread) CONTEXT(_thread)[32]
|
||||
#endif
|
||||
#if defined(__arm32__) || defined(__arm__) || defined(__armel__) \
|
||||
|| defined(__armeb__)
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
{ \
|
||||
sigsetjmp(CONTEXT(_thread), 1); \
|
||||
CONTEXT(_thread)[23] = (unsigned char*) ((_sp) - 128); \
|
||||
CONTEXT(_thread)[24] = (int) _main; \
|
||||
*status = PR_TRUE; \
|
||||
}
|
||||
#define _MD_GET_SP(_thread) CONTEXT(_thread)[23]
|
||||
#endif
|
||||
#ifdef __alpha__
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
{ \
|
||||
sigsetjmp(CONTEXT(_thread), 1); \
|
||||
CONTEXT(_thread)[34] = (unsigned char*) ((_sp) - 128); \
|
||||
CONTEXT(_thread)[2] = (long) _main; \
|
||||
CONTEXT(_thread)[30] = (long) _main; \
|
||||
CONTEXT(_thread)[31] = (long) _main; \
|
||||
*status = PR_TRUE; \
|
||||
}
|
||||
#define _MD_GET_SP(_thread) CONTEXT(_thread)[34]
|
||||
#endif
|
||||
#ifndef _MD_INIT_CONTEXT
|
||||
#error "Need to define _MD_INIT_CONTEXT for this platform"
|
||||
#endif
|
||||
|
||||
#define PR_NUM_GCREGS _JBLEN
|
||||
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
if (!sigsetjmp(CONTEXT(_thread), 1)) { \
|
||||
(_thread)->md.errcode = errno; \
|
||||
_PR_Schedule(); \
|
||||
}
|
||||
|
||||
/*
|
||||
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
|
||||
*/
|
||||
#define _MD_RESTORE_CONTEXT(_thread) \
|
||||
{ \
|
||||
errno = (_thread)->md.errcode; \
|
||||
_MD_SET_CURRENT_THREAD(_thread); \
|
||||
siglongjmp(CONTEXT(_thread), 1); \
|
||||
}
|
||||
|
||||
/* Machine-dependent (MD) data structures */
|
||||
|
||||
struct _MDThread {
|
||||
PR_CONTEXT_TYPE context;
|
||||
int id;
|
||||
int errcode;
|
||||
};
|
||||
|
||||
struct _MDThreadStack {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDLock {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSemaphore {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDCVar {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSegment {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
/*
|
||||
* md-specific cpu structure field
|
||||
*/
|
||||
#define _PR_MD_MAX_OSFD FD_SETSIZE
|
||||
|
||||
struct _MDCPU_Unix {
|
||||
PRCList ioQ;
|
||||
PRUint32 ioq_timeout;
|
||||
PRInt32 ioq_max_osfd;
|
||||
PRInt32 ioq_osfd_cnt;
|
||||
#ifndef _PR_USE_POLL
|
||||
fd_set fd_read_set, fd_write_set, fd_exception_set;
|
||||
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
|
||||
fd_exception_cnt[_PR_MD_MAX_OSFD];
|
||||
#else
|
||||
struct pollfd *ioq_pollfds;
|
||||
int ioq_pollfds_size;
|
||||
#endif /* _PR_USE_POLL */
|
||||
};
|
||||
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
|
||||
struct _MDCPU {
|
||||
struct _MDCPU_Unix md_unix;
|
||||
};
|
||||
|
||||
#define _MD_INIT_LOCKS()
|
||||
#define _MD_NEW_LOCK(lock) PR_SUCCESS
|
||||
#define _MD_FREE_LOCK(lock)
|
||||
#define _MD_LOCK(lock)
|
||||
#define _MD_UNLOCK(lock)
|
||||
#define _MD_INIT_IO()
|
||||
#define _MD_IOQ_LOCK()
|
||||
#define _MD_IOQ_UNLOCK()
|
||||
|
||||
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
|
||||
#define _MD_INIT_THREAD _MD_InitializeThread
|
||||
#define _MD_EXIT_THREAD(thread)
|
||||
#define _MD_SUSPEND_THREAD(thread) _MD_suspend_thread
|
||||
#define _MD_RESUME_THREAD(thread) _MD_resume_thread
|
||||
#define _MD_CLEAN_THREAD(_thread)
|
||||
|
||||
#endif /* ! _PR_PTHREADS */
|
||||
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
#define _MD_GET_INTERVAL _PR_UNIX_GetInterval
|
||||
#define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond
|
||||
|
||||
/*
|
||||
* We wrapped the select() call. _MD_SELECT refers to the built-in,
|
||||
* unwrapped version.
|
||||
*/
|
||||
#define _MD_SELECT(nfds,r,w,e,tv) syscall(SYS_select,nfds,r,w,e,tv)
|
||||
#if defined(_PR_POLL_AVAILABLE)
|
||||
#include <poll.h>
|
||||
#define _MD_POLL(fds,nfds,timeout) syscall(SYS_poll,fds,nfds,timeout)
|
||||
#endif
|
||||
|
||||
#if NetBSD1_3 == 1L
|
||||
typedef unsigned int nfds_t;
|
||||
#endif
|
||||
|
||||
#endif /* nspr_netbsd_defs_h___ */
|
||||
299
Src/nprt_plugin/gecko/1.8/win/include/md/_nextstep.h
Normal file
299
Src/nprt_plugin/gecko/1.8/win/include/md/_nextstep.h
Normal file
@@ -0,0 +1,299 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Portable Runtime (NSPR).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998-2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nspr_nextstep_defs_h___
|
||||
#define nspr_nextstep_defs_h___
|
||||
|
||||
#include "prthread.h"
|
||||
|
||||
#include <bsd/libc.h>
|
||||
#include <bsd/syscall.h>
|
||||
|
||||
/* syscall() is not declared in NEXTSTEP's syscall.h ...
|
||||
*/
|
||||
extern int syscall(int number, ...);
|
||||
|
||||
/*
|
||||
* Internal configuration macros
|
||||
*/
|
||||
|
||||
#define PR_LINKER_ARCH "nextstep"
|
||||
#define _PR_SI_SYSNAME "NEXTSTEP"
|
||||
#if defined(__sparc__)
|
||||
#define _PR_SI_ARCHITECTURE "sparc"
|
||||
#elif defined(__m68k__)
|
||||
#define _PR_SI_ARCHITECTURE "m68k"
|
||||
#elif defined(__i386__)
|
||||
#define _PR_SI_ARCHITECTURE "x86"
|
||||
#else
|
||||
error Unknown NEXTSTEP architecture
|
||||
#endif
|
||||
#define PR_DLL_SUFFIX ".so"
|
||||
|
||||
#define _PR_VMBASE 0x30000000
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
#define _MD_DEFAULT_STACK_SIZE 65536L
|
||||
#define _MD_MMAP_FLAGS MAP_PRIVATE
|
||||
|
||||
#undef HAVE_STACK_GROWING_UP
|
||||
|
||||
#define HAVE_WEAK_MALLOC_SYMBOLS
|
||||
|
||||
#define HAVE_DLL
|
||||
#define USE_MACH_DYLD
|
||||
#define _PR_STAT_HAS_ONLY_ST_ATIME
|
||||
#define _PR_NO_LARGE_FILES
|
||||
|
||||
#define USE_SETJMP
|
||||
|
||||
#ifndef _PR_PTHREADS
|
||||
|
||||
#include <setjmp.h>
|
||||
|
||||
#define PR_CONTEXT_TYPE jmp_buf
|
||||
|
||||
#define CONTEXT(_th) ((_th)->md.context)
|
||||
|
||||
/* balazs.pataki@sztaki.hu:
|
||||
** __sparc__ is checked
|
||||
** __m68k__ is checked
|
||||
** __i386__ is a guess (one of the two defines should work)
|
||||
*/
|
||||
#if defined(__sparc__)
|
||||
#define _MD_GET_SP(_th) (_th)->md.context[2]
|
||||
#elif defined(__m68k__)
|
||||
#define _MD_GET_SP(_th) (_th)->md.context[2]
|
||||
#elif defined(__i386__)
|
||||
/* One of this two must be OK ... try using sc_onstack
|
||||
*/
|
||||
#define _MD_GET_SP(_th) (((struct sigcontext *) (_th)->md.context)->sc_onstack)
|
||||
//#define _MD_GET_SP(_th) (_th)->md.context[0].sc_esp
|
||||
#else
|
||||
error Unknown NEXTSTEP architecture
|
||||
#endif
|
||||
|
||||
#define PR_NUM_GCREGS _JBLEN
|
||||
|
||||
/*
|
||||
** Initialize a thread context to run "_main()" when started
|
||||
*/
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
{ \
|
||||
*status = PR_TRUE; \
|
||||
if (setjmp(CONTEXT(_thread))) { \
|
||||
_main(); \
|
||||
} \
|
||||
_MD_GET_SP(_thread) = (int) ((_sp) - 64); \
|
||||
}
|
||||
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
if (!setjmp(CONTEXT(_thread))) { \
|
||||
(_thread)->md.errcode = errno; \
|
||||
_PR_Schedule(); \
|
||||
}
|
||||
|
||||
/*
|
||||
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
|
||||
*/
|
||||
#define _MD_RESTORE_CONTEXT(_thread) \
|
||||
{ \
|
||||
errno = (_thread)->md.errcode; \
|
||||
_MD_SET_CURRENT_THREAD(_thread); \
|
||||
longjmp(CONTEXT(_thread), 1); \
|
||||
}
|
||||
|
||||
/* Machine-dependent (MD) data structures */
|
||||
|
||||
struct _MDThread {
|
||||
PR_CONTEXT_TYPE context;
|
||||
int id;
|
||||
int errcode;
|
||||
};
|
||||
|
||||
struct _MDThreadStack {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDLock {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSemaphore {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDCVar {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSegment {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
/*
|
||||
* md-specific cpu structure field
|
||||
*/
|
||||
#define _PR_MD_MAX_OSFD FD_SETSIZE
|
||||
|
||||
struct _MDCPU_Unix {
|
||||
PRCList ioQ;
|
||||
PRUint32 ioq_timeout;
|
||||
PRInt32 ioq_max_osfd;
|
||||
PRInt32 ioq_osfd_cnt;
|
||||
#ifndef _PR_USE_POLL
|
||||
fd_set fd_read_set, fd_write_set, fd_exception_set;
|
||||
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
|
||||
fd_exception_cnt[_PR_MD_MAX_OSFD];
|
||||
#else
|
||||
struct pollfd *ioq_pollfds;
|
||||
int ioq_pollfds_size;
|
||||
#endif /* _PR_USE_POLL */
|
||||
};
|
||||
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
|
||||
struct _MDCPU {
|
||||
struct _MDCPU_Unix md_unix;
|
||||
};
|
||||
|
||||
#define _MD_INIT_LOCKS()
|
||||
#define _MD_NEW_LOCK(lock) PR_SUCCESS
|
||||
#define _MD_FREE_LOCK(lock)
|
||||
#define _MD_LOCK(lock)
|
||||
#define _MD_UNLOCK(lock)
|
||||
#define _MD_INIT_IO()
|
||||
#define _MD_IOQ_LOCK()
|
||||
#define _MD_IOQ_UNLOCK()
|
||||
|
||||
extern PRStatus _MD_InitializeThread(PRThread *thread);
|
||||
|
||||
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
|
||||
#define _MD_INIT_THREAD _MD_InitializeThread
|
||||
#define _MD_EXIT_THREAD(thread)
|
||||
#define _MD_SUSPEND_THREAD(thread) _MD_suspend_thread
|
||||
#define _MD_RESUME_THREAD(thread) _MD_resume_thread
|
||||
#define _MD_CLEAN_THREAD(_thread)
|
||||
|
||||
extern PRStatus _MD_CREATE_THREAD(
|
||||
PRThread *thread,
|
||||
void (*start) (void *),
|
||||
PRThreadPriority priority,
|
||||
PRThreadScope scope,
|
||||
PRThreadState state,
|
||||
PRUint32 stackSize);
|
||||
extern void _MD_SET_PRIORITY(struct _MDThread *thread, PRUintn newPri);
|
||||
extern PRStatus _MD_WAIT(PRThread *, PRIntervalTime timeout);
|
||||
extern PRStatus _MD_WAKEUP_WAITER(PRThread *);
|
||||
extern void _MD_YIELD(void);
|
||||
|
||||
#endif /* ! _PR_PTHREADS */
|
||||
|
||||
extern void _MD_EarlyInit(void);
|
||||
extern PRIntervalTime _PR_UNIX_GetInterval(void);
|
||||
extern PRIntervalTime _PR_UNIX_TicksPerSecond(void);
|
||||
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
#define _MD_GET_INTERVAL _PR_UNIX_GetInterval
|
||||
#define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond
|
||||
|
||||
/*
|
||||
* We wrapped the select() call. _MD_SELECT refers to the built-in,
|
||||
* unwrapped version.
|
||||
*/
|
||||
#define _MD_SELECT(nfds,r,w,e,tv) syscall(SYS_select,nfds,r,w,e,tv)
|
||||
|
||||
/* For writev() */
|
||||
#include <sys/uio.h>
|
||||
|
||||
/* signal.h */
|
||||
/* balazs.pataki@sztaki.hu: this is stolen from sunos4.h. The things is that
|
||||
** NEXTSTEP doesn't support these flags for `struct sigaction's sa_flags, so
|
||||
** I have to fake them ...
|
||||
*/
|
||||
#define SA_RESTART 0
|
||||
|
||||
/* mmap */
|
||||
/* balazs.pataki@sztaki.hu: NEXTSTEP doesn't have mmap, at least not
|
||||
** publically. We have sys/mman.h, but it doesn't declare mmap(), and
|
||||
** PROT_NONE is also missing. syscall.h has entries for mmap, munmap, and
|
||||
** mprotect so I wrap these in nextstep.c as mmap(), munmap() and mprotect()
|
||||
** and pray for it to work.
|
||||
**
|
||||
*/
|
||||
caddr_t mmap(caddr_t addr, size_t len, int prot, int flags,
|
||||
int fildes, off_t off);
|
||||
int munmap(caddr_t addr, size_t len);
|
||||
int mprotect(caddr_t addr, size_t len, int prot);
|
||||
|
||||
/* my_mmap() is implemented in nextstep.c and is based on map_fd() of mach.
|
||||
*/
|
||||
caddr_t my_mmap(caddr_t addr, size_t len, int prot, int flags,
|
||||
int fildes, off_t off);
|
||||
int my_munmap(caddr_t addr, size_t len);
|
||||
|
||||
|
||||
/* string.h
|
||||
*/
|
||||
/* balazs.pataki@sztaki.hu: this is missing so implemenetd in nextstep.c ...
|
||||
*/
|
||||
char *strdup(const char *s1);
|
||||
|
||||
/* unistd.h
|
||||
*/
|
||||
/* balazs.pataki@sztaki.hu: these functions are hidden, though correctly
|
||||
** implemented in NEXTSTEP. Here I give the declaration for them to be used
|
||||
** by prmalloc.c, and I have a wrapped syscall() version of them in nextstep.c
|
||||
*/
|
||||
int brk(void *endds);
|
||||
void *sbrk(int incr);
|
||||
|
||||
#endif /* nspr_nextstep_defs_h___ */
|
||||
283
Src/nprt_plugin/gecko/1.8/win/include/md/_nspr_pthread.h
Normal file
283
Src/nprt_plugin/gecko/1.8/win/include/md/_nspr_pthread.h
Normal file
@@ -0,0 +1,283 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Portable Runtime (NSPR).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998-2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nspr_pthread_defs_h___
|
||||
#define nspr_pthread_defs_h___
|
||||
|
||||
#include <pthread.h>
|
||||
#include "prthread.h"
|
||||
|
||||
#if defined(PTHREADS_USER)
|
||||
/*
|
||||
** Thread Local Storage
|
||||
*/
|
||||
extern pthread_key_t current_thread_key;
|
||||
extern pthread_key_t current_cpu_key;
|
||||
extern pthread_key_t last_thread_key;
|
||||
extern pthread_key_t intsoff_key;
|
||||
|
||||
#define _MD_CURRENT_THREAD() \
|
||||
((struct PRThread *) pthread_getspecific(current_thread_key))
|
||||
#define _MD_CURRENT_CPU() \
|
||||
((struct _PRCPU *) pthread_getspecific(current_cpu_key))
|
||||
#define _MD_LAST_THREAD() \
|
||||
((struct PRThread *) pthread_getspecific(last_thread_key))
|
||||
|
||||
#define _MD_SET_CURRENT_THREAD(newval) \
|
||||
pthread_setspecific(current_thread_key, (void *)newval)
|
||||
|
||||
#define _MD_SET_CURRENT_CPU(newval) \
|
||||
pthread_setspecific(current_cpu_key, (void *)newval)
|
||||
|
||||
#define _MD_SET_LAST_THREAD(newval) \
|
||||
pthread_setspecific(last_thread_key, (void *)newval)
|
||||
|
||||
#define _MD_SET_INTSOFF(_val)
|
||||
#define _MD_GET_INTSOFF() 1
|
||||
|
||||
/*
|
||||
** Initialize the thread context preparing it to execute _main.
|
||||
*/
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
PR_BEGIN_MACRO \
|
||||
*status = PR_TRUE; \
|
||||
if (SAVE_CONTEXT(_thread)) { \
|
||||
(*_main)(); \
|
||||
} \
|
||||
_MD_SET_THR_SP(_thread, _sp); \
|
||||
_thread->no_sched = 0; \
|
||||
PR_END_MACRO
|
||||
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
PR_BEGIN_MACRO \
|
||||
PR_ASSERT(_thread->no_sched); \
|
||||
if (!SAVE_CONTEXT(_thread)) { \
|
||||
(_thread)->md.errcode = errno; \
|
||||
_MD_SET_LAST_THREAD(_thread); \
|
||||
_PR_Schedule(); \
|
||||
} else { \
|
||||
(_MD_LAST_THREAD())->no_sched = 0; \
|
||||
} \
|
||||
PR_END_MACRO
|
||||
|
||||
/*
|
||||
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
|
||||
*/
|
||||
#define _MD_RESTORE_CONTEXT(_thread) \
|
||||
PR_BEGIN_MACRO \
|
||||
errno = (_thread)->md.errcode; \
|
||||
_MD_SET_CURRENT_THREAD(_thread); \
|
||||
_thread->no_sched = 1; \
|
||||
GOTO_CONTEXT(_thread); \
|
||||
PR_END_MACRO
|
||||
|
||||
|
||||
/* Machine-dependent (MD) data structures */
|
||||
|
||||
struct _MDThread {
|
||||
jmp_buf jb;
|
||||
int id;
|
||||
int errcode;
|
||||
pthread_t pthread;
|
||||
pthread_mutex_t pthread_mutex;
|
||||
pthread_cond_t pthread_cond;
|
||||
int wait;
|
||||
};
|
||||
|
||||
struct _MDThreadStack {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDLock {
|
||||
pthread_mutex_t mutex;
|
||||
};
|
||||
|
||||
struct _MDSemaphore {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDCVar {
|
||||
pthread_mutex_t mutex;
|
||||
};
|
||||
|
||||
struct _MDSegment {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
/*
|
||||
* md-specific cpu structure field
|
||||
*/
|
||||
#define _PR_MD_MAX_OSFD FD_SETSIZE
|
||||
|
||||
struct _MDCPU_Unix {
|
||||
PRCList ioQ;
|
||||
PRUint32 ioq_timeout;
|
||||
PRInt32 ioq_max_osfd;
|
||||
PRInt32 ioq_osfd_cnt;
|
||||
#ifndef _PR_USE_POLL
|
||||
fd_set fd_read_set, fd_write_set, fd_exception_set;
|
||||
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
|
||||
fd_exception_cnt[_PR_MD_MAX_OSFD];
|
||||
#else
|
||||
struct pollfd *ioq_pollfds;
|
||||
int ioq_pollfds_size;
|
||||
#endif /* _PR_USE_POLL */
|
||||
};
|
||||
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
|
||||
struct _MDCPU {
|
||||
jmp_buf jb;
|
||||
pthread_t pthread;
|
||||
struct _MDCPU_Unix md_unix;
|
||||
};
|
||||
|
||||
/*
|
||||
#define _MD_NEW_LOCK(lock) PR_SUCCESS
|
||||
#define _MD_FREE_LOCK(lock)
|
||||
#define _MD_LOCK(lock)
|
||||
#define _MD_UNLOCK(lock)
|
||||
*/
|
||||
|
||||
extern pthread_mutex_t _pr_heapLock;
|
||||
|
||||
#define _PR_LOCK(lock) pthread_mutex_lock(lock)
|
||||
|
||||
#define _PR_UNLOCK(lock) pthread_mutex_unlock(lock)
|
||||
|
||||
|
||||
#define _PR_LOCK_HEAP() { \
|
||||
if (_pr_primordialCPU) { \
|
||||
_PR_LOCK(_pr_heapLock); \
|
||||
}
|
||||
|
||||
#define _PR_UNLOCK_HEAP() if (_pr_primordialCPU) { \
|
||||
_PR_UNLOCK(_pr_heapLock); \
|
||||
} \
|
||||
}
|
||||
|
||||
NSPR_API(PRStatus) _MD_NEW_LOCK(struct _MDLock *md);
|
||||
NSPR_API(void) _MD_FREE_LOCK(struct _MDLock *lockp);
|
||||
|
||||
#define _MD_LOCK(_lockp) _PR_LOCK(&(_lockp)->mutex)
|
||||
#define _MD_UNLOCK(_lockp) _PR_UNLOCK(&(_lockp)->mutex)
|
||||
|
||||
#define _MD_INIT_IO()
|
||||
#define _MD_IOQ_LOCK()
|
||||
#define _MD_IOQ_UNLOCK()
|
||||
#define _MD_CHECK_FOR_EXIT()
|
||||
|
||||
NSPR_API(PRStatus) _MD_InitThread(struct PRThread *thread);
|
||||
#define _MD_INIT_THREAD _MD_InitThread
|
||||
#define _MD_INIT_ATTACHED_THREAD _MD_InitThread
|
||||
|
||||
NSPR_API(void) _MD_ExitThread(struct PRThread *thread);
|
||||
#define _MD_EXIT_THREAD _MD_ExitThread
|
||||
|
||||
NSPR_API(void) _MD_SuspendThread(struct PRThread *thread);
|
||||
#define _MD_SUSPEND_THREAD _MD_SuspendThread
|
||||
|
||||
NSPR_API(void) _MD_ResumeThread(struct PRThread *thread);
|
||||
#define _MD_RESUME_THREAD _MD_ResumeThread
|
||||
|
||||
NSPR_API(void) _MD_SuspendCPU(struct _PRCPU *thread);
|
||||
#define _MD_SUSPEND_CPU _MD_SuspendCPU
|
||||
|
||||
NSPR_API(void) _MD_ResumeCPU(struct _PRCPU *thread);
|
||||
#define _MD_RESUME_CPU _MD_ResumeCPU
|
||||
|
||||
#define _MD_BEGIN_SUSPEND_ALL()
|
||||
#define _MD_END_SUSPEND_ALL()
|
||||
#define _MD_BEGIN_RESUME_ALL()
|
||||
#define _MD_END_RESUME_ALL()
|
||||
|
||||
NSPR_API(void) _MD_EarlyInit(void);
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
|
||||
NSPR_API(void) _MD_InitLocks(void);
|
||||
#define _MD_INIT_LOCKS _MD_InitLocks
|
||||
|
||||
NSPR_API(void) _MD_CleanThread(struct PRThread *thread);
|
||||
#define _MD_CLEAN_THREAD _MD_CleanThread
|
||||
|
||||
NSPR_API(PRStatus) _MD_CreateThread(
|
||||
struct PRThread *thread,
|
||||
void (*start) (void *),
|
||||
PRThreadPriority priority,
|
||||
PRThreadScope scope,
|
||||
PRThreadState state,
|
||||
PRUint32 stackSize);
|
||||
#define _MD_CREATE_THREAD _MD_CreateThread
|
||||
|
||||
extern void _MD_CleanupBeforeExit(void);
|
||||
#define _MD_CLEANUP_BEFORE_EXIT _MD_CleanupBeforeExit
|
||||
|
||||
NSPR_API(void) _MD_InitRunningCPU(struct _PRCPU *cpu);
|
||||
#define _MD_INIT_RUNNING_CPU _MD_InitRunningCPU
|
||||
|
||||
/* The _PR_MD_WAIT_LOCK and _PR_MD_WAKEUP_WAITER functions put to sleep and
|
||||
* awaken a thread which is waiting on a lock or cvar.
|
||||
*/
|
||||
NSPR_API(PRStatus) _MD_wait(struct PRThread *, PRIntervalTime timeout);
|
||||
#define _MD_WAIT _MD_wait
|
||||
|
||||
NSPR_API(PRStatus) _MD_WakeupWaiter(struct PRThread *);
|
||||
#define _MD_WAKEUP_WAITER _MD_WakeupWaiter
|
||||
|
||||
NSPR_API(void) _MD_SetPriority(struct _MDThread *thread,
|
||||
PRThreadPriority newPri);
|
||||
#define _MD_SET_PRIORITY _MD_SetPriority
|
||||
|
||||
#endif /* PTHREADS_USER */
|
||||
|
||||
#endif /* nspr_pthread_defs_h___ */
|
||||
221
Src/nprt_plugin/gecko/1.8/win/include/md/_nto.h
Normal file
221
Src/nprt_plugin/gecko/1.8/win/include/md/_nto.h
Normal file
@@ -0,0 +1,221 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Portable Runtime (NSPR).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1999-2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nspr_nto_defs_h___
|
||||
#define nspr_nto_defs_h___
|
||||
|
||||
/*
|
||||
** Internal configuration macros
|
||||
*/
|
||||
#define PR_LINKER_ARCH "nto"
|
||||
#define _PR_SI_SYSNAME "NTO"
|
||||
#define _PR_SI_ARCHITECTURE "x86"
|
||||
#define PR_DLL_SUFFIX ".so"
|
||||
|
||||
#define _PR_VMBASE 0x30000000
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
#define _MD_DEFAULT_STACK_SIZE 65536L
|
||||
#define _MD_MINIMUM_STACK_SIZE 131072L
|
||||
#define _MD_MMAP_FLAGS MAP_PRIVATE
|
||||
|
||||
#ifndef HAVE_WEAK_IO_SYMBOLS
|
||||
#define HAVE_WEAK_IO_SYMBOLS
|
||||
#endif
|
||||
|
||||
#undef _PR_POLL_AVAILABLE
|
||||
#undef _PR_USE_POLL
|
||||
#define _PR_HAVE_SOCKADDR_LEN
|
||||
#undef HAVE_BSD_FLOCK
|
||||
#define HAVE_FCNTL_FILE_LOCKING
|
||||
#define _PR_NO_LARGE_FILES
|
||||
#define _PR_STAT_HAS_ONLY_ST_ATIME
|
||||
#define PR_HAVE_POSIX_NAMED_SHARED_MEMORY
|
||||
#define _PR_HAVE_POSIX_SEMAPHORES
|
||||
|
||||
#undef FD_SETSIZE
|
||||
#define FD_SETSIZE 4096
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/select.h>
|
||||
|
||||
#undef HAVE_STACK_GROWING_UP
|
||||
#define HAVE_DLL
|
||||
#define USE_DLFCN
|
||||
#define NEED_STRFTIME_LOCK
|
||||
#define NEED_TIME_R
|
||||
#define _PR_NEED_STRCASECMP
|
||||
|
||||
#ifndef HAVE_STRERROR
|
||||
#define HAVE_STRERROR
|
||||
#endif
|
||||
|
||||
#define USE_SETJMP
|
||||
|
||||
#include <setjmp.h>
|
||||
|
||||
#define _SETJMP setjmp
|
||||
#define _LONGJMP longjmp
|
||||
#define _PR_CONTEXT_TYPE jmp_buf
|
||||
#define _PR_NUM_GCREGS _JBLEN
|
||||
#define _MD_GET_SP(_t) (_t)->md.context[7]
|
||||
|
||||
#define CONTEXT(_th) ((_th)->md.context)
|
||||
|
||||
|
||||
/*
|
||||
** Initialize the thread context preparing it to execute _main.
|
||||
*/
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
{ \
|
||||
*status = PR_TRUE; \
|
||||
if(_SETJMP(CONTEXT(_thread))) (*_main)(); \
|
||||
_MD_GET_SP(_thread) = (int) ((_sp) - 128); \
|
||||
}
|
||||
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
if (!_SETJMP(CONTEXT(_thread))) { \
|
||||
(_thread)->md.errcode = errno; \
|
||||
_PR_Schedule(); \
|
||||
}
|
||||
|
||||
/*
|
||||
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
|
||||
*/
|
||||
#define _MD_RESTORE_CONTEXT(_thread) \
|
||||
{ \
|
||||
errno = (_thread)->md.errcode; \
|
||||
_MD_SET_CURRENT_THREAD(_thread); \
|
||||
_LONGJMP(CONTEXT(_thread), 1); \
|
||||
}
|
||||
|
||||
/*
|
||||
** Machine-dependent (MD) data structures.
|
||||
*/
|
||||
struct _MDThread {
|
||||
_PR_CONTEXT_TYPE context;
|
||||
int id;
|
||||
int errcode;
|
||||
};
|
||||
|
||||
struct _MDThreadStack {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDLock {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSemaphore {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDCVar {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSegment {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
/*
|
||||
** md-specific cpu structure field
|
||||
*/
|
||||
#define _PR_MD_MAX_OSFD FD_SETSIZE
|
||||
|
||||
struct _MDCPU_Unix {
|
||||
PRCList ioQ;
|
||||
PRUint32 ioq_timeout;
|
||||
PRInt32 ioq_max_osfd;
|
||||
PRInt32 ioq_osfd_cnt;
|
||||
#ifndef _PR_USE_POLL
|
||||
fd_set fd_read_set, fd_write_set, fd_exception_set;
|
||||
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD], fd_write_cnt[_PR_MD_MAX_OSFD], fd_exception_cnt[_PR_MD_MAX_OSFD];
|
||||
#else
|
||||
struct pollfd *ioq_pollfds;
|
||||
int ioq_pollfds_size;
|
||||
#endif
|
||||
};
|
||||
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
|
||||
struct _MDCPU {
|
||||
struct _MDCPU_Unix md_unix;
|
||||
};
|
||||
|
||||
#define _MD_INIT_LOCKS()
|
||||
#define _MD_NEW_LOCK(lock) PR_SUCCESS
|
||||
#define _MD_FREE_LOCK(lock)
|
||||
#define _MD_LOCK(lock)
|
||||
#define _MD_UNLOCK(lock)
|
||||
#define _MD_INIT_IO()
|
||||
#define _MD_IOQ_LOCK()
|
||||
#define _MD_IOQ_UNLOCK()
|
||||
|
||||
#define _MD_GET_INTERVAL _PR_UNIX_GetInterval
|
||||
#define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
|
||||
#define _MD_INIT_THREAD _MD_InitializeThread
|
||||
#define _MD_EXIT_THREAD(thread)
|
||||
#define _MD_SUSPEND_THREAD(thread)
|
||||
#define _MD_RESUME_THREAD(thread)
|
||||
#define _MD_CLEAN_THREAD(_thread)
|
||||
|
||||
/*
|
||||
** We wrapped the select() call. _MD_SELECT refers to the built-in,
|
||||
** unwrapped version.
|
||||
*/
|
||||
#define _MD_SELECT select
|
||||
|
||||
#define SA_RESTART 0
|
||||
|
||||
#endif /* nspr_nto_defs_h___ */
|
||||
238
Src/nprt_plugin/gecko/1.8/win/include/md/_openbsd.h
Normal file
238
Src/nprt_plugin/gecko/1.8/win/include/md/_openbsd.h
Normal file
@@ -0,0 +1,238 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Portable Runtime (NSPR).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998-2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nspr_openbsd_defs_h___
|
||||
#define nspr_openbsd_defs_h___
|
||||
|
||||
#include <sys/syscall.h>
|
||||
|
||||
#define PR_LINKER_ARCH "openbsd"
|
||||
#define _PR_SI_SYSNAME "OPENBSD"
|
||||
#if defined(__i386__)
|
||||
#define _PR_SI_ARCHITECTURE "x86"
|
||||
#elif defined(__alpha__)
|
||||
#define _PR_SI_ARCHITECTURE "alpha"
|
||||
#elif defined(__amd64__)
|
||||
#define _PR_SI_ARCHITECTURE "amd64"
|
||||
#elif defined(__m68k__)
|
||||
#define _PR_SI_ARCHITECTURE "m68k"
|
||||
#elif defined(__powerpc__)
|
||||
#define _PR_SI_ARCHITECTURE "powerpc"
|
||||
#elif defined(__sparc__)
|
||||
#define _PR_SI_ARCHITECTURE "sparc"
|
||||
#endif
|
||||
|
||||
#define PR_DLL_SUFFIX ".so.1.0"
|
||||
|
||||
#define _PR_VMBASE 0x30000000
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
#define _MD_DEFAULT_STACK_SIZE 65536L
|
||||
#define _MD_MMAP_FLAGS MAP_PRIVATE
|
||||
|
||||
#undef HAVE_STACK_GROWING_UP
|
||||
#define HAVE_DLL
|
||||
#define USE_DLFCN
|
||||
#define _PR_HAVE_SOCKADDR_LEN
|
||||
#define _PR_NO_LARGE_FILES
|
||||
#define _PR_STAT_HAS_ST_ATIMESPEC
|
||||
#define _PR_POLL_AVAILABLE
|
||||
#define _PR_USE_POLL
|
||||
#define _PR_HAVE_SYSV_SEMAPHORES
|
||||
#define PR_HAVE_SYSV_NAMED_SHARED_MEMORY
|
||||
|
||||
#define _PR_INET6
|
||||
#define _PR_HAVE_INET_NTOP
|
||||
#define _PR_HAVE_GETHOSTBYNAME2
|
||||
#define _PR_HAVE_GETADDRINFO
|
||||
#define _PR_INET6_PROBE
|
||||
|
||||
#define USE_SETJMP
|
||||
|
||||
#ifndef _PR_PTHREADS
|
||||
#include <setjmp.h>
|
||||
|
||||
#define PR_CONTEXT_TYPE sigjmp_buf
|
||||
|
||||
#define CONTEXT(_th) ((_th)->md.context)
|
||||
|
||||
#if defined(__i386__) || defined(__sparc__) || defined(__m68k__)
|
||||
#define JB_SP_INDEX 2
|
||||
#elif defined(__powerpc__)
|
||||
#define JB_SP_INDEX 1
|
||||
#elif defined(__alpha__)
|
||||
#define JB_SP_INDEX 34
|
||||
#elif defined(__amd64__)
|
||||
#define JB_SP_INDEX 6
|
||||
#else
|
||||
#error "Need to define SP index in jmp_buf here"
|
||||
#endif
|
||||
#define _MD_GET_SP(_th) (_th)->md.context[JB_SP_INDEX]
|
||||
|
||||
#define PR_NUM_GCREGS _JBLEN
|
||||
|
||||
/*
|
||||
** Initialize a thread context to run "_main()" when started
|
||||
*/
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
{ \
|
||||
*status = PR_TRUE; \
|
||||
if (sigsetjmp(CONTEXT(_thread), 1)) { \
|
||||
_main(); \
|
||||
} \
|
||||
_MD_GET_SP(_thread) = (unsigned char*) ((_sp) - 64); \
|
||||
}
|
||||
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
if (!sigsetjmp(CONTEXT(_thread), 1)) { \
|
||||
(_thread)->md.errcode = errno; \
|
||||
_PR_Schedule(); \
|
||||
}
|
||||
|
||||
/*
|
||||
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
|
||||
*/
|
||||
#define _MD_RESTORE_CONTEXT(_thread) \
|
||||
{ \
|
||||
errno = (_thread)->md.errcode; \
|
||||
_MD_SET_CURRENT_THREAD(_thread); \
|
||||
siglongjmp(CONTEXT(_thread), 1); \
|
||||
}
|
||||
|
||||
/* Machine-dependent (MD) data structures */
|
||||
|
||||
struct _MDThread {
|
||||
PR_CONTEXT_TYPE context;
|
||||
int id;
|
||||
int errcode;
|
||||
};
|
||||
|
||||
struct _MDThreadStack {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDLock {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSemaphore {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDCVar {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSegment {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
/*
|
||||
* md-specific cpu structure field
|
||||
*/
|
||||
#define _PR_MD_MAX_OSFD FD_SETSIZE
|
||||
|
||||
struct _MDCPU_Unix {
|
||||
PRCList ioQ;
|
||||
PRUint32 ioq_timeout;
|
||||
PRInt32 ioq_max_osfd;
|
||||
PRInt32 ioq_osfd_cnt;
|
||||
#ifndef _PR_USE_POLL
|
||||
fd_set fd_read_set, fd_write_set, fd_exception_set;
|
||||
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
|
||||
fd_exception_cnt[_PR_MD_MAX_OSFD];
|
||||
#else
|
||||
struct pollfd *ioq_pollfds;
|
||||
int ioq_pollfds_size;
|
||||
#endif /* _PR_USE_POLL */
|
||||
};
|
||||
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
|
||||
struct _MDCPU {
|
||||
struct _MDCPU_Unix md_unix;
|
||||
};
|
||||
|
||||
#define _MD_INIT_LOCKS()
|
||||
#define _MD_NEW_LOCK(lock) PR_SUCCESS
|
||||
#define _MD_FREE_LOCK(lock)
|
||||
#define _MD_LOCK(lock)
|
||||
#define _MD_UNLOCK(lock)
|
||||
#define _MD_INIT_IO()
|
||||
#define _MD_IOQ_LOCK()
|
||||
#define _MD_IOQ_UNLOCK()
|
||||
|
||||
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
|
||||
#define _MD_INIT_THREAD _MD_InitializeThread
|
||||
#define _MD_EXIT_THREAD(thread)
|
||||
#define _MD_SUSPEND_THREAD(thread) _MD_suspend_thread
|
||||
#define _MD_RESUME_THREAD(thread) _MD_resume_thread
|
||||
#define _MD_CLEAN_THREAD(_thread)
|
||||
|
||||
#endif /* ! _PR_PTHREADS */
|
||||
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
#define _MD_GET_INTERVAL _PR_UNIX_GetInterval
|
||||
#define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond
|
||||
|
||||
/*
|
||||
* We wrapped the select() call. _MD_SELECT refers to the built-in,
|
||||
* unwrapped version.
|
||||
*/
|
||||
#define _MD_SELECT(nfds,r,w,e,tv) syscall(SYS_select,nfds,r,w,e,tv)
|
||||
#include <poll.h>
|
||||
#define _MD_POLL(fds,nfds,timeout) syscall(SYS_poll,fds,nfds,timeout)
|
||||
|
||||
#if OpenBSD1_3 == 1L
|
||||
typedef unsigned int nfds_t;
|
||||
#endif
|
||||
|
||||
#endif /* nspr_openbsd_defs_h___ */
|
||||
332
Src/nprt_plugin/gecko/1.8/win/include/md/_openvms.h
Normal file
332
Src/nprt_plugin/gecko/1.8/win/include/md/_openvms.h
Normal file
@@ -0,0 +1,332 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Portable Runtime (NSPR).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998-2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/*
|
||||
** This is the OpenVMS machine dependant configuration file. It is based
|
||||
** on the OSF/1 machine dependant file.
|
||||
*/
|
||||
|
||||
#ifndef nspr_openvms_defs_h___
|
||||
#define nspr_openvms_defs_h___
|
||||
|
||||
/*
|
||||
* Internal configuration macros
|
||||
*/
|
||||
|
||||
#define PR_LINKER_ARCH "OpenVMS"
|
||||
#define _PR_SI_SYSNAME "OpenVMS"
|
||||
#ifdef __alpha
|
||||
#define _PR_SI_ARCHITECTURE "alpha"
|
||||
#else
|
||||
#define _PR_SI_ARCHITECTURE "vax"
|
||||
#endif
|
||||
#define PR_DLL_SUFFIX ".so"
|
||||
|
||||
#define _PR_VMBASE 0x30000000
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
#define _MD_DEFAULT_STACK_SIZE 131072L
|
||||
#define _MD_MINIMUM_STACK_SIZE 131072L
|
||||
|
||||
/*
|
||||
** This is not defined on OpenVMS. I believe its only used in GC code, and
|
||||
** isn't that only used in Java? Anyway, for now, let's keep the compiler
|
||||
** happy.
|
||||
*/
|
||||
#define SA_RESTART 0
|
||||
|
||||
/*
|
||||
** OpenVMS doesn't have these in socket.h.
|
||||
** Does in later versions!
|
||||
*/
|
||||
#if 0
|
||||
struct ip_mreq {
|
||||
struct in_addr imr_multiaddr; /* IP multicast address of group */
|
||||
struct in_addr imr_interface; /* local IP address of interface */
|
||||
};
|
||||
#endif
|
||||
|
||||
/*
|
||||
* OSF1 needs the MAP_FIXED flag to ensure that mmap returns a pointer
|
||||
* with the upper 32 bits zero. This is because Java sticks a pointer
|
||||
* into an int.
|
||||
*/
|
||||
#define _MD_MMAP_FLAGS MAP_PRIVATE|MAP_FIXED
|
||||
|
||||
#undef HAVE_STACK_GROWING_UP
|
||||
#undef HAVE_WEAK_IO_SYMBOLS
|
||||
#undef HAVE_WEAK_MALLOC_SYMBOLS
|
||||
#undef HAVE_BSD_FLOCK
|
||||
|
||||
#define NEED_TIME_R
|
||||
|
||||
#define HAVE_DLL
|
||||
#define USE_DLFCN
|
||||
|
||||
#define _PR_POLL_AVAILABLE
|
||||
#define _PR_USE_POLL
|
||||
#define _PR_STAT_HAS_ONLY_ST_ATIME
|
||||
#define _PR_NO_LARGE_FILES
|
||||
#define _PR_STRICT_ADDR_LEN
|
||||
|
||||
/* IPv6 support */
|
||||
#ifdef _SOCKADDR_LEN
|
||||
#define _PR_HAVE_SOCKADDR_LEN
|
||||
#endif
|
||||
#define _PR_HAVE_GETIPNODEBYNAME
|
||||
#define _PR_HAVE_GETIPNODEBYADDR
|
||||
#define _PR_HAVE_GETADDRINFO
|
||||
#define _PR_INET6_PROBE
|
||||
#ifdef _PR_INET6
|
||||
#define _PR_HAVE_INET_NTOP
|
||||
#else
|
||||
#define AF_INET6 26
|
||||
#ifndef AI_CANONNAME
|
||||
#define AI_CANONNAME 0x00000002
|
||||
struct addrinfo {
|
||||
int ai_flags;
|
||||
int ai_family;
|
||||
int ai_socktype;
|
||||
int ai_protocol;
|
||||
size_t ai_addrlen;
|
||||
char *ai_canonname;
|
||||
struct sockaddr *ai_addr;
|
||||
struct addrinfo *ai_next;
|
||||
};
|
||||
#endif
|
||||
#define AI_V4MAPPED 0x00000010
|
||||
#define AI_ALL 0x00000008
|
||||
#define AI_ADDRCONFIG 0x00000020
|
||||
#endif
|
||||
|
||||
#define _PR_HAVE_MD_SOCKADDR_IN6
|
||||
/* if we have a quadword field defined in the structure, then its length */
|
||||
/* will be a multiple of 8, and connect() won't accept 32 (it wants 28) */
|
||||
struct _md_in6_addr {
|
||||
union {
|
||||
PRUint8 _S6_u8[16];
|
||||
PRUint16 _S6_u16[8];
|
||||
PRUint32 _S6_u32[4];
|
||||
} _S6_un;
|
||||
};
|
||||
struct _md_sockaddr_in6 {
|
||||
PRUint16 sin6_family;
|
||||
PRUint16 sin6_port;
|
||||
PRUint32 sin6_flowinfo;
|
||||
struct _md_in6_addr sin6_addr;
|
||||
PRUint32 sin6_scope_id;
|
||||
};
|
||||
|
||||
#undef USE_SETJMP
|
||||
|
||||
#include <setjmp.h>
|
||||
|
||||
/*
|
||||
* A jmp_buf is actually a struct sigcontext. The sc_sp field of
|
||||
* struct sigcontext is the stack pointer.
|
||||
*/
|
||||
#define _MD_GET_SP(_t) (((struct sigcontext *) (_t)->md.context)->sc_sp)
|
||||
#define PR_NUM_GCREGS _JBLEN
|
||||
#define CONTEXT(_th) ((_th)->md.context)
|
||||
|
||||
/*
|
||||
** I am ifdef'ing these out because that's the way they are in FT.
|
||||
*/
|
||||
#ifndef __VMS
|
||||
|
||||
/*
|
||||
** Initialize a thread context to run "_main()" when started
|
||||
*/
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
{ \
|
||||
*status = PR_TRUE; \
|
||||
if (setjmp(CONTEXT(_thread))) { \
|
||||
(*_main)(); \
|
||||
} \
|
||||
_MD_GET_SP(_thread) = (long) ((_sp) - 64); \
|
||||
_MD_GET_SP(_thread) &= ~15; \
|
||||
}
|
||||
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
if (!setjmp(CONTEXT(_thread))) { \
|
||||
(_thread)->md.errcode = errno; \
|
||||
_PR_Schedule(); \
|
||||
}
|
||||
|
||||
/*
|
||||
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
|
||||
*/
|
||||
#define _MD_RESTORE_CONTEXT(_thread) \
|
||||
{ \
|
||||
errno = (_thread)->md.errcode; \
|
||||
_MD_SET_CURRENT_THREAD(_thread); \
|
||||
longjmp(CONTEXT(_thread), 1); \
|
||||
}
|
||||
|
||||
#endif /* __VMS */
|
||||
|
||||
/* Machine-dependent (MD) data structures */
|
||||
|
||||
struct _MDThread {
|
||||
jmp_buf context;
|
||||
int id;
|
||||
int errcode;
|
||||
};
|
||||
|
||||
struct _MDThreadStack {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDLock {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSemaphore {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDCVar {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSegment {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
/*
|
||||
* md-specific cpu structure field
|
||||
*/
|
||||
#define _PR_MD_MAX_OSFD FD_SETSIZE
|
||||
|
||||
struct _MDCPU_Unix {
|
||||
PRCList ioQ;
|
||||
PRUint32 ioq_timeout;
|
||||
PRInt32 ioq_max_osfd;
|
||||
PRInt32 ioq_osfd_cnt;
|
||||
#ifndef _PR_USE_POLL
|
||||
fd_set fd_read_set, fd_write_set, fd_exception_set;
|
||||
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
|
||||
fd_exception_cnt[_PR_MD_MAX_OSFD];
|
||||
#else
|
||||
struct pollfd *ioq_pollfds;
|
||||
int ioq_pollfds_size;
|
||||
#endif /* _PR_USE_POLL */
|
||||
};
|
||||
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
|
||||
struct _MDCPU {
|
||||
struct _MDCPU_Unix md_unix;
|
||||
};
|
||||
|
||||
#ifndef _PR_PTHREADS
|
||||
#define _MD_INIT_LOCKS()
|
||||
#endif
|
||||
#define _MD_NEW_LOCK(lock) PR_SUCCESS
|
||||
#define _MD_FREE_LOCK(lock)
|
||||
#define _MD_LOCK(lock)
|
||||
#define _MD_UNLOCK(lock)
|
||||
#define _MD_INIT_IO()
|
||||
#define _MD_IOQ_LOCK()
|
||||
#define _MD_IOQ_UNLOCK()
|
||||
|
||||
/*
|
||||
* The following are copied from _sunos.h, _aix.h. This means
|
||||
* some of them should probably be moved into _unixos.h. But
|
||||
* _irix.h seems to be quite different in regard to these macros.
|
||||
*/
|
||||
#define _MD_GET_INTERVAL _PR_UNIX_GetInterval
|
||||
extern PRIntervalTime _PR_UNIX_GetInterval(void);
|
||||
#define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond
|
||||
extern PRIntervalTime _PR_UNIX_TicksPerSecond(void);
|
||||
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
void _MD_EarlyInit(void);
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
|
||||
#define _MD_INIT_THREAD _MD_InitializeThread
|
||||
#ifdef _VMS_NOT_YET
|
||||
NSPR_API(void) _PR_InitThreads(
|
||||
PRThreadType type, PRThreadPriority priority, PRUintn maxPTDs);
|
||||
#endif
|
||||
#define _MD_EXIT_THREAD(thread)
|
||||
#define _MD_SUSPEND_THREAD(thread)
|
||||
#define _MD_RESUME_THREAD(thread)
|
||||
#define _MD_CLEAN_THREAD(_thread)
|
||||
|
||||
/* The following defines unwrapped versions of select() and poll(). */
|
||||
extern int __select (int, fd_set *, fd_set *, fd_set *, struct timeval *);
|
||||
#define _MD_SELECT __select
|
||||
|
||||
#ifndef __VMS
|
||||
#define _MD_POLL __poll
|
||||
extern int __poll(struct pollfd filedes[], unsigned int nfds, int timeout);
|
||||
#endif
|
||||
|
||||
#ifdef __VMS
|
||||
NSPR_API(void) _PR_InitCPUs(void);
|
||||
NSPR_API(void) _PR_MD_START_INTERRUPTS(void);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Atomic operations
|
||||
*/
|
||||
#include <machine/builtins.h>
|
||||
#define _PR_HAVE_ATOMIC_OPS
|
||||
#define _MD_INIT_ATOMIC()
|
||||
#define _MD_ATOMIC_ADD(ptr,val) (__ATOMIC_ADD_LONG(ptr,val) + val)
|
||||
#define _MD_ATOMIC_INCREMENT(val) (__ATOMIC_INCREMENT_LONG(val) + 1)
|
||||
#define _MD_ATOMIC_DECREMENT(val) (__ATOMIC_DECREMENT_LONG(val) - 1)
|
||||
#define _MD_ATOMIC_SET(val, newval) __ATOMIC_EXCH_LONG(val, newval)
|
||||
|
||||
extern int thread_suspend(PRThread *thr_id);
|
||||
extern int thread_resume(PRThread *thr_id);
|
||||
|
||||
#endif /* nspr_openvms_defs_h___ */
|
||||
594
Src/nprt_plugin/gecko/1.8/win/include/md/_os2.h
Normal file
594
Src/nprt_plugin/gecko/1.8/win/include/md/_os2.h
Normal file
@@ -0,0 +1,594 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Portable Runtime (NSPR).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998-2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nspr_os2_defs_h___
|
||||
#define nspr_os2_defs_h___
|
||||
|
||||
#ifndef NO_LONG_LONG
|
||||
#define INCL_LONGLONG
|
||||
#endif
|
||||
#define INCL_DOS
|
||||
#define INCL_DOSPROCESS
|
||||
#define INCL_DOSERRORS
|
||||
#define INCL_WIN
|
||||
#define INCL_WPS
|
||||
#include <os2.h>
|
||||
#include <sys/select.h>
|
||||
|
||||
#include "prio.h"
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef XP_OS2_VACPP
|
||||
/* TODO RAMSEMs need to be written for GCC/EMX */
|
||||
#define USE_RAMSEM
|
||||
#endif
|
||||
|
||||
#ifdef USE_RAMSEM
|
||||
#pragma pack(4)
|
||||
|
||||
#pragma pack(2)
|
||||
typedef struct _RAMSEM
|
||||
{
|
||||
ULONG ulTIDPID;
|
||||
ULONG hevSem;
|
||||
ULONG cLocks;
|
||||
USHORT cWaiting;
|
||||
USHORT cPosts;
|
||||
} RAMSEM, *PRAMSEM;
|
||||
|
||||
typedef struct _CRITICAL_SECTION
|
||||
{
|
||||
ULONG ulReserved[4]; /* Same size as RAMSEM */
|
||||
} CRITICAL_SECTION, *PCRITICAL_SECTION, *LPCRITICAL_SECTION;
|
||||
#pragma pack(4)
|
||||
|
||||
APIRET _Optlink SemRequest486(PRAMSEM, ULONG);
|
||||
APIRET _Optlink SemReleasex86(PRAMSEM, ULONG);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Internal configuration macros
|
||||
*/
|
||||
|
||||
#define PR_LINKER_ARCH "os2"
|
||||
#define _PR_SI_SYSNAME "OS2"
|
||||
#define _PR_SI_ARCHITECTURE "x86" /* XXXMB hardcode for now */
|
||||
|
||||
#define HAVE_DLL
|
||||
#define _PR_GLOBAL_THREADS_ONLY
|
||||
#undef HAVE_THREAD_AFFINITY
|
||||
#define _PR_HAVE_THREADSAFE_GETHOST
|
||||
#define _PR_HAVE_ATOMIC_OPS
|
||||
|
||||
#define HANDLE unsigned long
|
||||
#define HINSTANCE HMODULE
|
||||
|
||||
/* --- Common User-Thread/Native-Thread Definitions --------------------- */
|
||||
|
||||
/* --- Globals --- */
|
||||
extern struct PRLock *_pr_schedLock;
|
||||
|
||||
/* --- Typedefs --- */
|
||||
typedef void (*FiberFunc)(void *);
|
||||
|
||||
#define PR_NUM_GCREGS 8
|
||||
typedef PRInt32 PR_CONTEXT_TYPE[PR_NUM_GCREGS];
|
||||
#define GC_VMBASE 0x40000000
|
||||
#define GC_VMLIMIT 0x00FFFFFF
|
||||
typedef int (*FARPROC)();
|
||||
|
||||
#define _MD_MAGIC_THREAD 0x22222222
|
||||
#define _MD_MAGIC_THREADSTACK 0x33333333
|
||||
#define _MD_MAGIC_SEGMENT 0x44444444
|
||||
#define _MD_MAGIC_DIR 0x55555555
|
||||
#define _MD_MAGIC_CV 0x66666666
|
||||
|
||||
struct _MDSemaphore {
|
||||
HEV sem;
|
||||
};
|
||||
|
||||
struct _MDCPU {
|
||||
int unused;
|
||||
};
|
||||
|
||||
struct _MDThread {
|
||||
HEV blocked_sema; /* Threads block on this when waiting
|
||||
* for IO or CondVar.
|
||||
*/
|
||||
PRBool inCVWaitQueue; /* PR_TRUE if the thread is in the
|
||||
* wait queue of some cond var.
|
||||
* PR_FALSE otherwise. */
|
||||
TID handle; /* OS/2 thread handle */
|
||||
void *sp; /* only valid when suspended */
|
||||
PRUint32 magic; /* for debugging */
|
||||
PR_CONTEXT_TYPE gcContext; /* Thread context for GC */
|
||||
struct PRThread *prev, *next; /* used by the cvar wait queue to
|
||||
* chain the PRThread structures
|
||||
* together */
|
||||
};
|
||||
|
||||
struct _MDThreadStack {
|
||||
PRUint32 magic; /* for debugging */
|
||||
};
|
||||
|
||||
struct _MDSegment {
|
||||
PRUint32 magic; /* for debugging */
|
||||
};
|
||||
|
||||
#undef PROFILE_LOCKS
|
||||
|
||||
struct _MDDir {
|
||||
HDIR d_hdl;
|
||||
union {
|
||||
FILEFINDBUF3 small;
|
||||
FILEFINDBUF3L large;
|
||||
} d_entry;
|
||||
PRBool firstEntry; /* Is this the entry returned
|
||||
* by FindFirstFile()? */
|
||||
PRUint32 magic; /* for debugging */
|
||||
};
|
||||
|
||||
struct _MDCVar {
|
||||
PRUint32 magic;
|
||||
struct PRThread *waitHead, *waitTail; /* the wait queue: a doubly-
|
||||
* linked list of threads
|
||||
* waiting on this condition
|
||||
* variable */
|
||||
PRIntn nwait; /* number of threads in the
|
||||
* wait queue */
|
||||
};
|
||||
|
||||
#define _MD_CV_NOTIFIED_LENGTH 6
|
||||
typedef struct _MDNotified _MDNotified;
|
||||
struct _MDNotified {
|
||||
PRIntn length; /* # of used entries in this
|
||||
* structure */
|
||||
struct {
|
||||
struct _MDCVar *cv; /* the condition variable notified */
|
||||
PRIntn times; /* and the number of times notified */
|
||||
struct PRThread *notifyHead; /* list of threads to wake up */
|
||||
} cv[_MD_CV_NOTIFIED_LENGTH];
|
||||
_MDNotified *link; /* link to another of these, or NULL */
|
||||
};
|
||||
|
||||
struct _MDLock {
|
||||
#ifdef USE_RAMSEM
|
||||
CRITICAL_SECTION mutex; /* this is recursive on NT */
|
||||
#else
|
||||
HMTX mutex; /* this is recursive on NT */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* When notifying cvars, there is no point in actually
|
||||
* waking up the threads waiting on the cvars until we've
|
||||
* released the lock. So, we temporarily record the cvars.
|
||||
* When doing an unlock, we'll then wake up the waiting threads.
|
||||
*/
|
||||
struct _MDNotified notified; /* array of conditions notified */
|
||||
#ifdef PROFILE_LOCKS
|
||||
PRInt32 hitcount;
|
||||
PRInt32 misscount;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct _MDFileDesc {
|
||||
PRInt32 osfd; /* The osfd can come from one of three spaces:
|
||||
* - For stdin, stdout, and stderr, we are using
|
||||
* the libc file handle (0, 1, 2), which is an int.
|
||||
* - For files and pipes, we are using OS/2 handles,
|
||||
* which is a void*.
|
||||
* - For sockets, we are using int
|
||||
*/
|
||||
};
|
||||
|
||||
struct _MDProcess {
|
||||
PID pid;
|
||||
};
|
||||
|
||||
/* --- Misc stuff --- */
|
||||
#define _MD_GET_SP(thread) (thread)->md.gcContext[6]
|
||||
|
||||
/* --- IO stuff --- */
|
||||
|
||||
#define _MD_OPEN (_PR_MD_OPEN)
|
||||
#define _MD_OPEN_FILE (_PR_MD_OPEN)
|
||||
#define _MD_READ (_PR_MD_READ)
|
||||
#define _MD_WRITE (_PR_MD_WRITE)
|
||||
#define _MD_WRITEV (_PR_MD_WRITEV)
|
||||
#define _MD_LSEEK (_PR_MD_LSEEK)
|
||||
#define _MD_LSEEK64 (_PR_MD_LSEEK64)
|
||||
extern PRInt32 _MD_CloseFile(PRInt32 osfd);
|
||||
#define _MD_CLOSE_FILE _MD_CloseFile
|
||||
#define _MD_GETFILEINFO (_PR_MD_GETFILEINFO)
|
||||
#define _MD_GETFILEINFO64 (_PR_MD_GETFILEINFO64)
|
||||
#define _MD_GETOPENFILEINFO (_PR_MD_GETOPENFILEINFO)
|
||||
#define _MD_GETOPENFILEINFO64 (_PR_MD_GETOPENFILEINFO64)
|
||||
#define _MD_STAT (_PR_MD_STAT)
|
||||
#define _MD_RENAME (_PR_MD_RENAME)
|
||||
#define _MD_ACCESS (_PR_MD_ACCESS)
|
||||
#define _MD_DELETE (_PR_MD_DELETE)
|
||||
#define _MD_MKDIR (_PR_MD_MKDIR)
|
||||
#define _MD_MAKE_DIR (_PR_MD_MKDIR)
|
||||
#define _MD_RMDIR (_PR_MD_RMDIR)
|
||||
#define _MD_LOCKFILE (_PR_MD_LOCKFILE)
|
||||
#define _MD_TLOCKFILE (_PR_MD_TLOCKFILE)
|
||||
#define _MD_UNLOCKFILE (_PR_MD_UNLOCKFILE)
|
||||
|
||||
/* --- Socket IO stuff --- */
|
||||
|
||||
/* The ones that don't map directly may need to be re-visited... */
|
||||
#ifdef XP_OS2_VACPP
|
||||
#define EPIPE EBADF
|
||||
#define EIO ECONNREFUSED
|
||||
#endif
|
||||
#define _MD_EACCES EACCES
|
||||
#define _MD_EADDRINUSE EADDRINUSE
|
||||
#define _MD_EADDRNOTAVAIL EADDRNOTAVAIL
|
||||
#define _MD_EAFNOSUPPORT EAFNOSUPPORT
|
||||
#define _MD_EAGAIN EWOULDBLOCK
|
||||
#define _MD_EALREADY EALREADY
|
||||
#define _MD_EBADF EBADF
|
||||
#define _MD_ECONNREFUSED ECONNREFUSED
|
||||
#define _MD_ECONNRESET ECONNRESET
|
||||
#define _MD_EFAULT SOCEFAULT
|
||||
#define _MD_EINPROGRESS EINPROGRESS
|
||||
#define _MD_EINTR EINTR
|
||||
#define _MD_EINVAL EINVAL
|
||||
#define _MD_EISCONN EISCONN
|
||||
#define _MD_ENETUNREACH ENETUNREACH
|
||||
#define _MD_ENOENT ENOENT
|
||||
#define _MD_ENOTCONN ENOTCONN
|
||||
#define _MD_ENOTSOCK ENOTSOCK
|
||||
#define _MD_EOPNOTSUPP EOPNOTSUPP
|
||||
#define _MD_EWOULDBLOCK EWOULDBLOCK
|
||||
#define _MD_GET_SOCKET_ERROR() sock_errno()
|
||||
#ifndef INADDR_LOOPBACK /* For some reason this is not defined in OS2 tcpip */
|
||||
/* #define INADDR_LOOPBACK INADDR_ANY */
|
||||
#endif
|
||||
|
||||
#define _MD_INIT_FILEDESC(fd)
|
||||
extern void _MD_MakeNonblock(PRFileDesc *f);
|
||||
#define _MD_MAKE_NONBLOCK _MD_MakeNonblock
|
||||
#define _MD_INIT_FD_INHERITABLE (_PR_MD_INIT_FD_INHERITABLE)
|
||||
#define _MD_QUERY_FD_INHERITABLE (_PR_MD_QUERY_FD_INHERITABLE)
|
||||
#define _MD_SHUTDOWN (_PR_MD_SHUTDOWN)
|
||||
#define _MD_LISTEN _PR_MD_LISTEN
|
||||
extern PRInt32 _MD_CloseSocket(PRInt32 osfd);
|
||||
#define _MD_CLOSE_SOCKET _MD_CloseSocket
|
||||
#define _MD_SENDTO (_PR_MD_SENDTO)
|
||||
#define _MD_RECVFROM (_PR_MD_RECVFROM)
|
||||
#ifdef XP_OS2_VACPP
|
||||
#define _MD_SOCKETPAIR(s, type, proto, sv) -1
|
||||
#else
|
||||
#define _MD_SOCKETPAIR (_PR_MD_SOCKETPAIR)
|
||||
#endif
|
||||
#define _MD_GETSOCKNAME (_PR_MD_GETSOCKNAME)
|
||||
#define _MD_GETPEERNAME (_PR_MD_GETPEERNAME)
|
||||
#define _MD_GETSOCKOPT (_PR_MD_GETSOCKOPT)
|
||||
#define _MD_SETSOCKOPT (_PR_MD_SETSOCKOPT)
|
||||
|
||||
#define _MD_FSYNC _PR_MD_FSYNC
|
||||
#define _MD_SET_FD_INHERITABLE (_PR_MD_SET_FD_INHERITABLE)
|
||||
|
||||
#ifdef _PR_HAVE_ATOMIC_OPS
|
||||
#define _MD_INIT_ATOMIC()
|
||||
#define _MD_ATOMIC_INCREMENT _PR_MD_ATOMIC_INCREMENT
|
||||
#define _MD_ATOMIC_ADD _PR_MD_ATOMIC_ADD
|
||||
#define _MD_ATOMIC_DECREMENT _PR_MD_ATOMIC_DECREMENT
|
||||
#define _MD_ATOMIC_SET _PR_MD_ATOMIC_SET
|
||||
#endif
|
||||
|
||||
#define _MD_INIT_IO (_PR_MD_INIT_IO)
|
||||
#define _MD_PR_POLL (_PR_MD_PR_POLL)
|
||||
|
||||
#define _MD_SOCKET (_PR_MD_SOCKET)
|
||||
extern PRInt32 _MD_SocketAvailable(PRFileDesc *fd);
|
||||
#define _MD_SOCKETAVAILABLE _MD_SocketAvailable
|
||||
#define _MD_PIPEAVAILABLE _MD_SocketAvailable
|
||||
#define _MD_CONNECT (_PR_MD_CONNECT)
|
||||
extern PRInt32 _MD_Accept(PRFileDesc *fd, PRNetAddr *raddr, PRUint32 *rlen,
|
||||
PRIntervalTime timeout);
|
||||
#define _MD_ACCEPT _MD_Accept
|
||||
#define _MD_BIND (_PR_MD_BIND)
|
||||
#define _MD_RECV (_PR_MD_RECV)
|
||||
#define _MD_SEND (_PR_MD_SEND)
|
||||
|
||||
/* --- Scheduler stuff --- */
|
||||
/* #define _MD_PAUSE_CPU _PR_MD_PAUSE_CPU */
|
||||
#define _MD_PAUSE_CPU
|
||||
|
||||
/* --- DIR stuff --- */
|
||||
#define PR_DIRECTORY_SEPARATOR '\\'
|
||||
#define PR_DIRECTORY_SEPARATOR_STR "\\"
|
||||
#define PR_PATH_SEPARATOR ';'
|
||||
#define PR_PATH_SEPARATOR_STR ";"
|
||||
#define _MD_ERRNO() errno
|
||||
#define _MD_OPEN_DIR (_PR_MD_OPEN_DIR)
|
||||
#define _MD_CLOSE_DIR (_PR_MD_CLOSE_DIR)
|
||||
#define _MD_READ_DIR (_PR_MD_READ_DIR)
|
||||
|
||||
/* --- Segment stuff --- */
|
||||
#define _MD_INIT_SEGS()
|
||||
#define _MD_ALLOC_SEGMENT(seg, size, vaddr) 0
|
||||
#define _MD_FREE_SEGMENT(seg)
|
||||
|
||||
/* --- Environment Stuff --- */
|
||||
#define _MD_GET_ENV (_PR_MD_GET_ENV)
|
||||
#define _MD_PUT_ENV (_PR_MD_PUT_ENV)
|
||||
|
||||
/* --- Threading Stuff --- */
|
||||
#define _MD_DEFAULT_STACK_SIZE 65536L
|
||||
#define _MD_INIT_THREAD (_PR_MD_INIT_THREAD)
|
||||
#define _MD_INIT_ATTACHED_THREAD (_PR_MD_INIT_THREAD)
|
||||
#define _MD_CREATE_THREAD (_PR_MD_CREATE_THREAD)
|
||||
#define _MD_YIELD (_PR_MD_YIELD)
|
||||
#define _MD_SET_PRIORITY (_PR_MD_SET_PRIORITY)
|
||||
#define _MD_CLEAN_THREAD (_PR_MD_CLEAN_THREAD)
|
||||
#define _MD_SETTHREADAFFINITYMASK (_PR_MD_SETTHREADAFFINITYMASK)
|
||||
#define _MD_GETTHREADAFFINITYMASK (_PR_MD_GETTHREADAFFINITYMASK)
|
||||
#define _MD_EXIT_THREAD (_PR_MD_EXIT_THREAD)
|
||||
#define _MD_SUSPEND_THREAD (_PR_MD_SUSPEND_THREAD)
|
||||
#define _MD_RESUME_THREAD (_PR_MD_RESUME_THREAD)
|
||||
#define _MD_SUSPEND_CPU (_PR_MD_SUSPEND_CPU)
|
||||
#define _MD_RESUME_CPU (_PR_MD_RESUME_CPU)
|
||||
#define _MD_WAKEUP_CPUS (_PR_MD_WAKEUP_CPUS)
|
||||
#define _MD_BEGIN_SUSPEND_ALL()
|
||||
#define _MD_BEGIN_RESUME_ALL()
|
||||
#define _MD_END_SUSPEND_ALL()
|
||||
#define _MD_END_RESUME_ALL()
|
||||
|
||||
/* --- Lock stuff --- */
|
||||
#define _PR_LOCK _MD_LOCK
|
||||
#define _PR_UNLOCK _MD_UNLOCK
|
||||
|
||||
#ifdef USE_RAMSEM
|
||||
#define _MD_NEW_LOCK (_PR_MD_NEW_LOCK)
|
||||
#define _MD_FREE_LOCK(lock) (DosCloseEventSem(((PRAMSEM)(&((lock)->mutex)))->hevSem))
|
||||
#define _MD_LOCK(lock) (SemRequest486(&((lock)->mutex), -1))
|
||||
#define _MD_TEST_AND_LOCK(lock) (SemRequest486(&((lock)->mutex), -1),0)
|
||||
#define _MD_UNLOCK(lock) \
|
||||
PR_BEGIN_MACRO \
|
||||
if (0 != (lock)->notified.length) { \
|
||||
md_UnlockAndPostNotifies((lock), NULL, NULL); \
|
||||
} else { \
|
||||
SemReleasex86( &(lock)->mutex, 0 ); \
|
||||
} \
|
||||
PR_END_MACRO
|
||||
#else
|
||||
#define _MD_NEW_LOCK (_PR_MD_NEW_LOCK)
|
||||
#define _MD_FREE_LOCK(lock) (DosCloseMutexSem((lock)->mutex))
|
||||
#define _MD_LOCK(lock) (DosRequestMutexSem((lock)->mutex, SEM_INDEFINITE_WAIT))
|
||||
#define _MD_TEST_AND_LOCK(lock) (DosRequestMutexSem((lock)->mutex, SEM_INDEFINITE_WAIT),0)
|
||||
#define _MD_UNLOCK(lock) \
|
||||
PR_BEGIN_MACRO \
|
||||
if (0 != (lock)->notified.length) { \
|
||||
md_UnlockAndPostNotifies((lock), NULL, NULL); \
|
||||
} else { \
|
||||
DosReleaseMutexSem((lock)->mutex); \
|
||||
} \
|
||||
PR_END_MACRO
|
||||
#endif
|
||||
|
||||
/* --- lock and cv waiting --- */
|
||||
#define _MD_WAIT (_PR_MD_WAIT)
|
||||
#define _MD_WAKEUP_WAITER (_PR_MD_WAKEUP_WAITER)
|
||||
|
||||
/* --- CVar ------------------- */
|
||||
#define _MD_WAIT_CV (_PR_MD_WAIT_CV)
|
||||
#define _MD_NEW_CV (_PR_MD_NEW_CV)
|
||||
#define _MD_FREE_CV (_PR_MD_FREE_CV)
|
||||
#define _MD_NOTIFY_CV (_PR_MD_NOTIFY_CV )
|
||||
#define _MD_NOTIFYALL_CV (_PR_MD_NOTIFYALL_CV)
|
||||
|
||||
/* XXXMB- the IOQ stuff is certainly not working correctly yet. */
|
||||
/* extern struct _MDLock _pr_ioq_lock; */
|
||||
#define _MD_IOQ_LOCK()
|
||||
#define _MD_IOQ_UNLOCK()
|
||||
|
||||
|
||||
/* --- Initialization stuff --- */
|
||||
#define _MD_START_INTERRUPTS()
|
||||
#define _MD_STOP_INTERRUPTS()
|
||||
#define _MD_DISABLE_CLOCK_INTERRUPTS()
|
||||
#define _MD_ENABLE_CLOCK_INTERRUPTS()
|
||||
#define _MD_BLOCK_CLOCK_INTERRUPTS()
|
||||
#define _MD_UNBLOCK_CLOCK_INTERRUPTS()
|
||||
#define _MD_EARLY_INIT (_PR_MD_EARLY_INIT)
|
||||
#define _MD_FINAL_INIT()
|
||||
#define _MD_INIT_CPUS()
|
||||
#define _MD_INIT_RUNNING_CPU(cpu)
|
||||
|
||||
struct PRProcess;
|
||||
struct PRProcessAttr;
|
||||
|
||||
#define _MD_CREATE_PROCESS _PR_CreateOS2Process
|
||||
extern struct PRProcess * _PR_CreateOS2Process(
|
||||
const char *path,
|
||||
char *const *argv,
|
||||
char *const *envp,
|
||||
const struct PRProcessAttr *attr
|
||||
);
|
||||
|
||||
#define _MD_DETACH_PROCESS _PR_DetachOS2Process
|
||||
extern PRStatus _PR_DetachOS2Process(struct PRProcess *process);
|
||||
|
||||
/* --- Wait for a child process to terminate --- */
|
||||
#define _MD_WAIT_PROCESS _PR_WaitOS2Process
|
||||
extern PRStatus _PR_WaitOS2Process(struct PRProcess *process,
|
||||
PRInt32 *exitCode);
|
||||
|
||||
#define _MD_KILL_PROCESS _PR_KillOS2Process
|
||||
extern PRStatus _PR_KillOS2Process(struct PRProcess *process);
|
||||
|
||||
#define _MD_CLEANUP_BEFORE_EXIT()
|
||||
#define _MD_EXIT (_PR_MD_EXIT)
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
PR_BEGIN_MACRO \
|
||||
*status = PR_TRUE; \
|
||||
PR_END_MACRO
|
||||
#define _MD_SWITCH_CONTEXT
|
||||
#define _MD_RESTORE_CONTEXT
|
||||
|
||||
/* --- Intervals --- */
|
||||
#define _MD_INTERVAL_INIT (_PR_MD_INTERVAL_INIT)
|
||||
#define _MD_GET_INTERVAL (_PR_MD_GET_INTERVAL)
|
||||
#define _MD_INTERVAL_PER_SEC (_PR_MD_INTERVAL_PER_SEC)
|
||||
#define _MD_INTERVAL_PER_MILLISEC() (_PR_MD_INTERVAL_PER_SEC() / 1000)
|
||||
#define _MD_INTERVAL_PER_MICROSEC() (_PR_MD_INTERVAL_PER_SEC() / 1000000)
|
||||
|
||||
/* --- Native-Thread Specific Definitions ------------------------------- */
|
||||
|
||||
typedef struct __NSPR_TLS
|
||||
{
|
||||
struct PRThread *_pr_thread_last_run;
|
||||
struct PRThread *_pr_currentThread;
|
||||
struct _PRCPU *_pr_currentCPU;
|
||||
} _NSPR_TLS;
|
||||
|
||||
extern _NSPR_TLS* pThreadLocalStorage;
|
||||
NSPR_API(void) _PR_MD_ENSURE_TLS(void);
|
||||
|
||||
#define _MD_GET_ATTACHED_THREAD() pThreadLocalStorage->_pr_currentThread
|
||||
extern struct PRThread * _MD_CURRENT_THREAD(void);
|
||||
#define _MD_SET_CURRENT_THREAD(_thread) _PR_MD_ENSURE_TLS(); pThreadLocalStorage->_pr_currentThread = (_thread)
|
||||
|
||||
#define _MD_LAST_THREAD() pThreadLocalStorage->_pr_thread_last_run
|
||||
#define _MD_SET_LAST_THREAD(_thread) _PR_MD_ENSURE_TLS(); pThreadLocalStorage->_pr_thread_last_run = (_thread)
|
||||
|
||||
#define _MD_CURRENT_CPU() pThreadLocalStorage->_pr_currentCPU
|
||||
#define _MD_SET_CURRENT_CPU(_cpu) _PR_MD_ENSURE_TLS(); pThreadLocalStorage->_pr_currentCPU = (_cpu)
|
||||
|
||||
/* lth. #define _MD_SET_INTSOFF(_val) (_pr_ints_off = (_val)) */
|
||||
/* lth. #define _MD_GET_INTSOFF() _pr_ints_off */
|
||||
/* lth. #define _MD_INCREMENT_INTSOFF() (_pr_ints_off++) */
|
||||
/* lth. #define _MD_DECREMENT_INTSOFF() (_pr_ints_off--) */
|
||||
|
||||
/* --- Scheduler stuff --- */
|
||||
#define LOCK_SCHEDULER() 0
|
||||
#define UNLOCK_SCHEDULER() 0
|
||||
#define _PR_LockSched() 0
|
||||
#define _PR_UnlockSched() 0
|
||||
|
||||
/* --- Initialization stuff --- */
|
||||
#define _MD_INIT_LOCKS()
|
||||
|
||||
/* --- Stack stuff --- */
|
||||
#define _MD_INIT_STACK(stack, redzone)
|
||||
#define _MD_CLEAR_STACK(stack)
|
||||
|
||||
/* --- Memory-mapped files stuff --- not implemented on OS/2 */
|
||||
|
||||
struct _MDFileMap {
|
||||
PRInt8 unused;
|
||||
};
|
||||
|
||||
extern PRStatus _MD_CreateFileMap(struct PRFileMap *fmap, PRInt64 size);
|
||||
#define _MD_CREATE_FILE_MAP _MD_CreateFileMap
|
||||
|
||||
extern PRInt32 _MD_GetMemMapAlignment(void);
|
||||
#define _MD_GET_MEM_MAP_ALIGNMENT _MD_GetMemMapAlignment
|
||||
|
||||
extern void * _MD_MemMap(struct PRFileMap *fmap, PRInt64 offset,
|
||||
PRUint32 len);
|
||||
#define _MD_MEM_MAP _MD_MemMap
|
||||
|
||||
extern PRStatus _MD_MemUnmap(void *addr, PRUint32 size);
|
||||
#define _MD_MEM_UNMAP _MD_MemUnmap
|
||||
|
||||
extern PRStatus _MD_CloseFileMap(struct PRFileMap *fmap);
|
||||
#define _MD_CLOSE_FILE_MAP _MD_CloseFileMap
|
||||
|
||||
/* Some stuff for setting up thread contexts */
|
||||
typedef ULONG DWORD, *PDWORD;
|
||||
|
||||
/* The following definitions and two structures are new in OS/2 Warp 4.0.
|
||||
*/
|
||||
#ifndef CONTEXT_CONTROL
|
||||
#define CONTEXT_CONTROL 0x00000001
|
||||
#define CONTEXT_INTEGER 0x00000002
|
||||
#define CONTEXT_SEGMENTS 0x00000004
|
||||
#define CONTEXT_FLOATING_POINT 0x00000008
|
||||
#define CONTEXT_FULL 0x0000000F
|
||||
|
||||
#pragma pack(2)
|
||||
typedef struct _FPREG {
|
||||
ULONG losig; /* Low 32-bits of the significand. */
|
||||
ULONG hisig; /* High 32-bits of the significand. */
|
||||
USHORT signexp; /* Sign and exponent. */
|
||||
} FPREG;
|
||||
typedef struct _CONTEXTRECORD {
|
||||
ULONG ContextFlags;
|
||||
ULONG ctx_env[7];
|
||||
FPREG ctx_stack[8];
|
||||
ULONG ctx_SegGs; /* GS register. */
|
||||
ULONG ctx_SegFs; /* FS register. */
|
||||
ULONG ctx_SegEs; /* ES register. */
|
||||
ULONG ctx_SegDs; /* DS register. */
|
||||
ULONG ctx_RegEdi; /* EDI register. */
|
||||
ULONG ctx_RegEsi; /* ESI register. */
|
||||
ULONG ctx_RegEax; /* EAX register. */
|
||||
ULONG ctx_RegEbx; /* EBX register. */
|
||||
ULONG ctx_RegEcx; /* ECX register. */
|
||||
ULONG ctx_RegEdx; /* EDX register. */
|
||||
ULONG ctx_RegEbp; /* EBP register. */
|
||||
ULONG ctx_RegEip; /* EIP register. */
|
||||
ULONG ctx_SegCs; /* CS register. */
|
||||
ULONG ctx_EFlags; /* EFLAGS register. */
|
||||
ULONG ctx_RegEsp; /* ESP register. */
|
||||
ULONG ctx_SegSs; /* SS register. */
|
||||
} CONTEXTRECORD, *PCONTEXTRECORD;
|
||||
#pragma pack()
|
||||
#endif
|
||||
|
||||
extern APIRET (* APIENTRY QueryThreadContext)(TID, ULONG, PCONTEXTRECORD);
|
||||
|
||||
/*
|
||||
#define _pr_tid (((PTIB2)_getTIBvalue(offsetof(TIB, tib_ptib2)))->tib2_ultid)
|
||||
#define _pr_current_Thread (_system_tls[_pr_tid-1].__pr_current_thread)
|
||||
*/
|
||||
|
||||
/* Some simple mappings of Windows API's to OS/2 API's to make our lives a
|
||||
* little bit easier. Only add one here if it is a DIRECT mapping. We are
|
||||
* not emulating anything. Just mapping.
|
||||
*/
|
||||
#define FreeLibrary(x) DosFreeModule((HMODULE)x)
|
||||
#define OutputDebugString(x)
|
||||
|
||||
extern int _MD_os2_get_nonblocking_connect_error(int osfd);
|
||||
|
||||
#endif /* nspr_os2_defs_h___ */
|
||||
162
Src/nprt_plugin/gecko/1.8/win/include/md/_os2_errors.h
Normal file
162
Src/nprt_plugin/gecko/1.8/win/include/md/_os2_errors.h
Normal file
@@ -0,0 +1,162 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Portable Runtime (NSPR).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998-2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nspr_os2_errors_h___
|
||||
#define nspr_os2_errors_h___
|
||||
|
||||
#include "md/_os2.h"
|
||||
#ifndef assert
|
||||
#include <assert.h>
|
||||
#endif
|
||||
|
||||
NSPR_API(void) _MD_os2_map_default_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_DEFAULT_ERROR _MD_os2_map_default_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_opendir_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_OPENDIR_ERROR _MD_os2_map_opendir_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_closedir_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_CLOSEDIR_ERROR _MD_os2_map_closedir_error
|
||||
|
||||
NSPR_API(void) _MD_os2_readdir_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_READDIR_ERROR _MD_os2_readdir_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_delete_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_DELETE_ERROR _MD_os2_map_delete_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_stat_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_STAT_ERROR _MD_os2_map_stat_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_fstat_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_FSTAT_ERROR _MD_os2_map_fstat_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_rename_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_RENAME_ERROR _MD_os2_map_rename_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_access_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_ACCESS_ERROR _MD_os2_map_access_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_mkdir_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_MKDIR_ERROR _MD_os2_map_mkdir_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_rmdir_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_RMDIR_ERROR _MD_os2_map_rmdir_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_read_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_READ_ERROR _MD_os2_map_read_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_transmitfile_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_TRANSMITFILE_ERROR _MD_os2_map_transmitfile_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_write_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_WRITE_ERROR _MD_os2_map_write_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_lseek_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_LSEEK_ERROR _MD_os2_map_lseek_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_fsync_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_FSYNC_ERROR _MD_os2_map_fsync_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_close_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_CLOSE_ERROR _MD_os2_map_close_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_socket_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_SOCKET_ERROR _MD_os2_map_socket_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_recv_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_RECV_ERROR _MD_os2_map_recv_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_recvfrom_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_RECVFROM_ERROR _MD_os2_map_recvfrom_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_send_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_SEND_ERROR _MD_os2_map_send_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_sendto_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_SENDTO_ERROR _MD_os2_map_sendto_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_writev_error(int err);
|
||||
#define _PR_MD_MAP_WRITEV_ERROR _MD_os2_map_writev_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_accept_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_ACCEPT_ERROR _MD_os2_map_accept_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_acceptex_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_ACCEPTEX_ERROR _MD_os2_map_acceptex_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_connect_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_CONNECT_ERROR _MD_os2_map_connect_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_bind_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_BIND_ERROR _MD_os2_map_bind_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_listen_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_LISTEN_ERROR _MD_os2_map_listen_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_shutdown_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_SHUTDOWN_ERROR _MD_os2_map_shutdown_error
|
||||
|
||||
#ifndef XP_OS2_VACPP
|
||||
NSPR_API(void) _MD_os2_map_socketpair_error(int err);
|
||||
#define _PR_MD_MAP_SOCKETPAIR_ERROR _MD_os2_map_socketpair_error
|
||||
#endif
|
||||
|
||||
NSPR_API(void) _MD_os2_map_getsockname_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_GETSOCKNAME_ERROR _MD_os2_map_getsockname_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_getpeername_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_GETPEERNAME_ERROR _MD_os2_map_getpeername_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_getsockopt_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_GETSOCKOPT_ERROR _MD_os2_map_getsockopt_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_setsockopt_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_SETSOCKOPT_ERROR _MD_os2_map_setsockopt_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_open_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_OPEN_ERROR _MD_os2_map_open_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_gethostname_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_GETHOSTNAME_ERROR _MD_os2_map_gethostname_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_select_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_SELECT_ERROR _MD_os2_map_select_error
|
||||
|
||||
NSPR_API(void) _MD_os2_map_lockf_error(int err);
|
||||
#define _PR_MD_MAP_LOCKF_ERROR _MD_os2_map_lockf_error
|
||||
|
||||
#endif /* nspr_os2_errors_h___ */
|
||||
255
Src/nprt_plugin/gecko/1.8/win/include/md/_osf1.h
Normal file
255
Src/nprt_plugin/gecko/1.8/win/include/md/_osf1.h
Normal file
@@ -0,0 +1,255 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Portable Runtime (NSPR).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998-2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nspr_osf1_defs_h___
|
||||
#define nspr_osf1_defs_h___
|
||||
|
||||
/*
|
||||
* Internal configuration macros
|
||||
*/
|
||||
|
||||
#define PR_LINKER_ARCH "osf"
|
||||
#define _PR_SI_SYSNAME "OSF"
|
||||
#define _PR_SI_ARCHITECTURE "alpha"
|
||||
#define PR_DLL_SUFFIX ".so"
|
||||
|
||||
#define _PR_VMBASE 0x30000000
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
#define _MD_DEFAULT_STACK_SIZE 131072L
|
||||
#define _MD_MMAP_FLAGS MAP_PRIVATE
|
||||
|
||||
#undef HAVE_STACK_GROWING_UP
|
||||
#undef HAVE_WEAK_IO_SYMBOLS
|
||||
#undef HAVE_WEAK_MALLOC_SYMBOLS
|
||||
#define HAVE_DLL
|
||||
#define HAVE_BSD_FLOCK
|
||||
|
||||
#define NEED_TIME_R
|
||||
#define USE_DLFCN
|
||||
|
||||
#define _PR_POLL_AVAILABLE
|
||||
#define _PR_USE_POLL
|
||||
#define _PR_STAT_HAS_ONLY_ST_ATIME
|
||||
#define _PR_HAVE_LARGE_OFF_T
|
||||
#define _PR_HAVE_GETIPNODEBYNAME
|
||||
#define _PR_HAVE_GETIPNODEBYADDR
|
||||
#define _PR_HAVE_GETADDRINFO
|
||||
#define _PR_INET6_PROBE
|
||||
#ifdef _PR_INET6
|
||||
#define _PR_HAVE_INET_NTOP
|
||||
#else
|
||||
#define AF_INET6 26
|
||||
#ifndef AI_CANONNAME
|
||||
#define AI_CANONNAME 0x00000002
|
||||
struct addrinfo {
|
||||
int ai_flags;
|
||||
int ai_family;
|
||||
int ai_socktype;
|
||||
int ai_protocol;
|
||||
size_t ai_addrlen;
|
||||
char *ai_canonname;
|
||||
struct sockaddr *ai_addr;
|
||||
struct addrinfo *ai_next;
|
||||
};
|
||||
#endif
|
||||
#define AI_V4MAPPED 0x00000010
|
||||
#define AI_ALL 0x00000008
|
||||
#define AI_ADDRCONFIG 0x00000020
|
||||
#endif
|
||||
#define _PR_HAVE_POSIX_SEMAPHORES
|
||||
#define PR_HAVE_POSIX_NAMED_SHARED_MEMORY
|
||||
|
||||
#define USE_SETJMP
|
||||
|
||||
#include <setjmp.h>
|
||||
|
||||
/*
|
||||
* A jmp_buf is actually a struct sigcontext. The sc_sp field of
|
||||
* struct sigcontext is the stack pointer.
|
||||
*/
|
||||
#define _MD_GET_SP(_t) (((struct sigcontext *) (_t)->md.context)->sc_sp)
|
||||
#define PR_NUM_GCREGS _JBLEN
|
||||
#define CONTEXT(_th) ((_th)->md.context)
|
||||
|
||||
/*
|
||||
** Initialize a thread context to run "_main()" when started
|
||||
*/
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
{ \
|
||||
*status = PR_TRUE; \
|
||||
if (setjmp(CONTEXT(_thread))) { \
|
||||
(*_main)(); \
|
||||
} \
|
||||
_MD_GET_SP(_thread) = (long) ((_sp) - 64); \
|
||||
_MD_GET_SP(_thread) &= ~15; \
|
||||
}
|
||||
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
if (!setjmp(CONTEXT(_thread))) { \
|
||||
(_thread)->md.errcode = errno; \
|
||||
_PR_Schedule(); \
|
||||
}
|
||||
|
||||
/*
|
||||
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
|
||||
*/
|
||||
#define _MD_RESTORE_CONTEXT(_thread) \
|
||||
{ \
|
||||
errno = (_thread)->md.errcode; \
|
||||
_MD_SET_CURRENT_THREAD(_thread); \
|
||||
longjmp(CONTEXT(_thread), 1); \
|
||||
}
|
||||
|
||||
/* Machine-dependent (MD) data structures */
|
||||
|
||||
struct _MDThread {
|
||||
jmp_buf context;
|
||||
int id;
|
||||
int errcode;
|
||||
};
|
||||
|
||||
struct _MDThreadStack {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDLock {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSemaphore {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDCVar {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSegment {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
/*
|
||||
* md-specific cpu structure field
|
||||
*/
|
||||
#define _PR_MD_MAX_OSFD FD_SETSIZE
|
||||
|
||||
struct _MDCPU_Unix {
|
||||
PRCList ioQ;
|
||||
PRUint32 ioq_timeout;
|
||||
PRInt32 ioq_max_osfd;
|
||||
PRInt32 ioq_osfd_cnt;
|
||||
#ifndef _PR_USE_POLL
|
||||
fd_set fd_read_set, fd_write_set, fd_exception_set;
|
||||
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
|
||||
fd_exception_cnt[_PR_MD_MAX_OSFD];
|
||||
#else
|
||||
struct pollfd *ioq_pollfds;
|
||||
int ioq_pollfds_size;
|
||||
#endif /* _PR_USE_POLL */
|
||||
};
|
||||
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
|
||||
struct _MDCPU {
|
||||
struct _MDCPU_Unix md_unix;
|
||||
};
|
||||
|
||||
#ifndef _PR_PTHREADS
|
||||
#define _MD_INIT_LOCKS()
|
||||
#endif
|
||||
#define _MD_NEW_LOCK(lock) PR_SUCCESS
|
||||
#define _MD_FREE_LOCK(lock)
|
||||
#define _MD_LOCK(lock)
|
||||
#define _MD_UNLOCK(lock)
|
||||
#define _MD_INIT_IO()
|
||||
#define _MD_IOQ_LOCK()
|
||||
#define _MD_IOQ_UNLOCK()
|
||||
|
||||
/*
|
||||
* The following are copied from _sunos.h, _aix.h. This means
|
||||
* some of them should probably be moved into _unixos.h. But
|
||||
* _irix.h seems to be quite different in regard to these macros.
|
||||
*/
|
||||
#define _MD_GET_INTERVAL _PR_UNIX_GetInterval
|
||||
#define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond
|
||||
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
|
||||
#define _MD_INIT_THREAD _MD_InitializeThread
|
||||
#define _MD_EXIT_THREAD(thread)
|
||||
#define _MD_SUSPEND_THREAD(thread)
|
||||
#define _MD_RESUME_THREAD(thread)
|
||||
#define _MD_CLEAN_THREAD(_thread)
|
||||
|
||||
/* The following defines unwrapped versions of select() and poll(). */
|
||||
#include <sys/time.h>
|
||||
extern int __select (int, fd_set *, fd_set *, fd_set *, struct timeval *);
|
||||
#define _MD_SELECT __select
|
||||
|
||||
#include <sys/poll.h>
|
||||
#define _MD_POLL __poll
|
||||
extern int __poll(struct pollfd filedes[], unsigned int nfds, int timeout);
|
||||
|
||||
/*
|
||||
* Atomic operations
|
||||
*/
|
||||
#ifdef OSF1_HAVE_MACHINE_BUILTINS_H
|
||||
#include <machine/builtins.h>
|
||||
#define _PR_HAVE_ATOMIC_OPS
|
||||
#define _MD_INIT_ATOMIC()
|
||||
#define _MD_ATOMIC_INCREMENT(val) (__ATOMIC_INCREMENT_LONG(val) + 1)
|
||||
#define _MD_ATOMIC_ADD(ptr, val) (__ATOMIC_ADD_LONG(ptr, val) + val)
|
||||
#define _MD_ATOMIC_DECREMENT(val) (__ATOMIC_DECREMENT_LONG(val) - 1)
|
||||
#define _MD_ATOMIC_SET(val, newval) __ATOMIC_EXCH_LONG(val, newval)
|
||||
#endif /* OSF1_HAVE_MACHINE_BUILTINS_H */
|
||||
|
||||
#endif /* nspr_osf1_defs_h___ */
|
||||
89
Src/nprt_plugin/gecko/1.8/win/include/md/_pcos.h
Normal file
89
Src/nprt_plugin/gecko/1.8/win/include/md/_pcos.h
Normal file
@@ -0,0 +1,89 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Portable Runtime (NSPR).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998-2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef prpcos_h___
|
||||
#define prpcos_h___
|
||||
|
||||
#define PR_DLL_SUFFIX ".dll"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#define DIRECTORY_SEPARATOR '\\'
|
||||
#define DIRECTORY_SEPARATOR_STR "\\"
|
||||
#define PATH_SEPARATOR ';'
|
||||
|
||||
#ifdef WIN16
|
||||
#define GCPTR __far
|
||||
#else
|
||||
#define GCPTR
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Routines for processing command line arguments
|
||||
*/
|
||||
PR_BEGIN_EXTERN_C
|
||||
#ifndef XP_OS2_EMX
|
||||
extern char *optarg;
|
||||
extern int optind;
|
||||
extern int getopt(int argc, char **argv, char *spec);
|
||||
#endif
|
||||
PR_END_EXTERN_C
|
||||
|
||||
|
||||
/*
|
||||
** Definitions of directory structures amd functions
|
||||
** These definitions are from:
|
||||
** <dirent.h>
|
||||
*/
|
||||
#ifdef XP_OS2_EMX
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#include <sys/stat.h>
|
||||
#include <io.h>
|
||||
#include <fcntl.h> /* O_BINARY */
|
||||
|
||||
#ifdef OS2
|
||||
extern PRStatus _MD_OS2GetHostName(char *name, PRUint32 namelen);
|
||||
#define _MD_GETHOSTNAME _MD_OS2GetHostName
|
||||
#else
|
||||
extern PRStatus _MD_WindowsGetHostName(char *name, PRUint32 namelen);
|
||||
#define _MD_GETHOSTNAME _MD_WindowsGetHostName
|
||||
extern PRStatus _MD_WindowsGetSysInfo(PRSysInfo cmd, char *name, PRUint32 namelen);
|
||||
#define _MD_GETSYSINFO _MD_WindowsGetSysInfo
|
||||
#endif
|
||||
|
||||
#endif /* prpcos_h___ */
|
||||
303
Src/nprt_plugin/gecko/1.8/win/include/md/_pth.h
Normal file
303
Src/nprt_plugin/gecko/1.8/win/include/md/_pth.h
Normal file
@@ -0,0 +1,303 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Portable Runtime (NSPR).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998-2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nspr_pth_defs_h_
|
||||
#define nspr_pth_defs_h_
|
||||
|
||||
/*
|
||||
** Appropriate definitions of entry points not used in a pthreads world
|
||||
*/
|
||||
#define _PR_MD_BLOCK_CLOCK_INTERRUPTS()
|
||||
#define _PR_MD_UNBLOCK_CLOCK_INTERRUPTS()
|
||||
#define _PR_MD_DISABLE_CLOCK_INTERRUPTS()
|
||||
#define _PR_MD_ENABLE_CLOCK_INTERRUPTS()
|
||||
|
||||
/* In good standards fashion, the DCE threads (based on posix-4) are not
|
||||
* quite the same as newer posix implementations. These are mostly name
|
||||
* changes and small differences, so macros usually do the trick
|
||||
*/
|
||||
#ifdef _PR_DCETHREADS
|
||||
#define _PT_PTHREAD_MUTEXATTR_INIT pthread_mutexattr_create
|
||||
#define _PT_PTHREAD_MUTEXATTR_DESTROY pthread_mutexattr_delete
|
||||
#define _PT_PTHREAD_MUTEX_INIT(m, a) pthread_mutex_init(&(m), a)
|
||||
#define _PT_PTHREAD_MUTEX_IS_LOCKED(m) (0 == pthread_mutex_trylock(&(m)))
|
||||
#define _PT_PTHREAD_CONDATTR_INIT pthread_condattr_create
|
||||
#define _PT_PTHREAD_COND_INIT(m, a) pthread_cond_init(&(m), a)
|
||||
#define _PT_PTHREAD_CONDATTR_DESTROY pthread_condattr_delete
|
||||
|
||||
/* Notes about differences between DCE threads and pthreads 10:
|
||||
* 1. pthread_mutex_trylock returns 1 when it locks the mutex
|
||||
* 0 when it does not. The latest pthreads has a set of errno-like
|
||||
* return values.
|
||||
* 2. return values from pthread_cond_timedwait are different.
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
#elif defined(BSDI)
|
||||
/*
|
||||
* Mutex and condition attributes are not supported. The attr
|
||||
* argument to pthread_mutex_init() and pthread_cond_init() must
|
||||
* be passed as NULL.
|
||||
*
|
||||
* The memset calls in _PT_PTHREAD_MUTEX_INIT and _PT_PTHREAD_COND_INIT
|
||||
* are to work around BSDI's using a single bit to indicate a mutex
|
||||
* or condition variable is initialized. This entire BSDI section
|
||||
* will go away when BSDI releases updated threads libraries for
|
||||
* BSD/OS 3.1 and 4.0.
|
||||
*/
|
||||
#define _PT_PTHREAD_MUTEXATTR_INIT(x) 0
|
||||
#define _PT_PTHREAD_MUTEXATTR_DESTROY(x) /* */
|
||||
#define _PT_PTHREAD_MUTEX_INIT(m, a) (memset(&(m), 0, sizeof(m)), \
|
||||
pthread_mutex_init(&(m), NULL))
|
||||
#define _PT_PTHREAD_MUTEX_IS_LOCKED(m) (EBUSY == pthread_mutex_trylock(&(m)))
|
||||
#define _PT_PTHREAD_CONDATTR_INIT(x) 0
|
||||
#define _PT_PTHREAD_CONDATTR_DESTROY(x) /* */
|
||||
#define _PT_PTHREAD_COND_INIT(m, a) (memset(&(m), 0, sizeof(m)), \
|
||||
pthread_cond_init(&(m), NULL))
|
||||
#else
|
||||
#define _PT_PTHREAD_MUTEXATTR_INIT pthread_mutexattr_init
|
||||
#define _PT_PTHREAD_MUTEXATTR_DESTROY pthread_mutexattr_destroy
|
||||
#define _PT_PTHREAD_MUTEX_INIT(m, a) pthread_mutex_init(&(m), &(a))
|
||||
#if defined(FREEBSD)
|
||||
#define _PT_PTHREAD_MUTEX_IS_LOCKED(m) pt_pthread_mutex_is_locked(&(m))
|
||||
#else
|
||||
#define _PT_PTHREAD_MUTEX_IS_LOCKED(m) (EBUSY == pthread_mutex_trylock(&(m)))
|
||||
#endif
|
||||
#if defined(DARWIN)
|
||||
#define _PT_PTHREAD_CONDATTR_INIT(x) 0
|
||||
#else
|
||||
#define _PT_PTHREAD_CONDATTR_INIT pthread_condattr_init
|
||||
#endif
|
||||
#define _PT_PTHREAD_CONDATTR_DESTROY pthread_condattr_destroy
|
||||
#define _PT_PTHREAD_COND_INIT(m, a) pthread_cond_init(&(m), &(a))
|
||||
#endif
|
||||
|
||||
/* The pthreads standard does not specify an invalid value for the
|
||||
* pthread_t handle. (0 is usually an invalid pthread identifier
|
||||
* but there are exceptions, for example, DG/UX.) These macros
|
||||
* define a way to set the handle to or compare the handle with an
|
||||
* invalid identifier. These macros are not portable and may be
|
||||
* more of a problem as we adapt to more pthreads implementations.
|
||||
* They are only used in the PRMonitor functions. Do not use them
|
||||
* in new code.
|
||||
*
|
||||
* Unfortunately some of our clients depend on certain properties
|
||||
* of our PRMonitor implementation, preventing us from replacing
|
||||
* it by a portable implementation.
|
||||
* - High-performance servers like the fact that PR_EnterMonitor
|
||||
* only calls PR_Lock and PR_ExitMonitor only calls PR_Unlock.
|
||||
* (A portable implementation would use a PRLock and a PRCondVar
|
||||
* to implement the recursive lock in a monitor and call both
|
||||
* PR_Lock and PR_Unlock in PR_EnterMonitor and PR_ExitMonitor.)
|
||||
* Unfortunately this forces us to read the monitor owner field
|
||||
* without holding a lock.
|
||||
* - One way to make it safe to read the monitor owner field
|
||||
* without holding a lock is to make that field a PRThread*
|
||||
* (one should be able to read a pointer with a single machine
|
||||
* instruction). However, PR_GetCurrentThread calls calloc if
|
||||
* it is called by a thread that was not created by NSPR. The
|
||||
* malloc tracing tools in the Mozilla client use PRMonitor for
|
||||
* locking in their malloc, calloc, and free functions. If
|
||||
* PR_EnterMonitor calls any of these functions, infinite
|
||||
* recursion ensues.
|
||||
*/
|
||||
#if defined(_PR_DCETHREADS)
|
||||
#define _PT_PTHREAD_INVALIDATE_THR_HANDLE(t) \
|
||||
memset(&(t), 0, sizeof(pthread_t))
|
||||
#define _PT_PTHREAD_THR_HANDLE_IS_INVALID(t) \
|
||||
(!memcmp(&(t), &pt_zero_tid, sizeof(pthread_t)))
|
||||
#define _PT_PTHREAD_COPY_THR_HANDLE(st, dt) (dt) = (st)
|
||||
#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(DARWIN) \
|
||||
|| defined(UNIXWARE) || defined(RISCOS)
|
||||
#define _PT_PTHREAD_INVALIDATE_THR_HANDLE(t) (t) = 0
|
||||
#define _PT_PTHREAD_THR_HANDLE_IS_INVALID(t) (t) == 0
|
||||
#define _PT_PTHREAD_COPY_THR_HANDLE(st, dt) (dt) = (st)
|
||||
#else
|
||||
#error "pthreads is not supported for this architecture"
|
||||
#endif
|
||||
|
||||
#if defined(_PR_DCETHREADS)
|
||||
#define _PT_PTHREAD_ATTR_INIT pthread_attr_create
|
||||
#define _PT_PTHREAD_ATTR_DESTROY pthread_attr_delete
|
||||
#define _PT_PTHREAD_CREATE(t, a, f, r) pthread_create(t, a, f, r)
|
||||
#define _PT_PTHREAD_KEY_CREATE pthread_keycreate
|
||||
#define _PT_PTHREAD_ATTR_SETSCHEDPOLICY pthread_attr_setsched
|
||||
#define _PT_PTHREAD_ATTR_GETSTACKSIZE(a, s) \
|
||||
(*(s) = pthread_attr_getstacksize(*(a)), 0)
|
||||
#define _PT_PTHREAD_GETSPECIFIC(k, r) \
|
||||
pthread_getspecific((k), (pthread_addr_t *) &(r))
|
||||
#elif defined(_PR_PTHREADS)
|
||||
#define _PT_PTHREAD_ATTR_INIT pthread_attr_init
|
||||
#define _PT_PTHREAD_ATTR_DESTROY pthread_attr_destroy
|
||||
#define _PT_PTHREAD_CREATE(t, a, f, r) pthread_create(t, &a, f, r)
|
||||
#define _PT_PTHREAD_KEY_CREATE pthread_key_create
|
||||
#define _PT_PTHREAD_ATTR_SETSCHEDPOLICY pthread_attr_setschedpolicy
|
||||
#define _PT_PTHREAD_ATTR_GETSTACKSIZE(a, s) pthread_attr_getstacksize(a, s)
|
||||
#define _PT_PTHREAD_GETSPECIFIC(k, r) (r) = pthread_getspecific(k)
|
||||
#else
|
||||
#error "Cannot determine pthread strategy"
|
||||
#endif
|
||||
|
||||
#if defined(_PR_DCETHREADS)
|
||||
#define _PT_PTHREAD_EXPLICIT_SCHED _PT_PTHREAD_DEFAULT_SCHED
|
||||
#endif
|
||||
|
||||
/*
|
||||
* pthread_mutex_trylock returns different values in DCE threads and
|
||||
* pthreads.
|
||||
*/
|
||||
#if defined(_PR_DCETHREADS)
|
||||
#define PT_TRYLOCK_SUCCESS 1
|
||||
#define PT_TRYLOCK_BUSY 0
|
||||
#else
|
||||
#define PT_TRYLOCK_SUCCESS 0
|
||||
#define PT_TRYLOCK_BUSY EBUSY
|
||||
#endif
|
||||
|
||||
/*
|
||||
* These platforms don't have sigtimedwait()
|
||||
*/
|
||||
#if (defined(AIX) && !defined(AIX4_3_PLUS)) || defined(LINUX) \
|
||||
|| defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD) \
|
||||
|| defined(BSDI) || defined(VMS) || defined(UNIXWARE) \
|
||||
|| defined(DARWIN)
|
||||
#define PT_NO_SIGTIMEDWAIT
|
||||
#endif
|
||||
|
||||
/*
|
||||
* These platforms don't have pthread_kill()
|
||||
*/
|
||||
#if defined(DARWIN)
|
||||
#define pthread_kill(thread, sig) ENOSYS
|
||||
#endif
|
||||
|
||||
#if defined(OSF1) || defined(VMS)
|
||||
#define PT_PRIO_MIN PRI_OTHER_MIN
|
||||
#define PT_PRIO_MAX PRI_OTHER_MAX
|
||||
#elif defined(IRIX)
|
||||
#include <sys/sched.h>
|
||||
#define PT_PRIO_MIN PX_PRIO_MIN
|
||||
#define PT_PRIO_MAX PX_PRIO_MAX
|
||||
#elif defined(AIX)
|
||||
#include <sys/priv.h>
|
||||
#include <sys/sched.h>
|
||||
#ifndef PTHREAD_CREATE_JOINABLE
|
||||
#define PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED
|
||||
#endif
|
||||
#define PT_PRIO_MIN DEFAULT_PRIO
|
||||
#define PT_PRIO_MAX DEFAULT_PRIO
|
||||
#elif defined(HPUX)
|
||||
|
||||
#if defined(_PR_DCETHREADS)
|
||||
#define PT_PRIO_MIN PRI_OTHER_MIN
|
||||
#define PT_PRIO_MAX PRI_OTHER_MAX
|
||||
#else /* defined(_PR_DCETHREADS) */
|
||||
#include <sys/sched.h>
|
||||
#define PT_PRIO_MIN sched_get_priority_min(SCHED_OTHER)
|
||||
#define PT_PRIO_MAX sched_get_priority_max(SCHED_OTHER)
|
||||
#endif /* defined(_PR_DCETHREADS) */
|
||||
|
||||
#elif defined(LINUX) || defined(FREEBSD)
|
||||
#define PT_PRIO_MIN sched_get_priority_min(SCHED_OTHER)
|
||||
#define PT_PRIO_MAX sched_get_priority_max(SCHED_OTHER)
|
||||
#elif defined(NTO)
|
||||
/*
|
||||
* Neutrino has functions that return the priority range but
|
||||
* they return invalid numbers, so I just hard coded these here
|
||||
* for now. Jerry.Kirk@Nexarecorp.com
|
||||
*/
|
||||
#define PT_PRIO_MIN 0
|
||||
#define PT_PRIO_MAX 30
|
||||
#elif defined(SOLARIS)
|
||||
/*
|
||||
* Solaris doesn't seem to have macros for the min/max priorities.
|
||||
* The range of 0-127 is mentioned in the pthread_setschedparam(3T)
|
||||
* man pages, and pthread_setschedparam indeed allows 0-127. However,
|
||||
* pthread_attr_setschedparam does not allow 0; it allows 1-127.
|
||||
*/
|
||||
#define PT_PRIO_MIN 1
|
||||
#define PT_PRIO_MAX 127
|
||||
#elif defined(OPENBSD)
|
||||
#define PT_PRIO_MIN 0
|
||||
#define PT_PRIO_MAX 31
|
||||
#elif defined(NETBSD) \
|
||||
|| defined(BSDI) || defined(DARWIN) || defined(UNIXWARE) \
|
||||
|| defined(RISCOS) /* XXX */
|
||||
#define PT_PRIO_MIN 0
|
||||
#define PT_PRIO_MAX 126
|
||||
#else
|
||||
#error "pthreads is not supported for this architecture"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The _PT_PTHREAD_YIELD function is called from a signal handler.
|
||||
* Needed for garbage collection -- Look at PR_Suspend/PR_Resume
|
||||
* implementation.
|
||||
*/
|
||||
#if defined(_PR_DCETHREADS)
|
||||
#define _PT_PTHREAD_YIELD() pthread_yield()
|
||||
#elif defined(OSF1) || defined(VMS)
|
||||
/*
|
||||
* sched_yield can't be called from a signal handler. Must use
|
||||
* the _np version.
|
||||
*/
|
||||
#define _PT_PTHREAD_YIELD() pthread_yield_np()
|
||||
#elif defined(AIX)
|
||||
extern int (*_PT_aix_yield_fcn)();
|
||||
#define _PT_PTHREAD_YIELD() (*_PT_aix_yield_fcn)()
|
||||
#elif defined(IRIX)
|
||||
#include <time.h>
|
||||
#define _PT_PTHREAD_YIELD() \
|
||||
PR_BEGIN_MACRO \
|
||||
struct timespec onemillisec = {0}; \
|
||||
onemillisec.tv_nsec = 1000000L; \
|
||||
nanosleep(&onemillisec,NULL); \
|
||||
PR_END_MACRO
|
||||
#elif defined(HPUX) || defined(LINUX) || defined(SOLARIS) \
|
||||
|| defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD) \
|
||||
|| defined(BSDI) || defined(NTO) || defined(DARWIN) \
|
||||
|| defined(UNIXWARE) || defined(RISCOS)
|
||||
#define _PT_PTHREAD_YIELD() sched_yield()
|
||||
#else
|
||||
#error "Need to define _PT_PTHREAD_YIELD for this platform"
|
||||
#endif
|
||||
|
||||
#endif /* nspr_pth_defs_h_ */
|
||||
215
Src/nprt_plugin/gecko/1.8/win/include/md/_qnx.h
Normal file
215
Src/nprt_plugin/gecko/1.8/win/include/md/_qnx.h
Normal file
@@ -0,0 +1,215 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Portable Runtime (NSPR).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998-2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nspr_qnx_defs_h___
|
||||
#define nspr_qnx_defs_h___
|
||||
|
||||
/*
|
||||
** Internal configuration macros
|
||||
*/
|
||||
#define PR_LINKER_ARCH "qnx"
|
||||
#define _PR_SI_SYSNAME "QNX"
|
||||
#define _PR_SI_ARCHITECTURE "x86"
|
||||
#define PR_DLL_SUFFIX ".so"
|
||||
|
||||
#define _PR_VMBASE 0x30000000
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
#define _MD_DEFAULT_STACK_SIZE 65536L
|
||||
#define _MD_MMAP_FLAGS MAP_PRIVATE
|
||||
|
||||
#ifndef HAVE_WEAK_IO_SYMBOLS
|
||||
#define HAVE_WEAK_IO_SYMBOLS
|
||||
#endif
|
||||
|
||||
#undef _PR_POLL_AVAILABLE
|
||||
#undef _PR_USE_POLL
|
||||
#define _PR_HAVE_SOCKADDR_LEN
|
||||
#define HAVE_BSD_FLOCK
|
||||
#define _PR_NO_LARGE_FILES
|
||||
#define _PR_STAT_HAS_ONLY_ST_ATIME
|
||||
|
||||
#include <sys/select.h>
|
||||
|
||||
#undef HAVE_STACK_GROWING_UP
|
||||
#undef HAVE_DLL
|
||||
#undef USE_DLFCN
|
||||
#define NEED_STRFTIME_LOCK
|
||||
#define NEED_TIME_R
|
||||
#define _PR_NEED_STRCASECMP
|
||||
|
||||
#ifndef HAVE_STRERROR
|
||||
#define HAVE_STRERROR
|
||||
#endif
|
||||
|
||||
#define USE_SETJMP
|
||||
|
||||
#include <setjmp.h>
|
||||
|
||||
#define _SETJMP setjmp
|
||||
#define _LONGJMP longjmp
|
||||
#define _PR_CONTEXT_TYPE jmp_buf
|
||||
#define _PR_NUM_GCREGS _JBLEN
|
||||
#define _MD_GET_SP(_t) (_t)->md.context[7]
|
||||
|
||||
#define CONTEXT(_th) ((_th)->md.context)
|
||||
|
||||
/*
|
||||
** Initialize the thread context preparing it to execute _main.
|
||||
*/
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
{ \
|
||||
*status = PR_TRUE; \
|
||||
if(_SETJMP(CONTEXT(_thread))) (*_main)(); \
|
||||
_MD_GET_SP(_thread) = (int) ((_sp) - 128); \
|
||||
}
|
||||
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
if (!_SETJMP(CONTEXT(_thread))) { \
|
||||
(_thread)->md.errcode = errno; \
|
||||
_PR_Schedule(); \
|
||||
}
|
||||
|
||||
/*
|
||||
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
|
||||
*/
|
||||
#define _MD_RESTORE_CONTEXT(_thread) \
|
||||
{ \
|
||||
errno = (_thread)->md.errcode; \
|
||||
_MD_SET_CURRENT_THREAD(_thread); \
|
||||
_LONGJMP(CONTEXT(_thread), 1); \
|
||||
}
|
||||
|
||||
/*
|
||||
** Machine-dependent (MD) data structures.
|
||||
*/
|
||||
struct _MDThread {
|
||||
_PR_CONTEXT_TYPE context;
|
||||
int id;
|
||||
int errcode;
|
||||
};
|
||||
|
||||
struct _MDThreadStack {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDLock {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSemaphore {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDCVar {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSegment {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
/*
|
||||
** md-specific cpu structure field
|
||||
*/
|
||||
#define _PR_MD_MAX_OSFD FD_SETSIZE
|
||||
|
||||
struct _MDCPU_Unix {
|
||||
PRCList ioQ;
|
||||
PRUint32 ioq_timeout;
|
||||
PRInt32 ioq_max_osfd;
|
||||
PRInt32 ioq_osfd_cnt;
|
||||
#ifndef _PR_USE_POLL
|
||||
fd_set fd_read_set, fd_write_set, fd_exception_set;
|
||||
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD], fd_write_cnt[_PR_MD_MAX_OSFD], fd_exception_cnt[_PR_MD_MAX_OSFD];
|
||||
#else
|
||||
struct pollfd *ioq_pollfds;
|
||||
int ioq_pollfds_size;
|
||||
#endif
|
||||
};
|
||||
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
|
||||
struct _MDCPU {
|
||||
struct _MDCPU_Unix md_unix;
|
||||
};
|
||||
|
||||
#define _MD_INIT_LOCKS()
|
||||
#define _MD_NEW_LOCK(lock) PR_SUCCESS
|
||||
#define _MD_FREE_LOCK(lock)
|
||||
#define _MD_LOCK(lock)
|
||||
#define _MD_UNLOCK(lock)
|
||||
#define _MD_INIT_IO()
|
||||
#define _MD_IOQ_LOCK()
|
||||
#define _MD_IOQ_UNLOCK()
|
||||
|
||||
#define _MD_GET_INTERVAL _PR_UNIX_GetInterval
|
||||
#define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
|
||||
#define _MD_INIT_THREAD _MD_InitializeThread
|
||||
#define _MD_EXIT_THREAD(thread)
|
||||
#define _MD_SUSPEND_THREAD(thread)
|
||||
#define _MD_RESUME_THREAD(thread)
|
||||
#define _MD_CLEAN_THREAD(_thread)
|
||||
|
||||
/*
|
||||
** We wrapped the select() call. _MD_SELECT refers to the built-in,
|
||||
** unwrapped version.
|
||||
*/
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/select.h>
|
||||
#define _MD_SELECT select
|
||||
|
||||
#define SA_RESTART 0
|
||||
|
||||
#endif /* nspr_qnx_defs_h___ */
|
||||
270
Src/nprt_plugin/gecko/1.8/win/include/md/_reliantunix.h
Normal file
270
Src/nprt_plugin/gecko/1.8/win/include/md/_reliantunix.h
Normal file
@@ -0,0 +1,270 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Portable Runtime (NSPR).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998-2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/*
|
||||
* reliantunix.h
|
||||
* 5/18/96 Taken from nec.h -- chrisk@netscape.com
|
||||
* 3/14/97 Modified for nspr20 -- chrisk@netscape.com
|
||||
*/
|
||||
#ifndef nspr_reliantunix_defs_h___
|
||||
#define nspr_reliantunix_defs_h___
|
||||
|
||||
/*
|
||||
* Internal configuration macros
|
||||
*/
|
||||
|
||||
#define PR_LINKER_ARCH "sinix"
|
||||
#define _PR_SI_SYSNAME "SINIX"
|
||||
#define _PR_SI_ARCHITECTURE "mips"
|
||||
#define PR_DLL_SUFFIX ".so"
|
||||
|
||||
#define _PR_VMBASE 0x30000000
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
#define _MD_DEFAULT_STACK_SIZE (2*65536L)
|
||||
#define _MD_MMAP_FLAGS MAP_PRIVATE|MAP_FIXED
|
||||
|
||||
#undef HAVE_STACK_GROWING_UP
|
||||
#define HAVE_DLL
|
||||
#define USE_DLFCN
|
||||
#define NEED_STRFTIME_LOCK
|
||||
#define NEED_TIME_R
|
||||
#define HAVE_NETCONFIG
|
||||
#define HAVE_WEAK_IO_SYMBOLS
|
||||
#define HAVE_WEAK_MALLOC_SYMBOLS
|
||||
#define _PR_RECV_BROKEN /* recv doesn't work on Unix Domain Sockets */
|
||||
#define _PR_POLL_AVAILABLE
|
||||
#define _PR_USE_POLL
|
||||
#define _PR_STAT_HAS_ST_ATIM
|
||||
#define _PR_NO_LARGE_FILES
|
||||
|
||||
/*
|
||||
* Mike Patnode indicated that it is possibly safe now to use context-switching
|
||||
* calls that do not change the signal mask, like setjmp vs. sigsetjmp.
|
||||
* So we'll use our homegrown, getcontext/setcontext-compatible stuff which
|
||||
* will save us the getcontext/setcontext system calls at each context switch.
|
||||
* It already works in FastTrack 2.01, so it should do it here :-)
|
||||
* - chrisk 040497
|
||||
*/
|
||||
#define USE_SETCXT /* temporarily disabled... */
|
||||
|
||||
#include <ucontext.h>
|
||||
|
||||
#ifdef USE_SETCXT
|
||||
/* use non-syscall machine language replacement */
|
||||
#define _GETCONTEXT getcxt
|
||||
#define _SETCONTEXT setcxt
|
||||
/* defined in os_ReliantUNIX.s */
|
||||
extern int getcxt(ucontext_t *);
|
||||
extern int setcxt(ucontext_t *);
|
||||
#else
|
||||
#define _GETCONTEXT getcontext
|
||||
#define _SETCONTEXT setcontext
|
||||
#endif
|
||||
|
||||
#define _MD_GET_SP(_t) (_t)->md.context.uc_mcontext.gpregs[CXT_SP]
|
||||
#define _PR_CONTEXT_TYPE ucontext_t
|
||||
#define _PR_NUM_GCREGS NGREG
|
||||
|
||||
#define CONTEXT(_thread) (&(_thread)->md.context)
|
||||
|
||||
#define _PR_IS_NATIVE_THREAD_SUPPORTED() 0
|
||||
|
||||
/*
|
||||
** Machine-dependent (MD) data structures.
|
||||
*/
|
||||
struct _MDThread {
|
||||
_PR_CONTEXT_TYPE context;
|
||||
int id;
|
||||
int errcode;
|
||||
};
|
||||
|
||||
struct _MDThreadStack {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDLock {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSemaphore {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDCVar {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSegment {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
/*
|
||||
* md-specific cpu structure field
|
||||
*/
|
||||
#define _PR_MD_MAX_OSFD FD_SETSIZE
|
||||
|
||||
struct _MDCPU_Unix {
|
||||
PRCList ioQ;
|
||||
PRUint32 ioq_timeout;
|
||||
PRInt32 ioq_max_osfd;
|
||||
PRInt32 ioq_osfd_cnt;
|
||||
#ifndef _PR_USE_POLL
|
||||
fd_set fd_read_set, fd_write_set, fd_exception_set;
|
||||
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
|
||||
fd_exception_cnt[_PR_MD_MAX_OSFD];
|
||||
#else
|
||||
struct pollfd *ioq_pollfds;
|
||||
int ioq_pollfds_size;
|
||||
#endif /* _PR_USE_POLL */
|
||||
};
|
||||
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
|
||||
struct _MDCPU {
|
||||
struct _MDCPU_Unix md_unix;
|
||||
};
|
||||
|
||||
#define _MD_INIT_LOCKS()
|
||||
#define _MD_NEW_LOCK(lock) PR_SUCCESS
|
||||
#define _MD_FREE_LOCK(lock)
|
||||
#define _MD_LOCK(lock)
|
||||
#define _MD_UNLOCK(lock)
|
||||
#define _MD_INIT_IO()
|
||||
#define _MD_IOQ_LOCK()
|
||||
#define _MD_IOQ_UNLOCK()
|
||||
|
||||
/*
|
||||
** Initialize the thread context preparing it to execute "_main()"
|
||||
** - get a nice, fresh context
|
||||
** - set its SP to the stack we allcoated for it
|
||||
** - set it to start things at "e"
|
||||
*/
|
||||
#define _MD_INIT_CONTEXT(thread, _sp, _main, status) \
|
||||
PR_BEGIN_MACRO \
|
||||
*status = PR_TRUE; \
|
||||
_GETCONTEXT(CONTEXT(thread)); \
|
||||
/* this is supposed to point to the stack BASE, not to SP */ \
|
||||
CONTEXT(thread)->uc_stack.ss_sp = thread->stack->stackBottom; \
|
||||
CONTEXT(thread)->uc_stack.ss_size = thread->stack->stackSize; \
|
||||
CONTEXT(thread)->uc_mcontext.gpregs[CXT_SP] = ((unsigned long)_sp - 128) & 0xfffffff8; \
|
||||
CONTEXT(thread)->uc_mcontext.gpregs[CXT_T9] = _main; \
|
||||
CONTEXT(thread)->uc_mcontext.gpregs[CXT_EPC] = _main; \
|
||||
CONTEXT(thread)->uc_mcontext.gpregs[CXT_RA] = 0; \
|
||||
thread->no_sched = 0; \
|
||||
PR_END_MACRO
|
||||
|
||||
/*
|
||||
** Save current context as it is scheduled away
|
||||
*/
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
PR_BEGIN_MACRO \
|
||||
if (!_GETCONTEXT(CONTEXT(_thread))) { \
|
||||
_MD_SAVE_ERRNO(_thread); \
|
||||
_MD_SET_LAST_THREAD(_thread); \
|
||||
_PR_Schedule(); \
|
||||
} \
|
||||
PR_END_MACRO
|
||||
|
||||
/*
|
||||
** Restore a thread context, saved by _MD_SWITCH_CONTEXT or set up
|
||||
** by _MD_INIT_CONTEXT
|
||||
** CXT_V0 is the register that holds the return value.
|
||||
** We must set it to 1 so that we can see if the return from
|
||||
** getcontext() is the result of calling getcontext() or
|
||||
** setcontext()...
|
||||
** setting a context got with getcontext() appears to
|
||||
** return from getcontext(), too!
|
||||
** CXT_A3 is the register that holds status when returning
|
||||
** from a syscall. It is set to 0 to indicate success,
|
||||
** because we want getcontext() on the other side of the magic
|
||||
** door to be ok.
|
||||
*/
|
||||
#define _MD_RESTORE_CONTEXT(_thread) \
|
||||
PR_BEGIN_MACRO \
|
||||
ucontext_t *uc = CONTEXT(_thread); \
|
||||
uc->uc_mcontext.gpregs[CXT_V0] = 1;\
|
||||
uc->uc_mcontext.gpregs[CXT_A3] = 0;\
|
||||
_MD_RESTORE_ERRNO(_thread); \
|
||||
_MD_SET_CURRENT_THREAD(_thread); \
|
||||
_SETCONTEXT(uc); \
|
||||
PR_END_MACRO
|
||||
|
||||
#define _MD_SAVE_ERRNO(t) (t)->md.errcode = errno;
|
||||
#define _MD_RESTORE_ERRNO(t) errno = (t)->md.errcode;
|
||||
|
||||
#define _MD_GET_INTERVAL _PR_UNIX_GetInterval
|
||||
#define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond
|
||||
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
|
||||
#define _MD_INIT_THREAD _MD_InitializeThread
|
||||
#define _MD_EXIT_THREAD(thread)
|
||||
#define _MD_SUSPEND_THREAD(thread)
|
||||
#define _MD_RESUME_THREAD(thread)
|
||||
#define _MD_CLEAN_THREAD(_thread)
|
||||
|
||||
#if !defined(S_ISSOCK) && defined(S_IFSOCK)
|
||||
#define S_ISSOCK(mode) ((mode&0xF000) == 0xC000)
|
||||
#endif
|
||||
#if !defined(S_ISLNK) && defined(S_IFLNK)
|
||||
#define S_ISLNK(mode) ((mode&0xA000) == 0xC000)
|
||||
#endif
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/select.h>
|
||||
extern int _select(int nfds, fd_set *readfds, fd_set *writefds,
|
||||
fd_set *execptfds, struct timeval *timeout);
|
||||
#define _MD_SELECT(nfds,r,w,e,tv) _select(nfds,r,w,e,tv)
|
||||
#define _MD_POLL _poll
|
||||
|
||||
#endif /* nspr_reliantunix_defs_h___ */
|
||||
225
Src/nprt_plugin/gecko/1.8/win/include/md/_rhapsody.h
Normal file
225
Src/nprt_plugin/gecko/1.8/win/include/md/_rhapsody.h
Normal file
@@ -0,0 +1,225 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Portable Runtime (NSPR).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998-2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nspr_rhapsody_defs_h___
|
||||
#define nspr_rhapsody_defs_h___
|
||||
|
||||
#include "prthread.h"
|
||||
|
||||
#include <sys/syscall.h>
|
||||
|
||||
#define PR_LINKER_ARCH "rhapsody"
|
||||
#define _PR_SI_SYSNAME "RHAPSODY"
|
||||
#ifdef i386
|
||||
#define _PR_SI_ARCHITECTURE "x86"
|
||||
#else
|
||||
#define _PR_SI_ARCHITECTURE "ppc"
|
||||
#endif
|
||||
#define PR_DLL_SUFFIX ".dylib"
|
||||
|
||||
#define _PR_VMBASE 0x30000000
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
#define _MD_DEFAULT_STACK_SIZE 65536L
|
||||
#define _MD_MMAP_FLAGS MAP_PRIVATE
|
||||
|
||||
#undef HAVE_STACK_GROWING_UP
|
||||
#define HAVE_DLL
|
||||
#define USE_MACH_DYLD
|
||||
#define _PR_HAVE_SOCKADDR_LEN
|
||||
#define _PR_STAT_HAS_ST_ATIMESPEC
|
||||
#define _PR_NO_LARGE_FILES
|
||||
#define PR_HAVE_SYSV_NAMED_SHARED_MEMORY
|
||||
|
||||
#define USE_SETJMP
|
||||
|
||||
#if !defined(_PR_PTHREADS)
|
||||
|
||||
#include <setjmp.h>
|
||||
|
||||
#define PR_CONTEXT_TYPE jmp_buf
|
||||
|
||||
#define CONTEXT(_th) ((_th)->md.context)
|
||||
#define _MD_GET_SP(_th) (((struct sigcontext *) (_th)->md.context)->sc_onstack)
|
||||
#define PR_NUM_GCREGS _JBLEN
|
||||
|
||||
/*
|
||||
** Initialize a thread context to run "_main()" when started
|
||||
*/
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
{ \
|
||||
*status = PR_TRUE; \
|
||||
if (setjmp(CONTEXT(_thread))) { \
|
||||
_main(); \
|
||||
} \
|
||||
_MD_GET_SP(_thread) = (unsigned char*) ((_sp) - 64); \
|
||||
}
|
||||
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
if (!setjmp(CONTEXT(_thread))) { \
|
||||
(_thread)->md.errcode = errno; \
|
||||
_PR_Schedule(); \
|
||||
}
|
||||
|
||||
/*
|
||||
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
|
||||
*/
|
||||
#define _MD_RESTORE_CONTEXT(_thread) \
|
||||
{ \
|
||||
errno = (_thread)->md.errcode; \
|
||||
_MD_SET_CURRENT_THREAD(_thread); \
|
||||
longjmp(CONTEXT(_thread), 1); \
|
||||
}
|
||||
|
||||
/* Machine-dependent (MD) data structures */
|
||||
|
||||
struct _MDThread {
|
||||
PR_CONTEXT_TYPE context;
|
||||
int id;
|
||||
int errcode;
|
||||
};
|
||||
|
||||
struct _MDThreadStack {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDLock {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSemaphore {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDCVar {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSegment {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
/*
|
||||
* md-specific cpu structure field
|
||||
*/
|
||||
#define _PR_MD_MAX_OSFD FD_SETSIZE
|
||||
|
||||
struct _MDCPU_Unix {
|
||||
PRCList ioQ;
|
||||
PRUint32 ioq_timeout;
|
||||
PRInt32 ioq_max_osfd;
|
||||
PRInt32 ioq_osfd_cnt;
|
||||
#ifndef _PR_USE_POLL
|
||||
fd_set fd_read_set, fd_write_set, fd_exception_set;
|
||||
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
|
||||
fd_exception_cnt[_PR_MD_MAX_OSFD];
|
||||
#else
|
||||
struct pollfd *ioq_pollfds;
|
||||
int ioq_pollfds_size;
|
||||
#endif /* _PR_USE_POLL */
|
||||
};
|
||||
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
|
||||
struct _MDCPU {
|
||||
struct _MDCPU_Unix md_unix;
|
||||
};
|
||||
|
||||
#define _MD_INIT_LOCKS()
|
||||
#define _MD_NEW_LOCK(lock) PR_SUCCESS
|
||||
#define _MD_FREE_LOCK(lock)
|
||||
#define _MD_LOCK(lock)
|
||||
#define _MD_UNLOCK(lock)
|
||||
#define _MD_INIT_IO()
|
||||
#define _MD_IOQ_LOCK()
|
||||
#define _MD_IOQ_UNLOCK()
|
||||
|
||||
extern PRStatus _MD_InitializeThread(PRThread *thread);
|
||||
|
||||
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
|
||||
#define _MD_INIT_THREAD _MD_InitializeThread
|
||||
#define _MD_EXIT_THREAD(thread)
|
||||
#define _MD_SUSPEND_THREAD(thread) _MD_suspend_thread
|
||||
#define _MD_RESUME_THREAD(thread) _MD_resume_thread
|
||||
#define _MD_CLEAN_THREAD(_thread)
|
||||
|
||||
extern PRStatus _MD_CREATE_THREAD(
|
||||
PRThread *thread,
|
||||
void (*start) (void *),
|
||||
PRThreadPriority priority,
|
||||
PRThreadScope scope,
|
||||
PRThreadState state,
|
||||
PRUint32 stackSize);
|
||||
extern void _MD_SET_PRIORITY(struct _MDThread *thread, PRUintn newPri);
|
||||
extern PRStatus _MD_WAIT(PRThread *, PRIntervalTime timeout);
|
||||
extern PRStatus _MD_WAKEUP_WAITER(PRThread *);
|
||||
extern void _MD_YIELD(void);
|
||||
|
||||
#endif /* ! _PR_PTHREADS */
|
||||
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
#define _MD_GET_INTERVAL _PR_UNIX_GetInterval
|
||||
#define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond
|
||||
|
||||
extern void _MD_EarlyInit(void);
|
||||
extern PRIntervalTime _PR_UNIX_GetInterval(void);
|
||||
extern PRIntervalTime _PR_UNIX_TicksPerSecond(void);
|
||||
|
||||
/*
|
||||
* We wrapped the select() call. _MD_SELECT refers to the built-in,
|
||||
* unwrapped version.
|
||||
*/
|
||||
#define _MD_SELECT(nfds,r,w,e,tv) syscall(SYS_select,nfds,r,w,e,tv)
|
||||
|
||||
/* For writev() */
|
||||
#include <sys/uio.h>
|
||||
|
||||
#endif /* nspr_rhapsody_defs_h___ */
|
||||
209
Src/nprt_plugin/gecko/1.8/win/include/md/_riscos.h
Normal file
209
Src/nprt_plugin/gecko/1.8/win/include/md/_riscos.h
Normal file
@@ -0,0 +1,209 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Portable Runtime (NSPR).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998-2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s): Peter Naulls <peter@chocky.org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nspr_riscos_defs_h___
|
||||
#define nspr_riscos_defs_h___
|
||||
|
||||
/*
|
||||
** Internal configuration macros
|
||||
*/
|
||||
#define PR_LINKER_ARCH "riscos"
|
||||
#define _PR_SI_SYSNAME "RISCOS"
|
||||
#define _PR_SI_ARCHITECTURE "arm"
|
||||
#define PR_DLL_SUFFIX ".a"
|
||||
|
||||
#define _PR_POLL_AVAILABLE
|
||||
#define _PR_USE_POLL
|
||||
#define _PR_HAVE_SOCKADDR_LEN
|
||||
#undef HAVE_BSD_FLOCK
|
||||
#define _PR_NO_LARGE_FILES
|
||||
#define _PR_STAT_HAS_ONLY_ST_ATIME
|
||||
#define _PR_HAVE_POSIX_SEMAPHORES
|
||||
|
||||
#include <sys/select.h>
|
||||
#include <sys/poll.h>
|
||||
#include <kernel.h>
|
||||
|
||||
|
||||
#undef HAVE_STACK_GROWING_UP
|
||||
#undef HAVE_DLL
|
||||
#undef USE_DLFCN
|
||||
#define NEED_STRFTIME_LOCK
|
||||
#define NEED_TIME_R
|
||||
#define PT_NO_SIGTIMEDWAIT
|
||||
|
||||
#ifndef HAVE_STRERROR
|
||||
#define HAVE_STRERROR
|
||||
#endif
|
||||
|
||||
#define USE_SETJMP
|
||||
|
||||
#include <setjmp.h>
|
||||
|
||||
#define _SETJMP setjmp
|
||||
#define _LONGJMP longjmp
|
||||
#define _PR_CONTEXT_TYPE jmp_buf
|
||||
#define _PR_NUM_GCREGS _JBLEN
|
||||
#define _MD_GET_SP(_t) (_t)->md.context[7]
|
||||
|
||||
#define CONTEXT(_th) ((_th)->md.context)
|
||||
|
||||
|
||||
/*
|
||||
** Initialize the thread context preparing it to execute _main.
|
||||
*/
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
{ \
|
||||
*status = PR_TRUE; \
|
||||
if(_SETJMP(CONTEXT(_thread))) (*_main)(); \
|
||||
_MD_GET_SP(_thread) = (int) ((_sp) - 128); \
|
||||
}
|
||||
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
if (!_SETJMP(CONTEXT(_thread))) { \
|
||||
(_thread)->md.errcode = errno; \
|
||||
_PR_Schedule(); \
|
||||
}
|
||||
|
||||
/*
|
||||
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
|
||||
*/
|
||||
#define _MD_RESTORE_CONTEXT(_thread) \
|
||||
{ \
|
||||
errno = (_thread)->md.errcode; \
|
||||
_MD_SET_CURRENT_THREAD(_thread); \
|
||||
_LONGJMP(CONTEXT(_thread), 1); \
|
||||
}
|
||||
|
||||
/*
|
||||
** Machine-dependent (MD) data structures.
|
||||
*/
|
||||
struct _MDThread {
|
||||
_PR_CONTEXT_TYPE context;
|
||||
int id;
|
||||
int errcode;
|
||||
};
|
||||
|
||||
struct _MDThreadStack {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDLock {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSemaphore {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDCVar {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSegment {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
/*
|
||||
** md-specific cpu structure field
|
||||
*/
|
||||
#define _PR_MD_MAX_OSFD FD_SETSIZE
|
||||
|
||||
struct _MDCPU_Unix {
|
||||
PRCList ioQ;
|
||||
PRUint32 ioq_timeout;
|
||||
PRInt32 ioq_max_osfd;
|
||||
PRInt32 ioq_osfd_cnt;
|
||||
#ifndef _PR_USE_POLL
|
||||
fd_set fd_read_set, fd_write_set, fd_exception_set;
|
||||
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD], fd_write_cnt[_PR_MD_MAX_OSFD], fd_exception_cnt[_PR_MD_MAX_OSFD];
|
||||
#else
|
||||
struct pollfd *ioq_pollfds;
|
||||
int ioq_pollfds_size;
|
||||
#endif
|
||||
};
|
||||
|
||||
#define _PR_IOQ(_cpu) /* */ ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
|
||||
struct _MDCPU {
|
||||
struct _MDCPU_Unix md_unix;
|
||||
};
|
||||
|
||||
#define _MD_INIT_LOCKS()
|
||||
#define _MD_NEW_LOCK(lock) PR_SUCCESS
|
||||
#define _MD_FREE_LOCK(lock)
|
||||
#define _MD_LOCK(lock)
|
||||
#define _MD_UNLOCK(lock)
|
||||
#define _MD_INIT_IO()
|
||||
#define _MD_IOQ_LOCK()
|
||||
#define _MD_IOQ_UNLOCK()
|
||||
|
||||
#define _MD_GET_INTERVAL _PR_UNIX_GetInterval
|
||||
#define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
|
||||
#define _MD_INIT_THREAD _MD_InitializeThread
|
||||
#define _MD_EXIT_THREAD(thread)
|
||||
#define _MD_SUSPEND_THREAD(thread)
|
||||
#define _MD_RESUME_THREAD(thread)
|
||||
#define _MD_CLEAN_THREAD(_thread)
|
||||
|
||||
/*
|
||||
** We wrapped the select() call. _MD_SELECT refers to the built-in,
|
||||
** unwrapped version.
|
||||
*/
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/select.h>
|
||||
#define _MD_SELECT select
|
||||
|
||||
#endif /* nspr_riscos_defs_h___ */
|
||||
204
Src/nprt_plugin/gecko/1.8/win/include/md/_scoos.h
Normal file
204
Src/nprt_plugin/gecko/1.8/win/include/md/_scoos.h
Normal file
@@ -0,0 +1,204 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Portable Runtime (NSPR).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998-2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nspr_scoos5_defs_h___
|
||||
#define nspr_scoos5_defs_h___
|
||||
|
||||
/*
|
||||
* Internal configuration macros
|
||||
*/
|
||||
|
||||
#define PR_LINKER_ARCH "scoos5"
|
||||
#define PR_DLL_SUFFIX ".so"
|
||||
|
||||
#define _PR_SI_SYSNAME "SCO"
|
||||
#define _PR_SI_ARCHITECTURE "x86"
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
|
||||
#define _MD_DEFAULT_STACK_SIZE 65536L
|
||||
#define _MD_MMAP_FLAGS MAP_PRIVATE
|
||||
|
||||
#undef HAVE_STACK_GROWING_UP
|
||||
#define HAVE_DLL
|
||||
#define USE_DLFCN
|
||||
|
||||
#if !defined (HAVE_STRERROR)
|
||||
#define HAVE_STRERROR
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_WEAK_IO_SYMBOLS
|
||||
#define HAVE_WEAK_IO_SYMBOLS
|
||||
#endif
|
||||
|
||||
#define _PR_POLL_AVAILABLE
|
||||
#define _PR_USE_POLL
|
||||
#define _PR_NO_LARGE_FILES
|
||||
#define _PR_STAT_HAS_ONLY_ST_ATIME
|
||||
|
||||
#define NEED_STRFTIME_LOCK
|
||||
#define NEED_TIME_R
|
||||
#define _PR_RECV_BROKEN /* recv doesn't work on Unix Domain Sockets */
|
||||
|
||||
#define USE_SETJMP
|
||||
|
||||
#ifdef _PR_LOCAL_THREADS_ONLY
|
||||
#include <setjmp.h>
|
||||
|
||||
#define _MD_GET_SP(_t) (_t)->md.jb[4]
|
||||
#define PR_NUM_GCREGS _SIGJBLEN
|
||||
#define PR_CONTEXT_TYPE sigjmp_buf
|
||||
|
||||
#define CONTEXT(_th) ((_th)->md.jb)
|
||||
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
{ \
|
||||
*status = PR_TRUE; \
|
||||
if (sigsetjmp(CONTEXT(_thread),1)) { \
|
||||
(*_main)(); \
|
||||
} \
|
||||
_MD_GET_SP(_thread) = (int) ((_sp) - 64); \
|
||||
}
|
||||
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
if (!sigsetjmp(CONTEXT(_thread), 1)) { \
|
||||
(_thread)->md.errcode = errno; \
|
||||
_PR_Schedule(); \
|
||||
}
|
||||
|
||||
/*
|
||||
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
|
||||
*/
|
||||
#define _MD_RESTORE_CONTEXT(_thread) \
|
||||
{ \
|
||||
errno = (_thread)->osErrorCode; \
|
||||
_MD_SET_CURRENT_THREAD(_thread); \
|
||||
siglongjmp(CONTEXT(_thread), 1); \
|
||||
}
|
||||
|
||||
#endif /* _PR_LOCAL_THREADS_ONLY */
|
||||
|
||||
struct _MDThread {
|
||||
jmp_buf jb;
|
||||
int id;
|
||||
int errcode;
|
||||
};
|
||||
|
||||
struct _MDThreadStack {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDLock {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSemaphore {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDCVar {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSegment {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
/*
|
||||
* md-specific cpu structure field
|
||||
*/
|
||||
#define _PR_MD_MAX_OSFD FD_SETSIZE
|
||||
|
||||
struct _MDCPU_Unix {
|
||||
PRCList ioQ;
|
||||
PRUint32 ioq_timeout;
|
||||
PRInt32 ioq_max_osfd;
|
||||
PRInt32 ioq_osfd_cnt;
|
||||
#ifndef _PR_USE_POLL
|
||||
fd_set fd_read_set, fd_write_set, fd_exception_set;
|
||||
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
|
||||
fd_exception_cnt[_PR_MD_MAX_OSFD];
|
||||
#else
|
||||
struct pollfd *ioq_pollfds;
|
||||
int ioq_pollfds_size;
|
||||
#endif /* _PR_USE_POLL */
|
||||
};
|
||||
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
|
||||
struct _MDCPU {
|
||||
struct _MDCPU_Unix md_unix;
|
||||
};
|
||||
|
||||
#define _MD_INIT_LOCKS()
|
||||
#define _MD_NEW_LOCK(lock) PR_SUCCESS
|
||||
#define _MD_FREE_LOCK(lock)
|
||||
#define _MD_LOCK(lock)
|
||||
#define _MD_UNLOCK(lock)
|
||||
#define _MD_INIT_IO()
|
||||
#define _MD_IOQ_LOCK()
|
||||
#define _MD_IOQ_UNLOCK()
|
||||
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
|
||||
#define _MD_INIT_THREAD _MD_InitializeThread
|
||||
#define _MD_EXIT_THREAD(thread)
|
||||
#define _MD_SUSPEND_THREAD(thread)
|
||||
#define _MD_RESUME_THREAD(thread)
|
||||
#define _MD_CLEAN_THREAD(_thread)
|
||||
|
||||
#define _MD_GET_INTERVAL _PR_UNIX_GetInterval
|
||||
#define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond
|
||||
|
||||
#define _MD_SELECT _select
|
||||
#define _MD_POLL _poll
|
||||
|
||||
#endif /* nspr_scoos5_defs_h___ */
|
||||
806
Src/nprt_plugin/gecko/1.8/win/include/md/_solaris.h
Normal file
806
Src/nprt_plugin/gecko/1.8/win/include/md/_solaris.h
Normal file
@@ -0,0 +1,806 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Portable Runtime (NSPR).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998-2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nspr_solaris_defs_h___
|
||||
#define nspr_solaris_defs_h___
|
||||
|
||||
/*
|
||||
* Internal configuration macros
|
||||
*/
|
||||
|
||||
#define PR_LINKER_ARCH "solaris"
|
||||
#define _PR_SI_SYSNAME "SOLARIS"
|
||||
#ifdef sparc
|
||||
#define _PR_SI_ARCHITECTURE "sparc"
|
||||
#elif defined(__x86_64)
|
||||
#define _PR_SI_ARCHITECTURE "x86-64"
|
||||
#elif defined(i386)
|
||||
#define _PR_SI_ARCHITECTURE "x86"
|
||||
#else
|
||||
#error unknown processor
|
||||
#endif
|
||||
#define PR_DLL_SUFFIX ".so"
|
||||
|
||||
#define _PR_VMBASE 0x30000000
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
#define _MD_DEFAULT_STACK_SIZE (2*65536L)
|
||||
#define _MD_MMAP_FLAGS MAP_SHARED
|
||||
|
||||
#undef HAVE_STACK_GROWING_UP
|
||||
|
||||
#ifndef HAVE_WEAK_IO_SYMBOLS
|
||||
#define HAVE_WEAK_IO_SYMBOLS
|
||||
#endif
|
||||
|
||||
#undef HAVE_WEAK_MALLOC_SYMBOLS
|
||||
#define HAVE_DLL
|
||||
#define USE_DLFCN
|
||||
#define NEED_STRFTIME_LOCK
|
||||
|
||||
/*
|
||||
* Intel x86 has atomic instructions.
|
||||
*
|
||||
* Sparc v8 does not have instructions to efficiently implement
|
||||
* atomic increment/decrement operations. In the local threads
|
||||
* only and pthreads versions, we use the default atomic routine
|
||||
* implementation in pratom.c. The obsolete global threads only
|
||||
* version uses a global mutex_t to implement the atomic routines
|
||||
* in solaris.c, which is actually equivalent to the default
|
||||
* implementation.
|
||||
*
|
||||
* 64-bit Solaris requires sparc v9, which has atomic instructions.
|
||||
*/
|
||||
#if defined(i386) || defined(_PR_GLOBAL_THREADS_ONLY) || defined(IS_64)
|
||||
#define _PR_HAVE_ATOMIC_OPS
|
||||
#endif
|
||||
|
||||
#define _PR_POLL_AVAILABLE
|
||||
#define _PR_USE_POLL
|
||||
#define _PR_STAT_HAS_ST_ATIM
|
||||
#ifdef SOLARIS2_5
|
||||
#define _PR_HAVE_SYSV_SEMAPHORES
|
||||
#define PR_HAVE_SYSV_NAMED_SHARED_MEMORY
|
||||
#else
|
||||
#define _PR_HAVE_POSIX_SEMAPHORES
|
||||
#define PR_HAVE_POSIX_NAMED_SHARED_MEMORY
|
||||
#endif
|
||||
#define _PR_HAVE_GETIPNODEBYNAME
|
||||
#define _PR_HAVE_GETIPNODEBYADDR
|
||||
#define _PR_HAVE_GETADDRINFO
|
||||
#define _PR_INET6_PROBE
|
||||
#define _PR_ACCEPT_INHERIT_NONBLOCK
|
||||
#ifdef _PR_INET6
|
||||
#define _PR_HAVE_INET_NTOP
|
||||
#else
|
||||
#define AF_INET6 26
|
||||
struct addrinfo {
|
||||
int ai_flags;
|
||||
int ai_family;
|
||||
int ai_socktype;
|
||||
int ai_protocol;
|
||||
size_t ai_addrlen;
|
||||
char *ai_canonname;
|
||||
struct sockaddr *ai_addr;
|
||||
struct addrinfo *ai_next;
|
||||
};
|
||||
#define AI_CANONNAME 0x0010
|
||||
#define AI_V4MAPPED 0x0001
|
||||
#define AI_ALL 0x0002
|
||||
#define AI_ADDRCONFIG 0x0004
|
||||
#define _PR_HAVE_MD_SOCKADDR_IN6
|
||||
/* isomorphic to struct in6_addr on Solaris 8 */
|
||||
struct _md_in6_addr {
|
||||
union {
|
||||
PRUint8 _S6_u8[16];
|
||||
PRUint32 _S6_u32[4];
|
||||
PRUint32 __S6_align;
|
||||
} _S6_un;
|
||||
};
|
||||
/* isomorphic to struct sockaddr_in6 on Solaris 8 */
|
||||
struct _md_sockaddr_in6 {
|
||||
PRUint16 sin6_family;
|
||||
PRUint16 sin6_port;
|
||||
PRUint32 sin6_flowinfo;
|
||||
struct _md_in6_addr sin6_addr;
|
||||
PRUint32 sin6_scope_id;
|
||||
PRUint32 __sin6_src_id;
|
||||
};
|
||||
#endif
|
||||
#if defined(_PR_GLOBAL_THREADS_ONLY) || defined(_PR_PTHREADS)
|
||||
#define _PR_HAVE_GETHOST_R
|
||||
#define _PR_HAVE_GETHOST_R_POINTER
|
||||
#endif
|
||||
|
||||
#include "prinrval.h"
|
||||
NSPR_API(PRIntervalTime) _MD_Solaris_GetInterval(void);
|
||||
#define _MD_GET_INTERVAL _MD_Solaris_GetInterval
|
||||
NSPR_API(PRIntervalTime) _MD_Solaris_TicksPerSecond(void);
|
||||
#define _MD_INTERVAL_PER_SEC _MD_Solaris_TicksPerSecond
|
||||
|
||||
#if defined(_PR_HAVE_ATOMIC_OPS)
|
||||
/*
|
||||
** Atomic Operations
|
||||
*/
|
||||
#define _MD_INIT_ATOMIC()
|
||||
|
||||
NSPR_API(PRInt32) _MD_AtomicIncrement(PRInt32 *val);
|
||||
#define _MD_ATOMIC_INCREMENT _MD_AtomicIncrement
|
||||
|
||||
NSPR_API(PRInt32) _MD_AtomicAdd(PRInt32 *ptr, PRInt32 val);
|
||||
#define _MD_ATOMIC_ADD _MD_AtomicAdd
|
||||
|
||||
NSPR_API(PRInt32) _MD_AtomicDecrement(PRInt32 *val);
|
||||
#define _MD_ATOMIC_DECREMENT _MD_AtomicDecrement
|
||||
|
||||
NSPR_API(PRInt32) _MD_AtomicSet(PRInt32 *val, PRInt32 newval);
|
||||
#define _MD_ATOMIC_SET _MD_AtomicSet
|
||||
#endif /* _PR_HAVE_ATOMIC_OPS */
|
||||
|
||||
#if defined(_PR_PTHREADS)
|
||||
|
||||
NSPR_API(void) _MD_EarlyInit(void);
|
||||
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
|
||||
#elif defined(_PR_GLOBAL_THREADS_ONLY)
|
||||
|
||||
#include "prthread.h"
|
||||
|
||||
#include <ucontext.h>
|
||||
|
||||
/*
|
||||
** Iinitialization Related definitions
|
||||
*/
|
||||
|
||||
NSPR_API(void) _MD_EarlyInit(void);
|
||||
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
|
||||
#define _MD_GET_SP(threadp) threadp->md.sp
|
||||
|
||||
/*
|
||||
** Clean-up the thread machine dependent data structure
|
||||
*/
|
||||
#define _MD_INIT_THREAD _MD_InitializeThread
|
||||
#define _MD_INIT_ATTACHED_THREAD _MD_InitializeThread
|
||||
|
||||
NSPR_API(PRStatus) _MD_CreateThread(PRThread *thread,
|
||||
void (*start)(void *),
|
||||
PRThreadPriority priority,
|
||||
PRThreadScope scope,
|
||||
PRThreadState state,
|
||||
PRUint32 stackSize);
|
||||
#define _MD_CREATE_THREAD _MD_CreateThread
|
||||
|
||||
#define _PR_CONTEXT_TYPE ucontext_t
|
||||
|
||||
#define CONTEXT(_thread) (&(_thread)->md.context)
|
||||
|
||||
#include <thread.h>
|
||||
#include <sys/lwp.h>
|
||||
#include <synch.h>
|
||||
|
||||
extern struct PRLock *_pr_schedLock;
|
||||
|
||||
/*
|
||||
** Thread Local Storage
|
||||
*/
|
||||
|
||||
#define THREAD_KEY_T thread_key_t
|
||||
|
||||
extern struct PRThread *_pr_attached_thread_tls();
|
||||
extern struct PRThread *_pr_current_thread_tls();
|
||||
extern struct _PRCPU *_pr_current_cpu_tls();
|
||||
extern struct PRThread *_pr_last_thread_tls();
|
||||
|
||||
extern THREAD_KEY_T threadid_key;
|
||||
extern THREAD_KEY_T cpuid_key;
|
||||
extern THREAD_KEY_T last_thread_key;
|
||||
|
||||
#define _MD_GET_ATTACHED_THREAD() _pr_attached_thread_tls()
|
||||
#define _MD_CURRENT_THREAD() _pr_current_thread_tls()
|
||||
#define _MD_CURRENT_CPU() _pr_current_cpu_tls()
|
||||
#define _MD_LAST_THREAD() _pr_last_thread_tls()
|
||||
|
||||
#define _MD_SET_CURRENT_THREAD(newval) \
|
||||
PR_BEGIN_MACRO \
|
||||
thr_setspecific(threadid_key, (void *)newval); \
|
||||
PR_END_MACRO
|
||||
|
||||
#define _MD_SET_CURRENT_CPU(newval) \
|
||||
PR_BEGIN_MACRO \
|
||||
thr_setspecific(cpuid_key, (void *)newval); \
|
||||
PR_END_MACRO
|
||||
|
||||
#define _MD_SET_LAST_THREAD(newval) \
|
||||
PR_BEGIN_MACRO \
|
||||
thr_setspecific(last_thread_key, (void *)newval); \
|
||||
PR_END_MACRO
|
||||
|
||||
#define _MD_CLEAN_THREAD(_thread) _MD_cleanup_thread(_thread)
|
||||
extern void _MD_exit_thread(PRThread *thread);
|
||||
#define _MD_EXIT_THREAD(thread) _MD_exit_thread(thread)
|
||||
|
||||
#define _MD_SUSPEND_THREAD(thread) _MD_Suspend(thread)
|
||||
#define _MD_RESUME_THREAD(thread) thr_continue((thread)->md.handle)
|
||||
|
||||
/* XXXX Needs to be defined - Prashant */
|
||||
#define _MD_SUSPEND_CPU(cpu)
|
||||
#define _MD_RESUME_CPU(cpu)
|
||||
|
||||
extern void _MD_Begin_SuspendAll(void);
|
||||
extern void _MD_End_SuspendAll(void);
|
||||
extern void _MD_End_ResumeAll(void);
|
||||
#define _MD_BEGIN_SUSPEND_ALL() _MD_Begin_SuspendAll()
|
||||
#define _MD_BEGIN_RESUME_ALL()
|
||||
#define _MD_END_SUSPEND_ALL() _MD_End_SuspendAll()
|
||||
#define _MD_END_RESUME_ALL() _MD_End_ResumeAll()
|
||||
|
||||
#define _MD_INIT_LOCKS()
|
||||
#define _MD_NEW_LOCK(md_lockp) (mutex_init(&((md_lockp)->lock),USYNC_THREAD,NULL) ? PR_FAILURE : PR_SUCCESS)
|
||||
#define _MD_FREE_LOCK(md_lockp) mutex_destroy(&((md_lockp)->lock))
|
||||
#define _MD_UNLOCK(md_lockp) mutex_unlock(&((md_lockp)->lock))
|
||||
#define _MD_TEST_AND_LOCK(md_lockp) mutex_trylock(&((md_lockp)->lock))
|
||||
struct _MDLock;
|
||||
NSPR_API(void) _MD_lock(struct _MDLock *md_lock);
|
||||
#undef PROFILE_LOCKS
|
||||
#ifndef PROFILE_LOCKS
|
||||
#define _MD_LOCK(md_lockp) _MD_lock(md_lockp)
|
||||
#else
|
||||
#define _MD_LOCK(md_lockp) \
|
||||
PR_BEGIN_MACRO \
|
||||
int rv = _MD_TEST_AND_LOCK(md_lockp); \
|
||||
if (rv == 0) { \
|
||||
(md_lockp)->hitcount++; \
|
||||
} else { \
|
||||
(md_lockp)->misscount++; \
|
||||
_MD_lock(md_lockp); \
|
||||
} \
|
||||
PR_END_MACRO
|
||||
#endif
|
||||
|
||||
#define _PR_LOCK_HEAP() if (_pr_heapLock) _MD_LOCK(&_pr_heapLock->md)
|
||||
#define _PR_UNLOCK_HEAP() if (_pr_heapLock) _MD_UNLOCK(&_pr_heapLock->md)
|
||||
|
||||
#define _MD_ATTACH_THREAD(threadp)
|
||||
|
||||
|
||||
#define THR_KEYCREATE thr_keycreate
|
||||
#define THR_SELF thr_self
|
||||
#define _MD_NEW_CV(condp) cond_init(&((condp)->cv), USYNC_THREAD, 0)
|
||||
#define COND_WAIT(condp, mutexp) cond_wait(condp, mutexp)
|
||||
#define COND_TIMEDWAIT(condp, mutexp, tspec) \
|
||||
cond_timedwait(condp, mutexp, tspec)
|
||||
#define _MD_NOTIFY_CV(condp, lockp) cond_signal(&((condp)->cv))
|
||||
#define _MD_NOTIFYALL_CV(condp,unused) cond_broadcast(&((condp)->cv))
|
||||
#define _MD_FREE_CV(condp) cond_destroy(&((condp)->cv))
|
||||
#define _MD_YIELD() thr_yield()
|
||||
#include <time.h>
|
||||
/*
|
||||
* Because clock_gettime() on Solaris/x86 2.4 always generates a
|
||||
* segmentation fault, we use an emulated version _pr_solx86_clock_gettime(),
|
||||
* which is implemented using gettimeofday().
|
||||
*/
|
||||
#if defined(i386) && defined(SOLARIS2_4)
|
||||
extern int _pr_solx86_clock_gettime(clockid_t clock_id, struct timespec *tp);
|
||||
#define GETTIME(tt) _pr_solx86_clock_gettime(CLOCK_REALTIME, (tt))
|
||||
#else
|
||||
#define GETTIME(tt) clock_gettime(CLOCK_REALTIME, (tt))
|
||||
#endif /* i386 && SOLARIS2_4 */
|
||||
|
||||
#define MUTEX_T mutex_t
|
||||
#define COND_T cond_t
|
||||
|
||||
#define _MD_NEW_SEM(md_semp,_val) sema_init(&((md_semp)->sem),_val,USYNC_THREAD,NULL)
|
||||
#define _MD_DESTROY_SEM(md_semp) sema_destroy(&((md_semp)->sem))
|
||||
#define _MD_WAIT_SEM(md_semp) sema_wait(&((md_semp)->sem))
|
||||
#define _MD_POST_SEM(md_semp) sema_post(&((md_semp)->sem))
|
||||
|
||||
#define _MD_SAVE_ERRNO(_thread)
|
||||
#define _MD_RESTORE_ERRNO(_thread)
|
||||
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
|
||||
|
||||
extern struct _MDLock _pr_ioq_lock;
|
||||
#define _MD_IOQ_LOCK() _MD_LOCK(&_pr_ioq_lock)
|
||||
#define _MD_IOQ_UNLOCK() _MD_UNLOCK(&_pr_ioq_lock)
|
||||
|
||||
extern PRStatus _MD_wait(struct PRThread *, PRIntervalTime timeout);
|
||||
#define _MD_WAIT _MD_wait
|
||||
|
||||
extern PRStatus _MD_WakeupWaiter(struct PRThread *);
|
||||
#define _MD_WAKEUP_WAITER _MD_WakeupWaiter
|
||||
|
||||
NSPR_API(void) _MD_InitIO(void);
|
||||
#define _MD_INIT_IO _MD_InitIO
|
||||
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
PR_BEGIN_MACRO \
|
||||
*status = PR_TRUE; \
|
||||
PR_END_MACRO
|
||||
#define _MD_SWITCH_CONTEXT(_thread)
|
||||
#define _MD_RESTORE_CONTEXT(_newThread)
|
||||
|
||||
struct _MDLock {
|
||||
MUTEX_T lock;
|
||||
#ifdef PROFILE_LOCKS
|
||||
PRInt32 hitcount;
|
||||
PRInt32 misscount;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct _MDCVar {
|
||||
COND_T cv;
|
||||
};
|
||||
|
||||
struct _MDSemaphore {
|
||||
sema_t sem;
|
||||
};
|
||||
|
||||
struct _MDThread {
|
||||
_PR_CONTEXT_TYPE context;
|
||||
thread_t handle;
|
||||
lwpid_t lwpid;
|
||||
uint_t sp; /* stack pointer */
|
||||
uint_t threadID; /* ptr to solaris-internal thread id structures */
|
||||
struct _MDSemaphore waiter_sem;
|
||||
};
|
||||
|
||||
struct _MDThreadStack {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSegment {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
/*
|
||||
* md-specific cpu structure field, common to all Unix platforms
|
||||
*/
|
||||
#define _PR_MD_MAX_OSFD FD_SETSIZE
|
||||
|
||||
struct _MDCPU_Unix {
|
||||
PRCList ioQ;
|
||||
PRUint32 ioq_timeout;
|
||||
PRInt32 ioq_max_osfd;
|
||||
PRInt32 ioq_osfd_cnt;
|
||||
#ifndef _PR_USE_POLL
|
||||
fd_set fd_read_set, fd_write_set, fd_exception_set;
|
||||
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
|
||||
fd_exception_cnt[_PR_MD_MAX_OSFD];
|
||||
#else
|
||||
struct pollfd *ioq_pollfds;
|
||||
int ioq_pollfds_size;
|
||||
#endif /* _PR_USE_POLL */
|
||||
};
|
||||
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
|
||||
|
||||
struct _MDCPU {
|
||||
struct _MDCPU_Unix md_unix;
|
||||
};
|
||||
|
||||
/* The following defines the unwrapped versions of select() and poll(). */
|
||||
extern int _select(int nfds, fd_set *readfds, fd_set *writefds,
|
||||
fd_set *exceptfds, struct timeval *timeout);
|
||||
#define _MD_SELECT _select
|
||||
|
||||
#include <poll.h>
|
||||
#define _MD_POLL _poll
|
||||
extern int _poll(struct pollfd *fds, unsigned long nfds, int timeout);
|
||||
|
||||
PR_BEGIN_EXTERN_C
|
||||
|
||||
/*
|
||||
** Missing function prototypes
|
||||
*/
|
||||
extern int gethostname (char *name, int namelen);
|
||||
|
||||
PR_END_EXTERN_C
|
||||
|
||||
#else /* _PR_GLOBAL_THREADS_ONLY */
|
||||
|
||||
/*
|
||||
* LOCAL_THREADS_ONLY implementation on Solaris
|
||||
*/
|
||||
|
||||
#include "prthread.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <ucontext.h>
|
||||
#include <sys/stack.h>
|
||||
#include <synch.h>
|
||||
|
||||
/*
|
||||
** Iinitialization Related definitions
|
||||
*/
|
||||
|
||||
NSPR_API(void) _MD_EarlyInit(void);
|
||||
NSPR_API(void) _MD_SolarisInit();
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _MD_SolarisInit
|
||||
#define _MD_INIT_THREAD _MD_InitializeThread
|
||||
|
||||
#ifdef USE_SETJMP
|
||||
|
||||
#include <setjmp.h>
|
||||
|
||||
#define _PR_CONTEXT_TYPE jmp_buf
|
||||
|
||||
#ifdef sparc
|
||||
#define _MD_GET_SP(_t) (_t)->md.context[2]
|
||||
#else
|
||||
#define _MD_GET_SP(_t) (_t)->md.context[4]
|
||||
#endif
|
||||
|
||||
#define PR_NUM_GCREGS _JBLEN
|
||||
#define CONTEXT(_thread) (_thread)->md.context
|
||||
|
||||
#else /* ! USE_SETJMP */
|
||||
|
||||
#ifdef sparc
|
||||
#define _PR_CONTEXT_TYPE ucontext_t
|
||||
#define _MD_GET_SP(_t) (_t)->md.context.uc_mcontext.gregs[REG_SP]
|
||||
/*
|
||||
** Sparc's use register windows. the _MD_GetRegisters for the sparc's
|
||||
** doesn't actually store anything into the argument buffer; instead the
|
||||
** register windows are homed to the stack. I assume that the stack
|
||||
** always has room for the registers to spill to...
|
||||
*/
|
||||
#define PR_NUM_GCREGS 0
|
||||
#else
|
||||
#define _PR_CONTEXT_TYPE unsigned int edi; sigset_t oldMask, blockMask; ucontext_t
|
||||
#define _MD_GET_SP(_t) (_t)->md.context.uc_mcontext.gregs[USP]
|
||||
#define PR_NUM_GCREGS _JBLEN
|
||||
#endif
|
||||
|
||||
#define CONTEXT(_thread) (&(_thread)->md.context)
|
||||
|
||||
#endif /* ! USE_SETJMP */
|
||||
|
||||
#include <time.h>
|
||||
/*
|
||||
* Because clock_gettime() on Solaris/x86 always generates a
|
||||
* segmentation fault, we use an emulated version _pr_solx86_clock_gettime(),
|
||||
* which is implemented using gettimeofday().
|
||||
*/
|
||||
#ifdef i386
|
||||
#define GETTIME(tt) _pr_solx86_clock_gettime(CLOCK_REALTIME, (tt))
|
||||
#else
|
||||
#define GETTIME(tt) clock_gettime(CLOCK_REALTIME, (tt))
|
||||
#endif /* i386 */
|
||||
|
||||
#define _MD_SAVE_ERRNO(_thread) (_thread)->md.errcode = errno;
|
||||
#define _MD_RESTORE_ERRNO(_thread) errno = (_thread)->md.errcode;
|
||||
|
||||
#ifdef sparc
|
||||
|
||||
#ifdef USE_SETJMP
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
PR_BEGIN_MACRO \
|
||||
int *context = (_thread)->md.context; \
|
||||
*status = PR_TRUE; \
|
||||
(void) setjmp(context); \
|
||||
(_thread)->md.context[1] = (int) ((_sp) - 64); \
|
||||
(_thread)->md.context[2] = (int) _main; \
|
||||
(_thread)->md.context[3] = (int) _main + 4; \
|
||||
_thread->no_sched = 0; \
|
||||
PR_END_MACRO
|
||||
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
if (!setjmp(CONTEXT(_thread))) { \
|
||||
_MD_SAVE_ERRNO(_thread) \
|
||||
_MD_SET_LAST_THREAD(_thread); \
|
||||
_MD_SET_CURRENT_THREAD(_thread); \
|
||||
_PR_Schedule(); \
|
||||
}
|
||||
|
||||
#define _MD_RESTORE_CONTEXT(_newThread) \
|
||||
{ \
|
||||
_MD_RESTORE_ERRNO(_newThread) \
|
||||
_MD_SET_CURRENT_THREAD(_newThread); \
|
||||
longjmp(CONTEXT(_newThread), 1); \
|
||||
}
|
||||
|
||||
#else
|
||||
/*
|
||||
** Initialize the thread context preparing it to execute _main.
|
||||
*/
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
PR_BEGIN_MACRO \
|
||||
ucontext_t *uc = CONTEXT(_thread); \
|
||||
*status = PR_TRUE; \
|
||||
getcontext(uc); \
|
||||
uc->uc_stack.ss_sp = (char *) ((unsigned long)(_sp - WINDOWSIZE - SA(MINFRAME)) & 0xfffffff8); \
|
||||
uc->uc_stack.ss_size = _thread->stack->stackSize; \
|
||||
uc->uc_stack.ss_flags = 0; /* ? */ \
|
||||
uc->uc_mcontext.gregs[REG_SP] = (unsigned int) uc->uc_stack.ss_sp; \
|
||||
uc->uc_mcontext.gregs[REG_PC] = (unsigned int) _main; \
|
||||
uc->uc_mcontext.gregs[REG_nPC] = (unsigned int) ((char*)_main)+4; \
|
||||
uc->uc_flags = UC_ALL; \
|
||||
_thread->no_sched = 0; \
|
||||
PR_END_MACRO
|
||||
|
||||
/*
|
||||
** Switch away from the current thread context by saving its state and
|
||||
** calling the thread scheduler. Reload cpu when we come back from the
|
||||
** context switch because it might have changed.
|
||||
*/
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
PR_BEGIN_MACRO \
|
||||
if (!getcontext(CONTEXT(_thread))) { \
|
||||
_MD_SAVE_ERRNO(_thread); \
|
||||
_MD_SET_LAST_THREAD(_thread); \
|
||||
_PR_Schedule(); \
|
||||
} \
|
||||
PR_END_MACRO
|
||||
|
||||
/*
|
||||
** Restore a thread context that was saved by _MD_SWITCH_CONTEXT or
|
||||
** initialized by _MD_INIT_CONTEXT.
|
||||
*/
|
||||
#define _MD_RESTORE_CONTEXT(_newThread) \
|
||||
PR_BEGIN_MACRO \
|
||||
ucontext_t *uc = CONTEXT(_newThread); \
|
||||
uc->uc_mcontext.gregs[11] = 1; \
|
||||
_MD_RESTORE_ERRNO(_newThread); \
|
||||
_MD_SET_CURRENT_THREAD(_newThread); \
|
||||
setcontext(uc); \
|
||||
PR_END_MACRO
|
||||
#endif
|
||||
|
||||
#else /* x86 solaris */
|
||||
|
||||
#ifdef USE_SETJMP
|
||||
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
PR_BEGIN_MACRO \
|
||||
*status = PR_TRUE; \
|
||||
if (setjmp(CONTEXT(_thread))) _main(); \
|
||||
_MD_GET_SP(_thread) = (int) ((_sp) - 64); \
|
||||
PR_END_MACRO
|
||||
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
if (!setjmp(CONTEXT(_thread))) { \
|
||||
_MD_SAVE_ERRNO(_thread) \
|
||||
_PR_Schedule(); \
|
||||
}
|
||||
|
||||
#define _MD_RESTORE_CONTEXT(_newThread) \
|
||||
{ \
|
||||
_MD_RESTORE_ERRNO(_newThread) \
|
||||
_MD_SET_CURRENT_THREAD(_newThread); \
|
||||
longjmp(CONTEXT(_newThread), 1); \
|
||||
}
|
||||
|
||||
#else /* USE_SETJMP */
|
||||
|
||||
#define WINDOWSIZE 0
|
||||
|
||||
int getedi(void);
|
||||
void setedi(int);
|
||||
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
PR_BEGIN_MACRO \
|
||||
ucontext_t *uc = CONTEXT(_thread); \
|
||||
*status = PR_TRUE; \
|
||||
getcontext(uc); \
|
||||
/* Force sp to be double aligned! */ \
|
||||
uc->uc_mcontext.gregs[USP] = (int) ((unsigned long)(_sp - WINDOWSIZE - SA(MINFRAME)) & 0xfffffff8); \
|
||||
uc->uc_mcontext.gregs[PC] = (int) _main; \
|
||||
(_thread)->no_sched = 0; \
|
||||
PR_END_MACRO
|
||||
|
||||
/* getcontext() may return 1, contrary to what the man page says */
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
PR_BEGIN_MACRO \
|
||||
ucontext_t *uc = CONTEXT(_thread); \
|
||||
PR_ASSERT(_thread->no_sched); \
|
||||
sigfillset(&((_thread)->md.blockMask)); \
|
||||
sigprocmask(SIG_BLOCK, &((_thread)->md.blockMask), \
|
||||
&((_thread)->md.oldMask)); \
|
||||
(_thread)->md.edi = getedi(); \
|
||||
if (! getcontext(uc)) { \
|
||||
sigprocmask(SIG_SETMASK, &((_thread)->md.oldMask), NULL); \
|
||||
uc->uc_mcontext.gregs[EDI] = (_thread)->md.edi; \
|
||||
_MD_SAVE_ERRNO(_thread) \
|
||||
_MD_SET_LAST_THREAD(_thread); \
|
||||
_PR_Schedule(); \
|
||||
} else { \
|
||||
sigprocmask(SIG_SETMASK, &((_thread)->md.oldMask), NULL); \
|
||||
setedi((_thread)->md.edi); \
|
||||
PR_ASSERT(_MD_LAST_THREAD() !=_MD_CURRENT_THREAD()); \
|
||||
_MD_LAST_THREAD()->no_sched = 0; \
|
||||
} \
|
||||
PR_END_MACRO
|
||||
|
||||
/*
|
||||
** Restore a thread context, saved by _PR_SWITCH_CONTEXT
|
||||
*/
|
||||
#define _MD_RESTORE_CONTEXT(_newthread) \
|
||||
PR_BEGIN_MACRO \
|
||||
ucontext_t *uc = CONTEXT(_newthread); \
|
||||
uc->uc_mcontext.gregs[EAX] = 1; \
|
||||
_MD_RESTORE_ERRNO(_newthread) \
|
||||
_MD_SET_CURRENT_THREAD(_newthread); \
|
||||
(_newthread)->no_sched = 1; \
|
||||
setcontext(uc); \
|
||||
PR_END_MACRO
|
||||
#endif /* USE_SETJMP */
|
||||
|
||||
#endif /* sparc */
|
||||
|
||||
struct _MDLock {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDCVar {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSemaphore {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDThread {
|
||||
_PR_CONTEXT_TYPE context;
|
||||
int errcode;
|
||||
int id;
|
||||
};
|
||||
|
||||
struct _MDThreadStack {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSegment {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
/*
|
||||
* md-specific cpu structure field
|
||||
*/
|
||||
#define _PR_MD_MAX_OSFD FD_SETSIZE
|
||||
|
||||
struct _MDCPU_Unix {
|
||||
PRCList ioQ;
|
||||
PRUint32 ioq_timeout;
|
||||
PRInt32 ioq_max_osfd;
|
||||
PRInt32 ioq_osfd_cnt;
|
||||
#ifndef _PR_USE_POLL
|
||||
fd_set fd_read_set, fd_write_set, fd_exception_set;
|
||||
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
|
||||
fd_exception_cnt[_PR_MD_MAX_OSFD];
|
||||
#else
|
||||
struct pollfd *ioq_pollfds;
|
||||
int ioq_pollfds_size;
|
||||
#endif /* _PR_USE_POLL */
|
||||
};
|
||||
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
|
||||
struct _MDCPU {
|
||||
struct _MDCPU_Unix md_unix;
|
||||
};
|
||||
|
||||
#ifndef _PR_PTHREADS
|
||||
#define _MD_INIT_LOCKS()
|
||||
#endif
|
||||
#define _MD_NEW_LOCK(lock) PR_SUCCESS
|
||||
#define _MD_FREE_LOCK(lock)
|
||||
#define _MD_LOCK(lock)
|
||||
#define _MD_UNLOCK(lock)
|
||||
#define _MD_INIT_IO()
|
||||
#define _MD_IOQ_LOCK()
|
||||
#define _MD_IOQ_UNLOCK()
|
||||
|
||||
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
|
||||
#define _MD_INIT_THREAD _MD_InitializeThread
|
||||
#define _MD_EXIT_THREAD(thread)
|
||||
#define _MD_SUSPEND_THREAD(thread)
|
||||
#define _MD_RESUME_THREAD(thread)
|
||||
#define _MD_CLEAN_THREAD(_thread)
|
||||
|
||||
extern PRStatus _MD_WAIT(struct PRThread *, PRIntervalTime timeout);
|
||||
extern PRStatus _MD_WAKEUP_WAITER(struct PRThread *);
|
||||
extern void _MD_YIELD(void);
|
||||
extern PRStatus _MD_InitializeThread(PRThread *thread);
|
||||
extern void _MD_SET_PRIORITY(struct _MDThread *thread,
|
||||
PRThreadPriority newPri);
|
||||
extern PRStatus _MD_CREATE_THREAD(PRThread *thread, void (*start) (void *),
|
||||
PRThreadPriority priority, PRThreadScope scope, PRThreadState state,
|
||||
PRUint32 stackSize);
|
||||
|
||||
NSPR_API(PRIntervalTime) _MD_Solaris_GetInterval(void);
|
||||
#define _MD_GET_INTERVAL _MD_Solaris_GetInterval
|
||||
NSPR_API(PRIntervalTime) _MD_Solaris_TicksPerSecond(void);
|
||||
#define _MD_INTERVAL_PER_SEC _MD_Solaris_TicksPerSecond
|
||||
|
||||
/* The following defines the unwrapped versions of select() and poll(). */
|
||||
extern int _select(int nfds, fd_set *readfds, fd_set *writefds,
|
||||
fd_set *exceptfds, struct timeval *timeout);
|
||||
#define _MD_SELECT _select
|
||||
|
||||
#include <stropts.h>
|
||||
#include <poll.h>
|
||||
#define _MD_POLL _poll
|
||||
extern int _poll(struct pollfd *fds, unsigned long nfds, int timeout);
|
||||
|
||||
PR_BEGIN_EXTERN_C
|
||||
|
||||
/*
|
||||
** Missing function prototypes
|
||||
*/
|
||||
extern int gethostname (char *name, int namelen);
|
||||
|
||||
PR_END_EXTERN_C
|
||||
|
||||
#endif /* _PR_GLOBAL_THREADS_ONLY */
|
||||
|
||||
extern void _MD_solaris_map_sendfile_error(int err);
|
||||
|
||||
#endif /* nspr_solaris_defs_h___ */
|
||||
|
||||
204
Src/nprt_plugin/gecko/1.8/win/include/md/_sony.h
Normal file
204
Src/nprt_plugin/gecko/1.8/win/include/md/_sony.h
Normal file
@@ -0,0 +1,204 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Portable Runtime (NSPR).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998-2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nspr_sony_defs_h___
|
||||
#define nspr_sony_defs_h___
|
||||
|
||||
#define PR_LINKER_ARCH "sony"
|
||||
#define _PR_SI_SYSNAME "SONY"
|
||||
#define _PR_SI_ARCHITECTURE "mips"
|
||||
#define PR_DLL_SUFFIX ".so"
|
||||
|
||||
#define _PR_VMBASE 0x30000000
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
#define _MD_DEFAULT_STACK_SIZE 65536L
|
||||
#define _MD_MMAP_FLAGS MAP_PRIVATE
|
||||
|
||||
#define _MD_GET_INTERVAL _PR_UNIX_GetInterval
|
||||
#define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond
|
||||
|
||||
#if defined(_PR_LOCAL_THREADS_ONLY)
|
||||
#include <ucontext.h>
|
||||
#include <sys/regset.h>
|
||||
|
||||
#define PR_NUM_GCREGS NGREG
|
||||
#define PR_CONTEXT_TYPE ucontext_t
|
||||
|
||||
#define CONTEXT(_thread) (&(_thread)->md.context)
|
||||
|
||||
#define _MD_GET_SP(_t) (_t)->md.context.uc_mcontext.gregs[CXT_SP]
|
||||
|
||||
/*
|
||||
** Initialize the thread context preparing it to execute _main()
|
||||
*/
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
{ \
|
||||
*status = PR_TRUE; \
|
||||
getcontext(CONTEXT(_thread)); \
|
||||
CONTEXT(_thread)->uc_stack.ss_sp = (char*) (_thread)->stack->stackBottom; \
|
||||
CONTEXT(_thread)->uc_stack.ss_size = (_thread)->stack->stackSize; \
|
||||
_MD_GET_SP(_thread) = (greg_t) (_sp) - 64; \
|
||||
makecontext(CONTEXT(_thread), _main, 0); \
|
||||
}
|
||||
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
if (!getcontext(CONTEXT(_thread))) { \
|
||||
(_thread)->md.errcode = errno; \
|
||||
_PR_Schedule(); \
|
||||
}
|
||||
|
||||
/*
|
||||
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
|
||||
*/
|
||||
#define _MD_RESTORE_CONTEXT(_thread) \
|
||||
{ \
|
||||
ucontext_t *uc = CONTEXT(_thread); \
|
||||
uc->uc_mcontext.gregs[CXT_V0] = 1; \
|
||||
uc->uc_mcontext.gregs[CXT_A3] = 0; \
|
||||
_MD_SET_CURRENT_THREAD(_thread); \
|
||||
errno = (_thread)->md.errcode; \
|
||||
setcontext(uc); \
|
||||
}
|
||||
|
||||
/* Machine-dependent (MD) data structures */
|
||||
|
||||
struct _MDThread {
|
||||
PR_CONTEXT_TYPE context;
|
||||
int id;
|
||||
int errcode;
|
||||
};
|
||||
|
||||
struct _MDThreadStack {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDLock {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSemaphore {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDCVar {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSegment {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
/*
|
||||
* md-specific cpu structure field
|
||||
*/
|
||||
#define _PR_MD_MAX_OSFD FD_SETSIZE
|
||||
|
||||
struct _MDCPU_Unix {
|
||||
PRCList ioQ;
|
||||
PRUint32 ioq_timeout;
|
||||
PRInt32 ioq_max_osfd;
|
||||
PRInt32 ioq_osfd_cnt;
|
||||
#ifndef _PR_USE_POLL
|
||||
fd_set fd_read_set, fd_write_set, fd_exception_set;
|
||||
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
|
||||
fd_exception_cnt[_PR_MD_MAX_OSFD];
|
||||
#else
|
||||
struct pollfd *ioq_pollfds;
|
||||
int ioq_pollfds_size;
|
||||
#endif /* _PR_USE_POLL */
|
||||
};
|
||||
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
|
||||
struct _MDCPU {
|
||||
struct _MDCPU_Unix md_unix;
|
||||
};
|
||||
|
||||
#define _MD_INIT_LOCKS()
|
||||
#define _MD_NEW_LOCK(lock) PR_SUCCESS
|
||||
#define _MD_FREE_LOCK(lock)
|
||||
#define _MD_LOCK(lock)
|
||||
#define _MD_UNLOCK(lock)
|
||||
#define _MD_INIT_IO()
|
||||
#define _MD_IOQ_LOCK()
|
||||
#define _MD_IOQ_UNLOCK()
|
||||
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
|
||||
#define _MD_INIT_THREAD _MD_InitializeThread
|
||||
#define _MD_EXIT_THREAD(thread)
|
||||
#define _MD_SUSPEND_THREAD(thread)
|
||||
#define _MD_RESUME_THREAD(thread)
|
||||
#define _MD_CLEAN_THREAD(_thread)
|
||||
|
||||
/* The following defines unwrapped versions of select() and poll(). */
|
||||
extern int _select (int, fd_set *, fd_set *, fd_set *, struct timeval *);
|
||||
#define _MD_SELECT _select
|
||||
|
||||
#include <sys/poll.h>
|
||||
extern int _poll(struct pollfd *fds, unsigned long nfds, int timeout);
|
||||
#define _MD_POLL _poll
|
||||
|
||||
#endif /* _PR_LOCAL_THREADS_ONLY */
|
||||
|
||||
#undef HAVE_STACK_GROWING_UP
|
||||
#define HAVE_DLL
|
||||
#define USE_DLFCN
|
||||
#define NEED_TIME_R
|
||||
#define NEED_STRFTIME_LOCK
|
||||
|
||||
/*
|
||||
** Missing function prototypes
|
||||
*/
|
||||
extern int gethostname(char *name, int namelen);
|
||||
|
||||
#endif /* nspr_sony_defs_h___ */
|
||||
236
Src/nprt_plugin/gecko/1.8/win/include/md/_sunos4.h
Normal file
236
Src/nprt_plugin/gecko/1.8/win/include/md/_sunos4.h
Normal file
@@ -0,0 +1,236 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Portable Runtime (NSPR).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998-2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nspr_sunos_defs_h___
|
||||
#define nspr_sunos_defs_h___
|
||||
|
||||
#include "md/sunos4.h"
|
||||
|
||||
/* On SunOS 4, memset is declared in memory.h */
|
||||
#include <memory.h>
|
||||
#include <errno.h>
|
||||
#include <sys/syscall.h>
|
||||
|
||||
/*
|
||||
* Internal configuration macros
|
||||
*/
|
||||
|
||||
#define PR_LINKER_ARCH "sunos"
|
||||
#define _PR_SI_SYSNAME "SUNOS"
|
||||
#define _PR_SI_ARCHITECTURE "sparc"
|
||||
#define PR_DLL_SUFFIX ".so.1.0"
|
||||
|
||||
/*
|
||||
** For sunos type machines, don't specify an address because the
|
||||
** NetBSD/SPARC O.S. does the wrong thing.
|
||||
*/
|
||||
#define _PR_VMBASE 0x30000000
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
#define _MD_DEFAULT_STACK_SIZE 65536L
|
||||
#define _MD_MMAP_FLAGS MAP_PRIVATE
|
||||
|
||||
#undef HAVE_STACK_GROWING_UP
|
||||
#undef HAVE_WEAK_IO_SYMBOLS
|
||||
#undef HAVE_WEAK_MALLOC_SYMBOLS
|
||||
#define HAVE_DLL
|
||||
#define USE_DLFCN
|
||||
#define NEED_STRFTIME_LOCK
|
||||
#define NEED_TIME_R
|
||||
#define HAVE_BSD_FLOCK
|
||||
#define _PR_NO_LARGE_FILES
|
||||
#define _PR_STAT_HAS_ONLY_ST_ATIME
|
||||
|
||||
#define _MD_GET_INTERVAL _PR_UNIX_GetInterval
|
||||
#define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond
|
||||
|
||||
#define USE_SETJMP
|
||||
|
||||
#include <setjmp.h>
|
||||
|
||||
#define _MD_GET_SP(_t) (_t)->md.context[2]
|
||||
|
||||
#define PR_NUM_GCREGS _JBLEN
|
||||
|
||||
#define CONTEXT(_th) ((_th)->md.context)
|
||||
|
||||
/*
|
||||
** Initialize the thread context preparing it to execute _main.
|
||||
*/
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
PR_BEGIN_MACRO \
|
||||
int *context = (_thread)->md.context; \
|
||||
*status = PR_TRUE; \
|
||||
asm("ta 3"); \
|
||||
(void) setjmp(context); \
|
||||
(_thread)->md.context[2] = (int) ((_sp) - 64); \
|
||||
(_thread)->md.context[2] &= ~7; \
|
||||
(_thread)->md.context[3] = (int) _main; \
|
||||
(_thread)->md.context[4] = (int) _main + 4; \
|
||||
PR_END_MACRO
|
||||
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
asm("ta 3"); \
|
||||
if (!setjmp(CONTEXT(_thread))) { \
|
||||
(_thread)->md.errcode = errno; \
|
||||
_PR_Schedule(); \
|
||||
}
|
||||
|
||||
/*
|
||||
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
|
||||
*/
|
||||
#define _MD_RESTORE_CONTEXT(_thread) \
|
||||
{ \
|
||||
errno = (_thread)->md.errcode; \
|
||||
_MD_SET_CURRENT_THREAD(_thread); \
|
||||
longjmp(CONTEXT(_thread), 1); \
|
||||
}
|
||||
|
||||
#pragma unknown_control_flow(longjmp)
|
||||
#pragma unknown_control_flow(setjmp)
|
||||
#pragma unknown_control_flow(_PR_Schedule)
|
||||
|
||||
/*
|
||||
** Missing function prototypes
|
||||
*/
|
||||
|
||||
extern int socket (int domain, int type, int protocol);
|
||||
extern int getsockname (int s, struct sockaddr *name, int *namelen);
|
||||
extern int getpeername (int s, struct sockaddr *name, int *namelen);
|
||||
extern int getsockopt (int s, int level, int optname, char* optval, int* optlen);
|
||||
extern int setsockopt (int s, int level, int optname, const char* optval, int optlen);
|
||||
extern int accept (int s, struct sockaddr *addr, int *addrlen);
|
||||
extern int listen (int s, int backlog);
|
||||
extern int brk(void *);
|
||||
extern void *sbrk(int);
|
||||
|
||||
|
||||
/* Machine-dependent (MD) data structures. SunOS 4 has no native threads. */
|
||||
|
||||
struct _MDThread {
|
||||
jmp_buf context;
|
||||
int id;
|
||||
int errcode;
|
||||
};
|
||||
|
||||
struct _MDThreadStack {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDLock {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSemaphore {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDCVar {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSegment {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
/*
|
||||
* md-specific cpu structure field
|
||||
*/
|
||||
#define _PR_MD_MAX_OSFD FD_SETSIZE
|
||||
|
||||
struct _MDCPU_Unix {
|
||||
PRCList ioQ;
|
||||
PRUint32 ioq_timeout;
|
||||
PRInt32 ioq_max_osfd;
|
||||
PRInt32 ioq_osfd_cnt;
|
||||
#ifndef _PR_USE_POLL
|
||||
fd_set fd_read_set, fd_write_set, fd_exception_set;
|
||||
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
|
||||
fd_exception_cnt[_PR_MD_MAX_OSFD];
|
||||
#else
|
||||
struct pollfd *ioq_pollfds;
|
||||
int ioq_pollfds_size;
|
||||
#endif /* _PR_USE_POLL */
|
||||
};
|
||||
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
|
||||
struct _MDCPU {
|
||||
struct _MDCPU_Unix md_unix;
|
||||
};
|
||||
|
||||
#define _MD_INIT_LOCKS()
|
||||
#define _MD_NEW_LOCK(lock) PR_SUCCESS
|
||||
#define _MD_FREE_LOCK(lock)
|
||||
#define _MD_LOCK(lock)
|
||||
#define _MD_UNLOCK(lock)
|
||||
#define _MD_INIT_IO()
|
||||
#define _MD_IOQ_LOCK()
|
||||
#define _MD_IOQ_UNLOCK()
|
||||
|
||||
/* These are copied from _solaris.h */
|
||||
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
|
||||
#define _MD_INIT_THREAD _MD_InitializeThread
|
||||
#define _MD_EXIT_THREAD(thread)
|
||||
#define _MD_SUSPEND_THREAD(thread)
|
||||
#define _MD_RESUME_THREAD(thread)
|
||||
#define _MD_CLEAN_THREAD(_thread)
|
||||
|
||||
/*
|
||||
* We wrapped the select() call. _MD_SELECT refers to the built-in,
|
||||
* unwrapped version.
|
||||
*/
|
||||
#define _MD_SELECT(nfds,r,w,e,tv) syscall(SYS_select,nfds,r,w,e,tv)
|
||||
#define _MD_POLL(fds,nfds,timeout) syscall(SYS_poll,fds,nfds,timeout)
|
||||
|
||||
#endif /* nspr_sparc_defs_h___ */
|
||||
171
Src/nprt_plugin/gecko/1.8/win/include/md/_unix_errors.h
Normal file
171
Src/nprt_plugin/gecko/1.8/win/include/md/_unix_errors.h
Normal file
@@ -0,0 +1,171 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Portable Runtime (NSPR).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998-2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef prunixerrors_h___
|
||||
#define prunixerrors_h___
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stddef.h>
|
||||
|
||||
PR_BEGIN_EXTERN_C
|
||||
|
||||
extern void _MD_unix_map_default_error(int err);
|
||||
#define _PR_MD_MAP_DEFAULT_ERROR _MD_unix_map_default_error
|
||||
|
||||
extern void _MD_unix_map_opendir_error(int err);
|
||||
#define _PR_MD_MAP_OPENDIR_ERROR _MD_unix_map_opendir_error
|
||||
|
||||
extern void _MD_unix_map_closedir_error(int err);
|
||||
#define _PR_MD_MAP_CLOSEDIR_ERROR _MD_unix_map_closedir_error
|
||||
|
||||
extern void _MD_unix_readdir_error(int err);
|
||||
#define _PR_MD_MAP_READDIR_ERROR _MD_unix_readdir_error
|
||||
|
||||
extern void _MD_unix_map_unlink_error(int err);
|
||||
#define _PR_MD_MAP_UNLINK_ERROR _MD_unix_map_unlink_error
|
||||
|
||||
extern void _MD_unix_map_stat_error(int err);
|
||||
#define _PR_MD_MAP_STAT_ERROR _MD_unix_map_stat_error
|
||||
|
||||
extern void _MD_unix_map_fstat_error(int err);
|
||||
#define _PR_MD_MAP_FSTAT_ERROR _MD_unix_map_fstat_error
|
||||
|
||||
extern void _MD_unix_map_rename_error(int err);
|
||||
#define _PR_MD_MAP_RENAME_ERROR _MD_unix_map_rename_error
|
||||
|
||||
extern void _MD_unix_map_access_error(int err);
|
||||
#define _PR_MD_MAP_ACCESS_ERROR _MD_unix_map_access_error
|
||||
|
||||
extern void _MD_unix_map_mkdir_error(int err);
|
||||
#define _PR_MD_MAP_MKDIR_ERROR _MD_unix_map_mkdir_error
|
||||
|
||||
extern void _MD_unix_map_rmdir_error(int err);
|
||||
#define _PR_MD_MAP_RMDIR_ERROR _MD_unix_map_rmdir_error
|
||||
|
||||
extern void _MD_unix_map_read_error(int err);
|
||||
#define _PR_MD_MAP_READ_ERROR _MD_unix_map_read_error
|
||||
|
||||
extern void _MD_unix_map_write_error(int err);
|
||||
#define _PR_MD_MAP_WRITE_ERROR _MD_unix_map_write_error
|
||||
|
||||
extern void _MD_unix_map_lseek_error(int err);
|
||||
#define _PR_MD_MAP_LSEEK_ERROR _MD_unix_map_lseek_error
|
||||
|
||||
extern void _MD_unix_map_fsync_error(int err);
|
||||
#define _PR_MD_MAP_FSYNC_ERROR _MD_unix_map_fsync_error
|
||||
|
||||
extern void _MD_unix_map_close_error(int err);
|
||||
#define _PR_MD_MAP_CLOSE_ERROR _MD_unix_map_close_error
|
||||
|
||||
extern void _MD_unix_map_socket_error(int err);
|
||||
#define _PR_MD_MAP_SOCKET_ERROR _MD_unix_map_socket_error
|
||||
|
||||
extern void _MD_unix_map_socketavailable_error(int err);
|
||||
#define _PR_MD_MAP_SOCKETAVAILABLE_ERROR _MD_unix_map_socketavailable_error
|
||||
|
||||
extern void _MD_unix_map_recv_error(int err);
|
||||
#define _PR_MD_MAP_RECV_ERROR _MD_unix_map_recv_error
|
||||
|
||||
extern void _MD_unix_map_recvfrom_error(int err);
|
||||
#define _PR_MD_MAP_RECVFROM_ERROR _MD_unix_map_recvfrom_error
|
||||
|
||||
extern void _MD_unix_map_send_error(int err);
|
||||
#define _PR_MD_MAP_SEND_ERROR _MD_unix_map_send_error
|
||||
|
||||
extern void _MD_unix_map_sendto_error(int err);
|
||||
#define _PR_MD_MAP_SENDTO_ERROR _MD_unix_map_sendto_error
|
||||
|
||||
extern void _MD_unix_map_writev_error(int err);
|
||||
#define _PR_MD_MAP_WRITEV_ERROR _MD_unix_map_writev_error
|
||||
|
||||
extern void _MD_unix_map_accept_error(int err);
|
||||
#define _PR_MD_MAP_ACCEPT_ERROR _MD_unix_map_accept_error
|
||||
|
||||
extern void _MD_unix_map_connect_error(int err);
|
||||
#define _PR_MD_MAP_CONNECT_ERROR _MD_unix_map_connect_error
|
||||
|
||||
extern void _MD_unix_map_bind_error(int err);
|
||||
#define _PR_MD_MAP_BIND_ERROR _MD_unix_map_bind_error
|
||||
|
||||
extern void _MD_unix_map_listen_error(int err);
|
||||
#define _PR_MD_MAP_LISTEN_ERROR _MD_unix_map_listen_error
|
||||
|
||||
extern void _MD_unix_map_shutdown_error(int err);
|
||||
#define _PR_MD_MAP_SHUTDOWN_ERROR _MD_unix_map_shutdown_error
|
||||
|
||||
extern void _MD_unix_map_socketpair_error(int err);
|
||||
#define _PR_MD_MAP_SOCKETPAIR_ERROR _MD_unix_map_socketpair_error
|
||||
|
||||
extern void _MD_unix_map_getsockname_error(int err);
|
||||
#define _PR_MD_MAP_GETSOCKNAME_ERROR _MD_unix_map_getsockname_error
|
||||
|
||||
extern void _MD_unix_map_getpeername_error(int err);
|
||||
#define _PR_MD_MAP_GETPEERNAME_ERROR _MD_unix_map_getpeername_error
|
||||
|
||||
extern void _MD_unix_map_getsockopt_error(int err);
|
||||
#define _PR_MD_MAP_GETSOCKOPT_ERROR _MD_unix_map_getsockopt_error
|
||||
|
||||
extern void _MD_unix_map_setsockopt_error(int err);
|
||||
#define _PR_MD_MAP_SETSOCKOPT_ERROR _MD_unix_map_setsockopt_error
|
||||
|
||||
extern void _MD_unix_map_open_error(int err);
|
||||
#define _PR_MD_MAP_OPEN_ERROR _MD_unix_map_open_error
|
||||
|
||||
extern void _MD_unix_map_mmap_error(int err);
|
||||
#define _PR_MD_MAP_MMAP_ERROR _MD_unix_map_mmap_error
|
||||
|
||||
extern void _MD_unix_map_gethostname_error(int err);
|
||||
#define _PR_MD_MAP_GETHOSTNAME_ERROR _MD_unix_map_gethostname_error
|
||||
|
||||
extern void _MD_unix_map_select_error(int err);
|
||||
#define _PR_MD_MAP_SELECT_ERROR _MD_unix_map_select_error
|
||||
|
||||
extern void _MD_unix_map_poll_error(int err);
|
||||
#define _PR_MD_MAP_POLL_ERROR _MD_unix_map_poll_error
|
||||
|
||||
extern void _MD_unix_map_poll_revents_error(int err);
|
||||
#define _PR_MD_MAP_POLL_REVENTS_ERROR _MD_unix_map_poll_revents_error
|
||||
|
||||
extern void _MD_unix_map_flock_error(int err);
|
||||
#define _PR_MD_MAP_FLOCK_ERROR _MD_unix_map_flock_error
|
||||
|
||||
extern void _MD_unix_map_lockf_error(int err);
|
||||
#define _PR_MD_MAP_LOCKF_ERROR _MD_unix_map_lockf_error
|
||||
|
||||
PR_END_EXTERN_C
|
||||
|
||||
#endif /* prunixerrors_h___ */
|
||||
632
Src/nprt_plugin/gecko/1.8/win/include/md/_unixos.h
Normal file
632
Src/nprt_plugin/gecko/1.8/win/include/md/_unixos.h
Normal file
@@ -0,0 +1,632 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Portable Runtime (NSPR).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998-2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef prunixos_h___
|
||||
#define prunixos_h___
|
||||
|
||||
/*
|
||||
* If FD_SETSIZE is not defined on the command line, set the default value
|
||||
* before include select.h
|
||||
*/
|
||||
/*
|
||||
* Linux: FD_SETSIZE is defined in /usr/include/sys/select.h and should
|
||||
* not be redefined.
|
||||
*/
|
||||
#if !defined(LINUX) && !defined(DARWIN) && !defined(NEXTSTEP)
|
||||
#ifndef FD_SETSIZE
|
||||
#define FD_SETSIZE 4096
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stddef.h>
|
||||
#include <sys/stat.h>
|
||||
#include <dirent.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "prio.h"
|
||||
#include "prmem.h"
|
||||
#include "prclist.h"
|
||||
|
||||
/*
|
||||
* For select(), fd_set, and struct timeval.
|
||||
*
|
||||
* In The Single UNIX(R) Specification, Version 2,
|
||||
* the header file for select() is <sys/time.h>.
|
||||
*
|
||||
* fd_set is defined in <sys/types.h>. Usually
|
||||
* <sys/time.h> includes <sys/types.h>, but on some
|
||||
* older systems <sys/time.h> does not include
|
||||
* <sys/types.h>, so we include it explicitly.
|
||||
*/
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#if defined(AIX) /* Only pre-4.2 AIX needs it, but for simplicity... */
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
|
||||
#define _PR_HAVE_O_APPEND
|
||||
|
||||
#define PR_DIRECTORY_SEPARATOR '/'
|
||||
#define PR_DIRECTORY_SEPARATOR_STR "/"
|
||||
#define PR_PATH_SEPARATOR ':'
|
||||
#define PR_PATH_SEPARATOR_STR ":"
|
||||
#define GCPTR
|
||||
typedef int (*FARPROC)();
|
||||
|
||||
/*
|
||||
* intervals at which GLOBAL threads wakeup to check for pending interrupt
|
||||
*/
|
||||
#define _PR_INTERRUPT_CHECK_INTERVAL_SECS 5
|
||||
extern PRIntervalTime intr_timeout_ticks;
|
||||
|
||||
/*
|
||||
* The bit flags for the in_flags and out_flags fields
|
||||
* of _PR_UnixPollDesc
|
||||
*/
|
||||
#ifdef _PR_USE_POLL
|
||||
#define _PR_UNIX_POLL_READ POLLIN
|
||||
#define _PR_UNIX_POLL_WRITE POLLOUT
|
||||
#define _PR_UNIX_POLL_EXCEPT POLLPRI
|
||||
#define _PR_UNIX_POLL_ERR POLLERR
|
||||
#define _PR_UNIX_POLL_NVAL POLLNVAL
|
||||
#define _PR_UNIX_POLL_HUP POLLHUP
|
||||
#else /* _PR_USE_POLL */
|
||||
#define _PR_UNIX_POLL_READ 0x1
|
||||
#define _PR_UNIX_POLL_WRITE 0x2
|
||||
#define _PR_UNIX_POLL_EXCEPT 0x4
|
||||
#define _PR_UNIX_POLL_ERR 0x8
|
||||
#define _PR_UNIX_POLL_NVAL 0x10
|
||||
#define _PR_UNIX_POLL_HUP 0x20
|
||||
#endif /* _PR_USE_POLL */
|
||||
|
||||
typedef struct _PRUnixPollDesc {
|
||||
PRInt32 osfd;
|
||||
PRInt16 in_flags;
|
||||
PRInt16 out_flags;
|
||||
} _PRUnixPollDesc;
|
||||
|
||||
typedef struct PRPollQueue {
|
||||
PRCList links; /* for linking PRPollQueue's together */
|
||||
_PRUnixPollDesc *pds; /* array of poll descriptors */
|
||||
PRUintn npds; /* length of the array */
|
||||
PRPackedBool on_ioq; /* is this on the async i/o work q? */
|
||||
PRIntervalTime timeout; /* timeout, in ticks */
|
||||
struct PRThread *thr;
|
||||
} PRPollQueue;
|
||||
|
||||
#define _PR_POLLQUEUE_PTR(_qp) \
|
||||
((PRPollQueue*) ((char*) (_qp) - offsetof(PRPollQueue,links)))
|
||||
|
||||
|
||||
extern PRInt32 _PR_WaitForMultipleFDs(
|
||||
_PRUnixPollDesc *unixpds,
|
||||
PRInt32 pdcnt,
|
||||
PRIntervalTime timeout);
|
||||
extern void _PR_Unblock_IO_Wait(struct PRThread *thr);
|
||||
|
||||
#if defined(_PR_LOCAL_THREADS_ONLY) || defined(_PR_GLOBAL_THREADS_ONLY)
|
||||
#define _MD_CHECK_FOR_EXIT()
|
||||
#endif
|
||||
|
||||
extern fd_set _pr_md_read_set, _pr_md_write_set, _pr_md_exception_set;
|
||||
extern PRInt16 _pr_md_read_cnt[], _pr_md_write_cnt[], _pr_md_exception_cnt[];
|
||||
extern PRInt32 _pr_md_ioq_max_osfd;
|
||||
extern PRUint32 _pr_md_ioq_timeout;
|
||||
|
||||
struct _MDFileDesc {
|
||||
int osfd;
|
||||
#if defined(LINUX) && defined(_PR_PTHREADS)
|
||||
int tcp_nodelay; /* used by pt_LinuxSendFile */
|
||||
#endif
|
||||
};
|
||||
|
||||
struct _MDDir {
|
||||
DIR *d;
|
||||
};
|
||||
|
||||
struct _PRCPU;
|
||||
extern void _MD_unix_init_running_cpu(struct _PRCPU *cpu);
|
||||
|
||||
/*
|
||||
** Make a redzone at both ends of the stack segment. Disallow access
|
||||
** to those pages of memory. It's ok if the mprotect call's don't
|
||||
** work - it just means that we don't really have a functional
|
||||
** redzone.
|
||||
*/
|
||||
#include <sys/mman.h>
|
||||
#ifndef PROT_NONE
|
||||
#define PROT_NONE 0x0
|
||||
#endif
|
||||
|
||||
#if defined(DEBUG) && !defined(DARWIN) && !defined(NEXTSTEP)
|
||||
#if !defined(SOLARIS)
|
||||
#include <string.h> /* for memset() */
|
||||
#define _MD_INIT_STACK(ts,REDZONE) \
|
||||
PR_BEGIN_MACRO \
|
||||
(void) mprotect((void*)ts->seg->vaddr, REDZONE, PROT_NONE); \
|
||||
(void) mprotect((void*) ((char*)ts->seg->vaddr + REDZONE + ts->stackSize),\
|
||||
REDZONE, PROT_NONE); \
|
||||
/* \
|
||||
** Fill stack memory with something that turns into an illegal \
|
||||
** pointer value. This will sometimes find runtime references to \
|
||||
** uninitialized pointers. We don't do this for solaris because we \
|
||||
** can use purify instead. \
|
||||
*/ \
|
||||
if (_pr_debugStacks) { \
|
||||
memset(ts->allocBase + REDZONE, 0xf7, ts->stackSize); \
|
||||
} \
|
||||
PR_END_MACRO
|
||||
#else /* !SOLARIS */
|
||||
#define _MD_INIT_STACK(ts,REDZONE) \
|
||||
PR_BEGIN_MACRO \
|
||||
(void) mprotect((void*)ts->seg->vaddr, REDZONE, PROT_NONE); \
|
||||
(void) mprotect((void*) ((char*)ts->seg->vaddr + REDZONE + ts->stackSize),\
|
||||
REDZONE, PROT_NONE); \
|
||||
PR_END_MACRO
|
||||
#endif /* !SOLARIS */
|
||||
|
||||
/*
|
||||
* _MD_CLEAR_STACK
|
||||
* Allow access to the redzone pages; the access was turned off in
|
||||
* _MD_INIT_STACK.
|
||||
*/
|
||||
#define _MD_CLEAR_STACK(ts) \
|
||||
PR_BEGIN_MACRO \
|
||||
(void) mprotect((void*)ts->seg->vaddr, REDZONE, PROT_READ|PROT_WRITE);\
|
||||
(void) mprotect((void*) ((char*)ts->seg->vaddr + REDZONE + ts->stackSize),\
|
||||
REDZONE, PROT_READ|PROT_WRITE); \
|
||||
PR_END_MACRO
|
||||
|
||||
#else /* DEBUG */
|
||||
|
||||
#define _MD_INIT_STACK(ts,REDZONE)
|
||||
#define _MD_CLEAR_STACK(ts)
|
||||
|
||||
#endif /* DEBUG */
|
||||
|
||||
#if !defined(SOLARIS)
|
||||
|
||||
#define PR_SET_INTSOFF(newval)
|
||||
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
extern void _PR_UnixInit(void);
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
struct _MDProcess {
|
||||
pid_t pid;
|
||||
};
|
||||
|
||||
struct PRProcess;
|
||||
struct PRProcessAttr;
|
||||
|
||||
/* Create a new process (fork() + exec()) */
|
||||
#define _MD_CREATE_PROCESS _MD_CreateUnixProcess
|
||||
extern struct PRProcess * _MD_CreateUnixProcess(
|
||||
const char *path,
|
||||
char *const *argv,
|
||||
char *const *envp,
|
||||
const struct PRProcessAttr *attr
|
||||
);
|
||||
|
||||
#define _MD_DETACH_PROCESS _MD_DetachUnixProcess
|
||||
extern PRStatus _MD_DetachUnixProcess(struct PRProcess *process);
|
||||
|
||||
/* Wait for a child process to terminate */
|
||||
#define _MD_WAIT_PROCESS _MD_WaitUnixProcess
|
||||
extern PRStatus _MD_WaitUnixProcess(struct PRProcess *process,
|
||||
PRInt32 *exitCode);
|
||||
|
||||
#define _MD_KILL_PROCESS _MD_KillUnixProcess
|
||||
extern PRStatus _MD_KillUnixProcess(struct PRProcess *process);
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
extern void _MD_EnableClockInterrupts(void);
|
||||
extern void _MD_DisableClockInterrupts(void);
|
||||
|
||||
#define _MD_START_INTERRUPTS _MD_StartInterrupts
|
||||
#define _MD_STOP_INTERRUPTS _MD_StopInterrupts
|
||||
#define _MD_DISABLE_CLOCK_INTERRUPTS _MD_DisableClockInterrupts
|
||||
#define _MD_ENABLE_CLOCK_INTERRUPTS _MD_EnableClockInterrupts
|
||||
#define _MD_BLOCK_CLOCK_INTERRUPTS _MD_BlockClockInterrupts
|
||||
#define _MD_UNBLOCK_CLOCK_INTERRUPTS _MD_UnblockClockInterrupts
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
extern void _MD_InitCPUS(void);
|
||||
#define _MD_INIT_CPUS _MD_InitCPUS
|
||||
|
||||
extern void _MD_Wakeup_CPUs(void);
|
||||
#define _MD_WAKEUP_CPUS _MD_Wakeup_CPUs
|
||||
|
||||
#define _MD_PAUSE_CPU _MD_PauseCPU
|
||||
|
||||
#if defined(_PR_LOCAL_THREADS_ONLY) || defined(_PR_GLOBAL_THREADS_ONLY)
|
||||
#define _MD_CLEANUP_BEFORE_EXIT()
|
||||
#endif
|
||||
|
||||
#ifndef IRIX
|
||||
#define _MD_EXIT(status) _exit(status)
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
#define _MD_GET_ENV getenv
|
||||
#define _MD_PUT_ENV putenv
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
#define _MD_INIT_FILEDESC(fd)
|
||||
|
||||
extern void _MD_MakeNonblock(PRFileDesc *fd);
|
||||
#define _MD_MAKE_NONBLOCK _MD_MakeNonblock
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
#if !defined(_PR_PTHREADS)
|
||||
|
||||
extern void _MD_InitSegs(void);
|
||||
extern PRStatus _MD_AllocSegment(PRSegment *seg, PRUint32 size,
|
||||
void *vaddr);
|
||||
extern void _MD_FreeSegment(PRSegment *seg);
|
||||
|
||||
#define _MD_INIT_SEGS _MD_InitSegs
|
||||
#define _MD_ALLOC_SEGMENT _MD_AllocSegment
|
||||
#define _MD_FREE_SEGMENT _MD_FreeSegment
|
||||
|
||||
#endif /* !defined(_PR_PTHREADS) */
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
#if !defined(HPUX_LW_TIMER)
|
||||
#define _MD_INTERVAL_INIT()
|
||||
#endif
|
||||
#define _MD_INTERVAL_PER_MILLISEC() (_PR_MD_INTERVAL_PER_SEC() / 1000)
|
||||
#define _MD_INTERVAL_PER_MICROSEC() (_PR_MD_INTERVAL_PER_SEC() / 1000000)
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
#define _MD_ERRNO() (errno)
|
||||
#define _MD_GET_SOCKET_ERROR() (errno)
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
extern PRInt32 _MD_AvailableSocket(PRInt32 osfd);
|
||||
|
||||
extern void _MD_StartInterrupts(void);
|
||||
extern void _MD_StopInterrupts(void);
|
||||
extern void _MD_DisableClockInterrupts(void);
|
||||
extern void _MD_BlockClockInterrupts(void);
|
||||
extern void _MD_UnblockClockInterrupts(void);
|
||||
extern void _MD_PauseCPU(PRIntervalTime timeout);
|
||||
|
||||
extern PRStatus _MD_open_dir(struct _MDDir *, const char *);
|
||||
extern PRInt32 _MD_close_dir(struct _MDDir *);
|
||||
extern char * _MD_read_dir(struct _MDDir *, PRIntn);
|
||||
extern PRInt32 _MD_open(const char *name, PRIntn osflags, PRIntn mode);
|
||||
extern PRInt32 _MD_delete(const char *name);
|
||||
extern PRInt32 _MD_getfileinfo(const char *fn, PRFileInfo *info);
|
||||
extern PRInt32 _MD_getfileinfo64(const char *fn, PRFileInfo64 *info);
|
||||
extern PRInt32 _MD_getopenfileinfo(const PRFileDesc *fd, PRFileInfo *info);
|
||||
extern PRInt32 _MD_getopenfileinfo64(const PRFileDesc *fd, PRFileInfo64 *info);
|
||||
extern PRInt32 _MD_rename(const char *from, const char *to);
|
||||
extern PRInt32 _MD_access(const char *name, PRAccessHow how);
|
||||
extern PRInt32 _MD_mkdir(const char *name, PRIntn mode);
|
||||
extern PRInt32 _MD_rmdir(const char *name);
|
||||
extern PRInt32 _MD_accept_read(PRInt32 sock, PRInt32 *newSock,
|
||||
PRNetAddr **raddr, void *buf, PRInt32 amount);
|
||||
extern PRInt32 _PR_UnixSendFile(PRFileDesc *sd, PRSendFileData *sfd,
|
||||
PRTransmitFileFlags flags, PRIntervalTime timeout);
|
||||
|
||||
extern PRStatus _MD_LockFile(PRInt32 osfd);
|
||||
extern PRStatus _MD_TLockFile(PRInt32 osfd);
|
||||
extern PRStatus _MD_UnlockFile(PRInt32 osfd);
|
||||
|
||||
#define _MD_OPEN_DIR(dir, name) _MD_open_dir(dir, name)
|
||||
#define _MD_CLOSE_DIR(dir) _MD_close_dir(dir)
|
||||
#define _MD_READ_DIR(dir, flags) _MD_read_dir(dir, flags)
|
||||
#define _MD_OPEN(name, osflags, mode) _MD_open(name, osflags, mode)
|
||||
#define _MD_OPEN_FILE(name, osflags, mode) _MD_open(name, osflags, mode)
|
||||
extern PRInt32 _MD_read(PRFileDesc *fd, void *buf, PRInt32 amount);
|
||||
#define _MD_READ(fd,buf,amount) _MD_read(fd,buf,amount)
|
||||
extern PRInt32 _MD_write(PRFileDesc *fd, const void *buf, PRInt32 amount);
|
||||
#define _MD_WRITE(fd,buf,amount) _MD_write(fd,buf,amount)
|
||||
#define _MD_DELETE(name) _MD_delete(name)
|
||||
#define _MD_GETFILEINFO(fn, info) _MD_getfileinfo(fn, info)
|
||||
#define _MD_GETFILEINFO64(fn, info) _MD_getfileinfo64(fn, info)
|
||||
#define _MD_GETOPENFILEINFO(fd, info) _MD_getopenfileinfo(fd, info)
|
||||
#define _MD_GETOPENFILEINFO64(fd, info) _MD_getopenfileinfo64(fd, info)
|
||||
#define _MD_RENAME(from, to) _MD_rename(from, to)
|
||||
#define _MD_ACCESS(name, how) _MD_access(name, how)
|
||||
#define _MD_MKDIR(name, mode) _MD_mkdir(name, mode)
|
||||
#define _MD_MAKE_DIR(name, mode) _MD_mkdir(name, mode)
|
||||
#define _MD_RMDIR(name) _MD_rmdir(name)
|
||||
#define _MD_ACCEPT_READ(sock, newSock, raddr, buf, amount) _MD_accept_read(sock, newSock, raddr, buf, amount)
|
||||
|
||||
#define _MD_LOCKFILE _MD_LockFile
|
||||
#define _MD_TLOCKFILE _MD_TLockFile
|
||||
#define _MD_UNLOCKFILE _MD_UnlockFile
|
||||
|
||||
|
||||
extern PRInt32 _MD_socket(int af, int type, int flags);
|
||||
#define _MD_SOCKET _MD_socket
|
||||
extern PRInt32 _MD_connect(PRFileDesc *fd, const PRNetAddr *addr,
|
||||
PRUint32 addrlen, PRIntervalTime timeout);
|
||||
#define _MD_CONNECT _MD_connect
|
||||
extern PRInt32 _MD_accept(PRFileDesc *fd, PRNetAddr *addr, PRUint32 *addrlen,
|
||||
PRIntervalTime timeout);
|
||||
#define _MD_ACCEPT _MD_accept
|
||||
extern PRInt32 _MD_bind(PRFileDesc *fd, const PRNetAddr *addr, PRUint32 addrlen);
|
||||
#define _MD_BIND _MD_bind
|
||||
extern PRInt32 _MD_listen(PRFileDesc *fd, PRIntn backlog);
|
||||
#define _MD_LISTEN _MD_listen
|
||||
extern PRInt32 _MD_shutdown(PRFileDesc *fd, PRIntn how);
|
||||
#define _MD_SHUTDOWN _MD_shutdown
|
||||
|
||||
extern PRInt32 _MD_recv(PRFileDesc *fd, void *buf, PRInt32 amount,
|
||||
PRIntn flags, PRIntervalTime timeout);
|
||||
#define _MD_RECV _MD_recv
|
||||
extern PRInt32 _MD_send(PRFileDesc *fd, const void *buf, PRInt32 amount,
|
||||
PRIntn flags, PRIntervalTime timeout);
|
||||
#define _MD_SEND _MD_send
|
||||
extern PRInt32 _MD_recvfrom(PRFileDesc *fd, void *buf, PRInt32 amount,
|
||||
PRIntn flags, PRNetAddr *addr, PRUint32 *addrlen,
|
||||
PRIntervalTime timeout);
|
||||
#define _MD_RECVFROM _MD_recvfrom
|
||||
extern PRInt32 _MD_sendto(PRFileDesc *fd, const void *buf, PRInt32 amount,
|
||||
PRIntn flags, const PRNetAddr *addr, PRUint32 addrlen,
|
||||
PRIntervalTime timeout);
|
||||
#define _MD_SENDTO _MD_sendto
|
||||
extern PRInt32 _MD_writev(PRFileDesc *fd, const struct PRIOVec *iov,
|
||||
PRInt32 iov_size, PRIntervalTime timeout);
|
||||
#define _MD_WRITEV _MD_writev
|
||||
|
||||
extern PRInt32 _MD_socketavailable(PRFileDesc *fd);
|
||||
#define _MD_SOCKETAVAILABLE _MD_socketavailable
|
||||
extern PRInt64 _MD_socketavailable64(PRFileDesc *fd);
|
||||
#define _MD_SOCKETAVAILABLE64 _MD_socketavailable64
|
||||
|
||||
#define _MD_PIPEAVAILABLE _MD_socketavailable
|
||||
|
||||
extern PRInt32 _MD_pr_poll(PRPollDesc *pds, PRIntn npds,
|
||||
PRIntervalTime timeout);
|
||||
#define _MD_PR_POLL _MD_pr_poll
|
||||
|
||||
extern PRInt32 _MD_close(PRInt32 osfd);
|
||||
#define _MD_CLOSE_FILE _MD_close
|
||||
extern PRInt32 _MD_lseek(PRFileDesc*, PRInt32, PRSeekWhence);
|
||||
#define _MD_LSEEK _MD_lseek
|
||||
extern PRInt64 _MD_lseek64(PRFileDesc*, PRInt64, PRSeekWhence);
|
||||
#define _MD_LSEEK64 _MD_lseek64
|
||||
extern PRInt32 _MD_fsync(PRFileDesc *fd);
|
||||
#define _MD_FSYNC _MD_fsync
|
||||
|
||||
extern PRInt32 _MD_socketpair(int af, int type, int flags, PRInt32 *osfd);
|
||||
#define _MD_SOCKETPAIR _MD_socketpair
|
||||
|
||||
#define _MD_CLOSE_SOCKET _MD_close
|
||||
|
||||
#ifndef NO_NSPR_10_SUPPORT
|
||||
#define _MD_STAT stat
|
||||
#endif
|
||||
|
||||
extern PRStatus _MD_getpeername(PRFileDesc *fd, PRNetAddr *addr,
|
||||
PRUint32 *addrlen);
|
||||
#define _MD_GETPEERNAME _MD_getpeername
|
||||
extern PRStatus _MD_getsockname(PRFileDesc *fd, PRNetAddr *addr,
|
||||
PRUint32 *addrlen);
|
||||
#define _MD_GETSOCKNAME _MD_getsockname
|
||||
|
||||
extern PRStatus _MD_getsockopt(PRFileDesc *fd, PRInt32 level,
|
||||
PRInt32 optname, char* optval, PRInt32* optlen);
|
||||
#define _MD_GETSOCKOPT _MD_getsockopt
|
||||
extern PRStatus _MD_setsockopt(PRFileDesc *fd, PRInt32 level,
|
||||
PRInt32 optname, const char* optval, PRInt32 optlen);
|
||||
#define _MD_SETSOCKOPT _MD_setsockopt
|
||||
|
||||
extern PRStatus _MD_set_fd_inheritable(PRFileDesc *fd, PRBool inheritable);
|
||||
#define _MD_SET_FD_INHERITABLE _MD_set_fd_inheritable
|
||||
|
||||
extern void _MD_init_fd_inheritable(PRFileDesc *fd, PRBool imported);
|
||||
#define _MD_INIT_FD_INHERITABLE _MD_init_fd_inheritable
|
||||
|
||||
extern void _MD_query_fd_inheritable(PRFileDesc *fd);
|
||||
#define _MD_QUERY_FD_INHERITABLE _MD_query_fd_inheritable
|
||||
|
||||
extern PRStatus _MD_gethostname(char *name, PRUint32 namelen);
|
||||
#define _MD_GETHOSTNAME _MD_gethostname
|
||||
|
||||
extern PRStatus _MD_getsysinfo(PRSysInfo cmd, char *name, PRUint32 namelen);
|
||||
#define _MD_GETSYSINFO _MD_getsysinfo
|
||||
|
||||
extern int _MD_unix_get_nonblocking_connect_error(int osfd);
|
||||
|
||||
/* Memory-mapped files */
|
||||
|
||||
struct _MDFileMap {
|
||||
PRIntn prot;
|
||||
PRIntn flags;
|
||||
PRBool isAnonFM; /* when true, PR_CloseFileMap() must close the related fd */
|
||||
};
|
||||
|
||||
extern PRStatus _MD_CreateFileMap(struct PRFileMap *fmap, PRInt64 size);
|
||||
#define _MD_CREATE_FILE_MAP _MD_CreateFileMap
|
||||
|
||||
#define _MD_GET_MEM_MAP_ALIGNMENT() PR_GetPageSize()
|
||||
|
||||
extern void * _MD_MemMap(struct PRFileMap *fmap, PRInt64 offset,
|
||||
PRUint32 len);
|
||||
#define _MD_MEM_MAP _MD_MemMap
|
||||
|
||||
extern PRStatus _MD_MemUnmap(void *addr, PRUint32 size);
|
||||
#define _MD_MEM_UNMAP _MD_MemUnmap
|
||||
|
||||
extern PRStatus _MD_CloseFileMap(struct PRFileMap *fmap);
|
||||
#define _MD_CLOSE_FILE_MAP _MD_CloseFileMap
|
||||
|
||||
/*
|
||||
* The standard (XPG4) gettimeofday() (from BSD) takes two arguments.
|
||||
* On some SVR4 derivatives, gettimeofday() takes only one argument.
|
||||
* The GETTIMEOFDAY macro is intended to hide this difference.
|
||||
*/
|
||||
#ifdef HAVE_SVID_GETTOD
|
||||
#define GETTIMEOFDAY(tp) gettimeofday(tp)
|
||||
#else
|
||||
#define GETTIMEOFDAY(tp) gettimeofday((tp), NULL)
|
||||
#endif
|
||||
|
||||
#if defined(_PR_PTHREADS) && !defined(_PR_POLL_AVAILABLE)
|
||||
#define _PR_NEED_FAKE_POLL
|
||||
#endif
|
||||
|
||||
#if defined(_PR_NEED_FAKE_POLL)
|
||||
|
||||
/*
|
||||
* Some platforms don't have poll(), but our pthreads code calls poll().
|
||||
* As a temporary measure, I implemented a fake poll() using select().
|
||||
* Here are the struct and macro definitions copied from sys/poll.h
|
||||
* on Solaris 2.5.
|
||||
*/
|
||||
|
||||
struct pollfd {
|
||||
int fd;
|
||||
short events;
|
||||
short revents;
|
||||
};
|
||||
|
||||
/* poll events */
|
||||
|
||||
#define POLLIN 0x0001 /* fd is readable */
|
||||
#define POLLPRI 0x0002 /* high priority info at fd */
|
||||
#define POLLOUT 0x0004 /* fd is writeable (won't block) */
|
||||
#define POLLRDNORM 0x0040 /* normal data is readable */
|
||||
#define POLLWRNORM POLLOUT
|
||||
#define POLLRDBAND 0x0080 /* out-of-band data is readable */
|
||||
#define POLLWRBAND 0x0100 /* out-of-band data is writeable */
|
||||
|
||||
#define POLLNORM POLLRDNORM
|
||||
|
||||
#define POLLERR 0x0008 /* fd has error condition */
|
||||
#define POLLHUP 0x0010 /* fd has been hung up on */
|
||||
#define POLLNVAL 0x0020 /* invalid pollfd entry */
|
||||
|
||||
extern int poll(struct pollfd *, unsigned long, int);
|
||||
|
||||
#endif /* _PR_NEED_FAKE_POLL */
|
||||
|
||||
/*
|
||||
** A vector of the UNIX I/O calls we use. These are here to smooth over
|
||||
** the rough edges needed for large files. All of NSPR's implmentaions
|
||||
** go through this vector using syntax of the form
|
||||
** result = _md_iovector.xxx64(args);
|
||||
*/
|
||||
|
||||
#if defined(SOLARIS2_5)
|
||||
/*
|
||||
** Special case: Solaris 2.5.1
|
||||
** Solaris starts to have 64-bit file I/O in 2.6. We build on Solaris
|
||||
** 2.5.1 so that we can use the same binaries on both Solaris 2.5.1 and
|
||||
** 2.6. At run time, we detect whether 64-bit file I/O is available by
|
||||
** looking up the 64-bit file function symbols in libc. At build time,
|
||||
** we need to define the 64-bit file I/O datatypes that are compatible
|
||||
** with their definitions on Solaris 2.6.
|
||||
*/
|
||||
typedef PRInt64 off64_t;
|
||||
typedef PRUint64 ino64_t;
|
||||
typedef PRInt64 blkcnt64_t;
|
||||
struct stat64 {
|
||||
dev_t st_dev;
|
||||
long st_pad1[3];
|
||||
ino64_t st_ino;
|
||||
mode_t st_mode;
|
||||
nlink_t st_nlink;
|
||||
uid_t st_uid;
|
||||
gid_t st_gid;
|
||||
dev_t st_rdev;
|
||||
long t_pad2[2];
|
||||
off64_t st_size;
|
||||
timestruc_t st_atim;
|
||||
timestruc_t st_mtim;
|
||||
timestruc_t st_ctim;
|
||||
long st_blksize;
|
||||
blkcnt64_t st_blocks;
|
||||
char st_fstype[_ST_FSTYPSZ];
|
||||
long st_pad4[8];
|
||||
};
|
||||
typedef struct stat64 _MDStat64;
|
||||
typedef off64_t _MDOff64_t;
|
||||
|
||||
#elif defined(_PR_HAVE_OFF64_T)
|
||||
typedef struct stat64 _MDStat64;
|
||||
typedef off64_t _MDOff64_t;
|
||||
#elif defined(_PR_HAVE_LARGE_OFF_T)
|
||||
typedef struct stat _MDStat64;
|
||||
typedef off_t _MDOff64_t;
|
||||
#elif defined(_PR_NO_LARGE_FILES)
|
||||
typedef struct stat _MDStat64;
|
||||
typedef PRInt64 _MDOff64_t;
|
||||
#else
|
||||
#error "I don't know yet"
|
||||
#endif
|
||||
|
||||
typedef PRIntn (*_MD_Fstat64)(PRIntn osfd, _MDStat64 *buf);
|
||||
typedef PRIntn (*_MD_Open64)(const char *path, int oflag, ...);
|
||||
#if defined(VMS)
|
||||
typedef PRIntn (*_MD_Stat64)(const char *path, _MDStat64 *buf, ...);
|
||||
#else
|
||||
typedef PRIntn (*_MD_Stat64)(const char *path, _MDStat64 *buf);
|
||||
#endif
|
||||
typedef _MDOff64_t (*_MD_Lseek64)(PRIntn osfd, _MDOff64_t, PRIntn whence);
|
||||
typedef void* (*_MD_Mmap64)(
|
||||
void *addr, PRSize len, PRIntn prot, PRIntn flags,
|
||||
PRIntn fildes, _MDOff64_t offset);
|
||||
struct _MD_IOVector
|
||||
{
|
||||
_MD_Open64 _open64;
|
||||
_MD_Mmap64 _mmap64;
|
||||
_MD_Stat64 _stat64;
|
||||
_MD_Fstat64 _fstat64;
|
||||
_MD_Lseek64 _lseek64;
|
||||
};
|
||||
extern struct _MD_IOVector _md_iovector;
|
||||
|
||||
#endif /* prunixos_h___ */
|
||||
219
Src/nprt_plugin/gecko/1.8/win/include/md/_unixware.h
Normal file
219
Src/nprt_plugin/gecko/1.8/win/include/md/_unixware.h
Normal file
@@ -0,0 +1,219 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Portable Runtime (NSPR).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998-2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nspr_unixware_defs_h___
|
||||
#define nspr_unixware_defs_h___
|
||||
|
||||
/*
|
||||
* Internal configuration macros
|
||||
*/
|
||||
|
||||
#define PR_LINKER_ARCH "unixware"
|
||||
#define _PR_SI_SYSNAME "UnixWare"
|
||||
#define _PR_SI_ARCHITECTURE "x86"
|
||||
#define PR_DLL_SUFFIX ".so"
|
||||
|
||||
#define _PR_VMBASE 0x30000000
|
||||
#define _PR_STACK_VMBASE 0x50000000
|
||||
#define _MD_DEFAULT_STACK_SIZE 65536L
|
||||
#define _MD_MMAP_FLAGS MAP_PRIVATE
|
||||
|
||||
#ifndef HAVE_WEAK_IO_SYMBOLS
|
||||
#define HAVE_WEAK_IO_SYMBOLS
|
||||
#endif
|
||||
#define _PR_POLL_AVAILABLE
|
||||
#define _PR_USE_POLL
|
||||
#define _PR_STAT_HAS_ST_ATIM_UNION
|
||||
|
||||
#undef HAVE_STACK_GROWING_UP
|
||||
#define HAVE_NETCONFIG
|
||||
#define HAVE_DLL
|
||||
#define USE_DLFCN
|
||||
#define HAVE_STRERROR
|
||||
#define NEED_STRFTIME_LOCK
|
||||
#define NEED_TIME_R
|
||||
#define _PR_NEED_STRCASECMP
|
||||
|
||||
#define USE_SETJMP
|
||||
|
||||
#include <setjmp.h>
|
||||
|
||||
#define _SETJMP setjmp
|
||||
#define _LONGJMP longjmp
|
||||
#define _PR_CONTEXT_TYPE jmp_buf
|
||||
#define _MD_GET_SP(_t) (_t)->md.context[4]
|
||||
#define _PR_NUM_GCREGS _JBLEN
|
||||
|
||||
#define CONTEXT(_th) ((_th)->md.context)
|
||||
|
||||
/*
|
||||
** Initialize the thread context preparing it to execute _main.
|
||||
*/
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
{ \
|
||||
*status = PR_TRUE; \
|
||||
if(_SETJMP(CONTEXT(_thread))) (*_main)(); \
|
||||
_MD_GET_SP(_thread) = (int) ((_sp) - 128); \
|
||||
}
|
||||
|
||||
#define _MD_SWITCH_CONTEXT(_thread) \
|
||||
if (!_SETJMP(CONTEXT(_thread))) { \
|
||||
(_thread)->md.errcode = errno; \
|
||||
_PR_Schedule(); \
|
||||
}
|
||||
|
||||
/*
|
||||
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
|
||||
*/
|
||||
#define _MD_RESTORE_CONTEXT(_thread) \
|
||||
{ \
|
||||
errno = (_thread)->md.errcode; \
|
||||
_MD_SET_CURRENT_THREAD(_thread); \
|
||||
_LONGJMP(CONTEXT(_thread), 1); \
|
||||
}
|
||||
|
||||
/* Machine-dependent (MD) data structures.
|
||||
* Don't use SVR4 native threads (yet).
|
||||
*/
|
||||
|
||||
struct _MDThread {
|
||||
_PR_CONTEXT_TYPE context;
|
||||
int id;
|
||||
int errcode;
|
||||
};
|
||||
|
||||
struct _MDThreadStack {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDLock {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSemaphore {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDCVar {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
struct _MDSegment {
|
||||
PRInt8 notused;
|
||||
};
|
||||
|
||||
/*
|
||||
* md-specific cpu structure field
|
||||
*/
|
||||
#define _PR_MD_MAX_OSFD FD_SETSIZE
|
||||
|
||||
struct _MDCPU_Unix {
|
||||
PRCList ioQ;
|
||||
PRUint32 ioq_timeout;
|
||||
PRInt32 ioq_max_osfd;
|
||||
PRInt32 ioq_osfd_cnt;
|
||||
#ifndef _PR_USE_POLL
|
||||
fd_set fd_read_set, fd_write_set, fd_exception_set;
|
||||
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
|
||||
fd_exception_cnt[_PR_MD_MAX_OSFD];
|
||||
#else
|
||||
struct pollfd *ioq_pollfds;
|
||||
int ioq_pollfds_size;
|
||||
#endif /* _PR_USE_POLL */
|
||||
};
|
||||
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
||||
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
||||
#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
||||
#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
||||
#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
||||
|
||||
#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
||||
|
||||
struct _MDCPU {
|
||||
struct _MDCPU_Unix md_unix;
|
||||
};
|
||||
|
||||
#define _MD_INIT_LOCKS()
|
||||
#define _MD_NEW_LOCK(lock) PR_SUCCESS
|
||||
#define _MD_FREE_LOCK(lock)
|
||||
#define _MD_LOCK(lock)
|
||||
#define _MD_UNLOCK(lock)
|
||||
#define _MD_INIT_IO()
|
||||
#define _MD_IOQ_LOCK()
|
||||
#define _MD_IOQ_UNLOCK()
|
||||
|
||||
/*
|
||||
* The following are copied from _sunos.h, _aix.h. This means
|
||||
* some of them should probably be moved into _unixos.h. But
|
||||
* _irix.h seems to be quite different in regard to these macros.
|
||||
*/
|
||||
#define _MD_GET_INTERVAL _PR_UNIX_GetInterval
|
||||
#define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond
|
||||
|
||||
#define _MD_EARLY_INIT _MD_EarlyInit
|
||||
#define _MD_FINAL_INIT _PR_UnixInit
|
||||
#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
|
||||
#define _MD_INIT_THREAD _MD_InitializeThread
|
||||
#define _MD_EXIT_THREAD(thread)
|
||||
#define _MD_SUSPEND_THREAD(thread)
|
||||
#define _MD_RESUME_THREAD(thread)
|
||||
#define _MD_CLEAN_THREAD(_thread)
|
||||
|
||||
/*
|
||||
* We wrapped the select() call. _MD_SELECT refers to the built-in,
|
||||
* unwrapped version.
|
||||
*/
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/select.h>
|
||||
extern int _select(int nfds, fd_set *readfds, fd_set *writefds,
|
||||
fd_set *execptfds, struct timeval *timeout);
|
||||
#define _MD_SELECT _select
|
||||
|
||||
#define _MD_POLL _poll
|
||||
extern int _poll(struct pollfd *fds, unsigned long nfds, int timeout);
|
||||
|
||||
#endif /* nspr_unixware_defs_h___ */
|
||||
568
Src/nprt_plugin/gecko/1.8/win/include/md/_win16.h
Normal file
568
Src/nprt_plugin/gecko/1.8/win/include/md/_win16.h
Normal file
@@ -0,0 +1,568 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Portable Runtime (NSPR).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998-2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nspr_win16_defs_h___
|
||||
#define nspr_win16_defs_h___
|
||||
|
||||
#include <windows.h>
|
||||
#include <winsock.h>
|
||||
#include <errno.h>
|
||||
#include <direct.h>
|
||||
|
||||
#include "nspr.h"
|
||||
/* $$ fix this */
|
||||
#define Remind(x)
|
||||
|
||||
/*
|
||||
* Internal configuration macros
|
||||
*/
|
||||
|
||||
#define PR_LINKER_ARCH "win16"
|
||||
#define _PR_SI_SYSNAME "WIN16"
|
||||
#define _PR_SI_ARCHITECTURE "x86" /* XXXMB hardcode for now */
|
||||
|
||||
#define HAVE_DLL
|
||||
#define _PR_NO_PREEMPT
|
||||
#define _PR_LOCAL_THREADS_ONLY
|
||||
#undef _PR_GLOBAL_THREADS_ONLY
|
||||
#undef HAVE_THREAD_AFFINITY
|
||||
#define _PR_HAVE_ATOMIC_OPS
|
||||
|
||||
/* --- Common User-Thread/Native-Thread Definitions --------------------- */
|
||||
|
||||
extern struct PRLock *_pr_schedLock;
|
||||
extern char * _pr_top_of_task_stack;
|
||||
|
||||
|
||||
/* --- Typedefs --- */
|
||||
|
||||
#define PR_NUM_GCREGS 9
|
||||
typedef PRInt32 PR_CONTEXT_TYPE[PR_NUM_GCREGS];
|
||||
|
||||
#define _MD_MAGIC_THREAD 0x22222222
|
||||
#define _MD_MAGIC_THREADSTACK 0x33333333
|
||||
#define _MD_MAGIC_SEGMENT 0x44444444
|
||||
#define _MD_MAGIC_DIR 0x55555555
|
||||
#define _MD_MAGIC_CV 0x66666666
|
||||
|
||||
|
||||
typedef struct _PRWin16PollDesc
|
||||
{
|
||||
PRInt32 osfd;
|
||||
PRInt16 in_flags;
|
||||
PRInt16 out_flags;
|
||||
} _PRWin16PollDesc;
|
||||
|
||||
typedef struct PRPollQueue
|
||||
{
|
||||
PRCList links; /* for linking PRPollQueue's together */
|
||||
_PRWin16PollDesc *pds; /* array of poll descriptors */
|
||||
PRUintn npds; /* length of the array */
|
||||
PRPackedBool on_ioq; /* is this on the async i/o work q? */
|
||||
PRIntervalTime timeout; /* timeout, in ticks */
|
||||
struct PRThread *thr;
|
||||
} PRPollQueue;
|
||||
|
||||
#define _PR_POLLQUEUE_PTR(_qp) \
|
||||
((PRPollQueue *) ((char*) (_qp) - offsetof(PRPollQueue,links)))
|
||||
|
||||
NSPR_API(PRInt32) _PR_WaitForFD(PRInt32 osfd, PRUintn how,
|
||||
PRIntervalTime timeout);
|
||||
NSPR_API(void) _PR_Unblock_IO_Wait(struct PRThread *thr);
|
||||
|
||||
#define _PR_MD_MAX_OSFD FD_SETSIZE
|
||||
#define _PR_IOQ(_cpu) ((_cpu)->md.ioQ)
|
||||
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
|
||||
#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.fd_read_set)
|
||||
#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.fd_read_cnt)
|
||||
#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.fd_write_set)
|
||||
#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.fd_write_cnt)
|
||||
#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.fd_exception_set)
|
||||
#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.fd_exception_cnt)
|
||||
#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.ioq_timeout)
|
||||
#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.ioq_max_osfd)
|
||||
|
||||
struct _MDCPU {
|
||||
PRCList ioQ;
|
||||
fd_set fd_read_set, fd_write_set, fd_exception_set;
|
||||
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
|
||||
fd_exception_cnt[_PR_MD_MAX_OSFD];
|
||||
PRUint32 ioq_timeout;
|
||||
PRInt32 ioq_max_osfd;
|
||||
};
|
||||
|
||||
struct _MDThread {
|
||||
/* The overlapped structure must be first! */
|
||||
HANDLE blocked_sema; /* Threads block on this when waiting
|
||||
* for IO or CondVar.
|
||||
*/
|
||||
PRInt32 errcode; /* preserved errno for this thread */
|
||||
CATCHBUF context; /* thread context for Throw() */
|
||||
void *SP; /* Stack pointer, used only by GarbColl */
|
||||
int threadNumber; /* instrumentation: order of creation */
|
||||
_PRWin16PollDesc thr_pd; /* poll descriptor for i/o */
|
||||
PRPollQueue thr_pq; /* i/o parameters */
|
||||
void *exceptionContext; /* mfc exception context */
|
||||
char guardBand[24]; /* don't overwrite this */
|
||||
PRUint32 magic; /* self identifier, for debug */
|
||||
};
|
||||
|
||||
struct _MDThreadStack {
|
||||
PRUint32 magic; /* for debugging */
|
||||
PRIntn cxByteCount; /* number of stack bytes to move */
|
||||
char * stackTop; /* high address on stack */
|
||||
};
|
||||
|
||||
struct _MDSegment {
|
||||
PRUint32 magic; /* for debugging */
|
||||
};
|
||||
|
||||
|
||||
struct _MDLock {
|
||||
PRUint32 magic; /* for debugging */
|
||||
PRUint32 mutex;
|
||||
};
|
||||
|
||||
struct _MDDir {
|
||||
PRUint32 magic; /* for debugging */
|
||||
struct dirent *dir;
|
||||
};
|
||||
|
||||
struct _MDCVar {
|
||||
PRUint32 magic;
|
||||
};
|
||||
|
||||
struct _MDSemaphore {
|
||||
PRInt32 unused;
|
||||
};
|
||||
|
||||
struct _MDFileDesc {
|
||||
PRInt32 osfd;
|
||||
};
|
||||
|
||||
struct _MDProcess {
|
||||
HANDLE handle;
|
||||
DWORD id;
|
||||
};
|
||||
|
||||
/*
|
||||
** Microsoft 'struct _stat'
|
||||
** ... taken directly from msvc 1.52c's header file sys/stat.h
|
||||
** see PR_Stat() implemented in w16io.c
|
||||
** See BugSplat: 98516
|
||||
*/
|
||||
#pragma pack(push)
|
||||
#pragma pack(2)
|
||||
|
||||
typedef unsigned short _ino_t;
|
||||
typedef short _dev_t;
|
||||
typedef long _off_t;
|
||||
|
||||
typedef struct _MDMSStat {
|
||||
_dev_t st_dev;
|
||||
_ino_t st_ino;
|
||||
unsigned short st_mode;
|
||||
short st_nlink;
|
||||
short st_uid;
|
||||
short st_gid;
|
||||
_dev_t st_rdev;
|
||||
_off_t st_size;
|
||||
time_t st_atime;
|
||||
time_t st_mtime;
|
||||
time_t st_ctime;
|
||||
} _MDMSStat;
|
||||
#pragma pack(pop)
|
||||
|
||||
/* --- Errors --- */
|
||||
/* These are NSPR generated error codes which need to be unique from
|
||||
* OS error codes.
|
||||
*/
|
||||
#define _MD_UNIQUEBASE 50000
|
||||
#define _MD_EINTERRUPTED _MD_UNIQUEBASE + 1
|
||||
#define _MD_ETIMEDOUT _MD_UNIQUEBASE + 2
|
||||
#define _MD_EIO _MD_UNIQUEBASE + 3
|
||||
|
||||
struct PRProcess;
|
||||
struct PRProcessAttr;
|
||||
|
||||
/* --- Create a new process --- */
|
||||
#define _MD_CREATE_PROCESS _PR_CreateWindowsProcess
|
||||
extern struct PRProcess * _PR_CreateWindowsProcess(
|
||||
const char *path,
|
||||
char *const *argv,
|
||||
char *const *envp,
|
||||
const struct PRProcessAttr *attr
|
||||
);
|
||||
|
||||
#define _MD_DETACH_PROCESS _PR_DetachWindowsProcess
|
||||
extern PRStatus _PR_DetachWindowsProcess(struct PRProcess *process);
|
||||
|
||||
/* --- Wait for a child process to terminate --- */
|
||||
#define _MD_WAIT_PROCESS _PR_WaitWindowsProcess
|
||||
extern PRStatus _PR_WaitWindowsProcess(struct PRProcess *process,
|
||||
PRInt32 *exitCode);
|
||||
|
||||
#define _MD_KILL_PROCESS _PR_KillWindowsProcess
|
||||
extern PRStatus _PR_KillWindowsProcess(struct PRProcess *process);
|
||||
|
||||
|
||||
/* --- Misc stuff --- */
|
||||
|
||||
#define MD_ASSERTINT( x ) PR_ASSERT( (x) < 65535 )
|
||||
|
||||
/* --- IO stuff --- */
|
||||
#define MAX_PATH 256
|
||||
#define _MD_ERRNO() errno
|
||||
#define GetLastError() errno
|
||||
|
||||
#define _MD_GET_FILE_ERROR() errno
|
||||
#define _MD_SET_FILE_ERROR(_err) errno = (_err)
|
||||
|
||||
#define _MD_OPEN _PR_MD_OPEN
|
||||
#define _MD_READ _PR_MD_READ
|
||||
#define _MD_WRITE _PR_MD_WRITE
|
||||
#define _MD_WRITEV _PR_MD_WRITEV
|
||||
#define _MD_LSEEK _PR_MD_LSEEK
|
||||
#define _MD_LSEEK64 _PR_MD_LSEEK64
|
||||
#define _MD_CLOSE_FILE _PR_MD_CLOSE_FILE
|
||||
#define _MD_GETFILEINFO _PR_MD_GETFILEINFO
|
||||
#define _MD_GETOPENFILEINFO _PR_MD_GETOPENFILEINFO
|
||||
#define _MD_STAT _PR_MD_STAT
|
||||
#define _MD_RENAME _PR_MD_RENAME
|
||||
#define _MD_ACCESS _PR_MD_ACCESS
|
||||
#define _MD_DELETE _PR_MD_DELETE
|
||||
#define _MD_MKDIR _PR_MD_MKDIR
|
||||
#define _MD_RMDIR _PR_MD_RMDIR
|
||||
#define _MD_LOCKFILE _PR_MD_LOCKFILE
|
||||
#define _MD_TLOCKFILE _PR_MD_TLOCKFILE
|
||||
#define _MD_UNLOCKFILE _PR_MD_UNLOCKFILE
|
||||
|
||||
|
||||
/* --- Socket IO stuff --- */
|
||||
#define _MD_EACCES WSAEACCES
|
||||
#define _MD_EADDRINUSE WSAEADDRINUSE
|
||||
#define _MD_EADDRNOTAVAIL WSAEADDRNOTAVAIL
|
||||
#define _MD_EAFNOSUPPORT WSAEAFNOSUPPORT
|
||||
#define _MD_EAGAIN WSAEWOULDBLOCK
|
||||
#define _MD_EALREADY WSAEALREADY
|
||||
#define _MD_EBADF WSAEBADF
|
||||
#define _MD_ECONNREFUSED WSAECONNREFUSED
|
||||
#define _MD_ECONNRESET WSAECONNRESET
|
||||
#define _MD_EFAULT WSAEFAULT
|
||||
#define _MD_EINPROGRESS WSAEINPROGRESS
|
||||
#define _MD_EINTR WSAEINTR
|
||||
#define _MD_EINVAL EINVAL
|
||||
#define _MD_EISCONN WSAEISCONN
|
||||
#define _MD_ENETUNREACH WSAENETUNREACH
|
||||
#define _MD_ENOENT ENOENT
|
||||
#define _MD_ENOTCONN WSAENOTCONN
|
||||
#define _MD_ENOTSOCK WSAENOTSOCK
|
||||
#define _MD_EOPNOTSUPP WSAEOPNOTSUPP
|
||||
#define _MD_EWOULDBLOCK WSAEWOULDBLOCK
|
||||
#define _MD_GET_SOCKET_ERROR() WSAGetLastError()
|
||||
#define _MD_SET_SOCKET_ERROR(_err) WSASetLastError(_err)
|
||||
|
||||
#define _MD_INIT_FILEDESC(fd)
|
||||
#define _MD_MAKE_NONBLOCK _PR_MD_MAKE_NONBLOCK
|
||||
#define _MD_SHUTDOWN _PR_MD_SHUTDOWN
|
||||
#define _MD_LISTEN _PR_MD_LISTEN
|
||||
#define _MD_CLOSE_SOCKET _PR_MD_CLOSE_SOCKET
|
||||
#define _MD_SENDTO _PR_MD_SENDTO
|
||||
#define _MD_RECVFROM _PR_MD_RECVFROM
|
||||
#define _MD_SOCKETPAIR(s, type, proto, sv) -1
|
||||
#define _MD_GETSOCKNAME _PR_MD_GETSOCKNAME
|
||||
#define _MD_GETPEERNAME _PR_MD_GETPEERNAME
|
||||
#define _MD_GETSOCKOPT _PR_MD_GETSOCKOPT
|
||||
#define _MD_SETSOCKOPT _PR_MD_SETSOCKOPT
|
||||
#define _MD_SELECT select
|
||||
#define _MD_FSYNC _PR_MD_FSYNC
|
||||
#define _MD_SOCKETAVAILABLE _PR_MD_SOCKETAVAILABLE
|
||||
|
||||
#define _MD_INIT_ATOMIC()
|
||||
#define _MD_ATOMIC_INCREMENT(x) (*x++)
|
||||
#define _MD_ATOMIC_ADD(ptr, val) ((*x) += val)
|
||||
#define _MD_ATOMIC_DECREMENT(x) (*x--)
|
||||
#define _MD_ATOMIC_SET(x,y) (*x, y)
|
||||
|
||||
#define _MD_INIT_IO _PR_MD_INIT_IO
|
||||
|
||||
/* win95 doesn't have async IO */
|
||||
#define _MD_SOCKET _PR_MD_SOCKET
|
||||
#define _MD_CONNECT _PR_MD_CONNECT
|
||||
#define _MD_ACCEPT _PR_MD_ACCEPT
|
||||
#define _MD_BIND _PR_MD_BIND
|
||||
#define _MD_RECV _PR_MD_RECV
|
||||
#define _MD_SEND _PR_MD_SEND
|
||||
|
||||
#define _MD_CHECK_FOR_EXIT()
|
||||
|
||||
/* --- Scheduler stuff --- */
|
||||
#define _MD_PAUSE_CPU _PR_MD_PAUSE_CPU
|
||||
|
||||
/* --- DIR stuff --- */
|
||||
#define PR_DIRECTORY_SEPARATOR '\\'
|
||||
#define PR_DIRECTORY_SEPARATOR_STR "\\"
|
||||
#define PR_PATH_SEPARATOR ';'
|
||||
#define PR_PATH_SEPARATOR_STR ";"
|
||||
#define _MD_OPEN_DIR _PR_MD_OPEN_DIR
|
||||
#define _MD_CLOSE_DIR _PR_MD_CLOSE_DIR
|
||||
#define _MD_READ_DIR _PR_MD_READ_DIR
|
||||
|
||||
/* --- Segment stuff --- */
|
||||
#define _MD_INIT_SEGS()
|
||||
#define _MD_ALLOC_SEGMENT _MD_AllocSegment
|
||||
#define _MD_FREE_SEGMENT _MD_FreeSegment
|
||||
|
||||
/* --- Environment Stuff --- */
|
||||
#define _MD_GET_ENV _PR_MD_GET_ENV
|
||||
#define _MD_PUT_ENV _PR_MD_PUT_ENV
|
||||
|
||||
/* --- Threading Stuff --- */
|
||||
#define _MD_DEFAULT_STACK_SIZE 32767L
|
||||
#define _MD_INIT_THREAD _PR_MD_INIT_THREAD
|
||||
#define _MD_CREATE_THREAD(t,f,p,sc,st,stsiz) (PR_SUCCESS)
|
||||
#define _MD_YIELD _PR_MD_YIELD
|
||||
#define _MD_SET_PRIORITY(t,p)
|
||||
#define _MD_CLEAN_THREAD(t)
|
||||
#define _MD_SETTHREADAFFINITYMASK _PR_MD_SETTHREADAFFINITYMASK
|
||||
#define _MD_GETTHREADAFFINITYMASK _PR_MD_GETTHREADAFFINITYMASK
|
||||
#define _MD_EXIT_THREAD
|
||||
#define _MD_SUSPEND_THREAD _PR_MD_SUSPEND_THREAD
|
||||
#define _MD_RESUME_THREAD _PR_MD_RESUME_THREAD
|
||||
#define _MD_SUSPEND_CPU _PR_MD_SUSPEND_CPU
|
||||
#define _MD_RESUME_CPU _PR_MD_RESUME_CPU
|
||||
#define _MD_BEGIN_SUSPEND_ALL()
|
||||
#define _MD_BEGIN_RESUME_ALL()
|
||||
#define _MD_END_SUSPEND_ALL()
|
||||
#define _MD_END_RESUME_ALL()
|
||||
|
||||
/* --- Lock stuff --- */
|
||||
/*
|
||||
** Win16 does not need MD locks.
|
||||
*/
|
||||
#define _PR_LOCK _MD_LOCK
|
||||
#define _PR_UNLOCK _MD_UNLOCK
|
||||
|
||||
#define _MD_NEW_LOCK(l) (PR_SUCCESS)
|
||||
#define _MD_FREE_LOCK(l)
|
||||
#define _MD_LOCK(l)
|
||||
#define _MD_TEST_AND_LOCK(l) (-1)
|
||||
#define _MD_UNLOCK(l)
|
||||
|
||||
/* --- lock and cv waiting --- */
|
||||
#define _MD_WAIT _PR_MD_WAIT
|
||||
#define _MD_WAKEUP_WAITER(a)
|
||||
#define _MD_WAKEUP_CPUS _PR_MD_WAKEUP_CPUS
|
||||
|
||||
/* --- CVar ------------------- */
|
||||
#define _MD_WAIT_CV _PR_MD_WAIT_CV
|
||||
#define _MD_NEW_CV _PR_MD_NEW_CV
|
||||
#define _MD_FREE_CV _PR_MD_FREE_CV
|
||||
#define _MD_NOTIFY_CV _PR_MD_NOTIFY_CV
|
||||
#define _MD_NOTIFYALL_CV _PR_MD_NOTIFYALL_CV
|
||||
|
||||
/* XXXMB- the IOQ stuff is certainly not working correctly yet. */
|
||||
#define _MD_IOQ_LOCK()
|
||||
#define _MD_IOQ_UNLOCK()
|
||||
|
||||
|
||||
/* --- Initialization stuff --- */
|
||||
NSPR_API(void) _MD_INIT_RUNNING_CPU(struct _PRCPU *cpu );
|
||||
#define _MD_START_INTERRUPTS()
|
||||
#define _MD_STOP_INTERRUPTS()
|
||||
#define _MD_DISABLE_CLOCK_INTERRUPTS()
|
||||
#define _MD_ENABLE_CLOCK_INTERRUPTS()
|
||||
#define _MD_BLOCK_CLOCK_INTERRUPTS()
|
||||
#define _MD_UNBLOCK_CLOCK_INTERRUPTS()
|
||||
#define _MD_EARLY_INIT _PR_MD_EARLY_INIT
|
||||
#define _MD_FINAL_INIT _PR_MD_FINAL_INIT
|
||||
#define _MD_INIT_CPUS()
|
||||
|
||||
/* --- User Threading stuff --- */
|
||||
#define _MD_EXIT
|
||||
|
||||
#define _MD_CLEANUP_BEFORE_EXIT _PR_MD_CLEANUP_BEFORE_EXIT
|
||||
|
||||
/* --- Intervals --- */
|
||||
#define _MD_INTERVAL_INIT _PR_MD_INTERVAL_INIT
|
||||
#define _MD_GET_INTERVAL _PR_MD_GET_INTERVAL
|
||||
#define _MD_INTERVAL_PER_SEC _PR_MD_INTERVAL_PER_SEC
|
||||
#define _MD_INTERVAL_PER_MILLISEC() (_PR_MD_INTERVAL_PER_SEC() / 1000)
|
||||
#define _MD_INTERVAL_PER_MICROSEC() (_PR_MD_INTERVAL_PER_SEC() / 1000000)
|
||||
|
||||
/* --- Scheduler stuff --- */
|
||||
#define LOCK_SCHEDULER() 0
|
||||
#define UNLOCK_SCHEDULER() 0
|
||||
#define _PR_LockSched() 0
|
||||
#define _PR_UnlockSched() 0
|
||||
|
||||
/* --- Initialization stuff --- */
|
||||
#define _MD_INIT_LOCKS()
|
||||
|
||||
/* --- Stack stuff --- */
|
||||
#define _MD_INIT_STACK _PR_MD_INIT_STACK
|
||||
#define _MD_CLEAR_STACK(stack)
|
||||
|
||||
/*
|
||||
** Watcom needs to see this to make the linker work.
|
||||
**
|
||||
*/
|
||||
NSPR_API(void) _PR_NativeDestroyThread(PRThread *thread);
|
||||
NSPR_API(void) _PR_UserDestroyThread(PRThread *thread);
|
||||
|
||||
|
||||
/*
|
||||
** If thread emulation is used, then setjmp/longjmp stores the register
|
||||
** state of each thread.
|
||||
**
|
||||
** CatchBuf layout:
|
||||
** context[0] - IP
|
||||
** context[1] - CS
|
||||
** context[2] - SP
|
||||
** context[3] - BP
|
||||
** context[4] - SI
|
||||
** context[5] - DI
|
||||
** context[6] - DS
|
||||
** context[7] - ?? (maybe flags)
|
||||
** context[8] - SS
|
||||
*/
|
||||
#define PR_CONTEXT_TYPE CATCHBUF
|
||||
#define PR_NUM_GCREGS 9
|
||||
|
||||
#define _MD_GET_SP(thread) ((thread)->md.SP)
|
||||
#define CONTEXT(_t) ((_t)->md.context)
|
||||
|
||||
/*
|
||||
** Initialize a thread context to run "e(o,a)" when started
|
||||
*/
|
||||
#define _MD_INIT_CONTEXT(_t, sp, epa, stat ) \
|
||||
{ \
|
||||
*(stat) = PR_TRUE; \
|
||||
Catch((_t)->md.context ); \
|
||||
(_t)->md.context[0] = OFFSETOF(epa); \
|
||||
(_t)->md.context[1] = SELECTOROF(epa); \
|
||||
(_t)->md.context[2] = OFFSETOF(_pr_top_of_task_stack - 64); \
|
||||
(_t)->md.context[3] = 0; \
|
||||
}
|
||||
|
||||
#define _MD_SWITCH_CONTEXT(_t) \
|
||||
if (!Catch((_t)->md.context)) { \
|
||||
int garbCollPlaceHolder; \
|
||||
(_t)->md.errcode = errno; \
|
||||
(_t)->md.SP = &garbCollPlaceHolder; \
|
||||
_PR_Schedule(); \
|
||||
}
|
||||
|
||||
#define _MD_SAVE_CONTEXT(_t) \
|
||||
{ \
|
||||
int garbCollPlaceHolder; \
|
||||
Catch((_t)->md.context); \
|
||||
(_t)->md.errcode = errno; \
|
||||
(_t)->md.SP = &garbCollPlaceHolder; \
|
||||
}
|
||||
|
||||
/*
|
||||
** Restore a thread context, saved by _MD_SWITCH_CONTEXT
|
||||
*/
|
||||
#define _PR_MD_RESTORE_CONTEXT _MD_RESTORE_CONTEXT
|
||||
|
||||
/*
|
||||
* Memory-mapped files
|
||||
*/
|
||||
|
||||
struct _MDFileMap {
|
||||
PRInt8 unused;
|
||||
};
|
||||
|
||||
extern PRStatus _MD_CreateFileMap(struct PRFileMap *fmap, PRInt64 size);
|
||||
#define _MD_CREATE_FILE_MAP _MD_CreateFileMap
|
||||
|
||||
extern PRInt32 _MD_GetMemMapAlignment(void);
|
||||
#define _MD_GET_MEM_MAP_ALIGNMENT _MD_GetMemMapAlignment
|
||||
|
||||
extern void * _MD_MemMap(struct PRFileMap *fmap, PRInt64 offset,
|
||||
PRUint32 len);
|
||||
#define _MD_MEM_MAP _MD_MemMap
|
||||
|
||||
extern PRStatus _MD_MemUnmap(void *addr, PRUint32 size);
|
||||
#define _MD_MEM_UNMAP _MD_MemUnmap
|
||||
|
||||
extern PRStatus _MD_CloseFileMap(struct PRFileMap *fmap);
|
||||
#define _MD_CLOSE_FILE_MAP _MD_CloseFileMap
|
||||
|
||||
|
||||
/* --- Error mapping ----------------------------------- */
|
||||
extern void _PR_MD_map_error( int err );
|
||||
|
||||
#define _PR_MD_MAP_OPENDIR_ERROR _PR_MD_map_error
|
||||
#define _PR_MD_MAP_CLOSEDIR_ERROR _PR_MD_map_error
|
||||
#define _PR_MD_MAP_READDIR_ERROR _PR_MD_map_error
|
||||
#define _PR_MD_MAP_DELETE_ERROR _PR_MD_map_error
|
||||
#define _PR_MD_MAP_STAT_ERROR _PR_MD_map_error
|
||||
#define _PR_MD_MAP_FSTAT_ERROR _PR_MD_map_error
|
||||
#define _PR_MD_MAP_RENAME_ERROR _PR_MD_map_error
|
||||
#define _PR_MD_MAP_ACCESS_ERROR _PR_MD_map_error
|
||||
#define _PR_MD_MAP_MKDIR_ERROR _PR_MD_map_error
|
||||
#define _PR_MD_MAP_RMDIR_ERROR _PR_MD_map_error
|
||||
#define _PR_MD_MAP_READ_ERROR _PR_MD_map_error
|
||||
#define _PR_MD_MAP_TRANSMITFILE_ERROR _PR_MD_map_error
|
||||
#define _PR_MD_MAP_WRITE_ERROR _PR_MD_map_error
|
||||
#define _PR_MD_MAP_LSEEK_ERROR _PR_MD_map_error
|
||||
#define _PR_MD_MAP_FSYNC_ERROR _PR_MD_map_error
|
||||
#define _PR_MD_MAP_CLOSE_ERROR _PR_MD_map_error
|
||||
#define _PR_MD_MAP_SOCKET_ERROR _PR_MD_map_error
|
||||
#define _PR_MD_MAP_RECV_ERROR _PR_MD_map_error
|
||||
#define _PR_MD_MAP_RECVFROM_ERROR _PR_MD_map_error
|
||||
#define _PR_MD_MAP_SEND_ERROR _PR_MD_map_error
|
||||
#define _PR_MD_MAP_SENDTO_ERROR _PR_MD_map_error
|
||||
#define _PR_MD_MAP_ACCEPT_ERROR _PR_MD_map_error
|
||||
#define _PR_MD_MAP_ACCEPTEX_ERROR _PR_MD_map_error
|
||||
#define _PR_MD_MAP_CONNECT_ERROR _PR_MD_map_error
|
||||
#define _PR_MD_MAP_BIND_ERROR _PR_MD_map_error
|
||||
#define _PR_MD_MAP_LISTEN_ERROR _PR_MD_map_error
|
||||
#define _PR_MD_MAP_SHUTDOWN_ERROR _PR_MD_map_error
|
||||
#define _PR_MD_MAP_GETSOCKNAME_ERROR _PR_MD_map_error
|
||||
#define _PR_MD_MAP_GETPEERNAME_ERROR _PR_MD_map_error
|
||||
#define _PR_MD_MAP_GETSOCKOPT_ERROR _PR_MD_map_error
|
||||
#define _PR_MD_MAP_SETSOCKOPT_ERROR _PR_MD_map_error
|
||||
#define _PR_MD_MAP_OPEN_ERROR _PR_MD_map_error
|
||||
#define _PR_MD_MAP_GETHOSTNAME_ERROR _PR_MD_map_error
|
||||
#define _PR_MD_MAP_SELECT_ERROR _PR_MD_map_error
|
||||
#define _PR_MD_MAP_LOCKF_ERROR _PR_MD_map_error
|
||||
#define _PR_MD_MAP_WSASTARTUP_ERROR _PR_MD_map_error
|
||||
|
||||
#endif /* nspr_win16_defs_h___ */
|
||||
154
Src/nprt_plugin/gecko/1.8/win/include/md/_win32_errors.h
Normal file
154
Src/nprt_plugin/gecko/1.8/win/include/md/_win32_errors.h
Normal file
@@ -0,0 +1,154 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Portable Runtime (NSPR).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998-2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nspr_win32_errors_h___
|
||||
#define nspr_win32_errors_h___
|
||||
|
||||
#include <windows.h>
|
||||
#include <winsock.h>
|
||||
#include <errno.h>
|
||||
|
||||
|
||||
extern void _MD_win32_map_default_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_DEFAULT_ERROR _MD_win32_map_default_error
|
||||
|
||||
extern void _MD_win32_map_opendir_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_OPENDIR_ERROR _MD_win32_map_opendir_error
|
||||
|
||||
extern void _MD_win32_map_closedir_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_CLOSEDIR_ERROR _MD_win32_map_closedir_error
|
||||
|
||||
extern void _MD_unix_readdir_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_READDIR_ERROR _MD_unix_readdir_error
|
||||
|
||||
extern void _MD_win32_map_delete_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_DELETE_ERROR _MD_win32_map_delete_error
|
||||
|
||||
extern void _MD_win32_map_stat_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_STAT_ERROR _MD_win32_map_stat_error
|
||||
|
||||
extern void _MD_win32_map_fstat_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_FSTAT_ERROR _MD_win32_map_fstat_error
|
||||
|
||||
extern void _MD_win32_map_rename_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_RENAME_ERROR _MD_win32_map_rename_error
|
||||
|
||||
extern void _MD_win32_map_access_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_ACCESS_ERROR _MD_win32_map_access_error
|
||||
|
||||
extern void _MD_win32_map_mkdir_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_MKDIR_ERROR _MD_win32_map_mkdir_error
|
||||
|
||||
extern void _MD_win32_map_rmdir_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_RMDIR_ERROR _MD_win32_map_rmdir_error
|
||||
|
||||
extern void _MD_win32_map_read_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_READ_ERROR _MD_win32_map_read_error
|
||||
|
||||
extern void _MD_win32_map_transmitfile_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_TRANSMITFILE_ERROR _MD_win32_map_transmitfile_error
|
||||
|
||||
extern void _MD_win32_map_write_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_WRITE_ERROR _MD_win32_map_write_error
|
||||
|
||||
extern void _MD_win32_map_lseek_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_LSEEK_ERROR _MD_win32_map_lseek_error
|
||||
|
||||
extern void _MD_win32_map_fsync_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_FSYNC_ERROR _MD_win32_map_fsync_error
|
||||
|
||||
extern void _MD_win32_map_close_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_CLOSE_ERROR _MD_win32_map_close_error
|
||||
|
||||
extern void _MD_win32_map_socket_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_SOCKET_ERROR _MD_win32_map_socket_error
|
||||
|
||||
extern void _MD_win32_map_recv_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_RECV_ERROR _MD_win32_map_recv_error
|
||||
|
||||
extern void _MD_win32_map_recvfrom_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_RECVFROM_ERROR _MD_win32_map_recvfrom_error
|
||||
|
||||
extern void _MD_win32_map_send_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_SEND_ERROR _MD_win32_map_send_error
|
||||
|
||||
extern void _MD_win32_map_sendto_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_SENDTO_ERROR _MD_win32_map_sendto_error
|
||||
|
||||
extern void _MD_win32_map_accept_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_ACCEPT_ERROR _MD_win32_map_accept_error
|
||||
|
||||
extern void _MD_win32_map_acceptex_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_ACCEPTEX_ERROR _MD_win32_map_acceptex_error
|
||||
|
||||
extern PRInt32 _MD_win32_map_connect_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_CONNECT_ERROR _MD_win32_map_connect_error
|
||||
|
||||
extern void _MD_win32_map_bind_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_BIND_ERROR _MD_win32_map_bind_error
|
||||
|
||||
extern void _MD_win32_map_listen_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_LISTEN_ERROR _MD_win32_map_listen_error
|
||||
|
||||
extern void _MD_win32_map_shutdown_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_SHUTDOWN_ERROR _MD_win32_map_shutdown_error
|
||||
|
||||
extern void _MD_win32_map_getsockname_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_GETSOCKNAME_ERROR _MD_win32_map_getsockname_error
|
||||
|
||||
extern void _MD_win32_map_getpeername_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_GETPEERNAME_ERROR _MD_win32_map_getpeername_error
|
||||
|
||||
extern void _MD_win32_map_getsockopt_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_GETSOCKOPT_ERROR _MD_win32_map_getsockopt_error
|
||||
|
||||
extern void _MD_win32_map_setsockopt_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_SETSOCKOPT_ERROR _MD_win32_map_setsockopt_error
|
||||
|
||||
extern void _MD_win32_map_open_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_OPEN_ERROR _MD_win32_map_open_error
|
||||
|
||||
extern void _MD_win32_map_gethostname_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_GETHOSTNAME_ERROR _MD_win32_map_gethostname_error
|
||||
|
||||
extern void _MD_win32_map_select_error(PRInt32 err);
|
||||
#define _PR_MD_MAP_SELECT_ERROR _MD_win32_map_select_error
|
||||
|
||||
extern void _MD_win32_map_lockf_error(int err);
|
||||
#define _PR_MD_MAP_LOCKF_ERROR _MD_win32_map_lockf_error
|
||||
|
||||
#endif /* nspr_win32_errors_h___ */
|
||||
549
Src/nprt_plugin/gecko/1.8/win/include/md/_win95.h
Normal file
549
Src/nprt_plugin/gecko/1.8/win/include/md/_win95.h
Normal file
@@ -0,0 +1,549 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Portable Runtime (NSPR).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998-2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nspr_win95_defs_h___
|
||||
#define nspr_win95_defs_h___
|
||||
|
||||
#include "prio.h"
|
||||
|
||||
#include <windows.h>
|
||||
#include <winsock.h>
|
||||
#include <errno.h>
|
||||
|
||||
/*
|
||||
* Internal configuration macros
|
||||
*/
|
||||
|
||||
#define PR_LINKER_ARCH "win32"
|
||||
#define _PR_SI_SYSNAME "WIN95"
|
||||
#define _PR_SI_ARCHITECTURE "x86" /* XXXMB hardcode for now */
|
||||
|
||||
#define HAVE_DLL
|
||||
#undef HAVE_THREAD_AFFINITY
|
||||
#define _PR_HAVE_GETADDRINFO
|
||||
#define _PR_INET6_PROBE
|
||||
#ifndef _PR_INET6
|
||||
#define AF_INET6 23
|
||||
/* newer ws2tcpip.h provides these */
|
||||
#ifndef AI_CANONNAME
|
||||
#define AI_CANONNAME 0x2
|
||||
struct addrinfo {
|
||||
int ai_flags;
|
||||
int ai_family;
|
||||
int ai_socktype;
|
||||
int ai_protocol;
|
||||
size_t ai_addrlen;
|
||||
char *ai_canonname;
|
||||
struct sockaddr *ai_addr;
|
||||
struct addrinfo *ai_next;
|
||||
};
|
||||
#endif
|
||||
#define _PR_HAVE_MD_SOCKADDR_IN6
|
||||
/* isomorphic to struct in6_addr on Windows */
|
||||
struct _md_in6_addr {
|
||||
union {
|
||||
PRUint8 _S6_u8[16];
|
||||
PRUint16 _S6_u16[8];
|
||||
} _S6_un;
|
||||
};
|
||||
/* isomorphic to struct sockaddr_in6 on Windows */
|
||||
struct _md_sockaddr_in6 {
|
||||
PRInt16 sin6_family;
|
||||
PRUint16 sin6_port;
|
||||
PRUint32 sin6_flowinfo;
|
||||
struct _md_in6_addr sin6_addr;
|
||||
PRUint32 sin6_scope_id;
|
||||
};
|
||||
#endif
|
||||
#define _PR_HAVE_THREADSAFE_GETHOST
|
||||
#define _PR_HAVE_ATOMIC_OPS
|
||||
#define PR_HAVE_WIN32_NAMED_SHARED_MEMORY
|
||||
|
||||
/* --- Common User-Thread/Native-Thread Definitions --------------------- */
|
||||
|
||||
/* --- Globals --- */
|
||||
extern struct PRLock *_pr_schedLock;
|
||||
|
||||
/* --- Typedefs --- */
|
||||
typedef void (*FiberFunc)(void *);
|
||||
|
||||
#define PR_NUM_GCREGS 8
|
||||
typedef PRInt32 PR_CONTEXT_TYPE[PR_NUM_GCREGS];
|
||||
#define GC_VMBASE 0x40000000
|
||||
#define GC_VMLIMIT 0x00FFFFFF
|
||||
|
||||
#define _MD_MAGIC_THREAD 0x22222222
|
||||
#define _MD_MAGIC_THREADSTACK 0x33333333
|
||||
#define _MD_MAGIC_SEGMENT 0x44444444
|
||||
#define _MD_MAGIC_DIR 0x55555555
|
||||
#define _MD_MAGIC_CV 0x66666666
|
||||
|
||||
struct _MDCPU {
|
||||
int unused;
|
||||
};
|
||||
|
||||
struct _MDThread {
|
||||
HANDLE blocked_sema; /* Threads block on this when waiting
|
||||
* for IO or CondVar.
|
||||
*/
|
||||
PRBool inCVWaitQueue; /* PR_TRUE if the thread is in the
|
||||
* wait queue of some cond var.
|
||||
* PR_FALSE otherwise. */
|
||||
HANDLE handle; /* Win32 thread handle */
|
||||
PRUint32 id;
|
||||
void *sp; /* only valid when suspended */
|
||||
PRUint32 magic; /* for debugging */
|
||||
PR_CONTEXT_TYPE gcContext; /* Thread context for GC */
|
||||
struct PRThread *prev, *next; /* used by the cvar wait queue to
|
||||
* chain the PRThread structures
|
||||
* together */
|
||||
void (*start)(void *); /* used by _PR_MD_CREATE_THREAD to
|
||||
* pass its 'start' argument to
|
||||
* pr_root. */
|
||||
};
|
||||
|
||||
struct _MDThreadStack {
|
||||
PRUint32 magic; /* for debugging */
|
||||
};
|
||||
|
||||
struct _MDSegment {
|
||||
PRUint32 magic; /* for debugging */
|
||||
};
|
||||
|
||||
#undef PROFILE_LOCKS
|
||||
|
||||
struct _MDDir {
|
||||
HANDLE d_hdl;
|
||||
WIN32_FIND_DATA d_entry;
|
||||
PRBool firstEntry; /* Is this the entry returned
|
||||
* by FindFirstFile()? */
|
||||
PRUint32 magic; /* for debugging */
|
||||
};
|
||||
|
||||
#ifdef MOZ_UNICODE
|
||||
struct _MDDirUTF16 {
|
||||
HANDLE d_hdl;
|
||||
WIN32_FIND_DATAW d_entry;
|
||||
PRBool firstEntry; /* Is this the entry returned
|
||||
* by FindFirstFileW()? */
|
||||
PRUint32 magic; /* for debugging */
|
||||
};
|
||||
#endif /* MOZ_UNICODE */
|
||||
|
||||
struct _MDCVar {
|
||||
PRUint32 magic;
|
||||
struct PRThread *waitHead, *waitTail; /* the wait queue: a doubly-
|
||||
* linked list of threads
|
||||
* waiting on this condition
|
||||
* variable */
|
||||
PRIntn nwait; /* number of threads in the
|
||||
* wait queue */
|
||||
};
|
||||
|
||||
#define _MD_CV_NOTIFIED_LENGTH 6
|
||||
typedef struct _MDNotified _MDNotified;
|
||||
struct _MDNotified {
|
||||
PRIntn length; /* # of used entries in this
|
||||
* structure */
|
||||
struct {
|
||||
struct _MDCVar *cv; /* the condition variable notified */
|
||||
PRIntn times; /* and the number of times notified */
|
||||
struct PRThread *notifyHead; /* list of threads to wake up */
|
||||
} cv[_MD_CV_NOTIFIED_LENGTH];
|
||||
_MDNotified *link; /* link to another of these, or NULL */
|
||||
};
|
||||
|
||||
struct _MDLock {
|
||||
CRITICAL_SECTION mutex; /* this is recursive on NT */
|
||||
|
||||
/*
|
||||
* When notifying cvars, there is no point in actually
|
||||
* waking up the threads waiting on the cvars until we've
|
||||
* released the lock. So, we temporarily record the cvars.
|
||||
* When doing an unlock, we'll then wake up the waiting threads.
|
||||
*/
|
||||
struct _MDNotified notified; /* array of conditions notified */
|
||||
#ifdef PROFILE_LOCKS
|
||||
PRInt32 hitcount;
|
||||
PRInt32 misscount;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct _MDSemaphore {
|
||||
HANDLE sem;
|
||||
};
|
||||
|
||||
struct _MDFileDesc {
|
||||
PRInt32 osfd; /* The osfd can come from one of three spaces:
|
||||
* - For stdin, stdout, and stderr, we are using
|
||||
* the libc file handle (0, 1, 2), which is an int.
|
||||
* - For files and pipes, we are using Win32 HANDLE,
|
||||
* which is a void*.
|
||||
* - For sockets, we are using Winsock SOCKET, which
|
||||
* is a u_int.
|
||||
*/
|
||||
};
|
||||
|
||||
struct _MDProcess {
|
||||
HANDLE handle;
|
||||
DWORD id;
|
||||
};
|
||||
|
||||
/* --- Misc stuff --- */
|
||||
#define _MD_GET_SP(thread) (thread)->md.gcContext[6]
|
||||
|
||||
/* --- NT security stuff --- */
|
||||
|
||||
extern void _PR_NT_InitSids(void);
|
||||
extern void _PR_NT_FreeSids(void);
|
||||
extern PRStatus _PR_NT_MakeSecurityDescriptorACL(
|
||||
PRIntn mode,
|
||||
DWORD accessTable[],
|
||||
PSECURITY_DESCRIPTOR *resultSD,
|
||||
PACL *resultACL
|
||||
);
|
||||
extern void _PR_NT_FreeSecurityDescriptorACL(
|
||||
PSECURITY_DESCRIPTOR pSD, PACL pACL);
|
||||
|
||||
/* --- IO stuff --- */
|
||||
|
||||
#define _MD_OPEN _PR_MD_OPEN
|
||||
#define _MD_OPEN_FILE _PR_MD_OPEN_FILE
|
||||
#define _MD_READ _PR_MD_READ
|
||||
#define _MD_WRITE _PR_MD_WRITE
|
||||
#define _MD_WRITEV _PR_MD_WRITEV
|
||||
#define _MD_LSEEK _PR_MD_LSEEK
|
||||
#define _MD_LSEEK64 _PR_MD_LSEEK64
|
||||
extern PRInt32 _MD_CloseFile(PRInt32 osfd);
|
||||
#define _MD_CLOSE_FILE _MD_CloseFile
|
||||
#define _MD_GETFILEINFO _PR_MD_GETFILEINFO
|
||||
#define _MD_GETFILEINFO64 _PR_MD_GETFILEINFO64
|
||||
#define _MD_GETOPENFILEINFO _PR_MD_GETOPENFILEINFO
|
||||
#define _MD_GETOPENFILEINFO64 _PR_MD_GETOPENFILEINFO64
|
||||
#define _MD_STAT _PR_MD_STAT
|
||||
#define _MD_RENAME _PR_MD_RENAME
|
||||
#define _MD_ACCESS _PR_MD_ACCESS
|
||||
#define _MD_DELETE _PR_MD_DELETE
|
||||
#define _MD_MKDIR _PR_MD_MKDIR
|
||||
#define _MD_MAKE_DIR _PR_MD_MAKE_DIR
|
||||
#define _MD_RMDIR _PR_MD_RMDIR
|
||||
#define _MD_LOCKFILE _PR_MD_LOCKFILE
|
||||
#define _MD_TLOCKFILE _PR_MD_TLOCKFILE
|
||||
#define _MD_UNLOCKFILE _PR_MD_UNLOCKFILE
|
||||
|
||||
#ifdef MOZ_UNICODE
|
||||
/* --- UTF16 IO stuff --- */
|
||||
#define _MD_OPEN_FILE_UTF16 _PR_MD_OPEN_FILE_UTF16
|
||||
#define _MD_OPEN_DIR_UTF16 _PR_MD_OPEN_DIR_UTF16
|
||||
#define _MD_READ_DIR_UTF16 _PR_MD_READ_DIR_UTF16
|
||||
#define _MD_CLOSE_DIR_UTF16 _PR_MD_CLOSE_DIR_UTF16
|
||||
#define _MD_GETFILEINFO64_UTF16 _PR_MD_GETFILEINFO64_UTF16
|
||||
#endif /* MOZ_UNICODE */
|
||||
|
||||
/* --- Socket IO stuff --- */
|
||||
#define _MD_EACCES WSAEACCES
|
||||
#define _MD_EADDRINUSE WSAEADDRINUSE
|
||||
#define _MD_EADDRNOTAVAIL WSAEADDRNOTAVAIL
|
||||
#define _MD_EAFNOSUPPORT WSAEAFNOSUPPORT
|
||||
#define _MD_EAGAIN WSAEWOULDBLOCK
|
||||
#define _MD_EALREADY WSAEALREADY
|
||||
#define _MD_EBADF WSAEBADF
|
||||
#define _MD_ECONNREFUSED WSAECONNREFUSED
|
||||
#define _MD_ECONNRESET WSAECONNRESET
|
||||
#define _MD_EFAULT WSAEFAULT
|
||||
#define _MD_EINPROGRESS WSAEINPROGRESS
|
||||
#define _MD_EINTR WSAEINTR
|
||||
#define _MD_EINVAL EINVAL
|
||||
#define _MD_EISCONN WSAEISCONN
|
||||
#define _MD_ENETUNREACH WSAENETUNREACH
|
||||
#define _MD_ENOENT ENOENT
|
||||
#define _MD_ENOTCONN WSAENOTCONN
|
||||
#define _MD_ENOTSOCK WSAENOTSOCK
|
||||
#define _MD_EOPNOTSUPP WSAEOPNOTSUPP
|
||||
#define _MD_EWOULDBLOCK WSAEWOULDBLOCK
|
||||
#define _MD_GET_SOCKET_ERROR() WSAGetLastError()
|
||||
#define _MD_SET_SOCKET_ERROR(_err) WSASetLastError(_err)
|
||||
|
||||
#define _MD_INIT_FILEDESC(fd)
|
||||
extern void _MD_MakeNonblock(PRFileDesc *f);
|
||||
#define _MD_MAKE_NONBLOCK _MD_MakeNonblock
|
||||
#define _MD_INIT_FD_INHERITABLE _PR_MD_INIT_FD_INHERITABLE
|
||||
#define _MD_QUERY_FD_INHERITABLE _PR_MD_QUERY_FD_INHERITABLE
|
||||
#define _MD_SHUTDOWN _PR_MD_SHUTDOWN
|
||||
#define _MD_LISTEN _PR_MD_LISTEN
|
||||
extern PRInt32 _MD_CloseSocket(PRInt32 osfd);
|
||||
#define _MD_CLOSE_SOCKET _MD_CloseSocket
|
||||
#define _MD_SENDTO _PR_MD_SENDTO
|
||||
#define _MD_RECVFROM _PR_MD_RECVFROM
|
||||
#define _MD_SOCKETPAIR(s, type, proto, sv) -1
|
||||
#define _MD_GETSOCKNAME _PR_MD_GETSOCKNAME
|
||||
#define _MD_GETPEERNAME _PR_MD_GETPEERNAME
|
||||
#define _MD_GETSOCKOPT _PR_MD_GETSOCKOPT
|
||||
#define _MD_SETSOCKOPT _PR_MD_SETSOCKOPT
|
||||
#define _MD_SET_FD_INHERITABLE _PR_MD_SET_FD_INHERITABLE
|
||||
#define _MD_SELECT select
|
||||
#define _MD_FSYNC _PR_MD_FSYNC
|
||||
#define READ_FD 1
|
||||
#define WRITE_FD 2
|
||||
|
||||
#define _MD_INIT_ATOMIC()
|
||||
#if defined(_M_IX86) || defined(_X86_)
|
||||
#define _MD_ATOMIC_INCREMENT _PR_MD_ATOMIC_INCREMENT
|
||||
#define _MD_ATOMIC_ADD _PR_MD_ATOMIC_ADD
|
||||
#define _MD_ATOMIC_DECREMENT _PR_MD_ATOMIC_DECREMENT
|
||||
#else /* non-x86 processors */
|
||||
#define _MD_ATOMIC_INCREMENT(x) InterlockedIncrement((PLONG)x)
|
||||
#define _MD_ATOMIC_ADD(ptr,val) (InterlockedExchangeAdd((PLONG)ptr, (LONG)val) + val)
|
||||
#define _MD_ATOMIC_DECREMENT(x) InterlockedDecrement((PLONG)x)
|
||||
#endif /* x86 */
|
||||
#define _MD_ATOMIC_SET(x,y) InterlockedExchange((PLONG)x, (LONG)y)
|
||||
|
||||
#define _MD_INIT_IO _PR_MD_INIT_IO
|
||||
|
||||
|
||||
/* win95 doesn't have async IO */
|
||||
#define _MD_SOCKET _PR_MD_SOCKET
|
||||
extern PRInt32 _MD_SocketAvailable(PRFileDesc *fd);
|
||||
#define _MD_SOCKETAVAILABLE _MD_SocketAvailable
|
||||
#define _MD_PIPEAVAILABLE _PR_MD_PIPEAVAILABLE
|
||||
#define _MD_CONNECT _PR_MD_CONNECT
|
||||
extern PRInt32 _MD_Accept(PRFileDesc *fd, PRNetAddr *raddr, PRUint32 *rlen,
|
||||
PRIntervalTime timeout);
|
||||
#define _MD_ACCEPT _MD_Accept
|
||||
#define _MD_BIND _PR_MD_BIND
|
||||
#define _MD_RECV _PR_MD_RECV
|
||||
#define _MD_SEND _PR_MD_SEND
|
||||
#define _MD_PR_POLL _PR_MD_PR_POLL
|
||||
|
||||
/* --- Scheduler stuff --- */
|
||||
// #define _MD_PAUSE_CPU _PR_MD_PAUSE_CPU
|
||||
#define _MD_PAUSE_CPU
|
||||
|
||||
/* --- DIR stuff --- */
|
||||
#define PR_DIRECTORY_SEPARATOR '\\'
|
||||
#define PR_DIRECTORY_SEPARATOR_STR "\\"
|
||||
#define PR_PATH_SEPARATOR ';'
|
||||
#define PR_PATH_SEPARATOR_STR ";"
|
||||
#define _MD_ERRNO() GetLastError()
|
||||
#define _MD_OPEN_DIR _PR_MD_OPEN_DIR
|
||||
#define _MD_CLOSE_DIR _PR_MD_CLOSE_DIR
|
||||
#define _MD_READ_DIR _PR_MD_READ_DIR
|
||||
|
||||
/* --- Segment stuff --- */
|
||||
#define _MD_INIT_SEGS()
|
||||
#define _MD_ALLOC_SEGMENT(seg, size, vaddr) 0
|
||||
#define _MD_FREE_SEGMENT(seg)
|
||||
|
||||
/* --- Environment Stuff --- */
|
||||
#define _MD_GET_ENV _PR_MD_GET_ENV
|
||||
#define _MD_PUT_ENV _PR_MD_PUT_ENV
|
||||
|
||||
/* --- Threading Stuff --- */
|
||||
#define _MD_DEFAULT_STACK_SIZE 0
|
||||
#define _MD_INIT_THREAD _PR_MD_INIT_THREAD
|
||||
#define _MD_INIT_ATTACHED_THREAD _PR_MD_INIT_THREAD
|
||||
#define _MD_CREATE_THREAD _PR_MD_CREATE_THREAD
|
||||
#define _MD_YIELD _PR_MD_YIELD
|
||||
#define _MD_SET_PRIORITY _PR_MD_SET_PRIORITY
|
||||
#define _MD_CLEAN_THREAD _PR_MD_CLEAN_THREAD
|
||||
#define _MD_SETTHREADAFFINITYMASK _PR_MD_SETTHREADAFFINITYMASK
|
||||
#define _MD_GETTHREADAFFINITYMASK _PR_MD_GETTHREADAFFINITYMASK
|
||||
#define _MD_EXIT_THREAD _PR_MD_EXIT_THREAD
|
||||
#define _MD_EXIT _PR_MD_EXIT
|
||||
#define _MD_SUSPEND_THREAD _PR_MD_SUSPEND_THREAD
|
||||
#define _MD_RESUME_THREAD _PR_MD_RESUME_THREAD
|
||||
#define _MD_SUSPEND_CPU _PR_MD_SUSPEND_CPU
|
||||
#define _MD_RESUME_CPU _PR_MD_RESUME_CPU
|
||||
#define _MD_BEGIN_SUSPEND_ALL()
|
||||
#define _MD_BEGIN_RESUME_ALL()
|
||||
#define _MD_END_SUSPEND_ALL()
|
||||
#define _MD_END_RESUME_ALL()
|
||||
|
||||
/* --- Lock stuff --- */
|
||||
#define _PR_LOCK _MD_LOCK
|
||||
#define _PR_UNLOCK _MD_UNLOCK
|
||||
|
||||
#define _MD_NEW_LOCK(lock) (InitializeCriticalSection(&((lock)->mutex)),(lock)->notified.length=0,(lock)->notified.link=NULL,PR_SUCCESS)
|
||||
#define _MD_FREE_LOCK(lock) DeleteCriticalSection(&((lock)->mutex))
|
||||
#define _MD_LOCK(lock) EnterCriticalSection(&((lock)->mutex))
|
||||
#define _MD_TEST_AND_LOCK(lock) (EnterCriticalSection(&((lock)->mutex)),0)
|
||||
#define _MD_UNLOCK _PR_MD_UNLOCK
|
||||
|
||||
/* --- lock and cv waiting --- */
|
||||
#define _MD_WAIT _PR_MD_WAIT
|
||||
#define _MD_WAKEUP_WAITER _PR_MD_WAKEUP_WAITER
|
||||
|
||||
/* --- CVar ------------------- */
|
||||
#define _MD_WAIT_CV _PR_MD_WAIT_CV
|
||||
#define _MD_NEW_CV _PR_MD_NEW_CV
|
||||
#define _MD_FREE_CV _PR_MD_FREE_CV
|
||||
#define _MD_NOTIFY_CV _PR_MD_NOTIFY_CV
|
||||
#define _MD_NOTIFYALL_CV _PR_MD_NOTIFYALL_CV
|
||||
|
||||
/* XXXMB- the IOQ stuff is certainly not working correctly yet. */
|
||||
// extern struct _MDLock _pr_ioq_lock;
|
||||
#define _MD_IOQ_LOCK()
|
||||
#define _MD_IOQ_UNLOCK()
|
||||
|
||||
|
||||
/* --- Initialization stuff --- */
|
||||
#define _MD_START_INTERRUPTS()
|
||||
#define _MD_STOP_INTERRUPTS()
|
||||
#define _MD_DISABLE_CLOCK_INTERRUPTS()
|
||||
#define _MD_ENABLE_CLOCK_INTERRUPTS()
|
||||
#define _MD_BLOCK_CLOCK_INTERRUPTS()
|
||||
#define _MD_UNBLOCK_CLOCK_INTERRUPTS()
|
||||
#define _MD_EARLY_INIT _PR_MD_EARLY_INIT
|
||||
#define _MD_FINAL_INIT()
|
||||
#define _MD_INIT_CPUS()
|
||||
#define _MD_INIT_RUNNING_CPU(cpu)
|
||||
|
||||
struct PRProcess;
|
||||
struct PRProcessAttr;
|
||||
|
||||
#define _MD_CREATE_PROCESS _PR_CreateWindowsProcess
|
||||
extern struct PRProcess * _PR_CreateWindowsProcess(
|
||||
const char *path,
|
||||
char *const *argv,
|
||||
char *const *envp,
|
||||
const struct PRProcessAttr *attr
|
||||
);
|
||||
|
||||
#define _MD_DETACH_PROCESS _PR_DetachWindowsProcess
|
||||
extern PRStatus _PR_DetachWindowsProcess(struct PRProcess *process);
|
||||
|
||||
/* --- Wait for a child process to terminate --- */
|
||||
#define _MD_WAIT_PROCESS _PR_WaitWindowsProcess
|
||||
extern PRStatus _PR_WaitWindowsProcess(struct PRProcess *process,
|
||||
PRInt32 *exitCode);
|
||||
|
||||
#define _MD_KILL_PROCESS _PR_KillWindowsProcess
|
||||
extern PRStatus _PR_KillWindowsProcess(struct PRProcess *process);
|
||||
|
||||
#define _MD_CLEANUP_BEFORE_EXIT _PR_MD_CLEANUP_BEFORE_EXIT
|
||||
#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
||||
PR_BEGIN_MACRO \
|
||||
*status = PR_TRUE; \
|
||||
PR_END_MACRO
|
||||
#define _MD_SWITCH_CONTEXT
|
||||
#define _MD_RESTORE_CONTEXT
|
||||
|
||||
/* --- Intervals --- */
|
||||
#define _MD_INTERVAL_INIT _PR_MD_INTERVAL_INIT
|
||||
#define _MD_GET_INTERVAL _PR_MD_GET_INTERVAL
|
||||
#define _MD_INTERVAL_PER_SEC _PR_MD_INTERVAL_PER_SEC
|
||||
#define _MD_INTERVAL_PER_MILLISEC() (_PR_MD_INTERVAL_PER_SEC() / 1000)
|
||||
#define _MD_INTERVAL_PER_MICROSEC() (_PR_MD_INTERVAL_PER_SEC() / 1000000)
|
||||
|
||||
/* --- Time --- */
|
||||
extern void _PR_FileTimeToPRTime(const FILETIME *filetime, PRTime *prtm);
|
||||
|
||||
/* --- Native-Thread Specific Definitions ------------------------------- */
|
||||
|
||||
extern struct PRThread * _MD_CURRENT_THREAD(void);
|
||||
|
||||
#ifdef _PR_USE_STATIC_TLS
|
||||
extern __declspec(thread) struct PRThread *_pr_currentThread;
|
||||
#define _MD_GET_ATTACHED_THREAD() _pr_currentThread
|
||||
#define _MD_SET_CURRENT_THREAD(_thread) (_pr_currentThread = (_thread))
|
||||
|
||||
extern __declspec(thread) struct PRThread *_pr_thread_last_run;
|
||||
#define _MD_LAST_THREAD() _pr_thread_last_run
|
||||
#define _MD_SET_LAST_THREAD(_thread) (_pr_thread_last_run = 0)
|
||||
|
||||
extern __declspec(thread) struct _PRCPU *_pr_currentCPU;
|
||||
#define _MD_CURRENT_CPU() _pr_currentCPU
|
||||
#define _MD_SET_CURRENT_CPU(_cpu) (_pr_currentCPU = 0)
|
||||
#else /* _PR_USE_STATIC_TLS */
|
||||
extern DWORD _pr_currentThreadIndex;
|
||||
#define _MD_GET_ATTACHED_THREAD() ((PRThread *) TlsGetValue(_pr_currentThreadIndex))
|
||||
#define _MD_SET_CURRENT_THREAD(_thread) TlsSetValue(_pr_currentThreadIndex, (_thread))
|
||||
|
||||
extern DWORD _pr_lastThreadIndex;
|
||||
#define _MD_LAST_THREAD() ((PRThread *) TlsGetValue(_pr_lastThreadIndex))
|
||||
#define _MD_SET_LAST_THREAD(_thread) TlsSetValue(_pr_lastThreadIndex, 0)
|
||||
|
||||
extern DWORD _pr_currentCPUIndex;
|
||||
#define _MD_CURRENT_CPU() ((struct _PRCPU *) TlsGetValue(_pr_currentCPUIndex))
|
||||
#define _MD_SET_CURRENT_CPU(_cpu) TlsSetValue(_pr_currentCPUIndex, 0)
|
||||
#endif /* _PR_USE_STATIC_TLS */
|
||||
|
||||
/* --- Scheduler stuff --- */
|
||||
#define LOCK_SCHEDULER() 0
|
||||
#define UNLOCK_SCHEDULER() 0
|
||||
#define _PR_LockSched() 0
|
||||
#define _PR_UnlockSched() 0
|
||||
|
||||
/* --- Initialization stuff --- */
|
||||
#define _MD_INIT_LOCKS()
|
||||
|
||||
/* --- Stack stuff --- */
|
||||
#define _MD_INIT_STACK(stack, redzone)
|
||||
#define _MD_CLEAR_STACK(stack)
|
||||
|
||||
/* --- Memory-mapped files stuff --- */
|
||||
|
||||
struct _MDFileMap {
|
||||
HANDLE hFileMap;
|
||||
DWORD dwAccess;
|
||||
};
|
||||
|
||||
extern PRStatus _MD_CreateFileMap(struct PRFileMap *fmap, PRInt64 size);
|
||||
#define _MD_CREATE_FILE_MAP _MD_CreateFileMap
|
||||
|
||||
extern PRInt32 _MD_GetMemMapAlignment(void);
|
||||
#define _MD_GET_MEM_MAP_ALIGNMENT _MD_GetMemMapAlignment
|
||||
|
||||
extern void * _MD_MemMap(struct PRFileMap *fmap, PRInt64 offset,
|
||||
PRUint32 len);
|
||||
#define _MD_MEM_MAP _MD_MemMap
|
||||
|
||||
extern PRStatus _MD_MemUnmap(void *addr, PRUint32 size);
|
||||
#define _MD_MEM_UNMAP _MD_MemUnmap
|
||||
|
||||
extern PRStatus _MD_CloseFileMap(struct PRFileMap *fmap);
|
||||
#define _MD_CLOSE_FILE_MAP _MD_CloseFileMap
|
||||
|
||||
/* --- Named semaphores stuff --- */
|
||||
#define _PR_HAVE_NAMED_SEMAPHORES
|
||||
#define _MD_OPEN_SEMAPHORE _PR_MD_OPEN_SEMAPHORE
|
||||
#define _MD_WAIT_SEMAPHORE _PR_MD_WAIT_SEMAPHORE
|
||||
#define _MD_POST_SEMAPHORE _PR_MD_POST_SEMAPHORE
|
||||
#define _MD_CLOSE_SEMAPHORE _PR_MD_CLOSE_SEMAPHORE
|
||||
#define _MD_DELETE_SEMAPHORE(name) PR_SUCCESS /* no op */
|
||||
|
||||
#endif /* nspr_win32_defs_h___ */
|
||||
610
Src/nprt_plugin/gecko/1.8/win/include/md/_winnt.h
Normal file
610
Src/nprt_plugin/gecko/1.8/win/include/md/_winnt.h
Normal file
@@ -0,0 +1,610 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Portable Runtime (NSPR).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998-2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nspr_win32_defs_h___
|
||||
#define nspr_win32_defs_h___
|
||||
|
||||
/* Need to force service-pack 3 extensions to be defined by
|
||||
** setting _WIN32_WINNT to NT 4.0 for winsock.h, winbase.h, winnt.h.
|
||||
*/
|
||||
#ifndef _WIN32_WINNT
|
||||
#define _WIN32_WINNT 0x0400
|
||||
#elif (_WIN32_WINNT < 0x0400)
|
||||
#undef _WIN32_WINNT
|
||||
#define _WIN32_WINNT 0x0400
|
||||
#endif /* _WIN32_WINNT */
|
||||
|
||||
#include <windows.h>
|
||||
#include <winsock.h>
|
||||
#ifdef __MINGW32__
|
||||
#include <mswsock.h>
|
||||
#endif
|
||||
#include <errno.h>
|
||||
|
||||
#include "prio.h"
|
||||
#include "prclist.h"
|
||||
|
||||
/*
|
||||
* Internal configuration macros
|
||||
*/
|
||||
|
||||
#define PR_LINKER_ARCH "win32"
|
||||
#define _PR_SI_SYSNAME "WINNT"
|
||||
#define _PR_SI_ARCHITECTURE "x86" /* XXXMB hardcode for now */
|
||||
|
||||
#define HAVE_DLL
|
||||
#define HAVE_CUSTOM_USER_THREADS
|
||||
#define HAVE_THREAD_AFFINITY
|
||||
#define _PR_HAVE_GETADDRINFO
|
||||
#define _PR_INET6_PROBE
|
||||
#ifndef _PR_INET6
|
||||
#define AF_INET6 23
|
||||
/* newer ws2tcpip.h provides these */
|
||||
#ifndef AI_CANONNAME
|
||||
#define AI_CANONNAME 0x2
|
||||
struct addrinfo {
|
||||
int ai_flags;
|
||||
int ai_family;
|
||||
int ai_socktype;
|
||||
int ai_protocol;
|
||||
size_t ai_addrlen;
|
||||
char *ai_canonname;
|
||||
struct sockaddr *ai_addr;
|
||||
struct addrinfo *ai_next;
|
||||
};
|
||||
#endif
|
||||
#define _PR_HAVE_MD_SOCKADDR_IN6
|
||||
/* isomorphic to struct in6_addr on Windows */
|
||||
struct _md_in6_addr {
|
||||
union {
|
||||
PRUint8 _S6_u8[16];
|
||||
PRUint16 _S6_u16[8];
|
||||
} _S6_un;
|
||||
};
|
||||
/* isomorphic to struct sockaddr_in6 on Windows */
|
||||
struct _md_sockaddr_in6 {
|
||||
PRInt16 sin6_family;
|
||||
PRUint16 sin6_port;
|
||||
PRUint32 sin6_flowinfo;
|
||||
struct _md_in6_addr sin6_addr;
|
||||
PRUint32 sin6_scope_id;
|
||||
};
|
||||
#endif
|
||||
#define _PR_HAVE_THREADSAFE_GETHOST
|
||||
#define _PR_HAVE_ATOMIC_OPS
|
||||
#define _PR_HAVE_ATOMIC_CAS
|
||||
#define PR_HAVE_WIN32_NAMED_SHARED_MEMORY
|
||||
#define _PR_HAVE_PEEK_BUFFER
|
||||
#define _PR_PEEK_BUFFER_MAX (32 * 1024)
|
||||
#define _PR_FD_NEED_EMULATE_MSG_PEEK(fd) \
|
||||
(!(fd)->secret->nonblocking && (fd)->secret->inheritable != _PR_TRI_TRUE)
|
||||
|
||||
/* --- Common User-Thread/Native-Thread Definitions --------------------- */
|
||||
|
||||
/* --- Globals --- */
|
||||
extern struct PRLock *_pr_schedLock;
|
||||
|
||||
/* --- Typedefs --- */
|
||||
typedef void (*FiberFunc)(void *);
|
||||
|
||||
#define PR_NUM_GCREGS 8
|
||||
typedef PRInt32 PR_CONTEXT_TYPE[PR_NUM_GCREGS];
|
||||
#define GC_VMBASE 0x40000000
|
||||
#define GC_VMLIMIT 0x00FFFFFF
|
||||
|
||||
#define _MD_MAGIC_THREAD 0x22222222
|
||||
#define _MD_MAGIC_THREADSTACK 0x33333333
|
||||
#define _MD_MAGIC_SEGMENT 0x44444444
|
||||
#define _MD_MAGIC_DIR 0x55555555
|
||||
|
||||
struct _MDCPU {
|
||||
int unused;
|
||||
};
|
||||
|
||||
enum _MDIOModel {
|
||||
_MD_BlockingIO = 0x38,
|
||||
_MD_MultiWaitIO = 0x49
|
||||
};
|
||||
|
||||
typedef struct _MDOverlapped {
|
||||
OVERLAPPED overlapped; /* Used for async I/O */
|
||||
|
||||
enum _MDIOModel ioModel; /* The I/O model to implement
|
||||
* using overlapped I/O.
|
||||
*/
|
||||
union {
|
||||
struct _MDThread *mdThread; /* For blocking I/O, this structure
|
||||
* is embedded in the _MDThread
|
||||
* structure.
|
||||
*/
|
||||
struct {
|
||||
PRCList links; /* for group->io_ready list */
|
||||
struct PRRecvWait *desc; /* For multiwait I/O, this structure
|
||||
* is associated with a PRRecvWait
|
||||
* structure.
|
||||
*/
|
||||
struct PRWaitGroup *group;
|
||||
struct TimerEvent *timer;
|
||||
DWORD error;
|
||||
} mw;
|
||||
} data;
|
||||
} _MDOverlapped;
|
||||
|
||||
struct _MDThread {
|
||||
/* The overlapped structure must be first! */
|
||||
struct _MDOverlapped overlapped; /* Used for async IO for this thread */
|
||||
void *acceptex_buf; /* Used for AcceptEx() */
|
||||
TRANSMIT_FILE_BUFFERS *xmit_bufs; /* Used for TransmitFile() */
|
||||
HANDLE blocked_sema; /* Threads block on this when waiting
|
||||
* for IO or CondVar.
|
||||
*/
|
||||
PRInt32 blocked_io_status; /* Status of the completed IO */
|
||||
PRInt32 blocked_io_bytes; /* Bytes transferred for completed IO */
|
||||
PRInt32 blocked_io_error; /* Save error if status is FALSE */
|
||||
HANDLE handle;
|
||||
PRUint32 id;
|
||||
void *sp; /* only valid when suspended */
|
||||
PRUint32 magic; /* for debugging */
|
||||
PR_CONTEXT_TYPE gcContext; /* Thread context for GC */
|
||||
struct _PRCPU *thr_bound_cpu; /* thread bound to cpu */
|
||||
PRBool interrupt_disabled;/* thread cannot be interrupted */
|
||||
HANDLE thr_event; /* For native-threads-only support,
|
||||
thread blocks on this event */
|
||||
|
||||
/* The following are used only if this is a fiber */
|
||||
void *fiber_id; /* flag whether or not this is a fiber*/
|
||||
FiberFunc fiber_fn; /* main fiber routine */
|
||||
void *fiber_arg; /* arg to main fiber routine */
|
||||
PRUint32 fiber_stacksize; /* stacksize for fiber */
|
||||
PRInt32 fiber_last_error; /* last error for the fiber */
|
||||
void (*start)(void *); /* used by _PR_MD_CREATE_THREAD to
|
||||
* pass its 'start' argument to
|
||||
* pr_root. */
|
||||
};
|
||||
|
||||
struct _MDThreadStack {
|
||||
PRUint32 magic; /* for debugging */
|
||||
};
|
||||
|
||||
struct _MDSegment {
|
||||
PRUint32 magic; /* for debugging */
|
||||
};
|
||||
|
||||
#undef PROFILE_LOCKS
|
||||
|
||||
struct _MDLock {
|
||||
CRITICAL_SECTION mutex; /* this is recursive on NT */
|
||||
#ifdef PROFILE_LOCKS
|
||||
PRInt32 hitcount;
|
||||
PRInt32 misscount;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct _MDDir {
|
||||
HANDLE d_hdl;
|
||||
WIN32_FIND_DATA d_entry;
|
||||
PRBool firstEntry; /* Is this the entry returned
|
||||
* by FindFirstFile()? */
|
||||
PRUint32 magic; /* for debugging */
|
||||
};
|
||||
|
||||
struct _MDCVar {
|
||||
PRUint32 unused;
|
||||
};
|
||||
|
||||
struct _MDSemaphore {
|
||||
HANDLE sem;
|
||||
};
|
||||
|
||||
struct _MDFileDesc {
|
||||
PRInt32 osfd; /* The osfd can come from one of three spaces:
|
||||
* - For stdin, stdout, and stderr, we are using
|
||||
* the libc file handle (0, 1, 2), which is an int.
|
||||
* - For files and pipes, we are using Win32 HANDLE,
|
||||
* which is a void*.
|
||||
* - For sockets, we are using Winsock SOCKET, which
|
||||
* is a u_int.
|
||||
*/
|
||||
PRBool io_model_committed; /* The io model (blocking or nonblocking)
|
||||
* for this osfd has been committed and
|
||||
* cannot be changed. The osfd has been
|
||||
* either associated with the io
|
||||
* completion port or made nonblocking. */
|
||||
PRBool sync_file_io; /* Use synchronous file I/O on the osfd
|
||||
* (a file handle) */
|
||||
PRBool accepted_socket; /* Is this an accepted socket (on the
|
||||
* server side)? */
|
||||
PRNetAddr peer_addr; /* If this is an accepted socket, cache
|
||||
* the peer's address returned by
|
||||
* AcceptEx(). This is to work around
|
||||
* the bug that getpeername() on an
|
||||
* socket accepted by AcceptEx() returns
|
||||
* an all-zero net address. */
|
||||
};
|
||||
|
||||
struct _MDProcess {
|
||||
HANDLE handle;
|
||||
DWORD id;
|
||||
};
|
||||
|
||||
|
||||
/* --- Misc stuff --- */
|
||||
#define _MD_GET_SP(thread) (thread)->md.gcContext[6]
|
||||
|
||||
/* --- NT security stuff --- */
|
||||
|
||||
extern void _PR_NT_InitSids(void);
|
||||
extern void _PR_NT_FreeSids(void);
|
||||
extern PRStatus _PR_NT_MakeSecurityDescriptorACL(
|
||||
PRIntn mode,
|
||||
DWORD accessTable[],
|
||||
PSECURITY_DESCRIPTOR *resultSD,
|
||||
PACL *resultACL
|
||||
);
|
||||
extern void _PR_NT_FreeSecurityDescriptorACL(
|
||||
PSECURITY_DESCRIPTOR pSD, PACL pACL);
|
||||
|
||||
/* --- IO stuff --- */
|
||||
|
||||
extern PRInt32 _md_Associate(HANDLE);
|
||||
extern PRInt32 _PR_MD_CLOSE(PRInt32 osfd, PRBool socket);
|
||||
|
||||
#define _MD_OPEN _PR_MD_OPEN
|
||||
#define _MD_OPEN_FILE _PR_MD_OPEN_FILE
|
||||
#define _MD_READ _PR_MD_READ
|
||||
#define _MD_WRITE _PR_MD_WRITE
|
||||
#define _MD_WRITEV _PR_MD_WRITEV
|
||||
#define _MD_LSEEK _PR_MD_LSEEK
|
||||
#define _MD_LSEEK64 _PR_MD_LSEEK64
|
||||
#define _MD_CLOSE_FILE(f) _PR_MD_CLOSE(f, PR_FALSE)
|
||||
#define _MD_GETFILEINFO _PR_MD_GETFILEINFO
|
||||
#define _MD_GETFILEINFO64 _PR_MD_GETFILEINFO64
|
||||
#define _MD_GETOPENFILEINFO _PR_MD_GETOPENFILEINFO
|
||||
#define _MD_GETOPENFILEINFO64 _PR_MD_GETOPENFILEINFO64
|
||||
#define _MD_STAT _PR_MD_STAT
|
||||
#define _MD_RENAME _PR_MD_RENAME
|
||||
#define _MD_ACCESS _PR_MD_ACCESS
|
||||
#define _MD_DELETE _PR_MD_DELETE
|
||||
#define _MD_MKDIR _PR_MD_MKDIR
|
||||
#define _MD_MAKE_DIR _PR_MD_MAKE_DIR
|
||||
#define _MD_RMDIR _PR_MD_RMDIR
|
||||
#define _MD_LOCKFILE _PR_MD_LOCKFILE
|
||||
#define _MD_TLOCKFILE _PR_MD_TLOCKFILE
|
||||
#define _MD_UNLOCKFILE _PR_MD_UNLOCKFILE
|
||||
|
||||
/* --- Socket IO stuff --- */
|
||||
#define _MD_GET_SOCKET_ERROR() WSAGetLastError()
|
||||
#define _MD_SET_SOCKET_ERROR(_err) WSASetLastError(_err)
|
||||
|
||||
#define _MD_INIT_FILEDESC(fd)
|
||||
#define _MD_MAKE_NONBLOCK _PR_MD_MAKE_NONBLOCK
|
||||
#define _MD_INIT_FD_INHERITABLE _PR_MD_INIT_FD_INHERITABLE
|
||||
#define _MD_QUERY_FD_INHERITABLE _PR_MD_QUERY_FD_INHERITABLE
|
||||
#define _MD_SHUTDOWN _PR_MD_SHUTDOWN
|
||||
#define _MD_LISTEN _PR_MD_LISTEN
|
||||
#define _MD_CLOSE_SOCKET(s) _PR_MD_CLOSE(s, PR_TRUE)
|
||||
#define _MD_SENDTO _PR_MD_SENDTO
|
||||
#define _MD_RECVFROM _PR_MD_RECVFROM
|
||||
#define _MD_SOCKETPAIR(s, type, proto, sv) -1
|
||||
#define _MD_GETSOCKNAME _PR_MD_GETSOCKNAME
|
||||
#define _MD_GETPEERNAME _PR_MD_GETPEERNAME
|
||||
#define _MD_GETSOCKOPT _PR_MD_GETSOCKOPT
|
||||
#define _MD_SETSOCKOPT _PR_MD_SETSOCKOPT
|
||||
#define _MD_SELECT select
|
||||
extern int _PR_NTFiberSafeSelect(int, fd_set *, fd_set *, fd_set *,
|
||||
const struct timeval *);
|
||||
#define _MD_FSYNC _PR_MD_FSYNC
|
||||
#define _MD_SOCKETAVAILABLE _PR_MD_SOCKETAVAILABLE
|
||||
#define _MD_PIPEAVAILABLE _PR_MD_PIPEAVAILABLE
|
||||
#define _MD_SET_FD_INHERITABLE _PR_MD_SET_FD_INHERITABLE
|
||||
|
||||
#define _MD_INIT_ATOMIC()
|
||||
#if defined(_M_IX86) || defined(_X86_)
|
||||
#define _MD_ATOMIC_INCREMENT _PR_MD_ATOMIC_INCREMENT
|
||||
#define _MD_ATOMIC_ADD _PR_MD_ATOMIC_ADD
|
||||
#define _MD_ATOMIC_DECREMENT _PR_MD_ATOMIC_DECREMENT
|
||||
#else /* non-x86 processors */
|
||||
#define _MD_ATOMIC_INCREMENT(x) InterlockedIncrement((PLONG)x)
|
||||
#define _MD_ATOMIC_ADD(ptr,val) (InterlockedExchangeAdd((PLONG)ptr, (LONG)val) + val)
|
||||
#define _MD_ATOMIC_DECREMENT(x) InterlockedDecrement((PLONG)x)
|
||||
#endif /* x86 */
|
||||
#define _MD_ATOMIC_SET(x,y) InterlockedExchange((PLONG)x, (LONG)y)
|
||||
|
||||
#define _MD_INIT_IO _PR_MD_INIT_IO
|
||||
#define _MD_SOCKET _PR_MD_SOCKET
|
||||
#define _MD_CONNECT _PR_MD_CONNECT
|
||||
|
||||
#define _MD_ACCEPT(s, a, l, to) \
|
||||
_MD_FAST_ACCEPT(s, a, l, to, PR_FALSE, NULL, NULL)
|
||||
#define _MD_FAST_ACCEPT(s, a, l, to, fast, cb, cba) \
|
||||
_PR_MD_FAST_ACCEPT(s, a, l, to, fast, cb, cba)
|
||||
#define _MD_ACCEPT_READ(s, ns, ra, buf, l, t) \
|
||||
_MD_FAST_ACCEPT_READ(s, ns, ra, buf, l, t, PR_FALSE, NULL, NULL)
|
||||
#define _MD_FAST_ACCEPT_READ(s, ns, ra, buf, l, t, fast, cb, cba) \
|
||||
_PR_MD_FAST_ACCEPT_READ(s, ns, ra, buf, l, t, fast, cb, cba)
|
||||
#define _MD_UPDATE_ACCEPT_CONTEXT _PR_MD_UPDATE_ACCEPT_CONTEXT
|
||||
|
||||
#define _MD_BIND _PR_MD_BIND
|
||||
#define _MD_RECV _PR_MD_RECV
|
||||
#define _MD_SEND _PR_MD_SEND
|
||||
#define _MD_SENDFILE _PR_MD_SENDFILE
|
||||
#define _MD_PR_POLL _PR_MD_PR_POLL
|
||||
|
||||
/* --- Scheduler stuff --- */
|
||||
#define _MD_PAUSE_CPU _PR_MD_PAUSE_CPU
|
||||
|
||||
/* --- DIR stuff --- */
|
||||
#define PR_DIRECTORY_SEPARATOR '\\'
|
||||
#define PR_DIRECTORY_SEPARATOR_STR "\\"
|
||||
#define PR_PATH_SEPARATOR ';'
|
||||
#define PR_PATH_SEPARATOR_STR ";"
|
||||
#define _MD_ERRNO() GetLastError()
|
||||
#define _MD_OPEN_DIR _PR_MD_OPEN_DIR
|
||||
#define _MD_CLOSE_DIR _PR_MD_CLOSE_DIR
|
||||
#define _MD_READ_DIR _PR_MD_READ_DIR
|
||||
|
||||
/* --- Segment stuff --- */
|
||||
#define _MD_INIT_SEGS()
|
||||
#define _MD_ALLOC_SEGMENT(seg, size, vaddr) 0
|
||||
#define _MD_FREE_SEGMENT(seg)
|
||||
|
||||
/* --- Environment Stuff --- */
|
||||
#define _MD_GET_ENV _PR_MD_GET_ENV
|
||||
#define _MD_PUT_ENV _PR_MD_PUT_ENV
|
||||
|
||||
/* --- Threading Stuff --- */
|
||||
#define _MD_DEFAULT_STACK_SIZE 0
|
||||
#define _MD_INIT_THREAD _PR_MD_INIT_THREAD
|
||||
#define _MD_INIT_ATTACHED_THREAD _PR_MD_INIT_THREAD
|
||||
#define _MD_CREATE_THREAD _PR_MD_CREATE_THREAD
|
||||
#define _MD_JOIN_THREAD _PR_MD_JOIN_THREAD
|
||||
#define _MD_END_THREAD _PR_MD_END_THREAD
|
||||
#define _MD_YIELD _PR_MD_YIELD
|
||||
#define _MD_SET_PRIORITY _PR_MD_SET_PRIORITY
|
||||
#define _MD_CLEAN_THREAD _PR_MD_CLEAN_THREAD
|
||||
#define _MD_SETTHREADAFFINITYMASK _PR_MD_SETTHREADAFFINITYMASK
|
||||
#define _MD_GETTHREADAFFINITYMASK _PR_MD_GETTHREADAFFINITYMASK
|
||||
#define _MD_EXIT_THREAD _PR_MD_EXIT_THREAD
|
||||
#define _MD_SUSPEND_THREAD _PR_MD_SUSPEND_THREAD
|
||||
#define _MD_RESUME_THREAD _PR_MD_RESUME_THREAD
|
||||
#define _MD_SUSPEND_CPU _PR_MD_SUSPEND_CPU
|
||||
#define _MD_RESUME_CPU _PR_MD_RESUME_CPU
|
||||
#define _MD_BEGIN_SUSPEND_ALL()
|
||||
#define _MD_BEGIN_RESUME_ALL()
|
||||
#define _MD_END_SUSPEND_ALL()
|
||||
#define _MD_END_RESUME_ALL()
|
||||
|
||||
extern void _PR_Unblock_IO_Wait(PRThread *thr);
|
||||
|
||||
/* --- Lock stuff --- */
|
||||
#define _MD_NEW_LOCK(lock) (InitializeCriticalSection(&((lock)->mutex)),PR_SUCCESS)
|
||||
#define _MD_FREE_LOCK(lock) DeleteCriticalSection(&((lock)->mutex))
|
||||
#ifndef PROFILE_LOCKS
|
||||
#define _MD_LOCK(lock) EnterCriticalSection(&((lock)->mutex))
|
||||
#define _MD_TEST_AND_LOCK(lock) (TryEnterCriticalSection(&((lock)->mutex))== FALSE)
|
||||
#define _MD_UNLOCK(lock) LeaveCriticalSection(&((lock)->mutex))
|
||||
#else
|
||||
#define _MD_LOCK(lock) \
|
||||
PR_BEGIN_MACRO \
|
||||
BOOL rv = TryEnterCriticalSection(&((lock)->mutex)); \
|
||||
if (rv == TRUE) { \
|
||||
InterlockedIncrement(&((lock)->hitcount)); \
|
||||
} else { \
|
||||
InterlockedIncrement(&((lock)->misscount)); \
|
||||
EnterCriticalSection(&((lock)->mutex)); \
|
||||
} \
|
||||
PR_END_MACRO
|
||||
#define _MD_TEST_AND_LOCK(lock) 0 /* XXXMB */
|
||||
#define _MD_UNLOCK(lock) LeaveCriticalSection(&((lock)->mutex))
|
||||
#endif
|
||||
#define _PR_LOCK _MD_LOCK
|
||||
#define _PR_UNLOCK _MD_UNLOCK
|
||||
|
||||
/* --- lock and cv waiting --- */
|
||||
#define _MD_WAIT _PR_MD_WAIT
|
||||
#define _MD_WAKEUP_WAITER _PR_MD_WAKEUP_WAITER
|
||||
|
||||
/* XXXMB- the IOQ stuff is certainly not working correctly yet. */
|
||||
extern struct _MDLock _pr_ioq_lock;
|
||||
#define _MD_IOQ_LOCK() _MD_LOCK(&_pr_ioq_lock)
|
||||
#define _MD_IOQ_UNLOCK() _MD_UNLOCK(&_pr_ioq_lock)
|
||||
|
||||
|
||||
/* --- Initialization stuff --- */
|
||||
#define _MD_START_INTERRUPTS()
|
||||
#define _MD_STOP_INTERRUPTS()
|
||||
#define _MD_DISABLE_CLOCK_INTERRUPTS()
|
||||
#define _MD_ENABLE_CLOCK_INTERRUPTS()
|
||||
#define _MD_BLOCK_CLOCK_INTERRUPTS()
|
||||
#define _MD_UNBLOCK_CLOCK_INTERRUPTS()
|
||||
#define _MD_EARLY_INIT _PR_MD_EARLY_INIT
|
||||
#define _MD_FINAL_INIT()
|
||||
#define _MD_INIT_CPUS()
|
||||
#define _MD_INIT_RUNNING_CPU(cpu)
|
||||
|
||||
struct PRProcess;
|
||||
struct PRProcessAttr;
|
||||
|
||||
/* --- Create a new process --- */
|
||||
#define _MD_CREATE_PROCESS _PR_CreateWindowsProcess
|
||||
extern struct PRProcess * _PR_CreateWindowsProcess(
|
||||
const char *path,
|
||||
char *const *argv,
|
||||
char *const *envp,
|
||||
const struct PRProcessAttr *attr
|
||||
);
|
||||
|
||||
#define _MD_DETACH_PROCESS _PR_DetachWindowsProcess
|
||||
extern PRStatus _PR_DetachWindowsProcess(struct PRProcess *process);
|
||||
|
||||
/* --- Wait for a child process to terminate --- */
|
||||
#define _MD_WAIT_PROCESS _PR_WaitWindowsProcess
|
||||
extern PRStatus _PR_WaitWindowsProcess(struct PRProcess *process,
|
||||
PRInt32 *exitCode);
|
||||
|
||||
#define _MD_KILL_PROCESS _PR_KillWindowsProcess
|
||||
extern PRStatus _PR_KillWindowsProcess(struct PRProcess *process);
|
||||
|
||||
/* --- User Threading stuff --- */
|
||||
#define HAVE_FIBERS
|
||||
#define _MD_CREATE_USER_THREAD _PR_MD_CREATE_USER_THREAD
|
||||
#define _MD_CREATE_PRIMORDIAL_USER_THREAD _PR_MD_CREATE_PRIMORDIAL_USER_THREAD
|
||||
#define _MD_CLEANUP_BEFORE_EXIT _PR_MD_CLEANUP_BEFORE_EXIT
|
||||
#define _MD_EXIT _PR_MD_EXIT
|
||||
#define _MD_INIT_CONTEXT _PR_MD_INIT_CONTEXT
|
||||
#define _MD_SWITCH_CONTEXT _PR_MD_SWITCH_CONTEXT
|
||||
#define _MD_RESTORE_CONTEXT _PR_MD_RESTORE_CONTEXT
|
||||
|
||||
/* --- Intervals --- */
|
||||
#define _MD_INTERVAL_INIT _PR_MD_INTERVAL_INIT
|
||||
#define _MD_GET_INTERVAL _PR_MD_GET_INTERVAL
|
||||
#define _MD_INTERVAL_PER_SEC _PR_MD_INTERVAL_PER_SEC
|
||||
#define _MD_INTERVAL_PER_MILLISEC() (_PR_MD_INTERVAL_PER_SEC() / 1000)
|
||||
#define _MD_INTERVAL_PER_MICROSEC() (_PR_MD_INTERVAL_PER_SEC() / 1000000)
|
||||
|
||||
/* --- Time --- */
|
||||
extern void _PR_FileTimeToPRTime(const FILETIME *filetime, PRTime *prtm);
|
||||
|
||||
/* --- Native-Thread Specific Definitions ------------------------------- */
|
||||
|
||||
extern BOOL _pr_use_static_tls;
|
||||
|
||||
extern __declspec(thread) struct PRThread *_pr_current_fiber;
|
||||
extern DWORD _pr_currentFiberIndex;
|
||||
|
||||
#define _MD_GET_ATTACHED_THREAD() \
|
||||
(_pr_use_static_tls ? _pr_current_fiber \
|
||||
: (PRThread *) TlsGetValue(_pr_currentFiberIndex))
|
||||
|
||||
extern struct PRThread * _MD_CURRENT_THREAD(void);
|
||||
|
||||
#define _MD_SET_CURRENT_THREAD(_thread) \
|
||||
PR_BEGIN_MACRO \
|
||||
if (_pr_use_static_tls) { \
|
||||
_pr_current_fiber = (_thread); \
|
||||
} else { \
|
||||
TlsSetValue(_pr_currentFiberIndex, (_thread)); \
|
||||
} \
|
||||
PR_END_MACRO
|
||||
|
||||
extern __declspec(thread) struct PRThread *_pr_fiber_last_run;
|
||||
extern DWORD _pr_lastFiberIndex;
|
||||
|
||||
#define _MD_LAST_THREAD() \
|
||||
(_pr_use_static_tls ? _pr_fiber_last_run \
|
||||
: (PRThread *) TlsGetValue(_pr_lastFiberIndex))
|
||||
|
||||
#define _MD_SET_LAST_THREAD(_thread) \
|
||||
PR_BEGIN_MACRO \
|
||||
if (_pr_use_static_tls) { \
|
||||
_pr_fiber_last_run = (_thread); \
|
||||
} else { \
|
||||
TlsSetValue(_pr_lastFiberIndex, (_thread)); \
|
||||
} \
|
||||
PR_END_MACRO
|
||||
|
||||
extern __declspec(thread) struct _PRCPU *_pr_current_cpu;
|
||||
extern DWORD _pr_currentCPUIndex;
|
||||
|
||||
#define _MD_CURRENT_CPU() \
|
||||
(_pr_use_static_tls ? _pr_current_cpu \
|
||||
: (struct _PRCPU *) TlsGetValue(_pr_currentCPUIndex))
|
||||
|
||||
#define _MD_SET_CURRENT_CPU(_cpu) \
|
||||
PR_BEGIN_MACRO \
|
||||
if (_pr_use_static_tls) { \
|
||||
_pr_current_cpu = (_cpu); \
|
||||
} else { \
|
||||
TlsSetValue(_pr_currentCPUIndex, (_cpu)); \
|
||||
} \
|
||||
PR_END_MACRO
|
||||
|
||||
extern __declspec(thread) PRUintn _pr_ints_off;
|
||||
extern DWORD _pr_intsOffIndex;
|
||||
|
||||
#define _MD_GET_INTSOFF() \
|
||||
(_pr_use_static_tls ? _pr_ints_off \
|
||||
: (PRUintn) TlsGetValue(_pr_intsOffIndex))
|
||||
|
||||
#define _MD_SET_INTSOFF(_val) \
|
||||
PR_BEGIN_MACRO \
|
||||
if (_pr_use_static_tls) { \
|
||||
_pr_ints_off = (_val); \
|
||||
} else { \
|
||||
TlsSetValue(_pr_intsOffIndex, (LPVOID) (_val)); \
|
||||
} \
|
||||
PR_END_MACRO
|
||||
|
||||
/* --- Initialization stuff --- */
|
||||
#define _MD_INIT_LOCKS()
|
||||
|
||||
/* --- Stack stuff --- */
|
||||
#define _MD_INIT_STACK(stack, redzone)
|
||||
#define _MD_CLEAR_STACK(stack)
|
||||
|
||||
/* --- Memory-mapped files stuff --- */
|
||||
|
||||
struct _MDFileMap {
|
||||
HANDLE hFileMap;
|
||||
DWORD dwAccess;
|
||||
};
|
||||
|
||||
extern PRStatus _MD_CreateFileMap(struct PRFileMap *fmap, PRInt64 size);
|
||||
#define _MD_CREATE_FILE_MAP _MD_CreateFileMap
|
||||
|
||||
extern PRInt32 _MD_GetMemMapAlignment(void);
|
||||
#define _MD_GET_MEM_MAP_ALIGNMENT _MD_GetMemMapAlignment
|
||||
|
||||
extern void * _MD_MemMap(struct PRFileMap *fmap, PRInt64 offset,
|
||||
PRUint32 len);
|
||||
#define _MD_MEM_MAP _MD_MemMap
|
||||
|
||||
extern PRStatus _MD_MemUnmap(void *addr, PRUint32 size);
|
||||
#define _MD_MEM_UNMAP _MD_MemUnmap
|
||||
|
||||
extern PRStatus _MD_CloseFileMap(struct PRFileMap *fmap);
|
||||
#define _MD_CLOSE_FILE_MAP _MD_CloseFileMap
|
||||
|
||||
/* --- Named semaphores stuff --- */
|
||||
#define _PR_HAVE_NAMED_SEMAPHORES
|
||||
#define _MD_OPEN_SEMAPHORE _PR_MD_OPEN_SEMAPHORE
|
||||
#define _MD_WAIT_SEMAPHORE _PR_MD_WAIT_SEMAPHORE
|
||||
#define _MD_POST_SEMAPHORE _PR_MD_POST_SEMAPHORE
|
||||
#define _MD_CLOSE_SEMAPHORE _PR_MD_CLOSE_SEMAPHORE
|
||||
#define _MD_DELETE_SEMAPHORE(name) PR_SUCCESS /* no op */
|
||||
|
||||
#endif /* nspr_win32_defs_h___ */
|
||||
169
Src/nprt_plugin/gecko/1.8/win/include/md/prosdep.h
Normal file
169
Src/nprt_plugin/gecko/1.8/win/include/md/prosdep.h
Normal file
@@ -0,0 +1,169 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Portable Runtime (NSPR).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998-2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef prosdep_h___
|
||||
#define prosdep_h___
|
||||
|
||||
/*
|
||||
** Get OS specific header information
|
||||
*/
|
||||
#include "prtypes.h"
|
||||
|
||||
PR_BEGIN_EXTERN_C
|
||||
|
||||
#ifdef XP_PC
|
||||
|
||||
#include "md/_pcos.h"
|
||||
#ifdef WINNT
|
||||
#include "md/_winnt.h"
|
||||
#include "md/_win32_errors.h"
|
||||
#elif defined(WIN95)
|
||||
#include "md/_win95.h"
|
||||
#include "md/_win32_errors.h"
|
||||
#elif defined(WIN16)
|
||||
#include "md/_win16.h"
|
||||
#elif defined(OS2)
|
||||
#include "md/_os2.h"
|
||||
#include "md/_os2_errors.h"
|
||||
#else
|
||||
#error unknown Windows platform
|
||||
#endif
|
||||
|
||||
#elif defined XP_MAC
|
||||
|
||||
#include "_macos.h"
|
||||
|
||||
#elif defined(XP_UNIX)
|
||||
|
||||
#if defined(AIX)
|
||||
#include "md/_aix.h"
|
||||
|
||||
#elif defined(FREEBSD)
|
||||
#include "md/_freebsd.h"
|
||||
|
||||
#elif defined(NETBSD)
|
||||
#include "md/_netbsd.h"
|
||||
|
||||
#elif defined(OPENBSD)
|
||||
#include "md/_openbsd.h"
|
||||
|
||||
#elif defined(BSDI)
|
||||
#include "md/_bsdi.h"
|
||||
|
||||
#elif defined(HPUX)
|
||||
#include "md/_hpux.h"
|
||||
|
||||
#elif defined(IRIX)
|
||||
#include "md/_irix.h"
|
||||
|
||||
#elif defined(LINUX)
|
||||
#include "md/_linux.h"
|
||||
|
||||
#elif defined(OSF1)
|
||||
#include "md/_osf1.h"
|
||||
|
||||
#elif defined(DARWIN)
|
||||
#include "md/_darwin.h"
|
||||
|
||||
#elif defined(NEXTSTEP)
|
||||
#include "md/_nextstep.h"
|
||||
|
||||
#elif defined(SOLARIS)
|
||||
#include "md/_solaris.h"
|
||||
|
||||
#elif defined(SUNOS4)
|
||||
#include "md/_sunos4.h"
|
||||
|
||||
#elif defined(SNI)
|
||||
#include "md/_reliantunix.h"
|
||||
|
||||
#elif defined(SONY)
|
||||
#include "md/_sony.h"
|
||||
|
||||
#elif defined(NEC)
|
||||
#include "md/_nec.h"
|
||||
|
||||
#elif defined(SCO)
|
||||
#include "md/_scoos.h"
|
||||
|
||||
#elif defined(UNIXWARE)
|
||||
#include "md/_unixware.h"
|
||||
|
||||
#elif defined(NCR)
|
||||
#include "md/_ncr.h"
|
||||
|
||||
#elif defined(DGUX)
|
||||
#include "md/_dgux.h"
|
||||
|
||||
#elif defined(QNX)
|
||||
#include "md/_qnx.h"
|
||||
|
||||
#elif defined(VMS)
|
||||
#include "md/_openvms.h"
|
||||
|
||||
#elif defined(NTO)
|
||||
#include "md/_nto.h"
|
||||
|
||||
#elif defined(RISCOS)
|
||||
#include "md/_riscos.h"
|
||||
|
||||
#else
|
||||
#error unknown Unix flavor
|
||||
|
||||
#endif
|
||||
|
||||
#include "md/_unixos.h"
|
||||
#include "md/_unix_errors.h"
|
||||
|
||||
#elif defined(XP_BEOS)
|
||||
|
||||
#include "md/_beos.h"
|
||||
#include "md/_unix_errors.h"
|
||||
|
||||
#else
|
||||
|
||||
#error "The platform is not BeOS, Unix, Windows, or Mac"
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef _PR_PTHREADS
|
||||
#include "md/_pth.h"
|
||||
#endif
|
||||
|
||||
PR_END_EXTERN_C
|
||||
|
||||
#endif /* prosdep_h___ */
|
||||
164
Src/nprt_plugin/gecko/1.8/win/include/md/sunos4.h
Normal file
164
Src/nprt_plugin/gecko/1.8/win/include/md/sunos4.h
Normal file
@@ -0,0 +1,164 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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 Portable Runtime (NSPR).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998-2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef pr_sunos4_h___
|
||||
#define pr_sunos4_h___
|
||||
|
||||
#ifndef SVR4
|
||||
|
||||
/*
|
||||
** Hodge podge of random missing prototypes for the Sunos4 system
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <time.h>
|
||||
#include <limits.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#define PATH_MAX _POSIX_PATH_MAX
|
||||
|
||||
struct timeval;
|
||||
struct timezone;
|
||||
struct itimerval;
|
||||
struct sockaddr;
|
||||
struct stat;
|
||||
struct tm;
|
||||
|
||||
/* ctype.h */
|
||||
extern int tolower(int);
|
||||
extern int toupper(int);
|
||||
|
||||
/* errno.h */
|
||||
extern char *sys_errlist[];
|
||||
extern int sys_nerr;
|
||||
|
||||
#define strerror(e) sys_errlist[((unsigned)(e) < sys_nerr) ? e : 0]
|
||||
|
||||
extern void perror(const char *);
|
||||
|
||||
/* getopt */
|
||||
extern char *optarg;
|
||||
extern int optind;
|
||||
extern int getopt(int argc, char **argv, char *spec);
|
||||
|
||||
/* math.h */
|
||||
extern int srandom(long val);
|
||||
extern long random(void);
|
||||
|
||||
/* memory.h */
|
||||
#define memmove(to,from,len) bcopy((char*)(from),(char*)(to),len)
|
||||
|
||||
extern void bcopy(const char *, char *, int);
|
||||
|
||||
/* signal.h */
|
||||
/*
|
||||
** SunOS4 sigaction hides interrupts by default, so we can safely define
|
||||
** SA_RESTART to 0.
|
||||
*/
|
||||
#define SA_RESTART 0
|
||||
|
||||
/* stdio.h */
|
||||
extern int printf(const char *, ...);
|
||||
extern int fprintf(FILE *, const char *, ...);
|
||||
extern int vprintf(const char *, va_list);
|
||||
extern int vfprintf(FILE *, const char *, va_list);
|
||||
extern char *vsprintf(char *, const char *, va_list);
|
||||
extern int scanf(const char *, ...);
|
||||
extern int sscanf(const char *, const char *, ...);
|
||||
extern int fscanf(FILE *, const char *, ...);
|
||||
extern int fgetc(FILE *);
|
||||
extern int fputc(int, FILE *);
|
||||
extern int fputs(const char *, FILE *);
|
||||
extern int puts(const char *);
|
||||
extern int fread(void *, size_t, size_t, FILE *);
|
||||
extern int fwrite(const char *, int, int, FILE *);
|
||||
extern int fseek(FILE *, long, int);
|
||||
extern long ftell(FILE *);
|
||||
extern int rewind(FILE *);
|
||||
extern int fflush(FILE *);
|
||||
extern int _flsbuf(unsigned char, FILE *);
|
||||
extern int fclose(FILE *);
|
||||
extern int remove(const char *);
|
||||
extern int setvbuf(FILE *, char *, int, size_t);
|
||||
extern int system(const char *);
|
||||
extern FILE *popen(const char *, const char *);
|
||||
extern int pclose(FILE *);
|
||||
|
||||
/* stdlib.h */
|
||||
#define strtoul strtol
|
||||
|
||||
extern int isatty(int fildes);
|
||||
extern long strtol(const char *, char **, int);
|
||||
extern int putenv(const char *);
|
||||
extern void srand48(long);
|
||||
extern long lrand48(void);
|
||||
extern double drand48(void);
|
||||
|
||||
/* string.h */
|
||||
extern int strcasecmp(const char *, const char *);
|
||||
extern int strncasecmp(const char *, const char *, size_t);
|
||||
extern int strcoll(const char *, const char *);
|
||||
|
||||
/* time.h */
|
||||
extern time_t mktime(struct tm *);
|
||||
extern size_t strftime(char *, size_t, const char *, const struct tm *);
|
||||
extern int gettimeofday(struct timeval *, struct timezone *);
|
||||
extern int setitimer(int, struct itimerval *, struct itimerval *);
|
||||
extern time_t time(time_t *);
|
||||
extern time_t timegm(struct tm *);
|
||||
extern struct tm *localtime(const time_t *);
|
||||
extern struct tm *gmtime(const time_t *);
|
||||
|
||||
/* unistd.h */
|
||||
extern int rename(const char *, const char *);
|
||||
extern int ioctl(int, int, int *arg);
|
||||
extern int connect(int, struct sockaddr *, int);
|
||||
extern int readlink(const char *, char *, int);
|
||||
extern int symlink(const char *, const char *);
|
||||
extern int ftruncate(int, off_t);
|
||||
extern int fchmod(int, mode_t);
|
||||
extern int fchown(int, uid_t, gid_t);
|
||||
extern int lstat(const char *, struct stat *);
|
||||
extern int fstat(int, struct stat *);
|
||||
extern int select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
|
||||
extern int gethostname(char *, int);
|
||||
extern char *getwd(char *);
|
||||
extern int getpagesize(void);
|
||||
|
||||
#endif /* SVR4 */
|
||||
|
||||
#endif /* pr_sunos4_h___ */
|
||||
Reference in New Issue
Block a user