Bug 469739 - Add support for displaying Vista UAC shield icon; r=joe sr=vladimir
[wine-gecko.git] / nsprpub / pr / include / md / _sunos4.h
blob0d62892e302952dc67ea22448559f26cf342368c
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
13 * License.
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.
22 * Contributor(s):
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_sunos_defs_h___
39 #define nspr_sunos_defs_h___
41 #include "md/sunos4.h"
43 /* On SunOS 4, memset is declared in memory.h */
44 #include <memory.h>
45 #include <errno.h>
46 #include <sys/syscall.h>
49 * Internal configuration macros
52 #define PR_LINKER_ARCH "sunos"
53 #define _PR_SI_SYSNAME "SUNOS"
54 #define _PR_SI_ARCHITECTURE "sparc"
55 #define PR_DLL_SUFFIX ".so.1.0"
58 ** For sunos type machines, don't specify an address because the
59 ** NetBSD/SPARC O.S. does the wrong thing.
61 #define _PR_VMBASE 0x30000000
62 #define _PR_STACK_VMBASE 0x50000000
63 #define _MD_DEFAULT_STACK_SIZE 65536L
64 #define _MD_MMAP_FLAGS MAP_PRIVATE
66 #undef HAVE_STACK_GROWING_UP
67 #undef HAVE_WEAK_IO_SYMBOLS
68 #undef HAVE_WEAK_MALLOC_SYMBOLS
69 #define HAVE_DLL
70 #define USE_DLFCN
71 #define NEED_STRFTIME_LOCK
72 #define NEED_TIME_R
73 #define HAVE_BSD_FLOCK
74 #define _PR_NO_LARGE_FILES
75 #define _PR_STAT_HAS_ONLY_ST_ATIME
77 #define _MD_GET_INTERVAL _PR_UNIX_GetInterval
78 #define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond
80 #define USE_SETJMP
82 #include <setjmp.h>
84 #define _MD_GET_SP(_t) (_t)->md.context[2]
86 #define PR_NUM_GCREGS _JBLEN
88 #define CONTEXT(_th) ((_th)->md.context)
91 ** Initialize the thread context preparing it to execute _main.
93 #define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
94 PR_BEGIN_MACRO \
95 int *context = (_thread)->md.context; \
96 *status = PR_TRUE; \
97 asm("ta 3"); \
98 (void) setjmp(context); \
99 (_thread)->md.context[2] = (int) ((_sp) - 64); \
100 (_thread)->md.context[2] &= ~7; \
101 (_thread)->md.context[3] = (int) _main; \
102 (_thread)->md.context[4] = (int) _main + 4; \
103 PR_END_MACRO
105 #define _MD_SWITCH_CONTEXT(_thread) \
106 asm("ta 3"); \
107 if (!setjmp(CONTEXT(_thread))) { \
108 (_thread)->md.errcode = errno; \
109 _PR_Schedule(); \
113 ** Restore a thread context, saved by _MD_SWITCH_CONTEXT
115 #define _MD_RESTORE_CONTEXT(_thread) \
117 errno = (_thread)->md.errcode; \
118 _MD_SET_CURRENT_THREAD(_thread); \
119 longjmp(CONTEXT(_thread), 1); \
122 #pragma unknown_control_flow(longjmp)
123 #pragma unknown_control_flow(setjmp)
124 #pragma unknown_control_flow(_PR_Schedule)
127 ** Missing function prototypes
130 extern int socket (int domain, int type, int protocol);
131 extern int getsockname (int s, struct sockaddr *name, int *namelen);
132 extern int getpeername (int s, struct sockaddr *name, int *namelen);
133 extern int getsockopt (int s, int level, int optname, char* optval, int* optlen);
134 extern int setsockopt (int s, int level, int optname, const char* optval, int optlen);
135 extern int accept (int s, struct sockaddr *addr, int *addrlen);
136 extern int listen (int s, int backlog);
137 extern int brk(void *);
138 extern void *sbrk(int);
141 /* Machine-dependent (MD) data structures. SunOS 4 has no native threads. */
143 struct _MDThread {
144 jmp_buf context;
145 int id;
146 int errcode;
149 struct _MDThreadStack {
150 PRInt8 notused;
153 struct _MDLock {
154 PRInt8 notused;
157 struct _MDSemaphore {
158 PRInt8 notused;
161 struct _MDCVar {
162 PRInt8 notused;
165 struct _MDSegment {
166 PRInt8 notused;
170 * md-specific cpu structure field
172 #define _PR_MD_MAX_OSFD FD_SETSIZE
174 struct _MDCPU_Unix {
175 PRCList ioQ;
176 PRUint32 ioq_timeout;
177 PRInt32 ioq_max_osfd;
178 PRInt32 ioq_osfd_cnt;
179 #ifndef _PR_USE_POLL
180 fd_set fd_read_set, fd_write_set, fd_exception_set;
181 PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
182 fd_exception_cnt[_PR_MD_MAX_OSFD];
183 #else
184 struct pollfd *ioq_pollfds;
185 int ioq_pollfds_size;
186 #endif /* _PR_USE_POLL */
189 #define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
190 #define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
191 #define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
192 #define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
193 #define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
194 #define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
195 #define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
196 #define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
197 #define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
198 #define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
199 #define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
200 #define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
201 #define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
203 #define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
205 struct _MDCPU {
206 struct _MDCPU_Unix md_unix;
209 #define _MD_INIT_LOCKS()
210 #define _MD_NEW_LOCK(lock) PR_SUCCESS
211 #define _MD_FREE_LOCK(lock)
212 #define _MD_LOCK(lock)
213 #define _MD_UNLOCK(lock)
214 #define _MD_INIT_IO()
215 #define _MD_IOQ_LOCK()
216 #define _MD_IOQ_UNLOCK()
218 /* These are copied from _solaris.h */
220 #define _MD_EARLY_INIT _MD_EarlyInit
221 #define _MD_FINAL_INIT _PR_UnixInit
222 #define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
223 #define _MD_INIT_THREAD _MD_InitializeThread
224 #define _MD_EXIT_THREAD(thread)
225 #define _MD_SUSPEND_THREAD(thread)
226 #define _MD_RESUME_THREAD(thread)
227 #define _MD_CLEAN_THREAD(_thread)
230 * We wrapped the select() call. _MD_SELECT refers to the built-in,
231 * unwrapped version.
233 #define _MD_SELECT(nfds,r,w,e,tv) syscall(SYS_select,nfds,r,w,e,tv)
234 #define _MD_POLL(fds,nfds,timeout) syscall(SYS_poll,fds,nfds,timeout)
236 #endif /* nspr_sparc_defs_h___ */