Back to index

lightning-sunbird  0.9+nobinonly
_win16.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is the Netscape Portable Runtime (NSPR).
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998-2000
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *
00024  * Alternatively, the contents of this file may be used under the terms of
00025  * either the GNU General Public License Version 2 or later (the "GPL"), or
00026  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00027  * in which case the provisions of the GPL or the LGPL are applicable instead
00028  * of those above. If you wish to allow use of your version of this file only
00029  * under the terms of either the GPL or the LGPL, and not to allow others to
00030  * use your version of this file under the terms of the MPL, indicate your
00031  * decision by deleting the provisions above and replace them with the notice
00032  * and other provisions required by the GPL or the LGPL. If you do not delete
00033  * the provisions above, a recipient may use your version of this file under
00034  * the terms of any one of the MPL, the GPL or the LGPL.
00035  *
00036  * ***** END LICENSE BLOCK ***** */
00037 
00038 #ifndef nspr_win16_defs_h___
00039 #define nspr_win16_defs_h___
00040 
00041 #include <windows.h>
00042 #include <winsock.h>
00043 #include <errno.h>
00044 #include <direct.h>
00045 
00046 #include "nspr.h"
00047 /* $$ fix this */
00048 #define Remind(x)
00049 
00050 /*
00051  * Internal configuration macros
00052  */
00053 
00054 #define PR_LINKER_ARCH      "win16"
00055 #define _PR_SI_SYSNAME        "WIN16"
00056 #define _PR_SI_ARCHITECTURE   "x86"    /* XXXMB hardcode for now */
00057 
00058 #define HAVE_DLL
00059 #define _PR_NO_PREEMPT
00060 #define _PR_LOCAL_THREADS_ONLY
00061 #undef  _PR_GLOBAL_THREADS_ONLY
00062 #undef  HAVE_THREAD_AFFINITY
00063 #define _PR_HAVE_ATOMIC_OPS
00064 
00065 /* --- Common User-Thread/Native-Thread Definitions --------------------- */
00066 
00067 extern struct PRLock        *_pr_schedLock;
00068 extern char                 * _pr_top_of_task_stack;
00069 
00070 
00071 /* --- Typedefs --- */
00072 
00073 #define PR_NUM_GCREGS           9
00074 typedef PRInt32                     PR_CONTEXT_TYPE[PR_NUM_GCREGS];
00075 
00076 #define _MD_MAGIC_THREAD    0x22222222
00077 #define _MD_MAGIC_THREADSTACK      0x33333333
00078 #define _MD_MAGIC_SEGMENT   0x44444444
00079 #define _MD_MAGIC_DIR              0x55555555
00080 #define _MD_MAGIC_CV        0x66666666
00081 
00082 
00083 typedef struct _PRWin16PollDesc
00084 {
00085        PRInt32 osfd;
00086        PRInt16 in_flags;
00087        PRInt16 out_flags;
00088 } _PRWin16PollDesc;
00089 
00090 typedef struct PRPollQueue
00091 {
00092     PRCList links;              /* for linking PRPollQueue's together */
00093     _PRWin16PollDesc *pds;      /* array of poll descriptors */
00094     PRUintn npds;                         /* length of the array */
00095     PRPackedBool on_ioq;        /* is this on the async i/o work q? */
00096     PRIntervalTime timeout;     /* timeout, in ticks */
00097     struct PRThread *thr;
00098 } PRPollQueue;
00099 
00100 #define _PR_POLLQUEUE_PTR(_qp) \
00101     ((PRPollQueue *) ((char*) (_qp) - offsetof(PRPollQueue,links)))
00102 
00103 NSPR_API(PRInt32) _PR_WaitForFD(PRInt32 osfd, PRUintn how,
00104                                    PRIntervalTime timeout);
00105 NSPR_API(void) _PR_Unblock_IO_Wait(struct PRThread *thr);
00106 
00107 #define _PR_MD_MAX_OSFD             FD_SETSIZE
00108 #define _PR_IOQ(_cpu)                            ((_cpu)->md.ioQ)
00109 #define _PR_ADD_TO_IOQ(_pq, _cpu)  PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
00110 #define _PR_FD_READ_SET(_cpu)             ((_cpu)->md.fd_read_set)
00111 #define _PR_FD_READ_CNT(_cpu)             ((_cpu)->md.fd_read_cnt)
00112 #define _PR_FD_WRITE_SET(_cpu)            ((_cpu)->md.fd_write_set)
00113 #define _PR_FD_WRITE_CNT(_cpu)            ((_cpu)->md.fd_write_cnt)
00114 #define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.fd_exception_set)
00115 #define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.fd_exception_cnt)
00116 #define _PR_IOQ_TIMEOUT(_cpu)             ((_cpu)->md.ioq_timeout)
00117 #define _PR_IOQ_MAX_OSFD(_cpu)            ((_cpu)->md.ioq_max_osfd)
00118 
00119 struct _MDCPU {
00120     PRCList          ioQ;
00121     fd_set           fd_read_set, fd_write_set, fd_exception_set;
00122     PRInt16          fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
00123                             fd_exception_cnt[_PR_MD_MAX_OSFD];
00124     PRUint32  ioq_timeout;
00125     PRInt32          ioq_max_osfd;
00126 };
00127 
00128 struct _MDThread {
00129     /* The overlapped structure must be first! */
00130     HANDLE           blocked_sema;      /* Threads block on this when waiting
00131                                          * for IO or CondVar.
00132                                          */
00133     PRInt32         errcode;        /* preserved errno for this thread */
00134     CATCHBUF        context;        /* thread context for Throw() */
00135     void           *SP;             /* Stack pointer, used only by GarbColl */
00136     int             threadNumber;   /* instrumentation: order of creation */
00137        _PRWin16PollDesc thr_pd;       /* poll descriptor for i/o */
00138        PRPollQueue          thr_pq;        /* i/o parameters                 */
00139     void           *exceptionContext; /* mfc exception context */
00140     char            guardBand[24];  /* don't overwrite this */
00141     PRUint32        magic;          /* self identifier, for debug */
00142 };
00143 
00144 struct _MDThreadStack {
00145     PRUint32           magic;          /* for debugging */
00146     PRIntn          cxByteCount;    /* number of stack bytes to move */
00147     char *          stackTop;       /* high address on stack */
00148 };
00149 
00150 struct _MDSegment {
00151     PRUint32           magic;          /* for debugging */
00152 };
00153 
00154 
00155 struct _MDLock {
00156     PRUint32           magic;          /* for debugging */
00157     PRUint32           mutex;
00158 };
00159 
00160 struct _MDDir {
00161     PRUint32         magic;          /* for debugging */
00162     struct  dirent  *dir;
00163 };
00164 
00165 struct _MDCVar {
00166        PRUint32        magic;
00167 };
00168 
00169 struct _MDSemaphore {
00170        PRInt32                     unused;
00171 };
00172 
00173 struct _MDFileDesc {
00174     PRInt32 osfd;
00175 };
00176 
00177 struct _MDProcess {
00178     HANDLE handle;
00179     DWORD id;
00180 };
00181 
00182 /*
00183 ** Microsoft 'struct _stat'
00184 ** ... taken directly from msvc 1.52c's header file sys/stat.h
00185 ** see PR_Stat() implemented in w16io.c
00186 ** See BugSplat: 98516
00187 */
00188 #pragma pack(push)
00189 #pragma pack(2)
00190 
00191 typedef unsigned short _ino_t;
00192 typedef short _dev_t;
00193 typedef long _off_t;
00194 
00195 typedef struct _MDMSStat {
00196     _dev_t st_dev;
00197     _ino_t st_ino;
00198     unsigned short st_mode;
00199     short st_nlink;
00200     short st_uid;
00201     short st_gid;
00202     _dev_t st_rdev;
00203     _off_t st_size;
00204     time_t st_atime;
00205     time_t st_mtime;
00206     time_t st_ctime;
00207 } _MDMSStat;
00208 #pragma pack(pop)
00209 
00210 /* --- Errors --- */
00211     /* These are NSPR generated error codes which need to be unique from
00212      * OS error codes.
00213      */
00214 #define _MD_UNIQUEBASE                 50000
00215 #define _MD_EINTERRUPTED               _MD_UNIQUEBASE + 1
00216 #define _MD_ETIMEDOUT                  _MD_UNIQUEBASE + 2
00217 #define _MD_EIO                        _MD_UNIQUEBASE + 3
00218 
00219 struct PRProcess;
00220 struct PRProcessAttr;
00221 
00222 /* --- Create a new process --- */
00223 #define _MD_CREATE_PROCESS _PR_CreateWindowsProcess
00224 extern struct PRProcess * _PR_CreateWindowsProcess(
00225     const char *path,
00226     char *const *argv,
00227     char *const *envp,
00228     const struct PRProcessAttr *attr
00229 );
00230 
00231 #define _MD_DETACH_PROCESS _PR_DetachWindowsProcess
00232 extern PRStatus _PR_DetachWindowsProcess(struct PRProcess *process);
00233 
00234 /* --- Wait for a child process to terminate --- */
00235 #define _MD_WAIT_PROCESS _PR_WaitWindowsProcess
00236 extern PRStatus _PR_WaitWindowsProcess(struct PRProcess *process, 
00237     PRInt32 *exitCode);
00238 
00239 #define _MD_KILL_PROCESS _PR_KillWindowsProcess
00240 extern PRStatus _PR_KillWindowsProcess(struct PRProcess *process);
00241 
00242 
00243 /* --- Misc stuff --- */
00244 
00245 #define MD_ASSERTINT( x )             PR_ASSERT( (x) < 65535 )
00246 
00247 /* --- IO stuff --- */
00248 #define MAX_PATH    256
00249 #define _MD_ERRNO()                   errno
00250 #define GetLastError()                errno
00251 
00252 #define _MD_GET_FILE_ERROR()          errno
00253 #define _MD_SET_FILE_ERROR(_err)      errno = (_err)
00254 
00255 #define _MD_OPEN                      _PR_MD_OPEN
00256 #define _MD_READ                      _PR_MD_READ
00257 #define _MD_WRITE                     _PR_MD_WRITE
00258 #define _MD_WRITEV                    _PR_MD_WRITEV
00259 #define _MD_LSEEK                     _PR_MD_LSEEK
00260 #define _MD_LSEEK64                   _PR_MD_LSEEK64
00261 #define _MD_CLOSE_FILE                _PR_MD_CLOSE_FILE
00262 #define _MD_GETFILEINFO               _PR_MD_GETFILEINFO
00263 #define _MD_GETOPENFILEINFO           _PR_MD_GETOPENFILEINFO
00264 #define _MD_STAT                      _PR_MD_STAT
00265 #define _MD_RENAME                    _PR_MD_RENAME     
00266 #define _MD_ACCESS                    _PR_MD_ACCESS     
00267 #define _MD_DELETE                    _PR_MD_DELETE     
00268 #define _MD_MKDIR                     _PR_MD_MKDIR      
00269 #define _MD_RMDIR                     _PR_MD_RMDIR      
00270 #define _MD_LOCKFILE                  _PR_MD_LOCKFILE
00271 #define _MD_TLOCKFILE                 _PR_MD_TLOCKFILE
00272 #define _MD_UNLOCKFILE                _PR_MD_UNLOCKFILE
00273 
00274 
00275 /* --- Socket IO stuff --- */
00276 #define _MD_EACCES                WSAEACCES
00277 #define _MD_EADDRINUSE            WSAEADDRINUSE
00278 #define _MD_EADDRNOTAVAIL         WSAEADDRNOTAVAIL
00279 #define _MD_EAFNOSUPPORT          WSAEAFNOSUPPORT
00280 #define _MD_EAGAIN                WSAEWOULDBLOCK
00281 #define _MD_EALREADY              WSAEALREADY
00282 #define _MD_EBADF                 WSAEBADF
00283 #define _MD_ECONNREFUSED          WSAECONNREFUSED
00284 #define _MD_ECONNRESET            WSAECONNRESET
00285 #define _MD_EFAULT                WSAEFAULT
00286 #define _MD_EINPROGRESS           WSAEINPROGRESS
00287 #define _MD_EINTR                 WSAEINTR
00288 #define _MD_EINVAL                EINVAL
00289 #define _MD_EISCONN               WSAEISCONN
00290 #define _MD_ENETUNREACH           WSAENETUNREACH
00291 #define _MD_ENOENT                ENOENT
00292 #define _MD_ENOTCONN              WSAENOTCONN
00293 #define _MD_ENOTSOCK              WSAENOTSOCK
00294 #define _MD_EOPNOTSUPP            WSAEOPNOTSUPP
00295 #define _MD_EWOULDBLOCK           WSAEWOULDBLOCK
00296 #define _MD_GET_SOCKET_ERROR()    WSAGetLastError()
00297 #define _MD_SET_SOCKET_ERROR(_err) WSASetLastError(_err)
00298 
00299 #define _MD_INIT_FILEDESC(fd)
00300 #define _MD_MAKE_NONBLOCK             _PR_MD_MAKE_NONBLOCK
00301 #define _MD_SHUTDOWN                  _PR_MD_SHUTDOWN
00302 #define _MD_LISTEN                      _PR_MD_LISTEN
00303 #define _MD_CLOSE_SOCKET              _PR_MD_CLOSE_SOCKET
00304 #define _MD_SENDTO                    _PR_MD_SENDTO
00305 #define _MD_RECVFROM                  _PR_MD_RECVFROM
00306 #define _MD_SOCKETPAIR(s, type, proto, sv) -1
00307 #define _MD_GETSOCKNAME               _PR_MD_GETSOCKNAME
00308 #define _MD_GETPEERNAME               _PR_MD_GETPEERNAME
00309 #define _MD_GETSOCKOPT                _PR_MD_GETSOCKOPT
00310 #define _MD_SETSOCKOPT                _PR_MD_SETSOCKOPT
00311 #define _MD_SELECT                    select
00312 #define _MD_FSYNC                     _PR_MD_FSYNC
00313 #define _MD_SOCKETAVAILABLE           _PR_MD_SOCKETAVAILABLE
00314 
00315 #define _MD_INIT_ATOMIC()
00316 #define _MD_ATOMIC_INCREMENT(x)       (*x++)
00317 #define _MD_ATOMIC_ADD(ptr, val)      ((*x) += val)
00318 #define _MD_ATOMIC_DECREMENT(x)       (*x--)
00319 #define _MD_ATOMIC_SET(x,y)           (*x, y)
00320 
00321 #define _MD_INIT_IO                   _PR_MD_INIT_IO
00322 
00323 /* win95 doesn't have async IO */
00324 #define _MD_SOCKET                    _PR_MD_SOCKET
00325 #define _MD_CONNECT                   _PR_MD_CONNECT
00326 #define _MD_ACCEPT                    _PR_MD_ACCEPT
00327 #define _MD_BIND                      _PR_MD_BIND
00328 #define _MD_RECV                      _PR_MD_RECV
00329 #define _MD_SEND                      _PR_MD_SEND
00330 
00331 #define _MD_CHECK_FOR_EXIT()
00332 
00333 /* --- Scheduler stuff --- */
00334 #define _MD_PAUSE_CPU                 _PR_MD_PAUSE_CPU
00335 
00336 /* --- DIR stuff --- */
00337 #define PR_DIRECTORY_SEPARATOR        '\\'
00338 #define PR_DIRECTORY_SEPARATOR_STR    "\\"
00339 #define PR_PATH_SEPARATOR          ';'
00340 #define PR_PATH_SEPARATOR_STR             ";"
00341 #define _MD_OPEN_DIR                  _PR_MD_OPEN_DIR
00342 #define _MD_CLOSE_DIR                 _PR_MD_CLOSE_DIR
00343 #define _MD_READ_DIR                  _PR_MD_READ_DIR
00344 
00345 /* --- Segment stuff --- */
00346 #define _MD_INIT_SEGS()
00347 #define _MD_ALLOC_SEGMENT           _MD_AllocSegment
00348 #define _MD_FREE_SEGMENT            _MD_FreeSegment
00349 
00350 /* --- Environment Stuff --- */
00351 #define _MD_GET_ENV                 _PR_MD_GET_ENV
00352 #define _MD_PUT_ENV                 _PR_MD_PUT_ENV
00353 
00354 /* --- Threading Stuff --- */
00355 #define _MD_DEFAULT_STACK_SIZE      32767L
00356 #define _MD_INIT_THREAD             _PR_MD_INIT_THREAD
00357 #define _MD_CREATE_THREAD(t,f,p,sc,st,stsiz) (PR_SUCCESS)
00358 #define _MD_YIELD                   _PR_MD_YIELD
00359 #define _MD_SET_PRIORITY(t,p)            
00360 #define _MD_CLEAN_THREAD(t)
00361 #define _MD_SETTHREADAFFINITYMASK   _PR_MD_SETTHREADAFFINITYMASK
00362 #define _MD_GETTHREADAFFINITYMASK   _PR_MD_GETTHREADAFFINITYMASK
00363 #define _MD_EXIT_THREAD
00364 #define _MD_SUSPEND_THREAD          _PR_MD_SUSPEND_THREAD
00365 #define _MD_RESUME_THREAD           _PR_MD_RESUME_THREAD
00366 #define _MD_SUSPEND_CPU             _PR_MD_SUSPEND_CPU
00367 #define _MD_RESUME_CPU              _PR_MD_RESUME_CPU
00368 #define _MD_BEGIN_SUSPEND_ALL()
00369 #define _MD_BEGIN_RESUME_ALL()
00370 #define _MD_END_SUSPEND_ALL()
00371 #define _MD_END_RESUME_ALL()
00372 
00373 /* --- Lock stuff --- */
00374 /*
00375 ** Win16 does not need MD locks.
00376 */
00377 #define _PR_LOCK                    _MD_LOCK
00378 #define _PR_UNLOCK                  _MD_UNLOCK
00379 
00380 #define _MD_NEW_LOCK(l)             (PR_SUCCESS)
00381 #define _MD_FREE_LOCK(l)
00382 #define _MD_LOCK(l)
00383 #define _MD_TEST_AND_LOCK(l)        (-1)
00384 #define _MD_UNLOCK(l)
00385 
00386 /* --- lock and cv waiting --- */
00387 #define _MD_WAIT                      _PR_MD_WAIT
00388 #define _MD_WAKEUP_WAITER(a)
00389 #define _MD_WAKEUP_CPUS               _PR_MD_WAKEUP_CPUS
00390 
00391 /* --- CVar ------------------- */
00392 #define _MD_WAIT_CV                                _PR_MD_WAIT_CV
00393 #define _MD_NEW_CV                                 _PR_MD_NEW_CV
00394 #define _MD_FREE_CV                                _PR_MD_FREE_CV
00395 #define _MD_NOTIFY_CV                              _PR_MD_NOTIFY_CV   
00396 #define _MD_NOTIFYALL_CV                    _PR_MD_NOTIFYALL_CV
00397 
00398    /* XXXMB- the IOQ stuff is certainly not working correctly yet. */
00399 #define _MD_IOQ_LOCK()                
00400 #define _MD_IOQ_UNLOCK()              
00401 
00402 
00403 /* --- Initialization stuff --- */
00404 NSPR_API(void) _MD_INIT_RUNNING_CPU(struct _PRCPU *cpu );
00405 #define _MD_START_INTERRUPTS()
00406 #define _MD_STOP_INTERRUPTS()
00407 #define _MD_DISABLE_CLOCK_INTERRUPTS()
00408 #define _MD_ENABLE_CLOCK_INTERRUPTS()
00409 #define _MD_BLOCK_CLOCK_INTERRUPTS()
00410 #define _MD_UNBLOCK_CLOCK_INTERRUPTS()
00411 #define _MD_EARLY_INIT                  _PR_MD_EARLY_INIT
00412 #define _MD_FINAL_INIT                  _PR_MD_FINAL_INIT
00413 #define _MD_INIT_CPUS()
00414 
00415 /* --- User Threading stuff --- */
00416 #define _MD_EXIT
00417 
00418 #define _MD_CLEANUP_BEFORE_EXIT              _PR_MD_CLEANUP_BEFORE_EXIT
00419 
00420 /* --- Intervals --- */
00421 #define _MD_INTERVAL_INIT                 _PR_MD_INTERVAL_INIT
00422 #define _MD_GET_INTERVAL                  _PR_MD_GET_INTERVAL
00423 #define _MD_INTERVAL_PER_SEC              _PR_MD_INTERVAL_PER_SEC
00424 #define _MD_INTERVAL_PER_MILLISEC()       (_PR_MD_INTERVAL_PER_SEC() / 1000)
00425 #define _MD_INTERVAL_PER_MICROSEC()       (_PR_MD_INTERVAL_PER_SEC() / 1000000)
00426 
00427 /* --- Scheduler stuff --- */
00428 #define LOCK_SCHEDULER()                 0
00429 #define UNLOCK_SCHEDULER()               0
00430 #define _PR_LockSched()                    0
00431 #define _PR_UnlockSched()                0
00432 
00433 /* --- Initialization stuff --- */
00434 #define _MD_INIT_LOCKS()
00435 
00436 /* --- Stack stuff --- */
00437 #define _MD_INIT_STACK                   _PR_MD_INIT_STACK
00438 #define _MD_CLEAR_STACK(stack)
00439 
00440 /*
00441 ** Watcom needs to see this to make the linker work.
00442 **
00443 */
00444 NSPR_API(void) _PR_NativeDestroyThread(PRThread *thread);
00445 NSPR_API(void) _PR_UserDestroyThread(PRThread *thread);
00446 
00447 
00448 /*
00449 ** If thread emulation is used, then setjmp/longjmp stores the register
00450 ** state of each thread.
00451 **
00452 ** CatchBuf layout:
00453 **  context[0] - IP
00454 **  context[1] - CS
00455 **  context[2] - SP
00456 **  context[3] - BP
00457 **  context[4] - SI
00458 **  context[5] - DI
00459 **  context[6] - DS
00460 **  context[7] - ?? (maybe flags)
00461 **  context[8] - SS
00462 */
00463 #define PR_CONTEXT_TYPE     CATCHBUF
00464 #define PR_NUM_GCREGS       9
00465 
00466 #define _MD_GET_SP(thread)  ((thread)->md.SP)
00467 #define CONTEXT(_t)  ((_t)->md.context)
00468 
00469 /*
00470 ** Initialize a thread context to run "e(o,a)" when started
00471 */
00472 #define _MD_INIT_CONTEXT(_t, sp, epa, stat )   \
00473 {                                              \
00474      *(stat) = PR_TRUE;                        \
00475      Catch((_t)->md.context );             \
00476      (_t)->md.context[0] = OFFSETOF(epa);         \
00477      (_t)->md.context[1] = SELECTOROF(epa);                       \
00478      (_t)->md.context[2] = OFFSETOF(_pr_top_of_task_stack - 64);  \
00479      (_t)->md.context[3]  = 0;                 \
00480 }
00481 
00482 #define _MD_SWITCH_CONTEXT(_t)                 \
00483     if (!Catch((_t)->md.context)) {            \
00484         int     garbCollPlaceHolder;           \
00485         (_t)->md.errcode = errno;              \
00486         (_t)->md.SP = &garbCollPlaceHolder;    \
00487         _PR_Schedule();                        \
00488     }
00489 
00490 #define _MD_SAVE_CONTEXT(_t)                    \
00491     {                                           \
00492         int     garbCollPlaceHolder;            \
00493         Catch((_t)->md.context);                \
00494         (_t)->md.errcode = errno;               \
00495         (_t)->md.SP = &garbCollPlaceHolder;     \
00496     }
00497 
00498 /*
00499 ** Restore a thread context, saved by _MD_SWITCH_CONTEXT
00500 */
00501 #define _PR_MD_RESTORE_CONTEXT  _MD_RESTORE_CONTEXT
00502 
00503 /*
00504  * Memory-mapped files
00505  */
00506 
00507 struct _MDFileMap {
00508     PRInt8 unused;
00509 };
00510 
00511 extern PRStatus _MD_CreateFileMap(struct PRFileMap *fmap, PRInt64 size);
00512 #define _MD_CREATE_FILE_MAP _MD_CreateFileMap
00513 
00514 extern PRInt32 _MD_GetMemMapAlignment(void);
00515 #define _MD_GET_MEM_MAP_ALIGNMENT _MD_GetMemMapAlignment
00516 
00517 extern void * _MD_MemMap(struct PRFileMap *fmap, PRInt64 offset,
00518         PRUint32 len);
00519 #define _MD_MEM_MAP _MD_MemMap
00520 
00521 extern PRStatus _MD_MemUnmap(void *addr, PRUint32 size);
00522 #define _MD_MEM_UNMAP _MD_MemUnmap
00523 
00524 extern PRStatus _MD_CloseFileMap(struct PRFileMap *fmap);
00525 #define _MD_CLOSE_FILE_MAP _MD_CloseFileMap
00526 
00527 
00528 /* --- Error mapping ----------------------------------- */
00529 extern void _PR_MD_map_error( int err );
00530 
00531 #define _PR_MD_MAP_OPENDIR_ERROR        _PR_MD_map_error
00532 #define _PR_MD_MAP_CLOSEDIR_ERROR       _PR_MD_map_error
00533 #define _PR_MD_MAP_READDIR_ERROR        _PR_MD_map_error
00534 #define _PR_MD_MAP_DELETE_ERROR         _PR_MD_map_error
00535 #define _PR_MD_MAP_STAT_ERROR           _PR_MD_map_error
00536 #define _PR_MD_MAP_FSTAT_ERROR          _PR_MD_map_error
00537 #define _PR_MD_MAP_RENAME_ERROR         _PR_MD_map_error
00538 #define _PR_MD_MAP_ACCESS_ERROR         _PR_MD_map_error
00539 #define _PR_MD_MAP_MKDIR_ERROR          _PR_MD_map_error
00540 #define _PR_MD_MAP_RMDIR_ERROR          _PR_MD_map_error
00541 #define _PR_MD_MAP_READ_ERROR           _PR_MD_map_error
00542 #define _PR_MD_MAP_TRANSMITFILE_ERROR   _PR_MD_map_error
00543 #define _PR_MD_MAP_WRITE_ERROR          _PR_MD_map_error
00544 #define _PR_MD_MAP_LSEEK_ERROR          _PR_MD_map_error
00545 #define _PR_MD_MAP_FSYNC_ERROR          _PR_MD_map_error
00546 #define _PR_MD_MAP_CLOSE_ERROR          _PR_MD_map_error
00547 #define _PR_MD_MAP_SOCKET_ERROR         _PR_MD_map_error
00548 #define _PR_MD_MAP_RECV_ERROR           _PR_MD_map_error
00549 #define _PR_MD_MAP_RECVFROM_ERROR       _PR_MD_map_error
00550 #define _PR_MD_MAP_SEND_ERROR           _PR_MD_map_error
00551 #define _PR_MD_MAP_SENDTO_ERROR         _PR_MD_map_error
00552 #define _PR_MD_MAP_ACCEPT_ERROR         _PR_MD_map_error
00553 #define _PR_MD_MAP_ACCEPTEX_ERROR       _PR_MD_map_error
00554 #define _PR_MD_MAP_CONNECT_ERROR        _PR_MD_map_error
00555 #define _PR_MD_MAP_BIND_ERROR           _PR_MD_map_error
00556 #define _PR_MD_MAP_LISTEN_ERROR         _PR_MD_map_error
00557 #define _PR_MD_MAP_SHUTDOWN_ERROR       _PR_MD_map_error
00558 #define _PR_MD_MAP_GETSOCKNAME_ERROR    _PR_MD_map_error
00559 #define _PR_MD_MAP_GETPEERNAME_ERROR    _PR_MD_map_error
00560 #define _PR_MD_MAP_GETSOCKOPT_ERROR     _PR_MD_map_error
00561 #define _PR_MD_MAP_SETSOCKOPT_ERROR     _PR_MD_map_error
00562 #define _PR_MD_MAP_OPEN_ERROR           _PR_MD_map_error
00563 #define _PR_MD_MAP_GETHOSTNAME_ERROR    _PR_MD_map_error
00564 #define _PR_MD_MAP_SELECT_ERROR         _PR_MD_map_error
00565 #define _PR_MD_MAP_LOCKF_ERROR          _PR_MD_map_error
00566 #define _PR_MD_MAP_WSASTARTUP_ERROR     _PR_MD_map_error
00567 
00568 #endif /* nspr_win16_defs_h___ */