Wed, 31 Dec 2014 06:55:50 +0100
Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef nspr_scoos5_defs_h___
7 #define nspr_scoos5_defs_h___
9 /*
10 * Internal configuration macros
11 */
13 #define PR_LINKER_ARCH "scoos5"
14 #define PR_DLL_SUFFIX ".so"
16 #define _PR_SI_SYSNAME "SCO"
17 #define _PR_SI_ARCHITECTURE "x86"
18 #define _PR_STACK_VMBASE 0x50000000
20 #define _MD_DEFAULT_STACK_SIZE 65536L
21 #define _MD_MMAP_FLAGS MAP_PRIVATE
23 #undef HAVE_STACK_GROWING_UP
24 #define HAVE_DLL
25 #define USE_DLFCN
27 #if !defined (HAVE_STRERROR)
28 #define HAVE_STRERROR
29 #endif
31 #ifndef HAVE_WEAK_IO_SYMBOLS
32 #define HAVE_WEAK_IO_SYMBOLS
33 #endif
35 #define _PR_POLL_AVAILABLE
36 #define _PR_USE_POLL
37 #define _PR_NO_LARGE_FILES
38 #define _PR_STAT_HAS_ONLY_ST_ATIME
40 #define NEED_STRFTIME_LOCK
41 #define NEED_TIME_R
42 #define _PR_RECV_BROKEN /* recv doesn't work on Unix Domain Sockets */
44 #define USE_SETJMP
46 #ifdef _PR_LOCAL_THREADS_ONLY
47 #include <setjmp.h>
49 #define _MD_GET_SP(_t) (_t)->md.jb[4]
50 #define PR_NUM_GCREGS _SIGJBLEN
51 #define PR_CONTEXT_TYPE sigjmp_buf
53 #define CONTEXT(_th) ((_th)->md.jb)
55 #define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
56 { \
57 *status = PR_TRUE; \
58 if (sigsetjmp(CONTEXT(_thread),1)) { \
59 (*_main)(); \
60 } \
61 _MD_GET_SP(_thread) = (int) ((_sp) - 64); \
62 }
64 #define _MD_SWITCH_CONTEXT(_thread) \
65 if (!sigsetjmp(CONTEXT(_thread), 1)) { \
66 (_thread)->md.errcode = errno; \
67 _PR_Schedule(); \
68 }
70 /*
71 ** Restore a thread context, saved by _MD_SWITCH_CONTEXT
72 */
73 #define _MD_RESTORE_CONTEXT(_thread) \
74 { \
75 errno = (_thread)->osErrorCode; \
76 _MD_SET_CURRENT_THREAD(_thread); \
77 siglongjmp(CONTEXT(_thread), 1); \
78 }
80 #endif /* _PR_LOCAL_THREADS_ONLY */
82 struct _MDThread {
83 jmp_buf jb;
84 int id;
85 int errcode;
86 };
88 struct _MDThreadStack {
89 PRInt8 notused;
90 };
92 struct _MDLock {
93 PRInt8 notused;
94 };
96 struct _MDSemaphore {
97 PRInt8 notused;
98 };
100 struct _MDCVar {
101 PRInt8 notused;
102 };
104 struct _MDSegment {
105 PRInt8 notused;
106 };
108 /*
109 * md-specific cpu structure field
110 */
111 #define _PR_MD_MAX_OSFD FD_SETSIZE
113 struct _MDCPU_Unix {
114 PRCList ioQ;
115 PRUint32 ioq_timeout;
116 PRInt32 ioq_max_osfd;
117 PRInt32 ioq_osfd_cnt;
118 #ifndef _PR_USE_POLL
119 fd_set fd_read_set, fd_write_set, fd_exception_set;
120 PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
121 fd_exception_cnt[_PR_MD_MAX_OSFD];
122 #else
123 struct pollfd *ioq_pollfds;
124 int ioq_pollfds_size;
125 #endif /* _PR_USE_POLL */
126 };
128 #define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
129 #define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
130 #define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
131 #define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
132 #define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
133 #define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
134 #define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
135 #define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
136 #define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
137 #define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
138 #define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
139 #define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
140 #define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
142 #define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
144 struct _MDCPU {
145 struct _MDCPU_Unix md_unix;
146 };
148 #define _MD_INIT_LOCKS()
149 #define _MD_NEW_LOCK(lock) PR_SUCCESS
150 #define _MD_FREE_LOCK(lock)
151 #define _MD_LOCK(lock)
152 #define _MD_UNLOCK(lock)
153 #define _MD_INIT_IO()
154 #define _MD_IOQ_LOCK()
155 #define _MD_IOQ_UNLOCK()
157 #define _MD_EARLY_INIT _MD_EarlyInit
158 #define _MD_FINAL_INIT _PR_UnixInit
159 #define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
160 #define _MD_INIT_THREAD _MD_InitializeThread
161 #define _MD_EXIT_THREAD(thread)
162 #define _MD_SUSPEND_THREAD(thread)
163 #define _MD_RESUME_THREAD(thread)
164 #define _MD_CLEAN_THREAD(_thread)
166 #define _MD_INTERVAL_USE_GTOD
168 #define _MD_SELECT _select
169 #define _MD_POLL _poll
171 #endif /* nspr_scoos5_defs_h___ */