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_win95_defs_h___
|
---|
39 | #define nspr_win95_defs_h___
|
---|
40 |
|
---|
41 | #include "prio.h"
|
---|
42 |
|
---|
43 | #include <windows.h>
|
---|
44 | #include <winsock.h>
|
---|
45 | #include <errno.h>
|
---|
46 |
|
---|
47 | /*
|
---|
48 | * Internal configuration macros
|
---|
49 | */
|
---|
50 |
|
---|
51 | #define PR_LINKER_ARCH "win32"
|
---|
52 | #define _PR_SI_SYSNAME "WIN95"
|
---|
53 | #define _PR_SI_ARCHITECTURE "x86" /* XXXMB hardcode for now */
|
---|
54 |
|
---|
55 | #define HAVE_DLL
|
---|
56 | #undef HAVE_THREAD_AFFINITY
|
---|
57 | #define _PR_HAVE_GETADDRINFO
|
---|
58 | #define _PR_INET6_PROBE
|
---|
59 | #ifndef _PR_INET6
|
---|
60 | #define AF_INET6 23
|
---|
61 | /* newer ws2tcpip.h provides these */
|
---|
62 | #ifndef AI_CANONNAME
|
---|
63 | #define AI_CANONNAME 0x2
|
---|
64 | struct addrinfo {
|
---|
65 | int ai_flags;
|
---|
66 | int ai_family;
|
---|
67 | int ai_socktype;
|
---|
68 | int ai_protocol;
|
---|
69 | size_t ai_addrlen;
|
---|
70 | char *ai_canonname;
|
---|
71 | struct sockaddr *ai_addr;
|
---|
72 | struct addrinfo *ai_next;
|
---|
73 | };
|
---|
74 | #endif
|
---|
75 | #endif
|
---|
76 | #define _PR_HAVE_THREADSAFE_GETHOST
|
---|
77 | #define _PR_HAVE_ATOMIC_OPS
|
---|
78 | #define PR_HAVE_WIN32_NAMED_SHARED_MEMORY
|
---|
79 |
|
---|
80 | /* --- Common User-Thread/Native-Thread Definitions --------------------- */
|
---|
81 |
|
---|
82 | /* --- Globals --- */
|
---|
83 | extern struct PRLock *_pr_schedLock;
|
---|
84 |
|
---|
85 | /* --- Typedefs --- */
|
---|
86 | typedef void (*FiberFunc)(void *);
|
---|
87 |
|
---|
88 | #define PR_NUM_GCREGS 8
|
---|
89 | typedef PRInt32 PR_CONTEXT_TYPE[PR_NUM_GCREGS];
|
---|
90 | #define GC_VMBASE 0x40000000
|
---|
91 | #define GC_VMLIMIT 0x00FFFFFF
|
---|
92 |
|
---|
93 | #define _MD_MAGIC_THREAD 0x22222222
|
---|
94 | #define _MD_MAGIC_THREADSTACK 0x33333333
|
---|
95 | #define _MD_MAGIC_SEGMENT 0x44444444
|
---|
96 | #define _MD_MAGIC_DIR 0x55555555
|
---|
97 | #define _MD_MAGIC_CV 0x66666666
|
---|
98 |
|
---|
99 | struct _MDCPU {
|
---|
100 | int unused;
|
---|
101 | };
|
---|
102 |
|
---|
103 | struct _MDThread {
|
---|
104 | HANDLE blocked_sema; /* Threads block on this when waiting
|
---|
105 | * for IO or CondVar.
|
---|
106 | */
|
---|
107 | PRBool inCVWaitQueue; /* PR_TRUE if the thread is in the
|
---|
108 | * wait queue of some cond var.
|
---|
109 | * PR_FALSE otherwise. */
|
---|
110 | HANDLE handle; /* Win32 thread handle */
|
---|
111 | PRUint32 id;
|
---|
112 | void *sp; /* only valid when suspended */
|
---|
113 | PRUint32 magic; /* for debugging */
|
---|
114 | PR_CONTEXT_TYPE gcContext; /* Thread context for GC */
|
---|
115 | struct PRThread *prev, *next; /* used by the cvar wait queue to
|
---|
116 | * chain the PRThread structures
|
---|
117 | * together */
|
---|
118 | void (*start)(void *); /* used by _PR_MD_CREATE_THREAD to
|
---|
119 | * pass its 'start' argument to
|
---|
120 | * pr_root. */
|
---|
121 | };
|
---|
122 |
|
---|
123 | struct _MDThreadStack {
|
---|
124 | PRUint32 magic; /* for debugging */
|
---|
125 | };
|
---|
126 |
|
---|
127 | struct _MDSegment {
|
---|
128 | PRUint32 magic; /* for debugging */
|
---|
129 | };
|
---|
130 |
|
---|
131 | #undef PROFILE_LOCKS
|
---|
132 |
|
---|
133 | struct _MDDir {
|
---|
134 | HANDLE d_hdl;
|
---|
135 | WIN32_FIND_DATA d_entry;
|
---|
136 | PRBool firstEntry; /* Is this the entry returned
|
---|
137 | * by FindFirstFile()? */
|
---|
138 | PRUint32 magic; /* for debugging */
|
---|
139 | };
|
---|
140 |
|
---|
141 | #ifdef MOZ_UNICODE
|
---|
142 | struct _MDDirUTF16 {
|
---|
143 | HANDLE d_hdl;
|
---|
144 | WIN32_FIND_DATAW d_entry;
|
---|
145 | PRBool firstEntry; /* Is this the entry returned
|
---|
146 | * by FindFirstFileW()? */
|
---|
147 | PRUint32 magic; /* for debugging */
|
---|
148 | };
|
---|
149 | #endif /* MOZ_UNICODE */
|
---|
150 |
|
---|
151 | struct _MDCVar {
|
---|
152 | PRUint32 magic;
|
---|
153 | struct PRThread *waitHead, *waitTail; /* the wait queue: a doubly-
|
---|
154 | * linked list of threads
|
---|
155 | * waiting on this condition
|
---|
156 | * variable */
|
---|
157 | PRIntn nwait; /* number of threads in the
|
---|
158 | * wait queue */
|
---|
159 | };
|
---|
160 |
|
---|
161 | #define _MD_CV_NOTIFIED_LENGTH 6
|
---|
162 | typedef struct _MDNotified _MDNotified;
|
---|
163 | struct _MDNotified {
|
---|
164 | PRIntn length; /* # of used entries in this
|
---|
165 | * structure */
|
---|
166 | struct {
|
---|
167 | struct _MDCVar *cv; /* the condition variable notified */
|
---|
168 | PRIntn times; /* and the number of times notified */
|
---|
169 | struct PRThread *notifyHead; /* list of threads to wake up */
|
---|
170 | } cv[_MD_CV_NOTIFIED_LENGTH];
|
---|
171 | _MDNotified *link; /* link to another of these, or NULL */
|
---|
172 | };
|
---|
173 |
|
---|
174 | struct _MDLock {
|
---|
175 | CRITICAL_SECTION mutex; /* this is recursive on NT */
|
---|
176 |
|
---|
177 | /*
|
---|
178 | * When notifying cvars, there is no point in actually
|
---|
179 | * waking up the threads waiting on the cvars until we've
|
---|
180 | * released the lock. So, we temporarily record the cvars.
|
---|
181 | * When doing an unlock, we'll then wake up the waiting threads.
|
---|
182 | */
|
---|
183 | struct _MDNotified notified; /* array of conditions notified */
|
---|
184 | #ifdef PROFILE_LOCKS
|
---|
185 | PRInt32 hitcount;
|
---|
186 | PRInt32 misscount;
|
---|
187 | #endif
|
---|
188 | };
|
---|
189 |
|
---|
190 | struct _MDSemaphore {
|
---|
191 | HANDLE sem;
|
---|
192 | };
|
---|
193 |
|
---|
194 | struct _MDFileDesc {
|
---|
195 | PRInt32 osfd; /* The osfd can come from one of three spaces:
|
---|
196 | * - For stdin, stdout, and stderr, we are using
|
---|
197 | * the libc file handle (0, 1, 2), which is an int.
|
---|
198 | * - For files and pipes, we are using Win32 HANDLE,
|
---|
199 | * which is a void*.
|
---|
200 | * - For sockets, we are using Winsock SOCKET, which
|
---|
201 | * is a u_int.
|
---|
202 | */
|
---|
203 | };
|
---|
204 |
|
---|
205 | struct _MDProcess {
|
---|
206 | HANDLE handle;
|
---|
207 | DWORD id;
|
---|
208 | };
|
---|
209 |
|
---|
210 | /* --- Misc stuff --- */
|
---|
211 | #define _MD_GET_SP(thread) (thread)->md.gcContext[6]
|
---|
212 |
|
---|
213 | /* --- NT security stuff --- */
|
---|
214 |
|
---|
215 | extern void _PR_NT_InitSids(void);
|
---|
216 | extern void _PR_NT_FreeSids(void);
|
---|
217 | extern PRStatus _PR_NT_MakeSecurityDescriptorACL(
|
---|
218 | PRIntn mode,
|
---|
219 | DWORD accessTable[],
|
---|
220 | PSECURITY_DESCRIPTOR *resultSD,
|
---|
221 | PACL *resultACL
|
---|
222 | );
|
---|
223 | extern void _PR_NT_FreeSecurityDescriptorACL(
|
---|
224 | PSECURITY_DESCRIPTOR pSD, PACL pACL);
|
---|
225 |
|
---|
226 | /* --- IO stuff --- */
|
---|
227 |
|
---|
228 | #define _MD_OPEN _PR_MD_OPEN
|
---|
229 | #define _MD_OPEN_FILE _PR_MD_OPEN_FILE
|
---|
230 | #define _MD_READ _PR_MD_READ
|
---|
231 | #define _MD_WRITE _PR_MD_WRITE
|
---|
232 | #define _MD_WRITEV _PR_MD_WRITEV
|
---|
233 | #define _MD_LSEEK _PR_MD_LSEEK
|
---|
234 | #define _MD_LSEEK64 _PR_MD_LSEEK64
|
---|
235 | extern PRInt32 _MD_CloseFile(PRInt32 osfd);
|
---|
236 | #define _MD_CLOSE_FILE _MD_CloseFile
|
---|
237 | #define _MD_GETFILEINFO _PR_MD_GETFILEINFO
|
---|
238 | #define _MD_GETFILEINFO64 _PR_MD_GETFILEINFO64
|
---|
239 | #define _MD_GETOPENFILEINFO _PR_MD_GETOPENFILEINFO
|
---|
240 | #define _MD_GETOPENFILEINFO64 _PR_MD_GETOPENFILEINFO64
|
---|
241 | #define _MD_STAT _PR_MD_STAT
|
---|
242 | #define _MD_RENAME _PR_MD_RENAME
|
---|
243 | #define _MD_ACCESS _PR_MD_ACCESS
|
---|
244 | #define _MD_DELETE _PR_MD_DELETE
|
---|
245 | #define _MD_MKDIR _PR_MD_MKDIR
|
---|
246 | #define _MD_MAKE_DIR _PR_MD_MAKE_DIR
|
---|
247 | #define _MD_RMDIR _PR_MD_RMDIR
|
---|
248 | #define _MD_LOCKFILE _PR_MD_LOCKFILE
|
---|
249 | #define _MD_TLOCKFILE _PR_MD_TLOCKFILE
|
---|
250 | #define _MD_UNLOCKFILE _PR_MD_UNLOCKFILE
|
---|
251 |
|
---|
252 | #ifdef MOZ_UNICODE
|
---|
253 | /* --- UTF16 IO stuff --- */
|
---|
254 | #define _MD_OPEN_FILE_UTF16 _PR_MD_OPEN_FILE_UTF16
|
---|
255 | #define _MD_OPEN_DIR_UTF16 _PR_MD_OPEN_DIR_UTF16
|
---|
256 | #define _MD_READ_DIR_UTF16 _PR_MD_READ_DIR_UTF16
|
---|
257 | #define _MD_CLOSE_DIR_UTF16 _PR_MD_CLOSE_DIR_UTF16
|
---|
258 | #define _MD_GETFILEINFO64_UTF16 _PR_MD_GETFILEINFO64_UTF16
|
---|
259 | #endif /* MOZ_UNICODE */
|
---|
260 |
|
---|
261 | /* --- Socket IO stuff --- */
|
---|
262 | #define _MD_EACCES WSAEACCES
|
---|
263 | #define _MD_EADDRINUSE WSAEADDRINUSE
|
---|
264 | #define _MD_EADDRNOTAVAIL WSAEADDRNOTAVAIL
|
---|
265 | #define _MD_EAFNOSUPPORT WSAEAFNOSUPPORT
|
---|
266 | #define _MD_EAGAIN WSAEWOULDBLOCK
|
---|
267 | #define _MD_EALREADY WSAEALREADY
|
---|
268 | #define _MD_EBADF WSAEBADF
|
---|
269 | #define _MD_ECONNREFUSED WSAECONNREFUSED
|
---|
270 | #define _MD_ECONNRESET WSAECONNRESET
|
---|
271 | #define _MD_EFAULT WSAEFAULT
|
---|
272 | #define _MD_EINPROGRESS WSAEINPROGRESS
|
---|
273 | #define _MD_EINTR WSAEINTR
|
---|
274 | #define _MD_EINVAL EINVAL
|
---|
275 | #define _MD_EISCONN WSAEISCONN
|
---|
276 | #define _MD_ENETUNREACH WSAENETUNREACH
|
---|
277 | #define _MD_ENOENT ENOENT
|
---|
278 | #define _MD_ENOTCONN WSAENOTCONN
|
---|
279 | #define _MD_ENOTSOCK WSAENOTSOCK
|
---|
280 | #define _MD_EOPNOTSUPP WSAEOPNOTSUPP
|
---|
281 | #define _MD_EWOULDBLOCK WSAEWOULDBLOCK
|
---|
282 | #define _MD_GET_SOCKET_ERROR() WSAGetLastError()
|
---|
283 | #define _MD_SET_SOCKET_ERROR(_err) WSASetLastError(_err)
|
---|
284 |
|
---|
285 | #define _MD_INIT_FILEDESC(fd)
|
---|
286 | extern void _MD_MakeNonblock(PRFileDesc *f);
|
---|
287 | #define _MD_MAKE_NONBLOCK _MD_MakeNonblock
|
---|
288 | #define _MD_INIT_FD_INHERITABLE _PR_MD_INIT_FD_INHERITABLE
|
---|
289 | #define _MD_QUERY_FD_INHERITABLE _PR_MD_QUERY_FD_INHERITABLE
|
---|
290 | #define _MD_SHUTDOWN _PR_MD_SHUTDOWN
|
---|
291 | #define _MD_LISTEN _PR_MD_LISTEN
|
---|
292 | extern PRInt32 _MD_CloseSocket(PRInt32 osfd);
|
---|
293 | #define _MD_CLOSE_SOCKET _MD_CloseSocket
|
---|
294 | #define _MD_SENDTO _PR_MD_SENDTO
|
---|
295 | #define _MD_RECVFROM _PR_MD_RECVFROM
|
---|
296 | #define _MD_SOCKETPAIR(s, type, proto, sv) -1
|
---|
297 | #define _MD_GETSOCKNAME _PR_MD_GETSOCKNAME
|
---|
298 | #define _MD_GETPEERNAME _PR_MD_GETPEERNAME
|
---|
299 | #define _MD_GETSOCKOPT _PR_MD_GETSOCKOPT
|
---|
300 | #define _MD_SETSOCKOPT _PR_MD_SETSOCKOPT
|
---|
301 | #define _MD_SET_FD_INHERITABLE _PR_MD_SET_FD_INHERITABLE
|
---|
302 | #define _MD_SELECT select
|
---|
303 | #define _MD_FSYNC _PR_MD_FSYNC
|
---|
304 | #define READ_FD 1
|
---|
305 | #define WRITE_FD 2
|
---|
306 |
|
---|
307 | #define _MD_INIT_ATOMIC()
|
---|
308 | #if defined(_M_IX86) || defined(_X86_)
|
---|
309 | #define _MD_ATOMIC_INCREMENT _PR_MD_ATOMIC_INCREMENT
|
---|
310 | #define _MD_ATOMIC_ADD _PR_MD_ATOMIC_ADD
|
---|
311 | #define _MD_ATOMIC_DECREMENT _PR_MD_ATOMIC_DECREMENT
|
---|
312 | #else /* non-x86 processors */
|
---|
313 | #define _MD_ATOMIC_INCREMENT(x) InterlockedIncrement((PLONG)x)
|
---|
314 | #define _MD_ATOMIC_ADD(ptr,val) (InterlockedExchangeAdd((PLONG)ptr, (LONG)val) + val)
|
---|
315 | #define _MD_ATOMIC_DECREMENT(x) InterlockedDecrement((PLONG)x)
|
---|
316 | #endif /* x86 */
|
---|
317 | #define _MD_ATOMIC_SET(x,y) InterlockedExchange((PLONG)x, (LONG)y)
|
---|
318 |
|
---|
319 | #define _MD_INIT_IO _PR_MD_INIT_IO
|
---|
320 |
|
---|
321 |
|
---|
322 | /* win95 doesn't have async IO */
|
---|
323 | #define _MD_SOCKET _PR_MD_SOCKET
|
---|
324 | extern PRInt32 _MD_SocketAvailable(PRFileDesc *fd);
|
---|
325 | #define _MD_SOCKETAVAILABLE _MD_SocketAvailable
|
---|
326 | #define _MD_PIPEAVAILABLE _PR_MD_PIPEAVAILABLE
|
---|
327 | #define _MD_CONNECT _PR_MD_CONNECT
|
---|
328 | extern PRInt32 _MD_Accept(PRFileDesc *fd, PRNetAddr *raddr, PRUint32 *rlen,
|
---|
329 | PRIntervalTime timeout);
|
---|
330 | #define _MD_ACCEPT _MD_Accept
|
---|
331 | #define _MD_BIND _PR_MD_BIND
|
---|
332 | #define _MD_RECV _PR_MD_RECV
|
---|
333 | #define _MD_SEND _PR_MD_SEND
|
---|
334 | #define _MD_PR_POLL _PR_MD_PR_POLL
|
---|
335 |
|
---|
336 | /* --- Scheduler stuff --- */
|
---|
337 | // #define _MD_PAUSE_CPU _PR_MD_PAUSE_CPU
|
---|
338 | #define _MD_PAUSE_CPU
|
---|
339 |
|
---|
340 | /* --- DIR stuff --- */
|
---|
341 | #define PR_DIRECTORY_SEPARATOR '\\'
|
---|
342 | #define PR_DIRECTORY_SEPARATOR_STR "\\"
|
---|
343 | #define PR_PATH_SEPARATOR ';'
|
---|
344 | #define PR_PATH_SEPARATOR_STR ";"
|
---|
345 | #define _MD_ERRNO() GetLastError()
|
---|
346 | #define _MD_OPEN_DIR _PR_MD_OPEN_DIR
|
---|
347 | #define _MD_CLOSE_DIR _PR_MD_CLOSE_DIR
|
---|
348 | #define _MD_READ_DIR _PR_MD_READ_DIR
|
---|
349 |
|
---|
350 | /* --- Segment stuff --- */
|
---|
351 | #define _MD_INIT_SEGS()
|
---|
352 | #define _MD_ALLOC_SEGMENT(seg, size, vaddr) 0
|
---|
353 | #define _MD_FREE_SEGMENT(seg)
|
---|
354 |
|
---|
355 | /* --- Environment Stuff --- */
|
---|
356 | #define _MD_GET_ENV _PR_MD_GET_ENV
|
---|
357 | #define _MD_PUT_ENV _PR_MD_PUT_ENV
|
---|
358 |
|
---|
359 | /* --- Threading Stuff --- */
|
---|
360 | #define _MD_DEFAULT_STACK_SIZE 0
|
---|
361 | #define _MD_INIT_THREAD _PR_MD_INIT_THREAD
|
---|
362 | #define _MD_INIT_ATTACHED_THREAD _PR_MD_INIT_THREAD
|
---|
363 | #define _MD_CREATE_THREAD _PR_MD_CREATE_THREAD
|
---|
364 | #define _MD_YIELD _PR_MD_YIELD
|
---|
365 | #define _MD_SET_PRIORITY _PR_MD_SET_PRIORITY
|
---|
366 | #define _MD_CLEAN_THREAD _PR_MD_CLEAN_THREAD
|
---|
367 | #define _MD_SETTHREADAFFINITYMASK _PR_MD_SETTHREADAFFINITYMASK
|
---|
368 | #define _MD_GETTHREADAFFINITYMASK _PR_MD_GETTHREADAFFINITYMASK
|
---|
369 | #define _MD_EXIT_THREAD _PR_MD_EXIT_THREAD
|
---|
370 | #define _MD_EXIT _PR_MD_EXIT
|
---|
371 | #define _MD_SUSPEND_THREAD _PR_MD_SUSPEND_THREAD
|
---|
372 | #define _MD_RESUME_THREAD _PR_MD_RESUME_THREAD
|
---|
373 | #define _MD_SUSPEND_CPU _PR_MD_SUSPEND_CPU
|
---|
374 | #define _MD_RESUME_CPU _PR_MD_RESUME_CPU
|
---|
375 | #define _MD_BEGIN_SUSPEND_ALL()
|
---|
376 | #define _MD_BEGIN_RESUME_ALL()
|
---|
377 | #define _MD_END_SUSPEND_ALL()
|
---|
378 | #define _MD_END_RESUME_ALL()
|
---|
379 |
|
---|
380 | /* --- Lock stuff --- */
|
---|
381 | #define _PR_LOCK _MD_LOCK
|
---|
382 | #define _PR_UNLOCK _MD_UNLOCK
|
---|
383 |
|
---|
384 | #define _MD_NEW_LOCK(lock) (InitializeCriticalSection(&((lock)->mutex)),(lock)->notified.length=0,(lock)->notified.link=NULL,PR_SUCCESS)
|
---|
385 | #define _MD_FREE_LOCK(lock) DeleteCriticalSection(&((lock)->mutex))
|
---|
386 | #define _MD_LOCK(lock) EnterCriticalSection(&((lock)->mutex))
|
---|
387 | #define _MD_TEST_AND_LOCK(lock) (EnterCriticalSection(&((lock)->mutex)),0)
|
---|
388 | #define _MD_UNLOCK _PR_MD_UNLOCK
|
---|
389 |
|
---|
390 | /* --- lock and cv waiting --- */
|
---|
391 | #define _MD_WAIT _PR_MD_WAIT
|
---|
392 | #define _MD_WAKEUP_WAITER _PR_MD_WAKEUP_WAITER
|
---|
393 |
|
---|
394 | /* --- CVar ------------------- */
|
---|
395 | #define _MD_WAIT_CV _PR_MD_WAIT_CV
|
---|
396 | #define _MD_NEW_CV _PR_MD_NEW_CV
|
---|
397 | #define _MD_FREE_CV _PR_MD_FREE_CV
|
---|
398 | #define _MD_NOTIFY_CV _PR_MD_NOTIFY_CV
|
---|
399 | #define _MD_NOTIFYALL_CV _PR_MD_NOTIFYALL_CV
|
---|
400 |
|
---|
401 | /* XXXMB- the IOQ stuff is certainly not working correctly yet. */
|
---|
402 | // extern struct _MDLock _pr_ioq_lock;
|
---|
403 | #define _MD_IOQ_LOCK()
|
---|
404 | #define _MD_IOQ_UNLOCK()
|
---|
405 |
|
---|
406 |
|
---|
407 | /* --- Initialization stuff --- */
|
---|
408 | #define _MD_START_INTERRUPTS()
|
---|
409 | #define _MD_STOP_INTERRUPTS()
|
---|
410 | #define _MD_DISABLE_CLOCK_INTERRUPTS()
|
---|
411 | #define _MD_ENABLE_CLOCK_INTERRUPTS()
|
---|
412 | #define _MD_BLOCK_CLOCK_INTERRUPTS()
|
---|
413 | #define _MD_UNBLOCK_CLOCK_INTERRUPTS()
|
---|
414 | #define _MD_EARLY_INIT _PR_MD_EARLY_INIT
|
---|
415 | #define _MD_FINAL_INIT()
|
---|
416 | #define _MD_INIT_CPUS()
|
---|
417 | #define _MD_INIT_RUNNING_CPU(cpu)
|
---|
418 |
|
---|
419 | struct PRProcess;
|
---|
420 | struct PRProcessAttr;
|
---|
421 |
|
---|
422 | #define _MD_CREATE_PROCESS _PR_CreateWindowsProcess
|
---|
423 | extern struct PRProcess * _PR_CreateWindowsProcess(
|
---|
424 | const char *path,
|
---|
425 | char *const *argv,
|
---|
426 | char *const *envp,
|
---|
427 | const struct PRProcessAttr *attr
|
---|
428 | );
|
---|
429 |
|
---|
430 | #define _MD_DETACH_PROCESS _PR_DetachWindowsProcess
|
---|
431 | extern PRStatus _PR_DetachWindowsProcess(struct PRProcess *process);
|
---|
432 |
|
---|
433 | /* --- Wait for a child process to terminate --- */
|
---|
434 | #define _MD_WAIT_PROCESS _PR_WaitWindowsProcess
|
---|
435 | extern PRStatus _PR_WaitWindowsProcess(struct PRProcess *process,
|
---|
436 | PRInt32 *exitCode);
|
---|
437 |
|
---|
438 | #define _MD_KILL_PROCESS _PR_KillWindowsProcess
|
---|
439 | extern PRStatus _PR_KillWindowsProcess(struct PRProcess *process);
|
---|
440 |
|
---|
441 | #define _MD_CLEANUP_BEFORE_EXIT _PR_MD_CLEANUP_BEFORE_EXIT
|
---|
442 | #define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
|
---|
443 | PR_BEGIN_MACRO \
|
---|
444 | *status = PR_TRUE; \
|
---|
445 | PR_END_MACRO
|
---|
446 | #define _MD_SWITCH_CONTEXT
|
---|
447 | #define _MD_RESTORE_CONTEXT
|
---|
448 |
|
---|
449 | /* --- Intervals --- */
|
---|
450 | #define _MD_INTERVAL_INIT _PR_MD_INTERVAL_INIT
|
---|
451 | #define _MD_GET_INTERVAL _PR_MD_GET_INTERVAL
|
---|
452 | #define _MD_INTERVAL_PER_SEC _PR_MD_INTERVAL_PER_SEC
|
---|
453 | #define _MD_INTERVAL_PER_MILLISEC() (_PR_MD_INTERVAL_PER_SEC() / 1000)
|
---|
454 | #define _MD_INTERVAL_PER_MICROSEC() (_PR_MD_INTERVAL_PER_SEC() / 1000000)
|
---|
455 |
|
---|
456 | /* --- Time --- */
|
---|
457 | extern void _PR_FileTimeToPRTime(const FILETIME *filetime, PRTime *prtm);
|
---|
458 |
|
---|
459 | /* --- Native-Thread Specific Definitions ------------------------------- */
|
---|
460 |
|
---|
461 | extern struct PRThread * _MD_CURRENT_THREAD(void);
|
---|
462 |
|
---|
463 | #ifdef _PR_USE_STATIC_TLS
|
---|
464 | extern __declspec(thread) struct PRThread *_pr_currentThread;
|
---|
465 | #define _MD_GET_ATTACHED_THREAD() _pr_currentThread
|
---|
466 | #define _MD_SET_CURRENT_THREAD(_thread) (_pr_currentThread = (_thread))
|
---|
467 |
|
---|
468 | extern __declspec(thread) struct PRThread *_pr_thread_last_run;
|
---|
469 | #define _MD_LAST_THREAD() _pr_thread_last_run
|
---|
470 | #define _MD_SET_LAST_THREAD(_thread) (_pr_thread_last_run = 0)
|
---|
471 |
|
---|
472 | extern __declspec(thread) struct _PRCPU *_pr_currentCPU;
|
---|
473 | #define _MD_CURRENT_CPU() _pr_currentCPU
|
---|
474 | #define _MD_SET_CURRENT_CPU(_cpu) (_pr_currentCPU = 0)
|
---|
475 | #else /* _PR_USE_STATIC_TLS */
|
---|
476 | extern DWORD _pr_currentThreadIndex;
|
---|
477 | #define _MD_GET_ATTACHED_THREAD() ((PRThread *) TlsGetValue(_pr_currentThreadIndex))
|
---|
478 | #define _MD_SET_CURRENT_THREAD(_thread) TlsSetValue(_pr_currentThreadIndex, (_thread))
|
---|
479 |
|
---|
480 | extern DWORD _pr_lastThreadIndex;
|
---|
481 | #define _MD_LAST_THREAD() ((PRThread *) TlsGetValue(_pr_lastThreadIndex))
|
---|
482 | #define _MD_SET_LAST_THREAD(_thread) TlsSetValue(_pr_lastThreadIndex, 0)
|
---|
483 |
|
---|
484 | extern DWORD _pr_currentCPUIndex;
|
---|
485 | #define _MD_CURRENT_CPU() ((struct _PRCPU *) TlsGetValue(_pr_currentCPUIndex))
|
---|
486 | #define _MD_SET_CURRENT_CPU(_cpu) TlsSetValue(_pr_currentCPUIndex, 0)
|
---|
487 | #endif /* _PR_USE_STATIC_TLS */
|
---|
488 |
|
---|
489 | /* --- Scheduler stuff --- */
|
---|
490 | #define LOCK_SCHEDULER() 0
|
---|
491 | #define UNLOCK_SCHEDULER() 0
|
---|
492 | #define _PR_LockSched() 0
|
---|
493 | #define _PR_UnlockSched() 0
|
---|
494 |
|
---|
495 | /* --- Initialization stuff --- */
|
---|
496 | #define _MD_INIT_LOCKS()
|
---|
497 |
|
---|
498 | /* --- Stack stuff --- */
|
---|
499 | #define _MD_INIT_STACK(stack, redzone)
|
---|
500 | #define _MD_CLEAR_STACK(stack)
|
---|
501 |
|
---|
502 | /* --- Memory-mapped files stuff --- */
|
---|
503 |
|
---|
504 | struct _MDFileMap {
|
---|
505 | HANDLE hFileMap;
|
---|
506 | DWORD dwAccess;
|
---|
507 | };
|
---|
508 |
|
---|
509 | extern PRStatus _MD_CreateFileMap(struct PRFileMap *fmap, PRInt64 size);
|
---|
510 | #define _MD_CREATE_FILE_MAP _MD_CreateFileMap
|
---|
511 |
|
---|
512 | extern PRInt32 _MD_GetMemMapAlignment(void);
|
---|
513 | #define _MD_GET_MEM_MAP_ALIGNMENT _MD_GetMemMapAlignment
|
---|
514 |
|
---|
515 | extern void * _MD_MemMap(struct PRFileMap *fmap, PRInt64 offset,
|
---|
516 | PRUint32 len);
|
---|
517 | #define _MD_MEM_MAP _MD_MemMap
|
---|
518 |
|
---|
519 | extern PRStatus _MD_MemUnmap(void *addr, PRUint32 size);
|
---|
520 | #define _MD_MEM_UNMAP _MD_MemUnmap
|
---|
521 |
|
---|
522 | extern PRStatus _MD_CloseFileMap(struct PRFileMap *fmap);
|
---|
523 | #define _MD_CLOSE_FILE_MAP _MD_CloseFileMap
|
---|
524 |
|
---|
525 | /* --- Named semaphores stuff --- */
|
---|
526 | #define _PR_HAVE_NAMED_SEMAPHORES
|
---|
527 | #define _MD_OPEN_SEMAPHORE _PR_MD_OPEN_SEMAPHORE
|
---|
528 | #define _MD_WAIT_SEMAPHORE _PR_MD_WAIT_SEMAPHORE
|
---|
529 | #define _MD_POST_SEMAPHORE _PR_MD_POST_SEMAPHORE
|
---|
530 | #define _MD_CLOSE_SEMAPHORE _PR_MD_CLOSE_SEMAPHORE
|
---|
531 | #define _MD_DELETE_SEMAPHORE(name) PR_SUCCESS /* no op */
|
---|
532 |
|
---|
533 | #endif /* nspr_win32_defs_h___ */
|
---|