Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2818)

Side by Side Diff: gecko-sdk/include/md/_sunos4.h

Issue 20346: Version 1.8 of gecko-sdk. Downloaded from here:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/
Patch Set: Created 11 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « gecko-sdk/include/md/_sony.h ('k') | gecko-sdk/include/md/_unix_errors.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
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_sunos_defs_h___
39 #define nspr_sunos_defs_h___
40
41 #include "md/sunos4.h"
42
43 /* On SunOS 4, memset is declared in memory.h */
44 #include <memory.h>
45 #include <errno.h>
46 #include <sys/syscall.h>
47
48 /*
49 * Internal configuration macros
50 */
51
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"
56
57 /*
58 ** For sunos type machines, don't specify an address because the
59 ** NetBSD/SPARC O.S. does the wrong thing.
60 */
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
65
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
76
77 #define _MD_GET_INTERVAL _PR_UNIX_GetInterval
78 #define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond
79
80 #define USE_SETJMP
81
82 #include <setjmp.h>
83
84 #define _MD_GET_SP(_t) (_t)->md.context[2]
85
86 #define PR_NUM_GCREGS _JBLEN
87
88 #define CONTEXT(_th) ((_th)->md.context)
89
90 /*
91 ** Initialize the thread context preparing it to execute _main.
92 */
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
104
105 #define _MD_SWITCH_CONTEXT(_thread) \
106 asm("ta 3"); \
107 if (!setjmp(CONTEXT(_thread))) { \
108 (_thread)->md.errcode = errno; \
109 _PR_Schedule(); \
110 }
111
112 /*
113 ** Restore a thread context, saved by _MD_SWITCH_CONTEXT
114 */
115 #define _MD_RESTORE_CONTEXT(_thread) \
116 { \
117 errno = (_thread)->md.errcode; \
118 _MD_SET_CURRENT_THREAD(_thread); \
119 longjmp(CONTEXT(_thread), 1); \
120 }
121
122 #pragma unknown_control_flow(longjmp)
123 #pragma unknown_control_flow(setjmp)
124 #pragma unknown_control_flow(_PR_Schedule)
125
126 /*
127 ** Missing function prototypes
128 */
129
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 op tlen);
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);
139
140
141 /* Machine-dependent (MD) data structures. SunOS 4 has no native threads. */
142
143 struct _MDThread {
144 jmp_buf context;
145 int id;
146 int errcode;
147 };
148
149 struct _MDThreadStack {
150 PRInt8 notused;
151 };
152
153 struct _MDLock {
154 PRInt8 notused;
155 };
156
157 struct _MDSemaphore {
158 PRInt8 notused;
159 };
160
161 struct _MDCVar {
162 PRInt8 notused;
163 };
164
165 struct _MDSegment {
166 PRInt8 notused;
167 };
168
169 /*
170 * md-specific cpu structure field
171 */
172 #define _PR_MD_MAX_OSFD FD_SETSIZE
173
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 */
187 };
188
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)
202
203 #define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
204
205 struct _MDCPU {
206 struct _MDCPU_Unix md_unix;
207 };
208
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()
217
218 /* These are copied from _solaris.h */
219
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)
228
229 /*
230 * We wrapped the select() call. _MD_SELECT refers to the built-in,
231 * unwrapped version.
232 */
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)
235
236 #endif /* nspr_sparc_defs_h___ */
OLDNEW
« no previous file with comments | « gecko-sdk/include/md/_sony.h ('k') | gecko-sdk/include/md/_unix_errors.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698