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

Side by Side Diff: gecko-sdk/include/md/_os2.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/_openvms.h ('k') | gecko-sdk/include/md/_os2_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_os2_defs_h___
39 #define nspr_os2_defs_h___
40
41 #ifndef NO_LONG_LONG
42 #define INCL_LONGLONG
43 #endif
44 #define INCL_DOS
45 #define INCL_DOSPROCESS
46 #define INCL_DOSERRORS
47 #define INCL_WIN
48 #define INCL_WPS
49 #include <os2.h>
50 #include <sys/select.h>
51
52 #include "prio.h"
53
54 #include <errno.h>
55
56 #ifdef XP_OS2_VACPP
57 /* TODO RAMSEMs need to be written for GCC/EMX */
58 #define USE_RAMSEM
59 #endif
60
61 #ifdef USE_RAMSEM
62 #pragma pack(4)
63
64 #pragma pack(2)
65 typedef struct _RAMSEM
66 {
67 ULONG ulTIDPID;
68 ULONG hevSem;
69 ULONG cLocks;
70 USHORT cWaiting;
71 USHORT cPosts;
72 } RAMSEM, *PRAMSEM;
73
74 typedef struct _CRITICAL_SECTION
75 {
76 ULONG ulReserved[4]; /* Same size as RAMSEM */
77 } CRITICAL_SECTION, *PCRITICAL_SECTION, *LPCRITICAL_SECTION;
78 #pragma pack(4)
79
80 APIRET _Optlink SemRequest486(PRAMSEM, ULONG);
81 APIRET _Optlink SemReleasex86(PRAMSEM, ULONG);
82 #endif
83
84 /*
85 * Internal configuration macros
86 */
87
88 #define PR_LINKER_ARCH "os2"
89 #define _PR_SI_SYSNAME "OS2"
90 #define _PR_SI_ARCHITECTURE "x86" /* XXXMB hardcode for now */
91
92 #define HAVE_DLL
93 #define _PR_GLOBAL_THREADS_ONLY
94 #undef HAVE_THREAD_AFFINITY
95 #define _PR_HAVE_THREADSAFE_GETHOST
96 #define _PR_HAVE_ATOMIC_OPS
97
98 #define HANDLE unsigned long
99 #define HINSTANCE HMODULE
100
101 /* --- Common User-Thread/Native-Thread Definitions --------------------- */
102
103 /* --- Globals --- */
104 extern struct PRLock *_pr_schedLock;
105
106 /* --- Typedefs --- */
107 typedef void (*FiberFunc)(void *);
108
109 #define PR_NUM_GCREGS 8
110 typedef PRInt32 PR_CONTEXT_TYPE[PR_NUM_GCREGS];
111 #define GC_VMBASE 0x40000000
112 #define GC_VMLIMIT 0x00FFFFFF
113 typedef int (*FARPROC)();
114
115 #define _MD_MAGIC_THREAD 0x22222222
116 #define _MD_MAGIC_THREADSTACK 0x33333333
117 #define _MD_MAGIC_SEGMENT 0x44444444
118 #define _MD_MAGIC_DIR 0x55555555
119 #define _MD_MAGIC_CV 0x66666666
120
121 struct _MDSemaphore {
122 HEV sem;
123 };
124
125 struct _MDCPU {
126 int unused;
127 };
128
129 struct _MDThread {
130 HEV blocked_sema; /* Threads block on this when waiting
131 * for IO or CondVar.
132 */
133 PRBool inCVWaitQueue; /* PR_TRUE if the thread is in the
134 * wait queue of some cond var.
135 * PR_FALSE otherwise. */
136 TID handle; /* OS/2 thread handle */
137 void *sp; /* only valid when suspended */
138 PRUint32 magic; /* for debugging */
139 PR_CONTEXT_TYPE gcContext; /* Thread context for GC */
140 struct PRThread *prev, *next; /* used by the cvar wait queue to
141 * chain the PRThread structures
142 * together */
143 };
144
145 struct _MDThreadStack {
146 PRUint32 magic; /* for debugging */
147 };
148
149 struct _MDSegment {
150 PRUint32 magic; /* for debugging */
151 };
152
153 #undef PROFILE_LOCKS
154
155 struct _MDDir {
156 HDIR d_hdl;
157 union {
158 FILEFINDBUF3 small;
159 FILEFINDBUF3L large;
160 } d_entry;
161 PRBool firstEntry; /* Is this the entry returned
162 * by FindFirstFile()? */
163 PRUint32 magic; /* for debugging */
164 };
165
166 struct _MDCVar {
167 PRUint32 magic;
168 struct PRThread *waitHead, *waitTail; /* the wait queue: a doubly-
169 * linked list of threads
170 * waiting on this condition
171 * variable */
172 PRIntn nwait; /* number of threads in the
173 * wait queue */
174 };
175
176 #define _MD_CV_NOTIFIED_LENGTH 6
177 typedef struct _MDNotified _MDNotified;
178 struct _MDNotified {
179 PRIntn length; /* # of used entries in this
180 * structure */
181 struct {
182 struct _MDCVar *cv; /* the condition variable notified */
183 PRIntn times; /* and the number of times notified */
184 struct PRThread *notifyHead; /* list of threads to wake up */
185 } cv[_MD_CV_NOTIFIED_LENGTH];
186 _MDNotified *link; /* link to another of these, or NULL */
187 };
188
189 struct _MDLock {
190 #ifdef USE_RAMSEM
191 CRITICAL_SECTION mutex; /* this is recursive on NT */
192 #else
193 HMTX mutex; /* this is recursive on NT */
194 #endif
195
196 /*
197 * When notifying cvars, there is no point in actually
198 * waking up the threads waiting on the cvars until we've
199 * released the lock. So, we temporarily record the cvars.
200 * When doing an unlock, we'll then wake up the waiting threads.
201 */
202 struct _MDNotified notified; /* array of conditions notified */
203 #ifdef PROFILE_LOCKS
204 PRInt32 hitcount;
205 PRInt32 misscount;
206 #endif
207 };
208
209 struct _MDFileDesc {
210 PRInt32 osfd; /* The osfd can come from one of three spaces:
211 * - For stdin, stdout, and stderr, we are using
212 * the libc file handle (0, 1, 2), which is an int.
213 * - For files and pipes, we are using OS/2 handles,
214 * which is a void*.
215 * - For sockets, we are using int
216 */
217 };
218
219 struct _MDProcess {
220 PID pid;
221 };
222
223 /* --- Misc stuff --- */
224 #define _MD_GET_SP(thread) (thread)->md.gcContext[6]
225
226 /* --- IO stuff --- */
227
228 #define _MD_OPEN (_PR_MD_OPEN)
229 #define _MD_OPEN_FILE (_PR_MD_OPEN)
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_MKDIR)
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 /* --- Socket IO stuff --- */
253
254 /* The ones that don't map directly may need to be re-visited... */
255 #ifdef XP_OS2_VACPP
256 #define EPIPE EBADF
257 #define EIO ECONNREFUSED
258 #endif
259 #define _MD_EACCES EACCES
260 #define _MD_EADDRINUSE EADDRINUSE
261 #define _MD_EADDRNOTAVAIL EADDRNOTAVAIL
262 #define _MD_EAFNOSUPPORT EAFNOSUPPORT
263 #define _MD_EAGAIN EWOULDBLOCK
264 #define _MD_EALREADY EALREADY
265 #define _MD_EBADF EBADF
266 #define _MD_ECONNREFUSED ECONNREFUSED
267 #define _MD_ECONNRESET ECONNRESET
268 #define _MD_EFAULT SOCEFAULT
269 #define _MD_EINPROGRESS EINPROGRESS
270 #define _MD_EINTR EINTR
271 #define _MD_EINVAL EINVAL
272 #define _MD_EISCONN EISCONN
273 #define _MD_ENETUNREACH ENETUNREACH
274 #define _MD_ENOENT ENOENT
275 #define _MD_ENOTCONN ENOTCONN
276 #define _MD_ENOTSOCK ENOTSOCK
277 #define _MD_EOPNOTSUPP EOPNOTSUPP
278 #define _MD_EWOULDBLOCK EWOULDBLOCK
279 #define _MD_GET_SOCKET_ERROR() sock_errno()
280 #ifndef INADDR_LOOPBACK /* For some reason this is not defined in OS2 tcpip */
281 /* #define INADDR_LOOPBACK INADDR_ANY */
282 #endif
283
284 #define _MD_INIT_FILEDESC(fd)
285 extern void _MD_MakeNonblock(PRFileDesc *f);
286 #define _MD_MAKE_NONBLOCK _MD_MakeNonblock
287 #define _MD_INIT_FD_INHERITABLE (_PR_MD_INIT_FD_INHERITABLE)
288 #define _MD_QUERY_FD_INHERITABLE (_PR_MD_QUERY_FD_INHERITABLE)
289 #define _MD_SHUTDOWN (_PR_MD_SHUTDOWN)
290 #define _MD_LISTEN _PR_MD_LISTEN
291 extern PRInt32 _MD_CloseSocket(PRInt32 osfd);
292 #define _MD_CLOSE_SOCKET _MD_CloseSocket
293 #define _MD_SENDTO (_PR_MD_SENDTO)
294 #define _MD_RECVFROM (_PR_MD_RECVFROM)
295 #ifdef XP_OS2_VACPP
296 #define _MD_SOCKETPAIR(s, type, proto, sv) -1
297 #else
298 #define _MD_SOCKETPAIR (_PR_MD_SOCKETPAIR)
299 #endif
300 #define _MD_GETSOCKNAME (_PR_MD_GETSOCKNAME)
301 #define _MD_GETPEERNAME (_PR_MD_GETPEERNAME)
302 #define _MD_GETSOCKOPT (_PR_MD_GETSOCKOPT)
303 #define _MD_SETSOCKOPT (_PR_MD_SETSOCKOPT)
304
305 #define _MD_FSYNC _PR_MD_FSYNC
306 #define _MD_SET_FD_INHERITABLE (_PR_MD_SET_FD_INHERITABLE)
307
308 #ifdef _PR_HAVE_ATOMIC_OPS
309 #define _MD_INIT_ATOMIC()
310 #define _MD_ATOMIC_INCREMENT _PR_MD_ATOMIC_INCREMENT
311 #define _MD_ATOMIC_ADD _PR_MD_ATOMIC_ADD
312 #define _MD_ATOMIC_DECREMENT _PR_MD_ATOMIC_DECREMENT
313 #define _MD_ATOMIC_SET _PR_MD_ATOMIC_SET
314 #endif
315
316 #define _MD_INIT_IO (_PR_MD_INIT_IO)
317 #define _MD_PR_POLL (_PR_MD_PR_POLL)
318
319 #define _MD_SOCKET (_PR_MD_SOCKET)
320 extern PRInt32 _MD_SocketAvailable(PRFileDesc *fd);
321 #define _MD_SOCKETAVAILABLE _MD_SocketAvailable
322 #define _MD_PIPEAVAILABLE _MD_SocketAvailable
323 #define _MD_CONNECT (_PR_MD_CONNECT)
324 extern PRInt32 _MD_Accept(PRFileDesc *fd, PRNetAddr *raddr, PRUint32 *rlen,
325 PRIntervalTime timeout);
326 #define _MD_ACCEPT _MD_Accept
327 #define _MD_BIND (_PR_MD_BIND)
328 #define _MD_RECV (_PR_MD_RECV)
329 #define _MD_SEND (_PR_MD_SEND)
330
331 /* --- Scheduler stuff --- */
332 /* #define _MD_PAUSE_CPU _PR_MD_PAUSE_CPU */
333 #define _MD_PAUSE_CPU
334
335 /* --- DIR stuff --- */
336 #define PR_DIRECTORY_SEPARATOR '\\'
337 #define PR_DIRECTORY_SEPARATOR_STR "\\"
338 #define PR_PATH_SEPARATOR ';'
339 #define PR_PATH_SEPARATOR_STR ";"
340 #define _MD_ERRNO() errno
341 #define _MD_OPEN_DIR (_PR_MD_OPEN_DIR)
342 #define _MD_CLOSE_DIR (_PR_MD_CLOSE_DIR)
343 #define _MD_READ_DIR (_PR_MD_READ_DIR)
344
345 /* --- Segment stuff --- */
346 #define _MD_INIT_SEGS()
347 #define _MD_ALLOC_SEGMENT(seg, size, vaddr) 0
348 #define _MD_FREE_SEGMENT(seg)
349
350 /* --- Environment Stuff --- */
351 #define _MD_GET_ENV (_PR_MD_GET_ENV)
352 #define _MD_PUT_ENV (_PR_MD_PUT_ENV)
353
354 /* --- Threading Stuff --- */
355 #define _MD_DEFAULT_STACK_SIZE 65536L
356 #define _MD_INIT_THREAD (_PR_MD_INIT_THREAD)
357 #define _MD_INIT_ATTACHED_THREAD (_PR_MD_INIT_THREAD)
358 #define _MD_CREATE_THREAD (_PR_MD_CREATE_THREAD)
359 #define _MD_YIELD (_PR_MD_YIELD)
360 #define _MD_SET_PRIORITY (_PR_MD_SET_PRIORITY)
361 #define _MD_CLEAN_THREAD (_PR_MD_CLEAN_THREAD)
362 #define _MD_SETTHREADAFFINITYMASK (_PR_MD_SETTHREADAFFINITYMASK)
363 #define _MD_GETTHREADAFFINITYMASK (_PR_MD_GETTHREADAFFINITYMASK)
364 #define _MD_EXIT_THREAD (_PR_MD_EXIT_THREAD)
365 #define _MD_SUSPEND_THREAD (_PR_MD_SUSPEND_THREAD)
366 #define _MD_RESUME_THREAD (_PR_MD_RESUME_THREAD)
367 #define _MD_SUSPEND_CPU (_PR_MD_SUSPEND_CPU)
368 #define _MD_RESUME_CPU (_PR_MD_RESUME_CPU)
369 #define _MD_WAKEUP_CPUS (_PR_MD_WAKEUP_CPUS)
370 #define _MD_BEGIN_SUSPEND_ALL()
371 #define _MD_BEGIN_RESUME_ALL()
372 #define _MD_END_SUSPEND_ALL()
373 #define _MD_END_RESUME_ALL()
374
375 /* --- Lock stuff --- */
376 #define _PR_LOCK _MD_LOCK
377 #define _PR_UNLOCK _MD_UNLOCK
378
379 #ifdef USE_RAMSEM
380 #define _MD_NEW_LOCK (_PR_MD_NEW_LOCK)
381 #define _MD_FREE_LOCK(lock) (DosCloseEventSem(((PRAMSEM)(&((lock)->mut ex)))->hevSem))
382 #define _MD_LOCK(lock) (SemRequest486(&((lock)->mutex), -1))
383 #define _MD_TEST_AND_LOCK(lock) (SemRequest486(&((lock)->mutex), -1),0)
384 #define _MD_UNLOCK(lock) \
385 PR_BEGIN_MACRO \
386 if (0 != (lock)->notified.length) { \
387 md_UnlockAndPostNotifies((lock), NULL, NULL); \
388 } else { \
389 SemReleasex86( &(lock)->mutex, 0 ); \
390 } \
391 PR_END_MACRO
392 #else
393 #define _MD_NEW_LOCK (_PR_MD_NEW_LOCK)
394 #define _MD_FREE_LOCK(lock) (DosCloseMutexSem((lock)->mutex))
395 #define _MD_LOCK(lock) (DosRequestMutexSem((lock)->mutex, SEM_IND EFINITE_WAIT))
396 #define _MD_TEST_AND_LOCK(lock) (DosRequestMutexSem((lock)->mutex, SEM_IND EFINITE_WAIT),0)
397 #define _MD_UNLOCK(lock) \
398 PR_BEGIN_MACRO \
399 if (0 != (lock)->notified.length) { \
400 md_UnlockAndPostNotifies((lock), NULL, NULL); \
401 } else { \
402 DosReleaseMutexSem((lock)->mutex); \
403 } \
404 PR_END_MACRO
405 #endif
406
407 /* --- lock and cv waiting --- */
408 #define _MD_WAIT (_PR_MD_WAIT)
409 #define _MD_WAKEUP_WAITER (_PR_MD_WAKEUP_WAITER)
410
411 /* --- CVar ------------------- */
412 #define _MD_WAIT_CV (_PR_MD_WAIT_CV)
413 #define _MD_NEW_CV (_PR_MD_NEW_CV)
414 #define _MD_FREE_CV (_PR_MD_FREE_CV)
415 #define _MD_NOTIFY_CV (_PR_MD_NOTIFY_CV )
416 #define _MD_NOTIFYALL_CV (_PR_MD_NOTIFYALL_CV)
417
418 /* XXXMB- the IOQ stuff is certainly not working correctly yet. */
419 /* extern struct _MDLock _pr_ioq_lock; */
420 #define _MD_IOQ_LOCK()
421 #define _MD_IOQ_UNLOCK()
422
423
424 /* --- Initialization stuff --- */
425 #define _MD_START_INTERRUPTS()
426 #define _MD_STOP_INTERRUPTS()
427 #define _MD_DISABLE_CLOCK_INTERRUPTS()
428 #define _MD_ENABLE_CLOCK_INTERRUPTS()
429 #define _MD_BLOCK_CLOCK_INTERRUPTS()
430 #define _MD_UNBLOCK_CLOCK_INTERRUPTS()
431 #define _MD_EARLY_INIT (_PR_MD_EARLY_INIT)
432 #define _MD_FINAL_INIT()
433 #define _MD_INIT_CPUS()
434 #define _MD_INIT_RUNNING_CPU(cpu)
435
436 struct PRProcess;
437 struct PRProcessAttr;
438
439 #define _MD_CREATE_PROCESS _PR_CreateOS2Process
440 extern struct PRProcess * _PR_CreateOS2Process(
441 const char *path,
442 char *const *argv,
443 char *const *envp,
444 const struct PRProcessAttr *attr
445 );
446
447 #define _MD_DETACH_PROCESS _PR_DetachOS2Process
448 extern PRStatus _PR_DetachOS2Process(struct PRProcess *process);
449
450 /* --- Wait for a child process to terminate --- */
451 #define _MD_WAIT_PROCESS _PR_WaitOS2Process
452 extern PRStatus _PR_WaitOS2Process(struct PRProcess *process,
453 PRInt32 *exitCode);
454
455 #define _MD_KILL_PROCESS _PR_KillOS2Process
456 extern PRStatus _PR_KillOS2Process(struct PRProcess *process);
457
458 #define _MD_CLEANUP_BEFORE_EXIT()
459 #define _MD_EXIT (_PR_MD_EXIT)
460 #define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
461 PR_BEGIN_MACRO \
462 *status = PR_TRUE; \
463 PR_END_MACRO
464 #define _MD_SWITCH_CONTEXT
465 #define _MD_RESTORE_CONTEXT
466
467 /* --- Intervals --- */
468 #define _MD_INTERVAL_INIT (_PR_MD_INTERVAL_INIT)
469 #define _MD_GET_INTERVAL (_PR_MD_GET_INTERVAL)
470 #define _MD_INTERVAL_PER_SEC (_PR_MD_INTERVAL_PER_SEC)
471 #define _MD_INTERVAL_PER_MILLISEC() (_PR_MD_INTERVAL_PER_SEC() / 1000)
472 #define _MD_INTERVAL_PER_MICROSEC() (_PR_MD_INTERVAL_PER_SEC() / 1000000)
473
474 /* --- Native-Thread Specific Definitions ------------------------------- */
475
476 typedef struct __NSPR_TLS
477 {
478 struct PRThread *_pr_thread_last_run;
479 struct PRThread *_pr_currentThread;
480 struct _PRCPU *_pr_currentCPU;
481 } _NSPR_TLS;
482
483 extern _NSPR_TLS* pThreadLocalStorage;
484 NSPR_API(void) _PR_MD_ENSURE_TLS(void);
485
486 #define _MD_GET_ATTACHED_THREAD() pThreadLocalStorage->_pr_currentThread
487 extern struct PRThread * _MD_CURRENT_THREAD(void);
488 #define _MD_SET_CURRENT_THREAD(_thread) _PR_MD_ENSURE_TLS(); pThreadLocalStorage ->_pr_currentThread = (_thread)
489
490 #define _MD_LAST_THREAD() pThreadLocalStorage->_pr_thread_last_run
491 #define _MD_SET_LAST_THREAD(_thread) _PR_MD_ENSURE_TLS(); pThreadLocalStorage->_ pr_thread_last_run = (_thread)
492
493 #define _MD_CURRENT_CPU() pThreadLocalStorage->_pr_currentCPU
494 #define _MD_SET_CURRENT_CPU(_cpu) _PR_MD_ENSURE_TLS(); pThreadLocalStorage->_pr_ currentCPU = (_cpu)
495
496 /* lth. #define _MD_SET_INTSOFF(_val) (_pr_ints_off = (_val)) */
497 /* lth. #define _MD_GET_INTSOFF() _pr_ints_off */
498 /* lth. #define _MD_INCREMENT_INTSOFF() (_pr_ints_off++) */
499 /* lth. #define _MD_DECREMENT_INTSOFF() (_pr_ints_off--) */
500
501 /* --- Scheduler stuff --- */
502 #define LOCK_SCHEDULER() 0
503 #define UNLOCK_SCHEDULER() 0
504 #define _PR_LockSched() 0
505 #define _PR_UnlockSched() 0
506
507 /* --- Initialization stuff --- */
508 #define _MD_INIT_LOCKS()
509
510 /* --- Stack stuff --- */
511 #define _MD_INIT_STACK(stack, redzone)
512 #define _MD_CLEAR_STACK(stack)
513
514 /* --- Memory-mapped files stuff --- not implemented on OS/2 */
515
516 struct _MDFileMap {
517 PRInt8 unused;
518 };
519
520 extern PRStatus _MD_CreateFileMap(struct PRFileMap *fmap, PRInt64 size);
521 #define _MD_CREATE_FILE_MAP _MD_CreateFileMap
522
523 extern PRInt32 _MD_GetMemMapAlignment(void);
524 #define _MD_GET_MEM_MAP_ALIGNMENT _MD_GetMemMapAlignment
525
526 extern void * _MD_MemMap(struct PRFileMap *fmap, PRInt64 offset,
527 PRUint32 len);
528 #define _MD_MEM_MAP _MD_MemMap
529
530 extern PRStatus _MD_MemUnmap(void *addr, PRUint32 size);
531 #define _MD_MEM_UNMAP _MD_MemUnmap
532
533 extern PRStatus _MD_CloseFileMap(struct PRFileMap *fmap);
534 #define _MD_CLOSE_FILE_MAP _MD_CloseFileMap
535
536 /* Some stuff for setting up thread contexts */
537 typedef ULONG DWORD, *PDWORD;
538
539 /* The following definitions and two structures are new in OS/2 Warp 4.0.
540 */
541 #ifndef CONTEXT_CONTROL
542 #define CONTEXT_CONTROL 0x00000001
543 #define CONTEXT_INTEGER 0x00000002
544 #define CONTEXT_SEGMENTS 0x00000004
545 #define CONTEXT_FLOATING_POINT 0x00000008
546 #define CONTEXT_FULL 0x0000000F
547
548 #pragma pack(2)
549 typedef struct _FPREG {
550 ULONG losig; /* Low 32-bits of the significand. */
551 ULONG hisig; /* High 32-bits of the significand. */
552 USHORT signexp; /* Sign and exponent. */
553 } FPREG;
554 typedef struct _CONTEXTRECORD {
555 ULONG ContextFlags;
556 ULONG ctx_env[7];
557 FPREG ctx_stack[8];
558 ULONG ctx_SegGs; /* GS register. */
559 ULONG ctx_SegFs; /* FS register. */
560 ULONG ctx_SegEs; /* ES register. */
561 ULONG ctx_SegDs; /* DS register. */
562 ULONG ctx_RegEdi; /* EDI register. */
563 ULONG ctx_RegEsi; /* ESI register. */
564 ULONG ctx_RegEax; /* EAX register. */
565 ULONG ctx_RegEbx; /* EBX register. */
566 ULONG ctx_RegEcx; /* ECX register. */
567 ULONG ctx_RegEdx; /* EDX register. */
568 ULONG ctx_RegEbp; /* EBP register. */
569 ULONG ctx_RegEip; /* EIP register. */
570 ULONG ctx_SegCs; /* CS register. */
571 ULONG ctx_EFlags; /* EFLAGS register. */
572 ULONG ctx_RegEsp; /* ESP register. */
573 ULONG ctx_SegSs; /* SS register. */
574 } CONTEXTRECORD, *PCONTEXTRECORD;
575 #pragma pack()
576 #endif
577
578 extern APIRET (* APIENTRY QueryThreadContext)(TID, ULONG, PCONTEXTRECORD);
579
580 /*
581 #define _pr_tid (((PTIB2)_getTIBvalue(offsetof(TIB, tib_ptib2)))->tib 2_ultid)
582 #define _pr_current_Thread (_system_tls[_pr_tid-1].__pr_current_thread)
583 */
584
585 /* Some simple mappings of Windows API's to OS/2 API's to make our lives a
586 * little bit easier. Only add one here if it is a DIRECT mapping. We are
587 * not emulating anything. Just mapping.
588 */
589 #define FreeLibrary(x) DosFreeModule((HMODULE)x)
590 #define OutputDebugString(x)
591
592 extern int _MD_os2_get_nonblocking_connect_error(int osfd);
593
594 #endif /* nspr_os2_defs_h___ */
OLDNEW
« no previous file with comments | « gecko-sdk/include/md/_openvms.h ('k') | gecko-sdk/include/md/_os2_errors.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698