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
|
---|
4 | *
|
---|
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/
|
---|
9 | *
|
---|
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.
|
---|
14 | *
|
---|
15 | * The Original Code is the Netscape Portable Runtime (NSPR).
|
---|
16 | *
|
---|
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.
|
---|
21 | *
|
---|
22 | * Contributor(s):
|
---|
23 | *
|
---|
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.
|
---|
35 | *
|
---|
36 | * ***** END LICENSE BLOCK ***** */
|
---|
37 |
|
---|
38 | #ifndef nspr_linux_defs_h___
|
---|
39 | #define nspr_linux_defs_h___
|
---|
40 |
|
---|
41 | #include "prthread.h"
|
---|
42 |
|
---|
43 | /*
|
---|
44 | * Internal configuration macros
|
---|
45 | */
|
---|
46 |
|
---|
47 | #define PR_LINKER_ARCH "linux"
|
---|
48 | #define _PR_SI_SYSNAME "LINUX"
|
---|
49 | #ifdef __powerpc__
|
---|
50 | #define _PR_SI_ARCHITECTURE "ppc"
|
---|
51 | #elif defined(__alpha)
|
---|
52 | #define _PR_SI_ARCHITECTURE "alpha"
|
---|
53 | #elif defined(__ia64__)
|
---|
54 | #define _PR_SI_ARCHITECTURE "ia64"
|
---|
55 | #elif defined(__x86_64__)
|
---|
56 | #define _PR_SI_ARCHITECTURE "x86-64"
|
---|
57 | #elif defined(__mc68000__)
|
---|
58 | #define _PR_SI_ARCHITECTURE "m68k"
|
---|
59 | #elif defined(__sparc__)
|
---|
60 | #define _PR_SI_ARCHITECTURE "sparc"
|
---|
61 | #elif defined(__i386__)
|
---|
62 | #define _PR_SI_ARCHITECTURE "x86"
|
---|
63 | #elif defined(__mips__)
|
---|
64 | #define _PR_SI_ARCHITECTURE "mips"
|
---|
65 | #elif defined(__arm__)
|
---|
66 | #define _PR_SI_ARCHITECTURE "arm"
|
---|
67 | #elif defined(__hppa__)
|
---|
68 | #define _PR_SI_ARCHITECTURE "hppa"
|
---|
69 | #elif defined(__s390__)
|
---|
70 | #define _PR_SI_ARCHITECTURE "s390"
|
---|
71 | #elif defined(__s390x__)
|
---|
72 | #define _PR_SI_ARCHITECTURE "s390x"
|
---|
73 | #else
|
---|
74 | #error "Unknown CPU architecture"
|
---|
75 | #endif
|
---|
76 | #define PR_DLL_SUFFIX ".so"
|
---|
77 |
|
---|
78 | #define _PR_VMBASE 0x30000000
|
---|
79 | #define _PR_STACK_VMBASE 0x50000000
|
---|
80 | #define _MD_DEFAULT_STACK_SIZE 65536L
|
---|
81 | #define _MD_MMAP_FLAGS MAP_PRIVATE
|
---|
82 |
|
---|
83 | #undef HAVE_STACK_GROWING_UP
|
---|
84 |
|
---|
85 | /*
|
---|
86 | * Elf linux supports dl* functions
|
---|
87 | */
|
---|
88 | #define HAVE_DLL
|
---|
89 | #define USE_DLFCN
|
---|
90 |
|
---|
91 | #include "_iprt_atomic.h"
|
---|
92 |
|
---|
93 | #define USE_SETJMP
|
---|
94 | #if defined(__GLIBC__) && __GLIBC__ >= 2
|
---|
95 | #define _PR_POLL_AVAILABLE
|
---|
96 | #endif
|
---|
97 | #undef _PR_USE_POLL
|
---|
98 | #define _PR_STAT_HAS_ONLY_ST_ATIME
|
---|
99 | #if defined(__alpha) || defined(__ia64__)
|
---|
100 | #define _PR_HAVE_LARGE_OFF_T
|
---|
101 | #elif (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1)
|
---|
102 | #define _PR_HAVE_OFF64_T
|
---|
103 | #else
|
---|
104 | #define _PR_NO_LARGE_FILES
|
---|
105 | #endif
|
---|
106 | #if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1)
|
---|
107 | #define _PR_INET6
|
---|
108 | #define _PR_HAVE_INET_NTOP
|
---|
109 | #define _PR_HAVE_GETHOSTBYNAME2
|
---|
110 | #define _PR_HAVE_GETADDRINFO
|
---|
111 | #define _PR_INET6_PROBE
|
---|
112 | #endif
|
---|
113 | #define _PR_HAVE_SYSV_SEMAPHORES
|
---|
114 | #define PR_HAVE_SYSV_NAMED_SHARED_MEMORY
|
---|
115 | #if (__GLIBC__ >= 2) && defined(_PR_PTHREADS)
|
---|
116 | #define _PR_HAVE_GETHOST_R
|
---|
117 | #define _PR_HAVE_GETHOST_R_INT
|
---|
118 | #endif
|
---|
119 |
|
---|
120 | #ifdef _PR_PTHREADS
|
---|
121 |
|
---|
122 | extern void _MD_CleanupBeforeExit(void);
|
---|
123 | #define _MD_CLEANUP_BEFORE_EXIT _MD_CleanupBeforeExit
|
---|
124 |
|
---|
125 | #else /* ! _PR_PTHREADS */
|
---|
126 |
|
---|
127 | #include <setjmp.h>
|
---|
128 |
|
---|
129 | #define PR_CONTEXT_TYPE sigjmp_buf
|
---|
130 |
|
---|
131 | #define CONTEXT(_th) ((_th)->md.context)
|
---|
132 |
|
---|
133 | #ifdef __powerpc__
|
---|
134 | /*
|
---|
135 | * PowerPC based MkLinux
|
---|
136 | *
|
---|
137 | * On the PowerPC, the new style jmp_buf isn't used until glibc
|
---|
138 | * 2.1.
|
---|
139 | */
|
---|
140 | #if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1)
|
---|
141 | #define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[JB_GPR1]
|
---|
142 | #else
|
---|
143 | #define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[0].__misc[0]
|
---|
144 | #endif /* glibc 2.1 or later */
|
---|
145 | #define _MD_SET_FP(_t, val)
|
---|
146 | #define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
|
---|
147 | #define _MD_GET_FP_PTR(_t) ((void *) 0)
|
---|
148 | /* aix = 64, macos = 70 */
|
---|
149 | #define PR_NUM_GCREGS 64
|
---|
150 |
|
---|
151 | #elif defined(__alpha)
|
---|
152 | /* Alpha based Linux */
|
---|
153 |
|
---|
154 | #if defined(__GLIBC__) && __GLIBC__ >= 2
|
---|
155 | #define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[JB_SP]
|
---|
156 | #define _MD_SET_FP(_t, val)
|
---|
157 | #define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
|
---|
158 | #define _MD_GET_FP_PTR(_t) ((void *) 0)
|
---|
159 | #define _MD_SP_TYPE long int
|
---|
160 | #else
|
---|
161 | #define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[0].__sp
|
---|
162 | #define _MD_SET_FP(_t, val)
|
---|
163 | #define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
|
---|
164 | #define _MD_GET_FP_PTR(_t) ((void *) 0)
|
---|
165 | #define _MD_SP_TYPE __ptr_t
|
---|
166 | #endif /* defined(__GLIBC__) && __GLIBC__ >= 2 */
|
---|
167 |
|
---|
168 | /* XXX not sure if this is correct, or maybe it should be 17? */
|
---|
169 | #define PR_NUM_GCREGS 9
|
---|
170 |
|
---|
171 | #elif defined(__ia64__)
|
---|
172 |
|
---|
173 | #define _MD_GET_SP(_t) ((long *)((_t)->md.context[0].__jmpbuf)[0])
|
---|
174 | #define _MD_SET_FP(_t, val)
|
---|
175 | #define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
|
---|
176 | #define _MD_GET_FP_PTR(_t) ((void *) 0)
|
---|
177 | #define _MD_SP_TYPE long int
|
---|
178 |
|
---|
179 | #define PR_NUM_GCREGS _JBLEN
|
---|
180 |
|
---|
181 | #elif defined(__mc68000__)
|
---|
182 | /* m68k based Linux */
|
---|
183 |
|
---|
184 | /*
|
---|
185 | * On the m68k, glibc still uses the old style sigjmp_buf, even
|
---|
186 | * in glibc 2.0.7.
|
---|
187 | */
|
---|
188 | #if defined(__GLIBC__) && __GLIBC__ >= 2
|
---|
189 | #define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[0].__sp
|
---|
190 | #define _MD_SET_FP(_t, val)
|
---|
191 | #define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
|
---|
192 | #define _MD_GET_FP_PTR(_t) ((void *) 0)
|
---|
193 | #define _MD_SP_TYPE int
|
---|
194 | #else
|
---|
195 | #define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[0].__sp
|
---|
196 | #define _MD_SET_FP(_t, val)
|
---|
197 | #define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
|
---|
198 | #define _MD_GET_FP_PTR(_t) ((void *) 0)
|
---|
199 | #define _MD_SP_TYPE __ptr_t
|
---|
200 | #endif /* defined(__GLIBC__) && __GLIBC__ >= 2 */
|
---|
201 |
|
---|
202 | /* XXX not sure if this is correct, or maybe it should be 17? */
|
---|
203 | #define PR_NUM_GCREGS 9
|
---|
204 |
|
---|
205 | #elif defined(__sparc__)
|
---|
206 | /* Sparc */
|
---|
207 | #if defined(__GLIBC__) && __GLIBC__ >= 2
|
---|
208 | /*
|
---|
209 | * You need glibc2-2.0.7-25 or later. The libraries that came with
|
---|
210 | * Red Hat 5.1 are not new enough, but they are in 5.2.
|
---|
211 | */
|
---|
212 | #define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[JB_SP]
|
---|
213 | #define _MD_SET_FP(_t, val) ((_t)->md.context[0].__jmpbuf[JB_FP] = val)
|
---|
214 | #define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
|
---|
215 | #define _MD_GET_FP_PTR(_t) (&(_t)->md.context[0].__jmpbuf[JB_FP])
|
---|
216 | #define _MD_SP_TYPE int
|
---|
217 | #else
|
---|
218 | #define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[0].__fp
|
---|
219 | #define _MD_SET_FP(_t, val)
|
---|
220 | #define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
|
---|
221 | #define _MD_GET_FP_PTR(_t) ((void *) 0)
|
---|
222 | #define _MD_SP_TYPE __ptr_t
|
---|
223 | #endif /* defined(__GLIBC__) && __GLIBC__ >= 2 */
|
---|
224 |
|
---|
225 | #elif defined(__i386__)
|
---|
226 | /* Intel based Linux */
|
---|
227 | #if defined(__GLIBC__) && __GLIBC__ >= 2
|
---|
228 | #define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[JB_SP]
|
---|
229 | #define _MD_SET_FP(_t, val) ((_t)->md.context[0].__jmpbuf[JB_BP] = val)
|
---|
230 | #define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
|
---|
231 | #define _MD_GET_FP_PTR(_t) (&(_t)->md.context[0].__jmpbuf[JB_BP])
|
---|
232 | #define _MD_SP_TYPE int
|
---|
233 | #else
|
---|
234 | #define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[0].__sp
|
---|
235 | #define _MD_SET_FP(_t, val) ((_t)->md.context[0].__jmpbuf[0].__bp = val)
|
---|
236 | #define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
|
---|
237 | #define _MD_GET_FP_PTR(_t) &((_t)->md.context[0].__jmpbuf[0].__bp)
|
---|
238 | #define _MD_SP_TYPE __ptr_t
|
---|
239 | #endif /* defined(__GLIBC__) && __GLIBC__ >= 2 */
|
---|
240 | #define PR_NUM_GCREGS 6
|
---|
241 |
|
---|
242 | #elif defined(__mips__)
|
---|
243 | /* Linux/MIPS */
|
---|
244 | #if defined(__GLIBC__) && __GLIBC__ >= 2
|
---|
245 | #define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[0].__sp
|
---|
246 | #define _MD_SET_FP(_t, val) ((_t)->md.context[0].__jmpbuf[0].__fp = (val))
|
---|
247 | #define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
|
---|
248 | #define _MD_GET_FP_PTR(_t) (&(_t)->md.context[0].__jmpbuf[0].__fp)
|
---|
249 | #define _MD_SP_TYPE __ptr_t
|
---|
250 | #else
|
---|
251 | #error "Linux/MIPS pre-glibc2 not supported yet"
|
---|
252 | #endif /* defined(__GLIBC__) && __GLIBC__ >= 2 */
|
---|
253 |
|
---|
254 | #elif defined(__arm__)
|
---|
255 | /* ARM/Linux */
|
---|
256 | #if defined(__GLIBC__) && __GLIBC__ >= 2
|
---|
257 | #define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[20]
|
---|
258 | #define _MD_SET_FP(_t, val) ((_t)->md.context[0].__jmpbuf[19] = (val))
|
---|
259 | #define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
|
---|
260 | #define _MD_GET_FP_PTR(_t) (&(_t)->md.context[0].__jmpbuf[19])
|
---|
261 | #define _MD_SP_TYPE __ptr_t
|
---|
262 | #else
|
---|
263 | #error "ARM/Linux pre-glibc2 not supported yet"
|
---|
264 | #endif /* defined(__GLIBC__) && __GLIBC__ >= 2 */
|
---|
265 |
|
---|
266 | #else
|
---|
267 |
|
---|
268 | #error "Unknown CPU architecture"
|
---|
269 |
|
---|
270 | #endif /*__powerpc__*/
|
---|
271 |
|
---|
272 | /*
|
---|
273 | ** Initialize a thread context to run "_main()" when started
|
---|
274 | */
|
---|
275 | #ifdef __powerpc__
|
---|
276 |
|
---|
277 | #define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
---|
278 | { \
|
---|
279 | *status = PR_TRUE; \
|
---|
280 | if (sigsetjmp(CONTEXT(_thread), 1)) { \
|
---|
281 | _main(); \
|
---|
282 | } \
|
---|
283 | _MD_GET_SP(_thread) = (unsigned char*) ((_sp) - 128); \
|
---|
284 | _thread->md.sp = _MD_GET_SP_PTR(_thread); \
|
---|
285 | _thread->md.fp = _MD_GET_FP_PTR(_thread); \
|
---|
286 | _MD_SET_FP(_thread, 0); \
|
---|
287 | }
|
---|
288 |
|
---|
289 | #elif defined(__mips__)
|
---|
290 |
|
---|
291 | #define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
---|
292 | { \
|
---|
293 | *status = PR_TRUE; \
|
---|
294 | (void) sigsetjmp(CONTEXT(_thread), 1); \
|
---|
295 | _thread->md.context[0].__jmpbuf[0].__pc = (__ptr_t) _main; \
|
---|
296 | _MD_GET_SP(_thread) = (_MD_SP_TYPE) ((_sp) - 64); \
|
---|
297 | _thread->md.sp = _MD_GET_SP_PTR(_thread); \
|
---|
298 | _thread->md.fp = _MD_GET_FP_PTR(_thread); \
|
---|
299 | _MD_SET_FP(_thread, 0); \
|
---|
300 | }
|
---|
301 |
|
---|
302 | #else
|
---|
303 |
|
---|
304 | #define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
---|
305 | { \
|
---|
306 | *status = PR_TRUE; \
|
---|
307 | if (sigsetjmp(CONTEXT(_thread), 1)) { \
|
---|
308 | _main(); \
|
---|
309 | } \
|
---|
310 | _MD_GET_SP(_thread) = (_MD_SP_TYPE) ((_sp) - 64); \
|
---|
311 | _thread->md.sp = _MD_GET_SP_PTR(_thread); \
|
---|
312 | _thread->md.fp = _MD_GET_FP_PTR(_thread); \
|
---|
313 | _MD_SET_FP(_thread, 0); \
|
---|
314 | }
|
---|
315 |
|
---|
316 | #endif /*__powerpc__*/
|
---|
317 |
|
---|
318 | #define _MD_SWITCH_CONTEXT(_thread) \
|
---|
319 | if (!sigsetjmp(CONTEXT(_thread), 1)) { \
|
---|
320 | (_thread)->md.errcode = errno; \
|
---|
321 | _PR_Schedule(); \
|
---|
322 | }
|
---|
323 |
|
---|
324 | /*
|
---|
325 | ** Restore a thread context, saved by _MD_SWITCH_CONTEXT
|
---|
326 | */
|
---|
327 | #define _MD_RESTORE_CONTEXT(_thread) \
|
---|
328 | { \
|
---|
329 | errno = (_thread)->md.errcode; \
|
---|
330 | _MD_SET_CURRENT_THREAD(_thread); \
|
---|
331 | siglongjmp(CONTEXT(_thread), 1); \
|
---|
332 | }
|
---|
333 |
|
---|
334 | /* Machine-dependent (MD) data structures */
|
---|
335 |
|
---|
336 | struct _MDThread {
|
---|
337 | PR_CONTEXT_TYPE context;
|
---|
338 | void *sp;
|
---|
339 | void *fp;
|
---|
340 | int id;
|
---|
341 | int errcode;
|
---|
342 | };
|
---|
343 |
|
---|
344 | struct _MDThreadStack {
|
---|
345 | PRInt8 notused;
|
---|
346 | };
|
---|
347 |
|
---|
348 | struct _MDLock {
|
---|
349 | PRInt8 notused;
|
---|
350 | };
|
---|
351 |
|
---|
352 | struct _MDSemaphore {
|
---|
353 | PRInt8 notused;
|
---|
354 | };
|
---|
355 |
|
---|
356 | struct _MDCVar {
|
---|
357 | PRInt8 notused;
|
---|
358 | };
|
---|
359 |
|
---|
360 | struct _MDSegment {
|
---|
361 | PRInt8 notused;
|
---|
362 | };
|
---|
363 |
|
---|
364 | /*
|
---|
365 | * md-specific cpu structure field
|
---|
366 | */
|
---|
367 | #include <sys/time.h> /* for FD_SETSIZE */
|
---|
368 | #define _PR_MD_MAX_OSFD FD_SETSIZE
|
---|
369 |
|
---|
370 | struct _MDCPU_Unix {
|
---|
371 | PRCList ioQ;
|
---|
372 | PRUint32 ioq_timeout;
|
---|
373 | PRInt32 ioq_max_osfd;
|
---|
374 | PRInt32 ioq_osfd_cnt;
|
---|
375 | #ifndef _PR_USE_POLL
|
---|
376 | fd_set fd_read_set, fd_write_set, fd_exception_set;
|
---|
377 | PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
|
---|
378 | fd_exception_cnt[_PR_MD_MAX_OSFD];
|
---|
379 | #else
|
---|
380 | struct pollfd *ioq_pollfds;
|
---|
381 | int ioq_pollfds_size;
|
---|
382 | #endif /* _PR_USE_POLL */
|
---|
383 | };
|
---|
384 |
|
---|
385 | #define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
|
---|
386 | #define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
|
---|
387 | #define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
|
---|
388 | #define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
|
---|
389 | #define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
|
---|
390 | #define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
|
---|
391 | #define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
|
---|
392 | #define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
|
---|
393 | #define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
|
---|
394 | #define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
|
---|
395 | #define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
|
---|
396 | #define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
|
---|
397 | #define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
|
---|
398 |
|
---|
399 | #define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
|
---|
400 |
|
---|
401 | struct _MDCPU {
|
---|
402 | struct _MDCPU_Unix md_unix;
|
---|
403 | };
|
---|
404 |
|
---|
405 | #define _MD_INIT_LOCKS()
|
---|
406 | #define _MD_NEW_LOCK(lock) PR_SUCCESS
|
---|
407 | #define _MD_FREE_LOCK(lock)
|
---|
408 | #define _MD_LOCK(lock)
|
---|
409 | #define _MD_UNLOCK(lock)
|
---|
410 | #define _MD_INIT_IO()
|
---|
411 | #define _MD_IOQ_LOCK()
|
---|
412 | #define _MD_IOQ_UNLOCK()
|
---|
413 |
|
---|
414 | extern PRStatus _MD_InitializeThread(PRThread *thread);
|
---|
415 |
|
---|
416 | #define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
|
---|
417 | #define _MD_INIT_THREAD _MD_InitializeThread
|
---|
418 | #define _MD_EXIT_THREAD(thread)
|
---|
419 | #define _MD_SUSPEND_THREAD(thread) _MD_suspend_thread
|
---|
420 | #define _MD_RESUME_THREAD(thread) _MD_resume_thread
|
---|
421 | #define _MD_CLEAN_THREAD(_thread)
|
---|
422 |
|
---|
423 | extern PRStatus _MD_CREATE_THREAD(
|
---|
424 | PRThread *thread,
|
---|
425 | void (*start) (void *),
|
---|
426 | PRThreadPriority priority,
|
---|
427 | PRThreadScope scope,
|
---|
428 | PRThreadState state,
|
---|
429 | PRUint32 stackSize);
|
---|
430 | extern void _MD_SET_PRIORITY(struct _MDThread *thread, PRUintn newPri);
|
---|
431 | extern PRStatus _MD_WAIT(PRThread *, PRIntervalTime timeout);
|
---|
432 | extern PRStatus _MD_WAKEUP_WAITER(PRThread *);
|
---|
433 | extern void _MD_YIELD(void);
|
---|
434 |
|
---|
435 | #endif /* ! _PR_PTHREADS */
|
---|
436 |
|
---|
437 | extern void _MD_EarlyInit(void);
|
---|
438 | extern PRIntervalTime _PR_UNIX_GetInterval(void);
|
---|
439 | extern PRIntervalTime _PR_UNIX_TicksPerSecond(void);
|
---|
440 |
|
---|
441 | #define _MD_EARLY_INIT _MD_EarlyInit
|
---|
442 | #define _MD_FINAL_INIT _PR_UnixInit
|
---|
443 | #define _MD_GET_INTERVAL _PR_UNIX_GetInterval
|
---|
444 | #define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond
|
---|
445 |
|
---|
446 | /*
|
---|
447 | * We wrapped the select() call. _MD_SELECT refers to the built-in,
|
---|
448 | * unwrapped version.
|
---|
449 | */
|
---|
450 | #define _MD_SELECT __select
|
---|
451 |
|
---|
452 | #ifdef _PR_POLL_AVAILABLE
|
---|
453 | #include <sys/poll.h>
|
---|
454 | extern int __syscall_poll(struct pollfd *ufds, unsigned long int nfds,
|
---|
455 | int timeout);
|
---|
456 | #define _MD_POLL __syscall_poll
|
---|
457 | #endif
|
---|
458 |
|
---|
459 | /* For writev() */
|
---|
460 | #include <sys/uio.h>
|
---|
461 |
|
---|
462 | extern void _MD_linux_map_sendfile_error(int err);
|
---|
463 |
|
---|
464 | #endif /* nspr_linux_defs_h___ */
|
---|
465 |
|
---|