nsprpub/pr/include/md/_osf1.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/nsprpub/pr/include/md/_osf1.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,222 @@
     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_osf1_defs_h___
    1.10 +#define nspr_osf1_defs_h___
    1.11 +
    1.12 +/*
    1.13 + * Internal configuration macros
    1.14 + */
    1.15 +
    1.16 +#define PR_LINKER_ARCH	"osf"
    1.17 +#define _PR_SI_SYSNAME	"OSF"
    1.18 +#define _PR_SI_ARCHITECTURE "alpha"
    1.19 +#define PR_DLL_SUFFIX		".so"
    1.20 +
    1.21 +#define _PR_VMBASE              0x30000000
    1.22 +#define _PR_STACK_VMBASE        0x50000000
    1.23 +#define _MD_DEFAULT_STACK_SIZE  131072L
    1.24 +#define _MD_MMAP_FLAGS          MAP_PRIVATE
    1.25 +
    1.26 +#undef  HAVE_STACK_GROWING_UP
    1.27 +#undef 	HAVE_WEAK_IO_SYMBOLS
    1.28 +#undef 	HAVE_WEAK_MALLOC_SYMBOLS
    1.29 +#define HAVE_DLL
    1.30 +#define HAVE_BSD_FLOCK
    1.31 +
    1.32 +#define NEED_TIME_R
    1.33 +#define USE_DLFCN
    1.34 +
    1.35 +#define _PR_POLL_AVAILABLE
    1.36 +#define _PR_USE_POLL
    1.37 +#define _PR_STAT_HAS_ONLY_ST_ATIME
    1.38 +#define _PR_HAVE_LARGE_OFF_T
    1.39 +#define _PR_HAVE_GETIPNODEBYNAME
    1.40 +#define _PR_HAVE_GETIPNODEBYADDR
    1.41 +#define _PR_HAVE_GETADDRINFO
    1.42 +#define _PR_INET6_PROBE
    1.43 +#ifdef _PR_INET6
    1.44 +#define _PR_HAVE_INET_NTOP
    1.45 +#else
    1.46 +#define AF_INET6 26
    1.47 +#ifndef AI_CANONNAME
    1.48 +#define AI_CANONNAME 0x00000002
    1.49 +struct addrinfo {
    1.50 +    int              ai_flags;
    1.51 +    int              ai_family;
    1.52 +    int              ai_socktype;
    1.53 +    int              ai_protocol;
    1.54 +    size_t           ai_addrlen;
    1.55 +    char            *ai_canonname;
    1.56 +    struct sockaddr *ai_addr;
    1.57 +    struct addrinfo *ai_next;
    1.58 +};
    1.59 +#endif
    1.60 +#define AI_V4MAPPED 0x00000010
    1.61 +#define AI_ALL      0x00000008
    1.62 +#define AI_ADDRCONFIG 0x00000020
    1.63 +#endif
    1.64 +#define _PR_HAVE_POSIX_SEMAPHORES
    1.65 +#define PR_HAVE_POSIX_NAMED_SHARED_MEMORY
    1.66 +
    1.67 +#define USE_SETJMP
    1.68 +
    1.69 +#include <setjmp.h>
    1.70 +
    1.71 +/*
    1.72 + * A jmp_buf is actually a struct sigcontext.  The sc_sp field of
    1.73 + * struct sigcontext is the stack pointer.
    1.74 + */
    1.75 +#define _MD_GET_SP(_t) (((struct sigcontext *) (_t)->md.context)->sc_sp)
    1.76 +#define PR_NUM_GCREGS _JBLEN
    1.77 +#define CONTEXT(_th) ((_th)->md.context)
    1.78 +
    1.79 +/*
    1.80 +** Initialize a thread context to run "_main()" when started
    1.81 +*/
    1.82 +#define _MD_INIT_CONTEXT(_thread, _sp, _main, status)	      \
    1.83 +{									  \
    1.84 +        *status = PR_TRUE;              \
    1.85 +    if (setjmp(CONTEXT(_thread))) {				\
    1.86 +	(*_main)();						\
    1.87 +    }								\
    1.88 +    _MD_GET_SP(_thread) = (long) ((_sp) - 64);			\
    1.89 +    _MD_GET_SP(_thread) &= ~15;					\
    1.90 +}
    1.91 +
    1.92 +#define _MD_SWITCH_CONTEXT(_thread)  \
    1.93 +    if (!setjmp(CONTEXT(_thread))) { \
    1.94 +	(_thread)->md.errcode = errno;  \
    1.95 +	_PR_Schedule();		     \
    1.96 +    }
    1.97 +
    1.98 +/*
    1.99 +** Restore a thread context, saved by _MD_SWITCH_CONTEXT
   1.100 +*/
   1.101 +#define _MD_RESTORE_CONTEXT(_thread) \
   1.102 +{				     \
   1.103 +    errno = (_thread)->md.errcode;     \
   1.104 +    _MD_SET_CURRENT_THREAD(_thread);	\
   1.105 +    longjmp(CONTEXT(_thread), 1);    \
   1.106 +}
   1.107 +
   1.108 +/* Machine-dependent (MD) data structures */
   1.109 +
   1.110 +struct _MDThread {
   1.111 +    jmp_buf context;
   1.112 +    int id;
   1.113 +    int errcode;
   1.114 +};
   1.115 +
   1.116 +struct _MDThreadStack {
   1.117 +    PRInt8 notused;
   1.118 +};
   1.119 +
   1.120 +struct _MDLock {
   1.121 +    PRInt8 notused;
   1.122 +};
   1.123 +
   1.124 +struct _MDSemaphore {
   1.125 +    PRInt8 notused;
   1.126 +};
   1.127 +
   1.128 +struct _MDCVar {
   1.129 +    PRInt8 notused;
   1.130 +};
   1.131 +
   1.132 +struct _MDSegment {
   1.133 +    PRInt8 notused;
   1.134 +};
   1.135 +
   1.136 +/*
   1.137 + * md-specific cpu structure field
   1.138 + */
   1.139 +#define _PR_MD_MAX_OSFD FD_SETSIZE
   1.140 +
   1.141 +struct _MDCPU_Unix {
   1.142 +    PRCList ioQ;
   1.143 +    PRUint32 ioq_timeout;
   1.144 +    PRInt32 ioq_max_osfd;
   1.145 +    PRInt32 ioq_osfd_cnt;
   1.146 +#ifndef _PR_USE_POLL
   1.147 +    fd_set fd_read_set, fd_write_set, fd_exception_set;
   1.148 +    PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
   1.149 +				fd_exception_cnt[_PR_MD_MAX_OSFD];
   1.150 +#else
   1.151 +	struct pollfd *ioq_pollfds;
   1.152 +	int ioq_pollfds_size;
   1.153 +#endif	/* _PR_USE_POLL */
   1.154 +};
   1.155 +
   1.156 +#define _PR_IOQ(_cpu)			((_cpu)->md.md_unix.ioQ)
   1.157 +#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
   1.158 +#define _PR_FD_READ_SET(_cpu)		((_cpu)->md.md_unix.fd_read_set)
   1.159 +#define _PR_FD_READ_CNT(_cpu)		((_cpu)->md.md_unix.fd_read_cnt)
   1.160 +#define _PR_FD_WRITE_SET(_cpu)		((_cpu)->md.md_unix.fd_write_set)
   1.161 +#define _PR_FD_WRITE_CNT(_cpu)		((_cpu)->md.md_unix.fd_write_cnt)
   1.162 +#define _PR_FD_EXCEPTION_SET(_cpu)	((_cpu)->md.md_unix.fd_exception_set)
   1.163 +#define _PR_FD_EXCEPTION_CNT(_cpu)	((_cpu)->md.md_unix.fd_exception_cnt)
   1.164 +#define _PR_IOQ_TIMEOUT(_cpu)		((_cpu)->md.md_unix.ioq_timeout)
   1.165 +#define _PR_IOQ_MAX_OSFD(_cpu)		((_cpu)->md.md_unix.ioq_max_osfd)
   1.166 +#define _PR_IOQ_OSFD_CNT(_cpu)		((_cpu)->md.md_unix.ioq_osfd_cnt)
   1.167 +#define _PR_IOQ_POLLFDS(_cpu)		((_cpu)->md.md_unix.ioq_pollfds)
   1.168 +#define _PR_IOQ_POLLFDS_SIZE(_cpu)	((_cpu)->md.md_unix.ioq_pollfds_size)
   1.169 +
   1.170 +#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu)	32
   1.171 +
   1.172 +struct _MDCPU {
   1.173 +	struct _MDCPU_Unix md_unix;
   1.174 +};
   1.175 +
   1.176 +#ifndef _PR_PTHREADS
   1.177 +#define _MD_INIT_LOCKS()
   1.178 +#endif
   1.179 +#define _MD_NEW_LOCK(lock) PR_SUCCESS
   1.180 +#define _MD_FREE_LOCK(lock)
   1.181 +#define _MD_LOCK(lock)
   1.182 +#define _MD_UNLOCK(lock)
   1.183 +#define _MD_INIT_IO()
   1.184 +#define _MD_IOQ_LOCK()
   1.185 +#define _MD_IOQ_UNLOCK()
   1.186 +
   1.187 +/*
   1.188 + * The following are copied from _sunos.h, _aix.h.  This means
   1.189 + * some of them should probably be moved into _unixos.h.  But
   1.190 + * _irix.h seems to be quite different in regard to these macros.
   1.191 + */
   1.192 +#define _MD_INTERVAL_USE_GTOD
   1.193 +
   1.194 +#define _MD_EARLY_INIT		_MD_EarlyInit
   1.195 +#define _MD_FINAL_INIT		_PR_UnixInit
   1.196 +#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
   1.197 +#define _MD_INIT_THREAD         _MD_InitializeThread
   1.198 +#define _MD_EXIT_THREAD(thread)
   1.199 +#define	_MD_SUSPEND_THREAD(thread)
   1.200 +#define	_MD_RESUME_THREAD(thread)
   1.201 +#define _MD_CLEAN_THREAD(_thread)
   1.202 +
   1.203 +/* The following defines unwrapped versions of select() and poll(). */
   1.204 +#include <sys/time.h>
   1.205 +extern int __select (int, fd_set *, fd_set *, fd_set *, struct timeval *);
   1.206 +#define _MD_SELECT              __select
   1.207 +
   1.208 +#include <sys/poll.h>
   1.209 +#define _MD_POLL __poll
   1.210 +extern int __poll(struct pollfd filedes[], unsigned int nfds, int timeout);
   1.211 +
   1.212 +/*
   1.213 + * Atomic operations
   1.214 + */
   1.215 +#ifdef OSF1_HAVE_MACHINE_BUILTINS_H
   1.216 +#include <machine/builtins.h>
   1.217 +#define _PR_HAVE_ATOMIC_OPS
   1.218 +#define _MD_INIT_ATOMIC()
   1.219 +#define _MD_ATOMIC_INCREMENT(val) (__ATOMIC_INCREMENT_LONG(val) + 1)
   1.220 +#define _MD_ATOMIC_ADD(ptr, val)  (__ATOMIC_ADD_LONG(ptr, val) + val)
   1.221 +#define _MD_ATOMIC_DECREMENT(val) (__ATOMIC_DECREMENT_LONG(val) - 1)
   1.222 +#define _MD_ATOMIC_SET(val, newval) __ATOMIC_EXCH_LONG(val, newval)
   1.223 +#endif /* OSF1_HAVE_MACHINE_BUILTINS_H */
   1.224 +
   1.225 +#endif /* nspr_osf1_defs_h___ */

mercurial