1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
15 * The Original Code is the Netscape Portable Runtime (NSPR).
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998-2000
20 * the Initial Developer. All Rights Reserved.
24 * Alternatively, the contents of this file may be used under the terms of
25 * either the GNU General Public License Version 2 or later (the "GPL"), or
26 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
38 #ifndef nspr_osf1_defs_h___
39 #define nspr_osf1_defs_h___
42 * Internal configuration macros
45 #define PR_LINKER_ARCH "osf"
46 #define _PR_SI_SYSNAME "OSF"
47 #define _PR_SI_ARCHITECTURE "alpha"
48 #define PR_DLL_SUFFIX ".so"
50 #define _PR_VMBASE 0x30000000
51 #define _PR_STACK_VMBASE 0x50000000
52 #define _MD_DEFAULT_STACK_SIZE 131072L
53 #define _MD_MMAP_FLAGS MAP_PRIVATE
55 #undef HAVE_STACK_GROWING_UP
56 #undef HAVE_WEAK_IO_SYMBOLS
57 #undef HAVE_WEAK_MALLOC_SYMBOLS
59 #define HAVE_BSD_FLOCK
64 #define _PR_POLL_AVAILABLE
66 #define _PR_STAT_HAS_ONLY_ST_ATIME
67 #define _PR_HAVE_LARGE_OFF_T
68 #define _PR_HAVE_GETIPNODEBYNAME
69 #define _PR_HAVE_GETIPNODEBYADDR
70 #define _PR_HAVE_GETADDRINFO
71 #define _PR_INET6_PROBE
73 #define _PR_HAVE_INET_NTOP
77 #define AI_CANONNAME 0x00000002
85 struct sockaddr
*ai_addr
;
86 struct addrinfo
*ai_next
;
89 #define AI_V4MAPPED 0x00000010
90 #define AI_ALL 0x00000008
91 #define AI_ADDRCONFIG 0x00000020
93 #define _PR_HAVE_POSIX_SEMAPHORES
94 #define PR_HAVE_POSIX_NAMED_SHARED_MEMORY
101 * A jmp_buf is actually a struct sigcontext. The sc_sp field of
102 * struct sigcontext is the stack pointer.
104 #define _MD_GET_SP(_t) (((struct sigcontext *) (_t)->md.context)->sc_sp)
105 #define PR_NUM_GCREGS _JBLEN
106 #define CONTEXT(_th) ((_th)->md.context)
109 ** Initialize a thread context to run "_main()" when started
111 #define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
114 if (setjmp(CONTEXT(_thread))) { \
117 _MD_GET_SP(_thread) = (long) ((_sp) - 64); \
118 _MD_GET_SP(_thread) &= ~15; \
121 #define _MD_SWITCH_CONTEXT(_thread) \
122 if (!setjmp(CONTEXT(_thread))) { \
123 (_thread)->md.errcode = errno; \
128 ** Restore a thread context, saved by _MD_SWITCH_CONTEXT
130 #define _MD_RESTORE_CONTEXT(_thread) \
132 errno = (_thread)->md.errcode; \
133 _MD_SET_CURRENT_THREAD(_thread); \
134 longjmp(CONTEXT(_thread), 1); \
137 /* Machine-dependent (MD) data structures */
145 struct _MDThreadStack
{
153 struct _MDSemaphore
{
166 * md-specific cpu structure field
168 #define _PR_MD_MAX_OSFD FD_SETSIZE
172 PRUint32 ioq_timeout
;
173 PRInt32 ioq_max_osfd
;
174 PRInt32 ioq_osfd_cnt
;
176 fd_set fd_read_set
, fd_write_set
, fd_exception_set
;
177 PRInt16 fd_read_cnt
[_PR_MD_MAX_OSFD
],fd_write_cnt
[_PR_MD_MAX_OSFD
],
178 fd_exception_cnt
[_PR_MD_MAX_OSFD
];
180 struct pollfd
*ioq_pollfds
;
181 int ioq_pollfds_size
;
182 #endif /* _PR_USE_POLL */
185 #define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
186 #define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
187 #define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
188 #define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
189 #define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
190 #define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
191 #define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
192 #define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
193 #define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
194 #define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
195 #define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
196 #define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
197 #define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
199 #define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
202 struct _MDCPU_Unix md_unix
;
206 #define _MD_INIT_LOCKS()
208 #define _MD_NEW_LOCK(lock) PR_SUCCESS
209 #define _MD_FREE_LOCK(lock)
210 #define _MD_LOCK(lock)
211 #define _MD_UNLOCK(lock)
212 #define _MD_INIT_IO()
213 #define _MD_IOQ_LOCK()
214 #define _MD_IOQ_UNLOCK()
217 * The following are copied from _sunos.h, _aix.h. This means
218 * some of them should probably be moved into _unixos.h. But
219 * _irix.h seems to be quite different in regard to these macros.
221 #define _MD_GET_INTERVAL _PR_UNIX_GetInterval
222 #define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond
224 #define _MD_EARLY_INIT _MD_EarlyInit
225 #define _MD_FINAL_INIT _PR_UnixInit
226 #define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
227 #define _MD_INIT_THREAD _MD_InitializeThread
228 #define _MD_EXIT_THREAD(thread)
229 #define _MD_SUSPEND_THREAD(thread)
230 #define _MD_RESUME_THREAD(thread)
231 #define _MD_CLEAN_THREAD(_thread)
233 /* The following defines unwrapped versions of select() and poll(). */
234 #include <sys/time.h>
235 extern int __select (int, fd_set
*, fd_set
*, fd_set
*, struct timeval
*);
236 #define _MD_SELECT __select
238 #include <sys/poll.h>
239 #define _MD_POLL __poll
240 extern int __poll(struct pollfd filedes
[], unsigned int nfds
, int timeout
);
245 #ifdef OSF1_HAVE_MACHINE_BUILTINS_H
246 #include <machine/builtins.h>
247 #define _PR_HAVE_ATOMIC_OPS
248 #define _MD_INIT_ATOMIC()
249 #define _MD_ATOMIC_INCREMENT(val) (__ATOMIC_INCREMENT_LONG(val) + 1)
250 #define _MD_ATOMIC_ADD(ptr, val) (__ATOMIC_ADD_LONG(ptr, val) + val)
251 #define _MD_ATOMIC_DECREMENT(val) (__ATOMIC_DECREMENT_LONG(val) - 1)
252 #define _MD_ATOMIC_SET(val, newval) __ATOMIC_EXCH_LONG(val, newval)
253 #endif /* OSF1_HAVE_MACHINE_BUILTINS_H */
255 #endif /* nspr_osf1_defs_h___ */