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