Home | History | Annotate | Download | only in md
      1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /*
      3  * The contents of this file are subject to the Mozilla Public
      4  * License Version 1.1 (the "License"); you may not use this file
      5  * except in compliance with the License. You may obtain a copy of
      6  * the License at http://www.mozilla.org/MPL/
      7  *
      8  * Software distributed under the License is distributed on an "AS
      9  * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
     10  * implied. See the License for the specific language governing
     11  * rights and limitations under the License.
     12  *
     13  * The Original Code is the Netscape Portable Runtime (NSPR).
     14  *
     15  * The Initial Developer of the Original Code is Netscape
     16  * Communications Corporation.  Portions created by Netscape are
     17  * Copyright (C) 1998-2000 Netscape Communications Corporation.  All
     18  * Rights Reserved.
     19  *
     20  * Contributor(s):
     21  *
     22  * Alternatively, the contents of this file may be used under the
     23  * terms of the GNU General Public License Version 2 or later (the
     24  * "GPL"), in which case the provisions of the GPL are applicable
     25  * instead of those above.  If you wish to allow use of your
     26  * version of this file only under the terms of the GPL and not to
     27  * allow others to use your version of this file under the MPL,
     28  * indicate your decision by deleting the provisions above and
     29  * replace them with the notice and other provisions required by
     30  * the GPL.  If you do not delete the provisions above, a recipient
     31  * may use your version of this file under either the MPL or the
     32  * GPL.
     33  */
     34 
     35 #ifndef nspr_win16_defs_h___
     36 #define nspr_win16_defs_h___
     37 
     38 #include <windows.h>
     39 #include <winsock.h>
     40 #include <errno.h>
     41 #include <direct.h>
     42 
     43 #include "nspr.h"
     44 /* $$ fix this */
     45 #define Remind(x)
     46 
     47 /*
     48  * Internal configuration macros
     49  */
     50 
     51 #define PR_LINKER_ARCH      "win16"
     52 #define _PR_SI_SYSNAME        "WIN16"
     53 #define _PR_SI_ARCHITECTURE   "x86"    /* XXXMB hardcode for now */
     54 
     55 #define HAVE_DLL
     56 #define _PR_NO_PREEMPT
     57 #define _PR_LOCAL_THREADS_ONLY
     58 #undef  _PR_GLOBAL_THREADS_ONLY
     59 #undef  HAVE_THREAD_AFFINITY
     60 #define _PR_HAVE_ATOMIC_OPS
     61 
     62 /* --- Common User-Thread/Native-Thread Definitions --------------------- */
     63 
     64 extern struct PRLock        *_pr_schedLock;
     65 extern char                 * _pr_top_of_task_stack;
     66 
     67 
     68 /* --- Typedefs --- */
     69 
     70 #define PR_NUM_GCREGS           9
     71 typedef PRInt32	               PR_CONTEXT_TYPE[PR_NUM_GCREGS];
     72 
     73 #define _MD_MAGIC_THREAD	0x22222222
     74 #define _MD_MAGIC_THREADSTACK	0x33333333
     75 #define _MD_MAGIC_SEGMENT	0x44444444
     76 #define _MD_MAGIC_DIR		0x55555555
     77 #define _MD_MAGIC_CV        0x66666666
     78 
     79 
     80 typedef struct _PRWin16PollDesc
     81 {
     82 	PRInt32 osfd;
     83 	PRInt16 in_flags;
     84 	PRInt16 out_flags;
     85 } _PRWin16PollDesc;
     86 
     87 typedef struct PRPollQueue
     88 {
     89     PRCList links;              /* for linking PRPollQueue's together */
     90     _PRWin16PollDesc *pds;      /* array of poll descriptors */
     91     PRUintn npds;				/* length of the array */
     92     PRPackedBool on_ioq;        /* is this on the async i/o work q? */
     93     PRIntervalTime timeout;     /* timeout, in ticks */
     94     struct PRThread *thr;
     95 } PRPollQueue;
     96 
     97 #define _PR_POLLQUEUE_PTR(_qp) \
     98     ((PRPollQueue *) ((char*) (_qp) - offsetof(PRPollQueue,links)))
     99 
    100 NSPR_API(PRInt32) _PR_WaitForFD(PRInt32 osfd, PRUintn how,
    101 					PRIntervalTime timeout);
    102 NSPR_API(void) _PR_Unblock_IO_Wait(struct PRThread *thr);
    103 
    104 #define _PR_MD_MAX_OSFD             FD_SETSIZE
    105 #define _PR_IOQ(_cpu)				((_cpu)->md.ioQ)
    106 #define _PR_ADD_TO_IOQ(_pq, _cpu) 	PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
    107 #define _PR_FD_READ_SET(_cpu)		((_cpu)->md.fd_read_set)
    108 #define _PR_FD_READ_CNT(_cpu)		((_cpu)->md.fd_read_cnt)
    109 #define _PR_FD_WRITE_SET(_cpu)		((_cpu)->md.fd_write_set)
    110 #define _PR_FD_WRITE_CNT(_cpu)		((_cpu)->md.fd_write_cnt)
    111 #define _PR_FD_EXCEPTION_SET(_cpu)	((_cpu)->md.fd_exception_set)
    112 #define _PR_FD_EXCEPTION_CNT(_cpu)	((_cpu)->md.fd_exception_cnt)
    113 #define _PR_IOQ_TIMEOUT(_cpu)		((_cpu)->md.ioq_timeout)
    114 #define _PR_IOQ_MAX_OSFD(_cpu)		((_cpu)->md.ioq_max_osfd)
    115 
    116 struct _MDCPU {
    117     PRCList		ioQ;
    118     fd_set		fd_read_set, fd_write_set, fd_exception_set;
    119     PRInt16		fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
    120 				fd_exception_cnt[_PR_MD_MAX_OSFD];
    121     PRUint32	ioq_timeout;
    122     PRInt32		ioq_max_osfd;
    123 };
    124 
    125 struct _MDThread {
    126     /* The overlapped structure must be first! */
    127     HANDLE           blocked_sema;      /* Threads block on this when waiting
    128                                          * for IO or CondVar.
    129                                          */
    130     PRInt32         errcode;        /* preserved errno for this thread */
    131     CATCHBUF        context;        /* thread context for Throw() */
    132     void           *SP;             /* Stack pointer, used only by GarbColl */
    133     int             threadNumber;   /* instrumentation: order of creation */
    134 	_PRWin16PollDesc thr_pd;       /* poll descriptor for i/o */
    135 	PRPollQueue		thr_pq;        /* i/o parameters			*/
    136     void           *exceptionContext; /* mfc exception context */
    137     char            guardBand[24];  /* don't overwrite this */
    138     PRUint32        magic;          /* self identifier, for debug */
    139 };
    140 
    141 struct _MDThreadStack {
    142     PRUint32           magic;          /* for debugging */
    143     PRIntn          cxByteCount;    /* number of stack bytes to move */
    144     char *          stackTop;       /* high address on stack */
    145 };
    146 
    147 struct _MDSegment {
    148     PRUint32           magic;          /* for debugging */
    149 };
    150 
    151 
    152 struct _MDLock {
    153     PRUint32           magic;          /* for debugging */
    154     PRUint32           mutex;
    155 };
    156 
    157 struct _MDDir {
    158     PRUint32         magic;          /* for debugging */
    159     struct  dirent  *dir;
    160 };
    161 
    162 struct _MDCVar {
    163 	PRUint32        magic;
    164 };
    165 
    166 struct _MDSemaphore {
    167 	PRInt32			unused;
    168 };
    169 
    170 struct _MDFileDesc {
    171     PRInt32 osfd;
    172 };
    173 
    174 struct _MDProcess {
    175     HANDLE handle;
    176     DWORD id;
    177 };
    178 
    179 /*
    180 ** Microsoft 'struct _stat'
    181 ** ... taken directly from msvc 1.52c's header file sys/stat.h
    182 ** see PR_Stat() implemented in w16io.c
    183 ** See BugSplat: 98516
    184 */
    185 #pragma pack(push)
    186 #pragma pack(2)
    187 
    188 typedef unsigned short _ino_t;
    189 typedef short _dev_t;
    190 typedef long _off_t;
    191 
    192 typedef struct _MDMSStat {
    193     _dev_t st_dev;
    194     _ino_t st_ino;
    195     unsigned short st_mode;
    196     short st_nlink;
    197     short st_uid;
    198     short st_gid;
    199     _dev_t st_rdev;
    200     _off_t st_size;
    201     time_t st_atime;
    202     time_t st_mtime;
    203     time_t st_ctime;
    204 } _MDMSStat;
    205 #pragma pack(pop)
    206 
    207 /* --- Errors --- */
    208     /* These are NSPR generated error codes which need to be unique from
    209      * OS error codes.
    210      */
    211 #define _MD_UNIQUEBASE                 50000
    212 #define _MD_EINTERRUPTED               _MD_UNIQUEBASE + 1
    213 #define _MD_ETIMEDOUT                  _MD_UNIQUEBASE + 2
    214 #define _MD_EIO                        _MD_UNIQUEBASE + 3
    215 
    216 struct PRProcess;
    217 struct PRProcessAttr;
    218 
    219 /* --- Create a new process --- */
    220 #define _MD_CREATE_PROCESS _PR_CreateWindowsProcess
    221 extern struct PRProcess * _PR_CreateWindowsProcess(
    222     const char *path,
    223     char *const *argv,
    224     char *const *envp,
    225     const struct PRProcessAttr *attr
    226 );
    227 
    228 #define _MD_DETACH_PROCESS _PR_DetachWindowsProcess
    229 extern PRStatus _PR_DetachWindowsProcess(struct PRProcess *process);
    230 
    231 /* --- Wait for a child process to terminate --- */
    232 #define _MD_WAIT_PROCESS _PR_WaitWindowsProcess
    233 extern PRStatus _PR_WaitWindowsProcess(struct PRProcess *process,
    234     PRInt32 *exitCode);
    235 
    236 #define _MD_KILL_PROCESS _PR_KillWindowsProcess
    237 extern PRStatus _PR_KillWindowsProcess(struct PRProcess *process);
    238 
    239 
    240 /* --- Misc stuff --- */
    241 
    242 #define MD_ASSERTINT( x )             PR_ASSERT( (x) < 65535 )
    243 
    244 /* --- IO stuff --- */
    245 #define MAX_PATH    256
    246 #define _MD_ERRNO()                   errno
    247 #define GetLastError()                errno
    248 
    249 #define _MD_GET_FILE_ERROR()          errno
    250 #define _MD_SET_FILE_ERROR(_err)      errno = (_err)
    251 
    252 #define _MD_OPEN                      _PR_MD_OPEN
    253 #define _MD_READ                      _PR_MD_READ
    254 #define _MD_WRITE                     _PR_MD_WRITE
    255 #define _MD_WRITEV                    _PR_MD_WRITEV
    256 #define _MD_LSEEK                     _PR_MD_LSEEK
    257 #define _MD_LSEEK64                   _PR_MD_LSEEK64
    258 #define _MD_CLOSE_FILE                _PR_MD_CLOSE_FILE
    259 #define _MD_GETFILEINFO               _PR_MD_GETFILEINFO
    260 #define _MD_GETOPENFILEINFO           _PR_MD_GETOPENFILEINFO
    261 #define _MD_STAT                      _PR_MD_STAT
    262 #define _MD_RENAME                    _PR_MD_RENAME
    263 #define _MD_ACCESS                    _PR_MD_ACCESS
    264 #define _MD_DELETE                    _PR_MD_DELETE
    265 #define _MD_MKDIR                     _PR_MD_MKDIR
    266 #define _MD_RMDIR                     _PR_MD_RMDIR
    267 #define _MD_LOCKFILE                  _PR_MD_LOCKFILE
    268 #define _MD_TLOCKFILE                 _PR_MD_TLOCKFILE
    269 #define _MD_UNLOCKFILE                _PR_MD_UNLOCKFILE
    270 
    271 
    272 /* --- Socket IO stuff --- */
    273 #define _MD_EACCES                WSAEACCES
    274 #define _MD_EADDRINUSE            WSAEADDRINUSE
    275 #define _MD_EADDRNOTAVAIL         WSAEADDRNOTAVAIL
    276 #define _MD_EAFNOSUPPORT          WSAEAFNOSUPPORT
    277 #define _MD_EAGAIN                WSAEWOULDBLOCK
    278 #define _MD_EALREADY              WSAEALREADY
    279 #define _MD_EBADF                 WSAEBADF
    280 #define _MD_ECONNREFUSED          WSAECONNREFUSED
    281 #define _MD_ECONNRESET            WSAECONNRESET
    282 #define _MD_EFAULT                WSAEFAULT
    283 #define _MD_EINPROGRESS           WSAEINPROGRESS
    284 #define _MD_EINTR                 WSAEINTR
    285 #define _MD_EINVAL                EINVAL
    286 #define _MD_EISCONN               WSAEISCONN
    287 #define _MD_ENETUNREACH           WSAENETUNREACH
    288 #define _MD_ENOENT                ENOENT
    289 #define _MD_ENOTCONN              WSAENOTCONN
    290 #define _MD_ENOTSOCK              WSAENOTSOCK
    291 #define _MD_EOPNOTSUPP            WSAEOPNOTSUPP
    292 #define _MD_EWOULDBLOCK           WSAEWOULDBLOCK
    293 #define _MD_GET_SOCKET_ERROR()    WSAGetLastError()
    294 #define _MD_SET_SOCKET_ERROR(_err) WSASetLastError(_err)
    295 
    296 #define _MD_INIT_FILEDESC(fd)
    297 #define _MD_MAKE_NONBLOCK             _PR_MD_MAKE_NONBLOCK
    298 #define _MD_SHUTDOWN                  _PR_MD_SHUTDOWN
    299 #define _MD_LISTEN                      _PR_MD_LISTEN
    300 #define _MD_CLOSE_SOCKET              _PR_MD_CLOSE_SOCKET
    301 #define _MD_SENDTO                    _PR_MD_SENDTO
    302 #define _MD_RECVFROM                  _PR_MD_RECVFROM
    303 #define _MD_SOCKETPAIR(s, type, proto, sv) -1
    304 #define _MD_GETSOCKNAME               _PR_MD_GETSOCKNAME
    305 #define _MD_GETPEERNAME               _PR_MD_GETPEERNAME
    306 #define _MD_GETSOCKOPT                _PR_MD_GETSOCKOPT
    307 #define _MD_SETSOCKOPT                _PR_MD_SETSOCKOPT
    308 #define _MD_SELECT                    select
    309 #define _MD_FSYNC                     _PR_MD_FSYNC
    310 #define _MD_SOCKETAVAILABLE           _PR_MD_SOCKETAVAILABLE
    311 
    312 #define _MD_INIT_ATOMIC()
    313 #define _MD_ATOMIC_INCREMENT(x)       (*x++)
    314 #define _MD_ATOMIC_ADD(ptr, val)      ((*x) += val)
    315 #define _MD_ATOMIC_DECREMENT(x)       (*x--)
    316 #define _MD_ATOMIC_SET(x,y)           (*x, y)
    317 
    318 #define _MD_INIT_IO                   _PR_MD_INIT_IO
    319 
    320 /* win95 doesn't have async IO */
    321 #define _MD_SOCKET                    _PR_MD_SOCKET
    322 #define _MD_CONNECT                   _PR_MD_CONNECT
    323 #define _MD_ACCEPT                    _PR_MD_ACCEPT
    324 #define _MD_BIND                      _PR_MD_BIND
    325 #define _MD_RECV                      _PR_MD_RECV
    326 #define _MD_SEND                      _PR_MD_SEND
    327 
    328 #define _MD_CHECK_FOR_EXIT()
    329 
    330 /* --- Scheduler stuff --- */
    331 #define _MD_PAUSE_CPU                 _PR_MD_PAUSE_CPU
    332 
    333 /* --- DIR stuff --- */
    334 #define PR_DIRECTORY_SEPARATOR        '\\'
    335 #define PR_DIRECTORY_SEPARATOR_STR    "\\"
    336 #define PR_PATH_SEPARATOR		';'
    337 #define PR_PATH_SEPARATOR_STR		";"
    338 #define _MD_OPEN_DIR                  _PR_MD_OPEN_DIR
    339 #define _MD_CLOSE_DIR                 _PR_MD_CLOSE_DIR
    340 #define _MD_READ_DIR                  _PR_MD_READ_DIR
    341 
    342 /* --- Segment stuff --- */
    343 #define _MD_INIT_SEGS()
    344 #define _MD_ALLOC_SEGMENT           _MD_AllocSegment
    345 #define _MD_FREE_SEGMENT            _MD_FreeSegment
    346 
    347 /* --- Environment Stuff --- */
    348 #define _MD_GET_ENV                 _PR_MD_GET_ENV
    349 #define _MD_PUT_ENV                 _PR_MD_PUT_ENV
    350 
    351 /* --- Threading Stuff --- */
    352 #define _MD_DEFAULT_STACK_SIZE      32767L
    353 #define _MD_INIT_THREAD             _PR_MD_INIT_THREAD
    354 #define _MD_CREATE_THREAD(t,f,p,sc,st,stsiz) (PR_SUCCESS)
    355 #define _MD_YIELD                   _PR_MD_YIELD
    356 #define _MD_SET_PRIORITY(t,p)
    357 #define _MD_CLEAN_THREAD(t)
    358 #define _MD_SETTHREADAFFINITYMASK   _PR_MD_SETTHREADAFFINITYMASK
    359 #define _MD_GETTHREADAFFINITYMASK   _PR_MD_GETTHREADAFFINITYMASK
    360 #define _MD_EXIT_THREAD
    361 #define _MD_SUSPEND_THREAD          _PR_MD_SUSPEND_THREAD
    362 #define _MD_RESUME_THREAD           _PR_MD_RESUME_THREAD
    363 #define _MD_SUSPEND_CPU             _PR_MD_SUSPEND_CPU
    364 #define _MD_RESUME_CPU              _PR_MD_RESUME_CPU
    365 #define _MD_BEGIN_SUSPEND_ALL()
    366 #define _MD_BEGIN_RESUME_ALL()
    367 #define _MD_END_SUSPEND_ALL()
    368 #define _MD_END_RESUME_ALL()
    369 
    370 /* --- Lock stuff --- */
    371 /*
    372 ** Win16 does not need MD locks.
    373 */
    374 #define _PR_LOCK                    _MD_LOCK
    375 #define _PR_UNLOCK                  _MD_UNLOCK
    376 
    377 #define _MD_NEW_LOCK(l)             (PR_SUCCESS)
    378 #define _MD_FREE_LOCK(l)
    379 #define _MD_LOCK(l)
    380 #define _MD_TEST_AND_LOCK(l)        (-1)
    381 #define _MD_UNLOCK(l)
    382 
    383 /* --- lock and cv waiting --- */
    384 #define _MD_WAIT                      _PR_MD_WAIT
    385 #define _MD_WAKEUP_WAITER(a)
    386 #define _MD_WAKEUP_CPUS               _PR_MD_WAKEUP_CPUS
    387 
    388 /* --- CVar ------------------- */
    389 #define _MD_WAIT_CV					  _PR_MD_WAIT_CV
    390 #define _MD_NEW_CV					  _PR_MD_NEW_CV
    391 #define _MD_FREE_CV					  _PR_MD_FREE_CV
    392 #define _MD_NOTIFY_CV				  _PR_MD_NOTIFY_CV
    393 #define _MD_NOTIFYALL_CV			  _PR_MD_NOTIFYALL_CV
    394 
    395    /* XXXMB- the IOQ stuff is certainly not working correctly yet. */
    396 #define _MD_IOQ_LOCK()
    397 #define _MD_IOQ_UNLOCK()
    398 
    399 
    400 /* --- Initialization stuff --- */
    401 NSPR_API(void) _MD_INIT_RUNNING_CPU(struct _PRCPU *cpu );
    402 #define _MD_START_INTERRUPTS()
    403 #define _MD_STOP_INTERRUPTS()
    404 #define _MD_DISABLE_CLOCK_INTERRUPTS()
    405 #define _MD_ENABLE_CLOCK_INTERRUPTS()
    406 #define _MD_BLOCK_CLOCK_INTERRUPTS()
    407 #define _MD_UNBLOCK_CLOCK_INTERRUPTS()
    408 #define _MD_EARLY_INIT                  _PR_MD_EARLY_INIT
    409 #define _MD_FINAL_INIT                  _PR_MD_FINAL_INIT
    410 #define _MD_INIT_CPUS()
    411 
    412 /* --- User Threading stuff --- */
    413 #define _MD_EXIT
    414 
    415 #define _MD_CLEANUP_BEFORE_EXIT              _PR_MD_CLEANUP_BEFORE_EXIT
    416 
    417 /* --- Intervals --- */
    418 #define _MD_INTERVAL_INIT                 _PR_MD_INTERVAL_INIT
    419 #define _MD_GET_INTERVAL                  _PR_MD_GET_INTERVAL
    420 #define _MD_INTERVAL_PER_SEC              _PR_MD_INTERVAL_PER_SEC
    421 #define _MD_INTERVAL_PER_MILLISEC()       (_PR_MD_INTERVAL_PER_SEC() / 1000)
    422 #define _MD_INTERVAL_PER_MICROSEC()       (_PR_MD_INTERVAL_PER_SEC() / 1000000)
    423 
    424 /* --- Scheduler stuff --- */
    425 #define LOCK_SCHEDULER()                 0
    426 #define UNLOCK_SCHEDULER()               0
    427 #define _PR_LockSched()                	 0
    428 #define _PR_UnlockSched()                0
    429 
    430 /* --- Initialization stuff --- */
    431 #define _MD_INIT_LOCKS()
    432 
    433 /* --- Stack stuff --- */
    434 #define _MD_INIT_STACK                   _PR_MD_INIT_STACK
    435 #define _MD_CLEAR_STACK(stack)
    436 
    437 /*
    438 ** Watcom needs to see this to make the linker work.
    439 **
    440 */
    441 NSPR_API(void) _PR_NativeDestroyThread(PRThread *thread);
    442 NSPR_API(void) _PR_UserDestroyThread(PRThread *thread);
    443 
    444 
    445 /*
    446 ** If thread emulation is used, then setjmp/longjmp stores the register
    447 ** state of each thread.
    448 **
    449 ** CatchBuf layout:
    450 **  context[0] - IP
    451 **  context[1] - CS
    452 **  context[2] - SP
    453 **  context[3] - BP
    454 **  context[4] - SI
    455 **  context[5] - DI
    456 **  context[6] - DS
    457 **  context[7] - ?? (maybe flags)
    458 **  context[8] - SS
    459 */
    460 #define PR_CONTEXT_TYPE     CATCHBUF
    461 #define PR_NUM_GCREGS       9
    462 
    463 #define _MD_GET_SP(thread)  ((thread)->md.SP)
    464 #define CONTEXT(_t)  ((_t)->md.context)
    465 
    466 /*
    467 ** Initialize a thread context to run "e(o,a)" when started
    468 */
    469 #define _MD_INIT_CONTEXT(_t, sp, epa, stat )   \
    470 {                                              \
    471      *(stat) = PR_TRUE;                        \
    472      Catch((_t)->md.context );             \
    473      (_t)->md.context[0] = OFFSETOF(epa);         \
    474      (_t)->md.context[1] = SELECTOROF(epa);                       \
    475      (_t)->md.context[2] = OFFSETOF(_pr_top_of_task_stack - 64);  \
    476      (_t)->md.context[3]  = 0;                 \
    477 }
    478 
    479 #define _MD_SWITCH_CONTEXT(_t)                 \
    480     if (!Catch((_t)->md.context)) {            \
    481         int     garbCollPlaceHolder;           \
    482         (_t)->md.errcode = errno;              \
    483         (_t)->md.SP = &garbCollPlaceHolder;    \
    484         _PR_Schedule();                        \
    485     }
    486 
    487 #define _MD_SAVE_CONTEXT(_t)                    \
    488     {                                           \
    489         int     garbCollPlaceHolder;            \
    490         Catch((_t)->md.context);                \
    491         (_t)->md.errcode = errno;               \
    492         (_t)->md.SP = &garbCollPlaceHolder;     \
    493     }
    494 
    495 /*
    496 ** Restore a thread context, saved by _MD_SWITCH_CONTEXT
    497 */
    498 #define _PR_MD_RESTORE_CONTEXT  _MD_RESTORE_CONTEXT
    499 
    500 /*
    501  * Memory-mapped files
    502  */
    503 
    504 struct _MDFileMap {
    505     PRInt8 unused;
    506 };
    507 
    508 extern PRStatus _MD_CreateFileMap(struct PRFileMap *fmap, PRInt64 size);
    509 #define _MD_CREATE_FILE_MAP _MD_CreateFileMap
    510 
    511 extern PRInt32 _MD_GetMemMapAlignment(void);
    512 #define _MD_GET_MEM_MAP_ALIGNMENT _MD_GetMemMapAlignment
    513 
    514 extern void * _MD_MemMap(struct PRFileMap *fmap, PRInt64 offset,
    515         PRUint32 len);
    516 #define _MD_MEM_MAP _MD_MemMap
    517 
    518 extern PRStatus _MD_MemUnmap(void *addr, PRUint32 size);
    519 #define _MD_MEM_UNMAP _MD_MemUnmap
    520 
    521 extern PRStatus _MD_CloseFileMap(struct PRFileMap *fmap);
    522 #define _MD_CLOSE_FILE_MAP _MD_CloseFileMap
    523 
    524 
    525 /* --- Error mapping ----------------------------------- */
    526 extern void _PR_MD_map_error( int err );
    527 
    528 #define _PR_MD_MAP_OPENDIR_ERROR        _PR_MD_map_error
    529 #define _PR_MD_MAP_CLOSEDIR_ERROR       _PR_MD_map_error
    530 #define _PR_MD_MAP_READDIR_ERROR        _PR_MD_map_error
    531 #define _PR_MD_MAP_DELETE_ERROR         _PR_MD_map_error
    532 #define _PR_MD_MAP_STAT_ERROR           _PR_MD_map_error
    533 #define _PR_MD_MAP_FSTAT_ERROR          _PR_MD_map_error
    534 #define _PR_MD_MAP_RENAME_ERROR         _PR_MD_map_error
    535 #define _PR_MD_MAP_ACCESS_ERROR         _PR_MD_map_error
    536 #define _PR_MD_MAP_MKDIR_ERROR          _PR_MD_map_error
    537 #define _PR_MD_MAP_RMDIR_ERROR          _PR_MD_map_error
    538 #define _PR_MD_MAP_READ_ERROR           _PR_MD_map_error
    539 #define _PR_MD_MAP_TRANSMITFILE_ERROR   _PR_MD_map_error
    540 #define _PR_MD_MAP_WRITE_ERROR          _PR_MD_map_error
    541 #define _PR_MD_MAP_LSEEK_ERROR          _PR_MD_map_error
    542 #define _PR_MD_MAP_FSYNC_ERROR          _PR_MD_map_error
    543 #define _PR_MD_MAP_CLOSE_ERROR          _PR_MD_map_error
    544 #define _PR_MD_MAP_SOCKET_ERROR         _PR_MD_map_error
    545 #define _PR_MD_MAP_RECV_ERROR           _PR_MD_map_error
    546 #define _PR_MD_MAP_RECVFROM_ERROR       _PR_MD_map_error
    547 #define _PR_MD_MAP_SEND_ERROR           _PR_MD_map_error
    548 #define _PR_MD_MAP_SENDTO_ERROR         _PR_MD_map_error
    549 #define _PR_MD_MAP_ACCEPT_ERROR         _PR_MD_map_error
    550 #define _PR_MD_MAP_ACCEPTEX_ERROR       _PR_MD_map_error
    551 #define _PR_MD_MAP_CONNECT_ERROR        _PR_MD_map_error
    552 #define _PR_MD_MAP_BIND_ERROR           _PR_MD_map_error
    553 #define _PR_MD_MAP_LISTEN_ERROR         _PR_MD_map_error
    554 #define _PR_MD_MAP_SHUTDOWN_ERROR       _PR_MD_map_error
    555 #define _PR_MD_MAP_GETSOCKNAME_ERROR    _PR_MD_map_error
    556 #define _PR_MD_MAP_GETPEERNAME_ERROR    _PR_MD_map_error
    557 #define _PR_MD_MAP_GETSOCKOPT_ERROR     _PR_MD_map_error
    558 #define _PR_MD_MAP_SETSOCKOPT_ERROR     _PR_MD_map_error
    559 #define _PR_MD_MAP_OPEN_ERROR           _PR_MD_map_error
    560 #define _PR_MD_MAP_GETHOSTNAME_ERROR    _PR_MD_map_error
    561 #define _PR_MD_MAP_SELECT_ERROR         _PR_MD_map_error
    562 #define _PR_MD_MAP_LOCKF_ERROR          _PR_MD_map_error
    563 #define _PR_MD_MAP_WSASTARTUP_ERROR     _PR_MD_map_error
    564 
    565 #endif /* nspr_win16_defs_h___ */
    566