_win16.h 19 KB

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