nsprpub/pr/include/md/_solaris.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/nsprpub/pr/include/md/_solaris.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,493 @@
     1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#ifndef nspr_solaris_defs_h___
    1.10 +#define nspr_solaris_defs_h___
    1.11 +
    1.12 +/*
    1.13 + * Internal configuration macros
    1.14 + */
    1.15 +
    1.16 +#define PR_LINKER_ARCH	"solaris"
    1.17 +#define _PR_SI_SYSNAME	"SOLARIS"
    1.18 +#ifdef sparc
    1.19 +#define _PR_SI_ARCHITECTURE	"sparc"
    1.20 +#elif defined(__x86_64)
    1.21 +#define _PR_SI_ARCHITECTURE	"x86-64"
    1.22 +#elif defined(i386)
    1.23 +#define _PR_SI_ARCHITECTURE	"x86"
    1.24 +#else
    1.25 +#error unknown processor
    1.26 +#endif
    1.27 +#define PR_DLL_SUFFIX		".so"
    1.28 +
    1.29 +#define _PR_VMBASE		0x30000000
    1.30 +#define _PR_STACK_VMBASE	0x50000000
    1.31 +#define _MD_DEFAULT_STACK_SIZE	(2*65536L)
    1.32 +#define _MD_MMAP_FLAGS          MAP_SHARED
    1.33 +
    1.34 +#undef  HAVE_STACK_GROWING_UP
    1.35 +
    1.36 +#ifndef HAVE_WEAK_IO_SYMBOLS
    1.37 +#define	HAVE_WEAK_IO_SYMBOLS
    1.38 +#endif
    1.39 +
    1.40 +#undef	HAVE_WEAK_MALLOC_SYMBOLS
    1.41 +#define	HAVE_DLL
    1.42 +#define	USE_DLFCN
    1.43 +#define NEED_STRFTIME_LOCK
    1.44 +
    1.45 +/*
    1.46 + * Intel x86 has atomic instructions.
    1.47 + *
    1.48 + * Sparc v8 does not have instructions to efficiently implement
    1.49 + * atomic increment/decrement operations.  We use the default
    1.50 + * atomic routine implementation in pratom.c.
    1.51 + *
    1.52 + * 64-bit Solaris requires sparc v9, which has atomic instructions.
    1.53 + */
    1.54 +#if defined(i386) || defined(IS_64)
    1.55 +#define _PR_HAVE_ATOMIC_OPS
    1.56 +#endif
    1.57 +
    1.58 +#define _PR_POLL_AVAILABLE
    1.59 +#define _PR_USE_POLL
    1.60 +#define _PR_STAT_HAS_ST_ATIM
    1.61 +#ifdef SOLARIS2_5
    1.62 +#define _PR_HAVE_SYSV_SEMAPHORES
    1.63 +#define PR_HAVE_SYSV_NAMED_SHARED_MEMORY
    1.64 +#else
    1.65 +#define _PR_HAVE_POSIX_SEMAPHORES
    1.66 +#define PR_HAVE_POSIX_NAMED_SHARED_MEMORY
    1.67 +#endif
    1.68 +#define _PR_HAVE_GETIPNODEBYNAME
    1.69 +#define _PR_HAVE_GETIPNODEBYADDR
    1.70 +#define _PR_HAVE_GETADDRINFO
    1.71 +#define _PR_INET6_PROBE
    1.72 +#define _PR_ACCEPT_INHERIT_NONBLOCK
    1.73 +#ifdef _PR_INET6
    1.74 +#define _PR_HAVE_INET_NTOP
    1.75 +#else
    1.76 +#define AF_INET6 26
    1.77 +struct addrinfo {
    1.78 +    int ai_flags;
    1.79 +    int ai_family;
    1.80 +    int ai_socktype;
    1.81 +    int ai_protocol;
    1.82 +    size_t ai_addrlen;
    1.83 +    char *ai_canonname;
    1.84 +    struct sockaddr *ai_addr;
    1.85 +    struct addrinfo *ai_next;
    1.86 +};
    1.87 +#define AI_CANONNAME 0x0010
    1.88 +#define AI_V4MAPPED 0x0001 
    1.89 +#define AI_ALL      0x0002
    1.90 +#define AI_ADDRCONFIG   0x0004
    1.91 +#define _PR_HAVE_MD_SOCKADDR_IN6
    1.92 +/* isomorphic to struct in6_addr on Solaris 8 */
    1.93 +struct _md_in6_addr {
    1.94 +    union {
    1.95 +        PRUint8  _S6_u8[16];
    1.96 +        PRUint32 _S6_u32[4];
    1.97 +        PRUint32 __S6_align;
    1.98 +    } _S6_un;
    1.99 +};
   1.100 +/* isomorphic to struct sockaddr_in6 on Solaris 8 */
   1.101 +struct _md_sockaddr_in6 {
   1.102 +    PRUint16 sin6_family;
   1.103 +    PRUint16 sin6_port;
   1.104 +    PRUint32 sin6_flowinfo;
   1.105 +    struct _md_in6_addr sin6_addr;
   1.106 +    PRUint32 sin6_scope_id;
   1.107 +    PRUint32 __sin6_src_id;
   1.108 +};
   1.109 +#endif
   1.110 +#if defined(_PR_PTHREADS)
   1.111 +#define _PR_HAVE_GETHOST_R
   1.112 +#define _PR_HAVE_GETHOST_R_POINTER
   1.113 +#endif
   1.114 +
   1.115 +#include "prinrval.h"
   1.116 +#define _MD_INTERVAL_INIT()
   1.117 +NSPR_API(PRIntervalTime) _MD_Solaris_GetInterval(void);
   1.118 +#define _MD_GET_INTERVAL                  _MD_Solaris_GetInterval
   1.119 +NSPR_API(PRIntervalTime) _MD_Solaris_TicksPerSecond(void);
   1.120 +#define _MD_INTERVAL_PER_SEC              _MD_Solaris_TicksPerSecond
   1.121 +
   1.122 +#if defined(_PR_HAVE_ATOMIC_OPS)
   1.123 +/*
   1.124 +** Atomic Operations
   1.125 +*/
   1.126 +#define _MD_INIT_ATOMIC()
   1.127 +
   1.128 +NSPR_API(PRInt32) _MD_AtomicIncrement(PRInt32 *val);
   1.129 +#define _MD_ATOMIC_INCREMENT _MD_AtomicIncrement
   1.130 +
   1.131 +NSPR_API(PRInt32) _MD_AtomicAdd(PRInt32 *ptr, PRInt32 val);
   1.132 +#define _MD_ATOMIC_ADD _MD_AtomicAdd
   1.133 +
   1.134 +NSPR_API(PRInt32) _MD_AtomicDecrement(PRInt32 *val);
   1.135 +#define _MD_ATOMIC_DECREMENT _MD_AtomicDecrement
   1.136 +
   1.137 +NSPR_API(PRInt32) _MD_AtomicSet(PRInt32 *val, PRInt32 newval);
   1.138 +#define _MD_ATOMIC_SET _MD_AtomicSet
   1.139 +#endif /* _PR_HAVE_ATOMIC_OPS */
   1.140 +
   1.141 +#if defined(_PR_PTHREADS)
   1.142 +
   1.143 +NSPR_API(void)		_MD_EarlyInit(void);
   1.144 +
   1.145 +#define _MD_EARLY_INIT		_MD_EarlyInit
   1.146 +#define _MD_FINAL_INIT		_PR_UnixInit
   1.147 +
   1.148 +#else /* _PR_PTHREADS */
   1.149 +
   1.150 +/*
   1.151 + * _PR_LOCAL_THREADS_ONLY implementation on Solaris
   1.152 + */
   1.153 +
   1.154 +#include "prthread.h"
   1.155 +
   1.156 +#include <errno.h>
   1.157 +#include <ucontext.h>
   1.158 +#include <sys/stack.h>
   1.159 +#include <synch.h>
   1.160 +
   1.161 +/*
   1.162 +** Initialization Related definitions
   1.163 +*/
   1.164 +
   1.165 +NSPR_API(void)				_MD_EarlyInit(void);
   1.166 +NSPR_API(void)				_MD_SolarisInit();
   1.167 +#define _MD_EARLY_INIT		_MD_EarlyInit
   1.168 +#define _MD_FINAL_INIT		_MD_SolarisInit
   1.169 +#define	_MD_INIT_THREAD		_MD_InitializeThread
   1.170 +
   1.171 +#ifdef USE_SETJMP
   1.172 +
   1.173 +#include <setjmp.h>
   1.174 +
   1.175 +#define _PR_CONTEXT_TYPE	jmp_buf
   1.176 +
   1.177 +#ifdef sparc
   1.178 +#define _MD_GET_SP(_t)		(_t)->md.context[2]
   1.179 +#else
   1.180 +#define _MD_GET_SP(_t)		(_t)->md.context[4]
   1.181 +#endif
   1.182 +
   1.183 +#define PR_NUM_GCREGS		_JBLEN
   1.184 +#define CONTEXT(_thread)	(_thread)->md.context
   1.185 +
   1.186 +#else  /* ! USE_SETJMP */
   1.187 +
   1.188 +#ifdef sparc
   1.189 +#define	_PR_CONTEXT_TYPE	ucontext_t
   1.190 +#define _MD_GET_SP(_t)		(_t)->md.context.uc_mcontext.gregs[REG_SP]
   1.191 +/*
   1.192 +** Sparc's use register windows. the _MD_GetRegisters for the sparc's
   1.193 +** doesn't actually store anything into the argument buffer; instead the
   1.194 +** register windows are homed to the stack. I assume that the stack
   1.195 +** always has room for the registers to spill to...
   1.196 +*/
   1.197 +#define PR_NUM_GCREGS		0
   1.198 +#else
   1.199 +#define _PR_CONTEXT_TYPE	unsigned int edi; sigset_t oldMask, blockMask; ucontext_t
   1.200 +#define _MD_GET_SP(_t)		(_t)->md.context.uc_mcontext.gregs[USP]
   1.201 +#define PR_NUM_GCREGS		_JBLEN
   1.202 +#endif
   1.203 +
   1.204 +#define CONTEXT(_thread)	(&(_thread)->md.context)
   1.205 +
   1.206 +#endif /* ! USE_SETJMP */
   1.207 +
   1.208 +#include <time.h>
   1.209 +/* 
   1.210 + * Because clock_gettime() on Solaris/x86 always generates a
   1.211 + * segmentation fault, we use an emulated version _pr_solx86_clock_gettime(),
   1.212 + * which is implemented using gettimeofday().
   1.213 + */
   1.214 +#ifdef i386
   1.215 +#define GETTIME(tt) _pr_solx86_clock_gettime(CLOCK_REALTIME, (tt))
   1.216 +#else
   1.217 +#define GETTIME(tt) clock_gettime(CLOCK_REALTIME, (tt))
   1.218 +#endif  /* i386 */
   1.219 +
   1.220 +#define _MD_SAVE_ERRNO(_thread)			(_thread)->md.errcode = errno;
   1.221 +#define _MD_RESTORE_ERRNO(_thread)		errno = (_thread)->md.errcode;
   1.222 +
   1.223 +#ifdef sparc
   1.224 +
   1.225 +#ifdef USE_SETJMP
   1.226 +#define _MD_INIT_CONTEXT(_thread, _sp, _main, status)	      \
   1.227 +    PR_BEGIN_MACRO				      \
   1.228 +	int *context = (_thread)->md.context;	      \
   1.229 +    *status = PR_TRUE;              \
   1.230 +	(void) setjmp(context);			      \
   1.231 +	(_thread)->md.context[1] = (int) ((_sp) - 64); \
   1.232 +	(_thread)->md.context[2] = (int) _main;	      \
   1.233 +	(_thread)->md.context[3] = (int) _main + 4; \
   1.234 +    _thread->no_sched = 0; \
   1.235 +    PR_END_MACRO
   1.236 +
   1.237 +#define _MD_SWITCH_CONTEXT(_thread)    \
   1.238 +    if (!setjmp(CONTEXT(_thread))) { \
   1.239 +	_MD_SAVE_ERRNO(_thread)    \
   1.240 +	_MD_SET_LAST_THREAD(_thread);	 \
   1.241 +    _MD_SET_CURRENT_THREAD(_thread);	 \
   1.242 +	_PR_Schedule();		     \
   1.243 +    }
   1.244 +
   1.245 +#define _MD_RESTORE_CONTEXT(_newThread)	    \
   1.246 +{				     \
   1.247 +	_MD_RESTORE_ERRNO(_newThread)	    \
   1.248 +	_MD_SET_CURRENT_THREAD(_newThread); \
   1.249 +    longjmp(CONTEXT(_newThread), 1);    \
   1.250 +}
   1.251 +
   1.252 +#else
   1.253 +/*
   1.254 +** Initialize the thread context preparing it to execute _main.
   1.255 +*/
   1.256 +#define _MD_INIT_CONTEXT(_thread, _sp, _main, status)					\
   1.257 +    PR_BEGIN_MACRO				      									\
   1.258 +    ucontext_t *uc = CONTEXT(_thread);									\
   1.259 +    *status = PR_TRUE;													\
   1.260 +    getcontext(uc);														\
   1.261 +    uc->uc_stack.ss_sp = (char *) ((unsigned long)(_sp - WINDOWSIZE - SA(MINFRAME)) & 0xfffffff8);	\
   1.262 +    uc->uc_stack.ss_size = _thread->stack->stackSize; 					\
   1.263 +    uc->uc_stack.ss_flags = 0; 				/* ? */		        		\
   1.264 +    uc->uc_mcontext.gregs[REG_SP] = (unsigned int) uc->uc_stack.ss_sp;	\
   1.265 +    uc->uc_mcontext.gregs[REG_PC] = (unsigned int) _main;				\
   1.266 +    uc->uc_mcontext.gregs[REG_nPC] = (unsigned int) ((char*)_main)+4;	\
   1.267 +    uc->uc_flags = UC_ALL;												\
   1.268 +    _thread->no_sched = 0;												\
   1.269 +    PR_END_MACRO
   1.270 +
   1.271 +/*
   1.272 +** Switch away from the current thread context by saving its state and
   1.273 +** calling the thread scheduler. Reload cpu when we come back from the
   1.274 +** context switch because it might have changed.
   1.275 +*/
   1.276 +#define _MD_SWITCH_CONTEXT(_thread)    				\
   1.277 +    PR_BEGIN_MACRO                     				\
   1.278 +		if (!getcontext(CONTEXT(_thread))) { 		\
   1.279 +			_MD_SAVE_ERRNO(_thread);    			\
   1.280 +			_MD_SET_LAST_THREAD(_thread);	 		\
   1.281 +			_PR_Schedule();			 				\
   1.282 +		}					 						\
   1.283 +    PR_END_MACRO
   1.284 +
   1.285 +/*
   1.286 +** Restore a thread context that was saved by _MD_SWITCH_CONTEXT or
   1.287 +** initialized by _MD_INIT_CONTEXT.
   1.288 +*/
   1.289 +#define _MD_RESTORE_CONTEXT(_newThread)	    				\
   1.290 +    PR_BEGIN_MACRO			    							\
   1.291 +    	ucontext_t *uc = CONTEXT(_newThread); 				\
   1.292 +    	uc->uc_mcontext.gregs[11] = 1;     					\
   1.293 +		_MD_RESTORE_ERRNO(_newThread);	    				\
   1.294 +		_MD_SET_CURRENT_THREAD(_newThread); 				\
   1.295 +    	setcontext(uc);		       							\
   1.296 +    PR_END_MACRO
   1.297 +#endif
   1.298 +
   1.299 +#else  /* x86 solaris */
   1.300 +
   1.301 +#ifdef USE_SETJMP
   1.302 +
   1.303 +#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
   1.304 +    PR_BEGIN_MACRO \
   1.305 +    *status = PR_TRUE; \
   1.306 +    if (setjmp(CONTEXT(_thread))) _main(); \
   1.307 +    _MD_GET_SP(_thread) = (int) ((_sp) - 64); \
   1.308 +    PR_END_MACRO
   1.309 +
   1.310 +#define _MD_SWITCH_CONTEXT(_thread) \
   1.311 +    if (!setjmp(CONTEXT(_thread))) { \
   1.312 +        _MD_SAVE_ERRNO(_thread) \
   1.313 +        _PR_Schedule();	\
   1.314 +    }
   1.315 +
   1.316 +#define _MD_RESTORE_CONTEXT(_newThread) \
   1.317 +{ \
   1.318 +    _MD_RESTORE_ERRNO(_newThread) \
   1.319 +    _MD_SET_CURRENT_THREAD(_newThread); \
   1.320 +    longjmp(CONTEXT(_newThread), 1); \
   1.321 +}
   1.322 +
   1.323 +#else /* USE_SETJMP */
   1.324 +
   1.325 +#define WINDOWSIZE		0
   1.326 + 
   1.327 +int getedi(void);
   1.328 +void setedi(int);
   1.329 + 
   1.330 +#define _MD_INIT_CONTEXT(_thread, _sp, _main, status)	      \
   1.331 +	PR_BEGIN_MACRO					\
   1.332 +	ucontext_t *uc = CONTEXT(_thread);		\
   1.333 +        *status = PR_TRUE;              \
   1.334 +	getcontext(uc);					\
   1.335 +	/* Force sp to be double aligned! */		\
   1.336 +    	uc->uc_mcontext.gregs[USP] = (int) ((unsigned long)(_sp - WINDOWSIZE - SA(MINFRAME)) & 0xfffffff8);	\
   1.337 +	uc->uc_mcontext.gregs[PC] = (int) _main;	\
   1.338 +	(_thread)->no_sched = 0; \
   1.339 +	PR_END_MACRO
   1.340 +
   1.341 +/* getcontext() may return 1, contrary to what the man page says */
   1.342 +#define _MD_SWITCH_CONTEXT(_thread)			\
   1.343 +	PR_BEGIN_MACRO					\
   1.344 +	ucontext_t *uc = CONTEXT(_thread);		\
   1.345 +	PR_ASSERT(_thread->no_sched);			\
   1.346 +	sigfillset(&((_thread)->md.blockMask));		\
   1.347 +	sigprocmask(SIG_BLOCK, &((_thread)->md.blockMask),	\
   1.348 +		&((_thread)->md.oldMask));		\
   1.349 +	(_thread)->md.edi = getedi();			\
   1.350 +	if (! getcontext(uc)) {				\
   1.351 +		sigprocmask(SIG_SETMASK, &((_thread)->md.oldMask), NULL); \
   1.352 +		uc->uc_mcontext.gregs[EDI] = (_thread)->md.edi;	\
   1.353 +		_MD_SAVE_ERRNO(_thread)    		\
   1.354 +	        _MD_SET_LAST_THREAD(_thread);	        \
   1.355 +		_PR_Schedule();				\
   1.356 +	} else {					\
   1.357 +		sigprocmask(SIG_SETMASK, &((_thread)->md.oldMask), NULL); \
   1.358 +		setedi((_thread)->md.edi);		\
   1.359 +		PR_ASSERT(_MD_LAST_THREAD() !=_MD_CURRENT_THREAD()); \
   1.360 +		_MD_LAST_THREAD()->no_sched = 0;	\
   1.361 +	}						\
   1.362 +	PR_END_MACRO
   1.363 +
   1.364 +/*
   1.365 +** Restore a thread context, saved by _PR_SWITCH_CONTEXT
   1.366 +*/
   1.367 +#define _MD_RESTORE_CONTEXT(_newthread)			\
   1.368 +	PR_BEGIN_MACRO					\
   1.369 +	ucontext_t *uc = CONTEXT(_newthread);		\
   1.370 +	uc->uc_mcontext.gregs[EAX] = 1;			\
   1.371 +	_MD_RESTORE_ERRNO(_newthread)  			\
   1.372 +	_MD_SET_CURRENT_THREAD(_newthread);		\
   1.373 +	(_newthread)->no_sched = 1;			\
   1.374 +	setcontext(uc);					\
   1.375 +	PR_END_MACRO
   1.376 +#endif /* USE_SETJMP */
   1.377 +
   1.378 +#endif /* sparc */
   1.379 +
   1.380 +struct _MDLock {
   1.381 +	PRInt8 notused;
   1.382 +};
   1.383 +
   1.384 +struct _MDCVar {
   1.385 +	PRInt8 notused;
   1.386 +};
   1.387 +
   1.388 +struct _MDSemaphore {
   1.389 +	PRInt8 notused;
   1.390 +};
   1.391 +
   1.392 +struct _MDThread {
   1.393 +    _PR_CONTEXT_TYPE context;
   1.394 +    int errcode;
   1.395 +    int id;
   1.396 +};
   1.397 +
   1.398 +struct _MDThreadStack {
   1.399 +    PRInt8 notused;
   1.400 +};
   1.401 +
   1.402 +struct _MDSegment {
   1.403 +    PRInt8 notused;
   1.404 +};
   1.405 +
   1.406 +/*
   1.407 + * md-specific cpu structure field
   1.408 + */
   1.409 +#define _PR_MD_MAX_OSFD FD_SETSIZE
   1.410 +
   1.411 +struct _MDCPU_Unix {
   1.412 +    PRCList ioQ;
   1.413 +    PRUint32 ioq_timeout;
   1.414 +    PRInt32 ioq_max_osfd;
   1.415 +    PRInt32 ioq_osfd_cnt;
   1.416 +#ifndef _PR_USE_POLL
   1.417 +    fd_set fd_read_set, fd_write_set, fd_exception_set;
   1.418 +    PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
   1.419 +				fd_exception_cnt[_PR_MD_MAX_OSFD];
   1.420 +#else
   1.421 +	struct pollfd *ioq_pollfds;
   1.422 +	int ioq_pollfds_size;
   1.423 +#endif	/* _PR_USE_POLL */
   1.424 +};
   1.425 +
   1.426 +#define _PR_IOQ(_cpu)			((_cpu)->md.md_unix.ioQ)
   1.427 +#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
   1.428 +#define _PR_FD_READ_SET(_cpu)		((_cpu)->md.md_unix.fd_read_set)
   1.429 +#define _PR_FD_READ_CNT(_cpu)		((_cpu)->md.md_unix.fd_read_cnt)
   1.430 +#define _PR_FD_WRITE_SET(_cpu)		((_cpu)->md.md_unix.fd_write_set)
   1.431 +#define _PR_FD_WRITE_CNT(_cpu)		((_cpu)->md.md_unix.fd_write_cnt)
   1.432 +#define _PR_FD_EXCEPTION_SET(_cpu)	((_cpu)->md.md_unix.fd_exception_set)
   1.433 +#define _PR_FD_EXCEPTION_CNT(_cpu)	((_cpu)->md.md_unix.fd_exception_cnt)
   1.434 +#define _PR_IOQ_TIMEOUT(_cpu)		((_cpu)->md.md_unix.ioq_timeout)
   1.435 +#define _PR_IOQ_MAX_OSFD(_cpu)		((_cpu)->md.md_unix.ioq_max_osfd)
   1.436 +#define _PR_IOQ_OSFD_CNT(_cpu)		((_cpu)->md.md_unix.ioq_osfd_cnt)
   1.437 +#define _PR_IOQ_POLLFDS(_cpu)		((_cpu)->md.md_unix.ioq_pollfds)
   1.438 +#define _PR_IOQ_POLLFDS_SIZE(_cpu)	((_cpu)->md.md_unix.ioq_pollfds_size)
   1.439 +
   1.440 +#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu)	32
   1.441 +
   1.442 +struct _MDCPU {
   1.443 +	struct _MDCPU_Unix md_unix;
   1.444 +};
   1.445 +
   1.446 +#define _MD_INIT_LOCKS()
   1.447 +#define _MD_NEW_LOCK(lock)				PR_SUCCESS
   1.448 +#define _MD_FREE_LOCK(lock)
   1.449 +#define _MD_LOCK(lock)
   1.450 +#define _MD_UNLOCK(lock)
   1.451 +#define _MD_INIT_IO()
   1.452 +#define _MD_IOQ_LOCK()
   1.453 +#define _MD_IOQ_UNLOCK()
   1.454 +
   1.455 +#define _MD_INIT_RUNNING_CPU(cpu)		_MD_unix_init_running_cpu(cpu)
   1.456 +#define _MD_INIT_THREAD					_MD_InitializeThread
   1.457 +#define _MD_EXIT_THREAD(thread)
   1.458 +#define _MD_SUSPEND_THREAD(thread)
   1.459 +#define _MD_RESUME_THREAD(thread)
   1.460 +#define _MD_CLEAN_THREAD(_thread)
   1.461 +
   1.462 +extern PRStatus _MD_WAIT(struct PRThread *, PRIntervalTime timeout);
   1.463 +extern PRStatus _MD_WAKEUP_WAITER(struct PRThread *);
   1.464 +extern void     _MD_YIELD(void);
   1.465 +extern PRStatus _MD_InitializeThread(PRThread *thread);
   1.466 +extern void     _MD_SET_PRIORITY(struct _MDThread *thread,
   1.467 +	PRThreadPriority newPri);
   1.468 +extern PRStatus _MD_CREATE_THREAD(PRThread *thread, void (*start) (void *),
   1.469 +	PRThreadPriority priority, PRThreadScope scope, PRThreadState state,
   1.470 +        PRUint32 stackSize);
   1.471 +
   1.472 +/* The following defines the unwrapped versions of select() and poll(). */
   1.473 +extern int _select(int nfds, fd_set *readfds, fd_set *writefds,
   1.474 +	fd_set *exceptfds, struct timeval *timeout);
   1.475 +#define _MD_SELECT	_select
   1.476 +
   1.477 +#include <stropts.h>
   1.478 +#include <poll.h>
   1.479 +#define _MD_POLL _poll
   1.480 +extern int _poll(struct pollfd *fds, unsigned long nfds, int timeout);
   1.481 +
   1.482 +PR_BEGIN_EXTERN_C
   1.483 +
   1.484 +/*
   1.485 +** Missing function prototypes
   1.486 +*/
   1.487 +extern int gethostname (char *name, int namelen);
   1.488 +
   1.489 +PR_END_EXTERN_C
   1.490 +
   1.491 +#endif /* _PR_PTHREADS */
   1.492 +
   1.493 +extern void _MD_solaris_map_sendfile_error(int err);
   1.494 +
   1.495 +#endif /* nspr_solaris_defs_h___ */
   1.496 +

mercurial