1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 ***** */
39 * This file is used by not only Linux but also other glibc systems
40 * such as GNU/Hurd and GNU/k*BSD.
43 #ifndef nspr_linux_defs_h___
44 #define nspr_linux_defs_h___
49 * Internal configuration macros
52 #define PR_LINKER_ARCH "linux"
53 #define _PR_SI_SYSNAME "LINUX"
55 #define _PR_SI_ARCHITECTURE "ppc64"
56 #elif defined(__powerpc__)
57 #define _PR_SI_ARCHITECTURE "ppc"
58 #elif defined(__alpha)
59 #define _PR_SI_ARCHITECTURE "alpha"
60 #elif defined(__ia64__)
61 #define _PR_SI_ARCHITECTURE "ia64"
62 #elif defined(__x86_64__)
63 #define _PR_SI_ARCHITECTURE "x86-64"
64 #elif defined(__mc68000__)
65 #define _PR_SI_ARCHITECTURE "m68k"
66 #elif defined(__sparc__) && defined(__arch64__)
67 #define _PR_SI_ARCHITECTURE "sparc64"
68 #elif defined(__sparc__)
69 #define _PR_SI_ARCHITECTURE "sparc"
70 #elif defined(__i386__)
71 #define _PR_SI_ARCHITECTURE "x86"
72 #elif defined(__mips__)
73 #define _PR_SI_ARCHITECTURE "mips"
74 #elif defined(__arm__)
75 #define _PR_SI_ARCHITECTURE "arm"
76 #elif defined(__hppa__)
77 #define _PR_SI_ARCHITECTURE "hppa"
78 #elif defined(__s390x__)
79 #define _PR_SI_ARCHITECTURE "s390x"
80 #elif defined(__s390__)
81 #define _PR_SI_ARCHITECTURE "s390"
83 #error "Unknown CPU architecture"
85 #define PR_DLL_SUFFIX ".so"
87 #define _PR_VMBASE 0x30000000
88 #define _PR_STACK_VMBASE 0x50000000
89 #define _MD_DEFAULT_STACK_SIZE 65536L
90 #define _MD_MMAP_FLAGS MAP_PRIVATE
92 #undef HAVE_STACK_GROWING_UP
95 * Elf linux supports dl* functions
100 #ifdef __FreeBSD_kernel__
101 #define _PR_HAVE_SOCKADDR_LEN
104 #if defined(__i386__)
105 #define _PR_HAVE_ATOMIC_OPS
106 #define _MD_INIT_ATOMIC()
107 extern PRInt32
_PR_x86_AtomicIncrement(PRInt32
*val
);
108 #define _MD_ATOMIC_INCREMENT _PR_x86_AtomicIncrement
109 extern PRInt32
_PR_x86_AtomicDecrement(PRInt32
*val
);
110 #define _MD_ATOMIC_DECREMENT _PR_x86_AtomicDecrement
111 extern PRInt32
_PR_x86_AtomicAdd(PRInt32
*ptr
, PRInt32 val
);
112 #define _MD_ATOMIC_ADD _PR_x86_AtomicAdd
113 extern PRInt32
_PR_x86_AtomicSet(PRInt32
*val
, PRInt32 newval
);
114 #define _MD_ATOMIC_SET _PR_x86_AtomicSet
117 #if defined(__ia64__)
118 #define _PR_HAVE_ATOMIC_OPS
119 #define _MD_INIT_ATOMIC()
120 extern PRInt32
_PR_ia64_AtomicIncrement(PRInt32
*val
);
121 #define _MD_ATOMIC_INCREMENT _PR_ia64_AtomicIncrement
122 extern PRInt32
_PR_ia64_AtomicDecrement(PRInt32
*val
);
123 #define _MD_ATOMIC_DECREMENT _PR_ia64_AtomicDecrement
124 extern PRInt32
_PR_ia64_AtomicAdd(PRInt32
*ptr
, PRInt32 val
);
125 #define _MD_ATOMIC_ADD _PR_ia64_AtomicAdd
126 extern PRInt32
_PR_ia64_AtomicSet(PRInt32
*val
, PRInt32 newval
);
127 #define _MD_ATOMIC_SET _PR_ia64_AtomicSet
130 #if defined(__x86_64__)
131 #define _PR_HAVE_ATOMIC_OPS
132 #define _MD_INIT_ATOMIC()
133 extern PRInt32
_PR_x86_64_AtomicIncrement(PRInt32
*val
);
134 #define _MD_ATOMIC_INCREMENT _PR_x86_64_AtomicIncrement
135 extern PRInt32
_PR_x86_64_AtomicDecrement(PRInt32
*val
);
136 #define _MD_ATOMIC_DECREMENT _PR_x86_64_AtomicDecrement
137 extern PRInt32
_PR_x86_64_AtomicAdd(PRInt32
*ptr
, PRInt32 val
);
138 #define _MD_ATOMIC_ADD _PR_x86_64_AtomicAdd
139 extern PRInt32
_PR_x86_64_AtomicSet(PRInt32
*val
, PRInt32 newval
);
140 #define _MD_ATOMIC_SET _PR_x86_64_AtomicSet
143 #if defined(__powerpc__) && !defined(__powerpc64__)
144 #define _PR_HAVE_ATOMIC_OPS
145 #define _MD_INIT_ATOMIC()
146 extern PRInt32
_PR_ppc_AtomicIncrement(PRInt32
*val
);
147 #define _MD_ATOMIC_INCREMENT _PR_ppc_AtomicIncrement
148 extern PRInt32
_PR_ppc_AtomicDecrement(PRInt32
*val
);
149 #define _MD_ATOMIC_DECREMENT _PR_ppc_AtomicDecrement
150 extern PRInt32
_PR_ppc_AtomicAdd(PRInt32
*ptr
, PRInt32 val
);
151 #define _MD_ATOMIC_ADD _PR_ppc_AtomicAdd
152 extern PRInt32
_PR_ppc_AtomicSet(PRInt32
*val
, PRInt32 newval
);
153 #define _MD_ATOMIC_SET _PR_ppc_AtomicSet
157 #define _PR_HAVE_ATOMIC_OPS
158 #define _MD_INIT_ATOMIC()
159 #define _MD_ATOMIC_ADD(ptr, i) ({ \
160 PRInt32 __atomic_tmp, __atomic_ret; \
161 __asm__ __volatile__( \
162 "1: ldl_l %[ret], %[val] \n" \
163 " addl %[ret], %[inc], %[tmp] \n" \
164 " addl %[ret], %[inc], %[ret] \n" \
165 " stl_c %[tmp], %[val] \n" \
166 " beq %[tmp], 2f \n" \
170 : [ret] "=&r" (__atomic_ret), \
171 [tmp] "=&r" (__atomic_tmp), \
173 : [inc] "Ir" (i), "m" (*ptr)); \
176 #define _MD_ATOMIC_INCREMENT(ptr) _MD_ATOMIC_ADD(ptr, 1)
177 #define _MD_ATOMIC_DECREMENT(ptr) ({ \
178 PRInt32 __atomic_tmp, __atomic_ret; \
179 __asm__ __volatile__( \
180 "1: ldl_l %[ret], %[val] \n" \
181 " subl %[ret], 1, %[tmp] \n" \
182 " subl %[ret], 1, %[ret] \n" \
183 " stl_c %[tmp], %[val] \n" \
184 " beq %[tmp], 2f \n" \
188 : [ret] "=&r" (__atomic_ret), \
189 [tmp] "=&r" (__atomic_tmp), \
194 #define _MD_ATOMIC_SET(ptr, n) ({ \
195 PRInt32 __atomic_tmp, __atomic_ret; \
196 __asm__ __volatile__( \
197 "1: ldl_l %[ret], %[val] \n" \
198 " mov %[newval], %[tmp] \n" \
199 " stl_c %[tmp], %[val] \n" \
200 " beq %[tmp], 2f \n" \
204 : [ret] "=&r" (__atomic_ret), \
205 [tmp] "=&r"(__atomic_tmp), \
207 : [newval] "Ir" (n), "m" (*ptr)); \
212 #if defined(__arm__) && defined(_PR_ARM_KUSER)
213 #define _PR_HAVE_ATOMIC_OPS
214 #define _MD_INIT_ATOMIC()
217 * The kernel provides this helper function at a fixed address with a fixed
218 * ABI signature, directly callable from user space.
221 * Atomically store newval in *ptr if *ptr is equal to oldval.
222 * Return zero if *ptr was changed or non-zero if no exchange happened.
224 typedef int (__kernel_cmpxchg_t
)(int oldval
, int newval
, volatile int *ptr
);
225 #define __kernel_cmpxchg (*(__kernel_cmpxchg_t *)0xffff0fc0)
227 #define _MD_ATOMIC_INCREMENT(ptr) _MD_ATOMIC_ADD(ptr, 1)
228 #define _MD_ATOMIC_DECREMENT(ptr) _MD_ATOMIC_ADD(ptr, -1)
230 static inline PRInt32
_MD_ATOMIC_ADD(PRInt32
*ptr
, PRInt32 n
)
233 volatile PRInt32
*vp
= ptr
;
238 } while (__kernel_cmpxchg(ov
, nv
, vp
));
243 static inline PRInt32
_MD_ATOMIC_SET(PRInt32
*ptr
, PRInt32 nv
)
246 volatile PRInt32
*vp
= ptr
;
250 } while (__kernel_cmpxchg(ov
, nv
, vp
));
257 #if defined(__GLIBC__) && __GLIBC__ >= 2
258 #define _PR_POLL_AVAILABLE
261 #define _PR_STAT_HAS_ONLY_ST_ATIME
262 #if defined(__alpha) || defined(__ia64__)
263 #define _PR_HAVE_LARGE_OFF_T
264 #elif (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1)
265 #define _PR_HAVE_OFF64_T
267 #define _PR_NO_LARGE_FILES
269 #if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1)
271 #define _PR_HAVE_INET_NTOP
272 #define _PR_HAVE_GETHOSTBYNAME2
273 #define _PR_HAVE_GETADDRINFO
274 #define _PR_INET6_PROBE
276 #define _PR_HAVE_SYSV_SEMAPHORES
277 #define PR_HAVE_SYSV_NAMED_SHARED_MEMORY
278 #if (__GLIBC__ >= 2) && defined(_PR_PTHREADS)
279 #define _PR_HAVE_GETHOST_R
280 #define _PR_HAVE_GETHOST_R_INT
285 extern void _MD_CleanupBeforeExit(void);
286 #define _MD_CLEANUP_BEFORE_EXIT _MD_CleanupBeforeExit
288 #else /* ! _PR_PTHREADS */
292 #define PR_CONTEXT_TYPE sigjmp_buf
294 #define CONTEXT(_th) ((_th)->md.context)
298 * PowerPC based MkLinux
300 * On the PowerPC, the new style jmp_buf isn't used until glibc
303 #if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1)
304 #define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[JB_GPR1]
306 #define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[0].__misc[0]
307 #endif /* glibc 2.1 or later */
308 #define _MD_SET_FP(_t, val)
309 #define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
310 #define _MD_GET_FP_PTR(_t) ((void *) 0)
311 /* aix = 64, macos = 70 */
312 #define PR_NUM_GCREGS 64
314 #elif defined(__alpha)
315 /* Alpha based Linux */
317 #if defined(__GLIBC__) && __GLIBC__ >= 2
318 #define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[JB_SP]
319 #define _MD_SET_FP(_t, val)
320 #define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
321 #define _MD_GET_FP_PTR(_t) ((void *) 0)
322 #define _MD_SP_TYPE long int
324 #define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[0].__sp
325 #define _MD_SET_FP(_t, val)
326 #define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
327 #define _MD_GET_FP_PTR(_t) ((void *) 0)
328 #define _MD_SP_TYPE __ptr_t
329 #endif /* defined(__GLIBC__) && __GLIBC__ >= 2 */
331 /* XXX not sure if this is correct, or maybe it should be 17? */
332 #define PR_NUM_GCREGS 9
334 #elif defined(__ia64__)
336 #define _MD_GET_SP(_t) ((long *)((_t)->md.context[0].__jmpbuf)[0])
337 #define _MD_SET_FP(_t, val)
338 #define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
339 #define _MD_GET_FP_PTR(_t) ((void *) 0)
340 #define _MD_SP_TYPE long int
342 #define PR_NUM_GCREGS _JBLEN
344 #elif defined(__mc68000__)
345 /* m68k based Linux */
348 * On the m68k, glibc still uses the old style sigjmp_buf, even
351 #if defined(__GLIBC__) && __GLIBC__ >= 2
352 #define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[0].__sp
353 #define _MD_SET_FP(_t, val)
354 #define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
355 #define _MD_GET_FP_PTR(_t) ((void *) 0)
356 #define _MD_SP_TYPE int
358 #define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[0].__sp
359 #define _MD_SET_FP(_t, val)
360 #define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
361 #define _MD_GET_FP_PTR(_t) ((void *) 0)
362 #define _MD_SP_TYPE __ptr_t
363 #endif /* defined(__GLIBC__) && __GLIBC__ >= 2 */
365 /* XXX not sure if this is correct, or maybe it should be 17? */
366 #define PR_NUM_GCREGS 9
368 #elif defined(__sparc__)
370 #if defined(__GLIBC__) && __GLIBC__ >= 2
372 * You need glibc2-2.0.7-25 or later. The libraries that came with
373 * Red Hat 5.1 are not new enough, but they are in 5.2.
375 #define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[JB_SP]
376 #define _MD_SET_FP(_t, val) ((_t)->md.context[0].__jmpbuf[JB_FP] = val)
377 #define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
378 #define _MD_GET_FP_PTR(_t) (&(_t)->md.context[0].__jmpbuf[JB_FP])
379 #define _MD_SP_TYPE int
381 #define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[0].__fp
382 #define _MD_SET_FP(_t, val)
383 #define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
384 #define _MD_GET_FP_PTR(_t) ((void *) 0)
385 #define _MD_SP_TYPE __ptr_t
386 #endif /* defined(__GLIBC__) && __GLIBC__ >= 2 */
388 #elif defined(__i386__)
389 /* Intel based Linux */
390 #if defined(__GLIBC__) && __GLIBC__ >= 2
391 #define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[JB_SP]
392 #define _MD_SET_FP(_t, val) ((_t)->md.context[0].__jmpbuf[JB_BP] = val)
393 #define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
394 #define _MD_GET_FP_PTR(_t) (&(_t)->md.context[0].__jmpbuf[JB_BP])
395 #define _MD_SP_TYPE int
397 #define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[0].__sp
398 #define _MD_SET_FP(_t, val) ((_t)->md.context[0].__jmpbuf[0].__bp = val)
399 #define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
400 #define _MD_GET_FP_PTR(_t) &((_t)->md.context[0].__jmpbuf[0].__bp)
401 #define _MD_SP_TYPE __ptr_t
402 #endif /* defined(__GLIBC__) && __GLIBC__ >= 2 */
403 #define PR_NUM_GCREGS 6
405 #elif defined(__mips__)
407 #if defined(__GLIBC__) && __GLIBC__ >= 2
408 #define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[0].__sp
409 #define _MD_SET_FP(_t, val) ((_t)->md.context[0].__jmpbuf[0].__fp = (val))
410 #define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
411 #define _MD_GET_FP_PTR(_t) (&(_t)->md.context[0].__jmpbuf[0].__fp)
412 #define _MD_SP_TYPE __ptr_t
414 #error "Linux/MIPS pre-glibc2 not supported yet"
415 #endif /* defined(__GLIBC__) && __GLIBC__ >= 2 */
417 #elif defined(__arm__)
419 #if defined(__GLIBC__) && __GLIBC__ >= 2
422 #define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[8]
423 #define _MD_SET_FP(_t, val) ((_t)->md.context[0].__jmpbuf[7] = (val))
424 #define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
425 #define _MD_GET_FP_PTR(_t) (&(_t)->md.context[0].__jmpbuf[7])
426 #define _MD_SP_TYPE __ptr_t
427 #else /* __ARM_EABI__ */
429 #define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[20]
430 #define _MD_SET_FP(_t, val) ((_t)->md.context[0].__jmpbuf[19] = (val))
431 #define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
432 #define _MD_GET_FP_PTR(_t) (&(_t)->md.context[0].__jmpbuf[19])
433 #define _MD_SP_TYPE __ptr_t
434 #endif /* __ARM_EABI__ */
436 #error "ARM/Linux pre-glibc2 not supported yet"
437 #endif /* defined(__GLIBC__) && __GLIBC__ >= 2 */
441 #error "Unknown CPU architecture"
443 #endif /*__powerpc__*/
446 ** Initialize a thread context to run "_main()" when started
450 #define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
453 if (sigsetjmp(CONTEXT(_thread), 1)) { \
456 _MD_GET_SP(_thread) = (unsigned char*) ((_sp) - 128); \
457 _thread->md.sp = _MD_GET_SP_PTR(_thread); \
458 _thread->md.fp = _MD_GET_FP_PTR(_thread); \
459 _MD_SET_FP(_thread, 0); \
462 #elif defined(__mips__)
464 #define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
467 (void) sigsetjmp(CONTEXT(_thread), 1); \
468 _thread->md.context[0].__jmpbuf[0].__pc = (__ptr_t) _main; \
469 _MD_GET_SP(_thread) = (_MD_SP_TYPE) ((_sp) - 64); \
470 _thread->md.sp = _MD_GET_SP_PTR(_thread); \
471 _thread->md.fp = _MD_GET_FP_PTR(_thread); \
472 _MD_SET_FP(_thread, 0); \
477 #define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
480 if (sigsetjmp(CONTEXT(_thread), 1)) { \
483 _MD_GET_SP(_thread) = (_MD_SP_TYPE) ((_sp) - 64); \
484 _thread->md.sp = _MD_GET_SP_PTR(_thread); \
485 _thread->md.fp = _MD_GET_FP_PTR(_thread); \
486 _MD_SET_FP(_thread, 0); \
489 #endif /*__powerpc__*/
491 #define _MD_SWITCH_CONTEXT(_thread) \
492 if (!sigsetjmp(CONTEXT(_thread), 1)) { \
493 (_thread)->md.errcode = errno; \
498 ** Restore a thread context, saved by _MD_SWITCH_CONTEXT
500 #define _MD_RESTORE_CONTEXT(_thread) \
502 errno = (_thread)->md.errcode; \
503 _MD_SET_CURRENT_THREAD(_thread); \
504 siglongjmp(CONTEXT(_thread), 1); \
507 /* Machine-dependent (MD) data structures */
510 PR_CONTEXT_TYPE context
;
517 struct _MDThreadStack
{
525 struct _MDSemaphore
{
538 * md-specific cpu structure field
540 #include <sys/time.h> /* for FD_SETSIZE */
541 #define _PR_MD_MAX_OSFD FD_SETSIZE
545 PRUint32 ioq_timeout
;
546 PRInt32 ioq_max_osfd
;
547 PRInt32 ioq_osfd_cnt
;
549 fd_set fd_read_set
, fd_write_set
, fd_exception_set
;
550 PRInt16 fd_read_cnt
[_PR_MD_MAX_OSFD
],fd_write_cnt
[_PR_MD_MAX_OSFD
],
551 fd_exception_cnt
[_PR_MD_MAX_OSFD
];
553 struct pollfd
*ioq_pollfds
;
554 int ioq_pollfds_size
;
555 #endif /* _PR_USE_POLL */
558 #define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
559 #define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
560 #define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
561 #define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
562 #define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
563 #define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
564 #define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
565 #define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
566 #define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
567 #define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
568 #define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
569 #define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
570 #define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
572 #define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
575 struct _MDCPU_Unix md_unix
;
578 #define _MD_INIT_LOCKS()
579 #define _MD_NEW_LOCK(lock) PR_SUCCESS
580 #define _MD_FREE_LOCK(lock)
581 #define _MD_LOCK(lock)
582 #define _MD_UNLOCK(lock)
583 #define _MD_INIT_IO()
584 #define _MD_IOQ_LOCK()
585 #define _MD_IOQ_UNLOCK()
587 extern PRStatus
_MD_InitializeThread(PRThread
*thread
);
589 #define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
590 #define _MD_INIT_THREAD _MD_InitializeThread
591 #define _MD_EXIT_THREAD(thread)
592 #define _MD_SUSPEND_THREAD(thread) _MD_suspend_thread
593 #define _MD_RESUME_THREAD(thread) _MD_resume_thread
594 #define _MD_CLEAN_THREAD(_thread)
596 extern PRStatus
_MD_CREATE_THREAD(
598 void (*start
) (void *),
599 PRThreadPriority priority
,
603 extern void _MD_SET_PRIORITY(struct _MDThread
*thread
, PRUintn newPri
);
604 extern PRStatus
_MD_WAIT(PRThread
*, PRIntervalTime timeout
);
605 extern PRStatus
_MD_WAKEUP_WAITER(PRThread
*);
606 extern void _MD_YIELD(void);
608 #endif /* ! _PR_PTHREADS */
610 extern void _MD_EarlyInit(void);
611 extern PRIntervalTime
_PR_UNIX_GetInterval(void);
612 extern PRIntervalTime
_PR_UNIX_TicksPerSecond(void);
614 #define _MD_EARLY_INIT _MD_EarlyInit
615 #define _MD_FINAL_INIT _PR_UnixInit
616 #define _MD_GET_INTERVAL _PR_UNIX_GetInterval
617 #define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond
620 * We wrapped the select() call. _MD_SELECT refers to the built-in,
623 #define _MD_SELECT __select
625 #ifdef _PR_POLL_AVAILABLE
626 #include <sys/poll.h>
627 extern int __syscall_poll(struct pollfd
*ufds
, unsigned long int nfds
,
629 #define _MD_POLL __syscall_poll
635 extern void _MD_linux_map_sendfile_error(int err
);
637 #endif /* nspr_linux_defs_h___ */