Changeset 32971 in vbox
- Timestamp:
- Oct 7, 2010 10:15:26 AM (14 years ago)
- Location:
- trunk/src/libs/xpcom18a4/nsprpub/pr
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/xpcom18a4/nsprpub/pr/include/md/_unixos.h
r1 r32971 173 173 174 174 #if defined(DEBUG) && !defined(DARWIN) && !defined(NEXTSTEP) 175 #if !defined(SOLARIS) 175 #if !defined(SOLARIS) 176 176 #include <string.h> /* for memset() */ 177 177 #define _MD_INIT_STACK(ts,REDZONE) \ … … 218 218 #endif /* DEBUG */ 219 219 220 #if !defined(SOLARIS) 220 #if !defined(SOLARIS) 221 221 222 222 #define PR_SET_INTSOFF(newval) … … 246 246 ); 247 247 248 #ifdef VBOX 249 /* Create a new detached process (fork() + exec()) */ 250 #define _MD_CREATE_PROCESS_DETACHED _MD_CreateUnixProcessDetached 251 extern PRStatus _MD_CreateUnixProcessDetached( 252 const char *path, 253 char *const *argv, 254 char *const *envp, 255 const struct PRProcessAttr *attr 256 ); 257 #endif /* VBOX */ 258 248 259 #define _MD_DETACH_PROCESS _MD_DetachUnixProcess 249 260 extern PRStatus _MD_DetachUnixProcess(struct PRProcess *process); … … 297 308 298 309 extern void _MD_MakeNonblock(PRFileDesc *fd); 299 #define _MD_MAKE_NONBLOCK _MD_MakeNonblock 310 #define _MD_MAKE_NONBLOCK _MD_MakeNonblock 300 311 301 312 /************************************************************************/ … … 401 412 #define _MD_SHUTDOWN _MD_shutdown 402 413 403 extern PRInt32 _MD_recv(PRFileDesc *fd, void *buf, PRInt32 amount, 414 extern PRInt32 _MD_recv(PRFileDesc *fd, void *buf, PRInt32 amount, 404 415 PRIntn flags, PRIntervalTime timeout); 405 416 #define _MD_RECV _MD_recv -
trunk/src/libs/xpcom18a4/nsprpub/pr/include/private/primpl.h
r11551 r32971 91 91 92 92 /* 93 NSPR 2.0 must implement its function across a range of platforms 93 NSPR 2.0 must implement its function across a range of platforms 94 94 including: MAC, Windows/16, Windows/95, Windows/NT, and several 95 variants of Unix. Each implementation shares common code as well 95 variants of Unix. Each implementation shares common code as well 96 96 as having platform dependent portions. This standard describes how 97 97 the model dependent portions are to be implemented. 98 98 99 In header file pr/include/primpl.h, each publicly declared 99 In header file pr/include/primpl.h, each publicly declared 100 100 platform dependent function is declared as: 101 101 … … 103 103 #define _PR_MD_FUNCTION _MD_FUNCTION 104 104 105 In header file pr/include/md/<platform>/_<platform>.h, 105 In header file pr/include/md/<platform>/_<platform>.h, 106 106 each #define'd macro is redefined as one of: 107 107 … … 113 113 Where: 114 114 115 <blanks> is no definition at all. In this case, the function is not implemented 116 and is never called for this platform. 117 For example: 115 <blanks> is no definition at all. In this case, the function is not implemented 116 and is never called for this platform. 117 For example: 118 118 #define _MD_INIT_CPUS() 119 119 120 <expanded macro> is a C language macro expansion. 121 For example: 120 <expanded macro> is a C language macro expansion. 121 For example: 122 122 #define _MD_CLEAN_THREAD(_thread) \ 123 123 PR_BEGIN_MACRO \ … … 126 126 PR_END_MACRO 127 127 128 <osFunction> is some function implemented by the host operating system. 129 For example: 128 <osFunction> is some function implemented by the host operating system. 129 For example: 130 130 #define _MD_EXIT exit 131 131 132 <_MD_function> is the name of a function implemented for this platform in 133 pr/src/md/<platform>/<soruce>.c file. 134 For example: 132 <_MD_function> is the name of a function implemented for this platform in 133 pr/src/md/<platform>/<soruce>.c file. 134 For example: 135 135 #define _MD_GETFILEINFO _MD_GetFileInfo 136 136 … … 181 181 182 182 /* 183 * bits defined for pthreads 'state' field 183 * bits defined for pthreads 'state' field 184 184 */ 185 185 #define PT_THREAD_DETACHED 0x01 /* thread can't be joined */ … … 207 207 #endif /* GC_LEAK_DETECTOR */ 208 208 209 /* 209 /* 210 210 ** Possible values for thread's suspend field 211 211 ** Note that the first two can be the same as they are really mutually exclusive, … … 247 247 #ifdef _PR_LOCAL_THREADS_ONLY 248 248 249 #define _PR_MD_SUSPEND_THREAD(thread) 250 #define _PR_MD_RESUME_THREAD(thread) 251 #define _PR_MD_SUSPEND_CPU(cpu) 252 #define _PR_MD_RESUME_CPU(cpu) 253 #define _PR_MD_BEGIN_SUSPEND_ALL() 254 #define _PR_MD_END_SUSPEND_ALL() 255 #define _PR_MD_BEGIN_RESUME_ALL() 249 #define _PR_MD_SUSPEND_THREAD(thread) 250 #define _PR_MD_RESUME_THREAD(thread) 251 #define _PR_MD_SUSPEND_CPU(cpu) 252 #define _PR_MD_RESUME_CPU(cpu) 253 #define _PR_MD_BEGIN_SUSPEND_ALL() 254 #define _PR_MD_END_SUSPEND_ALL() 255 #define _PR_MD_BEGIN_RESUME_ALL() 256 256 #define _PR_MD_END_RESUME_ALL() 257 257 #define _PR_MD_INIT_ATTACHED_THREAD(thread) PR_FAILURE … … 294 294 PRThread *idle_thread; /* user-level idle thread for this CPUThread */ 295 295 296 PRIntervalTime last_clock; /* the last time we went into 296 PRIntervalTime last_clock; /* the last time we went into 297 297 * _PR_ClockInterrupt() on this CPU 298 298 */ … … 317 317 #endif 318 318 319 #ifdef _PR_LOCAL_THREADS_ONLY 319 #ifdef _PR_LOCAL_THREADS_ONLY 320 320 321 321 NSPR_API(struct _PRCPU *) _pr_currentCPU; … … 405 405 PR_END_MACRO 406 406 407 #ifdef _PR_LOCAL_THREADS_ONLY 407 #ifdef _PR_LOCAL_THREADS_ONLY 408 408 409 409 #define _PR_IS_NATIVE_THREAD(thread) 0 … … 435 435 436 436 #define _PR_ADD_SLEEPQ(_thread, _timeout) \ 437 _PR_AddSleepQ(_thread, _timeout); 437 _PR_AddSleepQ(_thread, _timeout); 438 438 439 439 #define _PR_DEL_SLEEPQ(_thread, _propogate) \ 440 _PR_DelSleepQ(_thread, _propogate); 440 _PR_DelSleepQ(_thread, _propogate); 441 441 442 442 #define _PR_ADD_JOINQ(_thread, _cpu) \ … … 470 470 _PR_MD_LOCK(&(_cpu)->queue->runQLock );\ 471 471 PR_END_MACRO 472 472 473 473 #define _PR_RUNQ_UNLOCK(_cpu) \ 474 474 PR_BEGIN_MACRO \ … … 519 519 PR_ASSERT((_thread)->queueCount == 0); \ 520 520 (_thread)->queueCount = QUEUE_SLEEP; \ 521 _PR_AddSleepQ(_thread, _timeout); 521 _PR_AddSleepQ(_thread, _timeout); 522 522 523 523 #define _PR_DEL_SLEEPQ(_thread, _propogate) \ 524 524 PR_ASSERT((_thread)->queueCount == QUEUE_SLEEP);\ 525 525 (_thread)->queueCount = 0; \ 526 _PR_DelSleepQ(_thread, _propogate); 526 _PR_DelSleepQ(_thread, _propogate); 527 527 528 528 #define _PR_ADD_JOINQ(_thread, _cpu) \ … … 577 577 #define _PR_LOCK_UNLOCK(_lock) \ 578 578 _PR_MD_UNLOCK(&(_lock)->ilock); 579 579 580 580 extern void _PR_UnblockLockWaiter(PRLock *lock); 581 581 … … 586 586 587 587 #define _PR_CVAR_LOCK(_cvar) \ 588 _PR_MD_LOCK(&(_cvar)->ilock); 588 _PR_MD_LOCK(&(_cvar)->ilock); 589 589 #define _PR_CVAR_UNLOCK(_cvar) \ 590 590 _PR_MD_UNLOCK(&(_cvar)->ilock); … … 626 626 #define _PR_STACK_PRIMORDIAL 0x4 /* stack for primordial thread */ 627 627 628 /* 628 /* 629 629 ** If the default stcksize from the client is zero, we need to pick a machine 630 630 ** dependent value. This is only for standard user threads. For custom threads, … … 996 996 #define _PR_MD_END_RESUME_ALL _MD_END_RESUME_ALL 997 997 998 #if defined(IRIX) 998 #if defined(IRIX) 999 999 NSPR_API(void) _PR_IRIX_CHILD_PROCESS(void); 1000 1000 #endif /* IRIX */ … … 1017 1017 1018 1018 extern PRStatus _PR_MD_CREATE_THREAD( 1019 PRThread *thread, 1020 void (*start) (void *), 1021 PRThreadPriority priority, 1019 PRThread *thread, 1020 void (*start) (void *), 1021 PRThreadPriority priority, 1022 1022 PRThreadScope scope, 1023 1023 PRThreadState state, … … 1191 1191 #define _PR_MD_SHUTDOWN _MD_SHUTDOWN 1192 1192 1193 extern PRInt32 _PR_MD_RECV(PRFileDesc *fd, void *buf, PRInt32 amount, 1193 extern PRInt32 _PR_MD_RECV(PRFileDesc *fd, void *buf, PRInt32 amount, 1194 1194 PRIntn flags, PRIntervalTime timeout); 1195 1195 #define _PR_MD_RECV _MD_RECV 1196 1196 1197 1197 extern PRInt32 _PR_MD_SEND( 1198 PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, 1198 PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, 1199 1199 PRIntervalTime timeout); 1200 1200 #define _PR_MD_SEND _MD_SEND 1201 1201 1202 extern PRInt32 _PR_MD_ACCEPT_READ(PRFileDesc *sd, PRInt32 *newSock, 1202 extern PRInt32 _PR_MD_ACCEPT_READ(PRFileDesc *sd, PRInt32 *newSock, 1203 1203 PRNetAddr **raddr, void *buf, PRInt32 amount, 1204 1204 PRIntervalTime timeout); … … 1206 1206 1207 1207 #ifdef WIN32 1208 extern PRInt32 _PR_MD_FAST_ACCEPT(PRFileDesc *fd, PRNetAddr *addr, 1208 extern PRInt32 _PR_MD_FAST_ACCEPT(PRFileDesc *fd, PRNetAddr *addr, 1209 1209 PRUint32 *addrlen, PRIntervalTime timeout, 1210 1210 PRBool fast, … … 1212 1212 void *callbackArg); 1213 1213 1214 extern PRInt32 _PR_MD_FAST_ACCEPT_READ(PRFileDesc *sd, PRInt32 *newSock, 1214 extern PRInt32 _PR_MD_FAST_ACCEPT_READ(PRFileDesc *sd, PRInt32 *newSock, 1215 1215 PRNetAddr **raddr, void *buf, PRInt32 amount, 1216 1216 PRIntervalTime timeout, PRBool fast, … … 1223 1223 1224 1224 extern PRInt32 _PR_MD_SENDFILE( 1225 PRFileDesc *sock, PRSendFileData *sfd, 1225 PRFileDesc *sock, PRSendFileData *sfd, 1226 1226 PRInt32 flags, PRIntervalTime timeout); 1227 1227 #define _PR_MD_SENDFILE _MD_SENDFILE … … 1301 1301 } else { \ 1302 1302 PR_SetError(PR_IO_TIMEOUT_ERROR, 0); \ 1303 } 1304 1303 } 1304 1305 1305 extern void *_PR_MD_GET_SP(PRThread *thread); 1306 1306 #define _PR_MD_GET_SP _MD_GET_SP … … 1454 1454 struct PRThread *owner; /* current lock owner */ 1455 1455 PRCList waitQ; /* list of threads waiting for lock */ 1456 PRThreadPriority priority; /* priority of lock */ 1456 PRThreadPriority priority; /* priority of lock */ 1457 1457 PRThreadPriority boostPriority; /* boosted priority of lock owner */ 1458 1458 _MDLock ilock; /* Internal Lock to protect user-level fields */ … … 1662 1662 PRUint32 threadAllocatedOnStack;/* boolean */ 1663 1663 1664 /* When an async IO is in progress and a second async IO cannot be 1664 /* When an async IO is in progress and a second async IO cannot be 1665 1665 * initiated, the io_pending flag is set to true. Some platforms will 1666 1666 * not use the io_pending flag. If the io_pending flag is true, then … … 1669 1669 PRBool io_pending; 1670 1670 PRInt32 io_fd; 1671 1671 1672 1672 /* If a timeout occurs or if an outstanding IO is interrupted and the 1673 * OS doesn't support a real cancellation (NT or MAC), then the 1673 * OS doesn't support a real cancellation (NT or MAC), then the 1674 1674 * io_suspended flag will be set to true. The thread will be resumed 1675 1675 * but may run into trouble issuing additional IOs until the io_pending 1676 * flag can be cleared 1676 * flag can be cleared 1677 1677 */ 1678 1678 PRBool io_suspended; … … 1744 1744 #endif 1745 1745 #if !defined(XP_UNIX) /* BugZilla: 4090 */ 1746 PRBool appendMode; 1746 PRBool appendMode; 1747 1747 #endif 1748 1748 _MDFileDesc md; … … 1762 1762 1763 1763 #ifdef MOZ_UNICODE 1764 struct PRDirUTF16 { 1765 PRDirEntry d; 1766 _MDDirUTF16 md; 1767 }; 1764 struct PRDirUTF16 { 1765 PRDirEntry d; 1766 _MDDirUTF16 md; 1767 }; 1768 1768 #endif /* MOZ_UNICODE */ 1769 1769 … … 1896 1896 #define _PR_MD_CREATE_PROCESS _MD_CREATE_PROCESS 1897 1897 1898 #ifdef _MD_CREATE_PROCESS_DETACHED 1899 # define _PR_MD_CREATE_PROCESS_DETACHED _MD_CREATE_PROCESS_DETACHED 1900 #endif 1901 1898 1902 extern PRStatus _PR_MD_DETACH_PROCESS(PRProcess *process); 1899 1903 #define _PR_MD_DETACH_PROCESS _MD_DETACH_PROCESS … … 1903 1907 1904 1908 extern PRStatus _PR_MD_KILL_PROCESS(PRProcess *process); 1905 #define _PR_MD_KILL_PROCESS _MD_KILL_PROCESS 1909 #define _PR_MD_KILL_PROCESS _MD_KILL_PROCESS 1906 1910 1907 1911 /* Current Time */ … … 2000 2004 ** Declare PRSharedMemory. 2001 2005 */ 2002 struct PRSharedMemory 2006 struct PRSharedMemory 2003 2007 { 2004 2008 char *ipcname; /* after conversion to native */ … … 2018 2022 #define _PR_SHM_IDENT 0xdeadbad 2019 2023 }; 2020 2021 extern PRSharedMemory * _MD_OpenSharedMemory( 2024 2025 extern PRSharedMemory * _MD_OpenSharedMemory( 2022 2026 const char *name, 2023 2027 PRSize size, … … 2039 2043 #define _PR_MD_DELETE_SHARED_MEMORY _MD_DeleteSharedMemory 2040 2044 2041 extern PRFileMap* _md_OpenAnonFileMap( 2045 extern PRFileMap* _md_OpenAnonFileMap( 2042 2046 const char *dirName, 2043 2047 PRSize size, -
trunk/src/libs/xpcom18a4/nsprpub/pr/src/md/unix/uxproces.c
r23919 r32971 64 64 #endif 65 65 66 #ifdef VBOX 67 #include <iprt/err.h> 68 #include <iprt/env.h> 69 #include <iprt/process.h> 70 #endif 71 66 72 /* 67 73 ********************************************************************** … … 179 185 #ifdef VMS 180 186 char VMScurdir[FILENAME_MAX+1] = { '\0' } ; 181 #endif 187 #endif 182 188 183 189 process = PR_NEW(PRProcess); … … 530 536 531 537 #endif /* _PR_SHARE_CLONES */ 538 539 #ifdef VBOX 540 PRStatus 541 _MD_CreateUnixProcessDetached( 542 const char *path, 543 char *const *argv, 544 char *const *envp, 545 const PRProcessAttr *attr) 546 { 547 int vrc; 548 int nEnv, idx; 549 RTENV childEnv; 550 RTENV newEnv = RTENV_DEFAULT; 551 552 if (PR_CallOnce(&pr_wp.once, _MD_InitProcesses) == PR_FAILURE) { 553 return PR_FAILURE; 554 } 555 /* this code doesn't support all attributes */ 556 PR_ASSERT(!attr || !attr->currentDirectory); 557 PR_ASSERT(!attr || !attr->stdinFd); 558 PR_ASSERT(!attr || !attr->stdoutFd); 559 PR_ASSERT(!attr || !attr->stderrFd); 560 /* no custom environment, please */ 561 PR_ASSERT(!envp); 562 563 childEnv = RTENV_DEFAULT; 564 if (attr && attr->fdInheritBuffer) { 565 vrc = RTEnvClone(&newEnv, childEnv); 566 if (RT_FAILURE(vrc)) 567 return PR_FAILURE; 568 vrc = RTEnvPutEx(newEnv, attr->fdInheritBuffer); 569 if (RT_FAILURE(vrc)) 570 { 571 RTEnvDestroy(newEnv); 572 return PR_FAILURE; 573 } 574 childEnv = newEnv; 575 } 576 577 vrc = RTProcCreate(path, (const char **)argv, childEnv, 578 RTPROC_FLAGS_DETACHED, NULL); 579 if (newEnv != RTENV_DEFAULT) { 580 RTEnvDestroy(newEnv); 581 } 582 if (RT_SUCCESS(vrc)) 583 return PR_SUCCESS; 584 else 585 return PR_FAILURE; 586 } /* _MD_CreateUnixProcessDetached */ 587 #endif 532 588 533 589 /* … … 688 744 * waitpid() cannot return 0 because we did not invoke it 689 745 * with the WNOHANG option. 690 */ 746 */ 691 747 PR_ASSERT(0 != pid); 692 748 … … 745 801 PR_Lock(pr_wp.ml); 746 802 #endif 747 803 748 804 do { 749 805 rv = read(pr_wp.pipefd[0], buf, sizeof(buf)); -
trunk/src/libs/xpcom18a4/nsprpub/pr/src/misc/prinit.c
r11822 r32971 41 41 #ifdef VBOX_USE_IPRT_IN_NSPR 42 42 # include <iprt/initterm.h> 43 #endif 43 #endif 44 44 45 45 PRLogModuleInfo *_pr_clock_lm; … … 178 178 #ifdef VBOX_USE_IPRT_IN_NSPR 179 179 RTR3Init(); 180 #endif 180 #endif 181 181 #ifdef _PR_ZONE_ALLOCATOR 182 182 _PR_InitZones(); … … 200 200 _pr_shm_lm = PR_NewLogModule("shm"); 201 201 _pr_shma_lm = PR_NewLogModule("shma"); 202 203 /* NOTE: These init's cannot depend on _PR_MD_CURRENT_THREAD() */ 202 203 /* NOTE: These init's cannot depend on _PR_MD_CURRENT_THREAD() */ 204 204 _PR_MD_EARLY_INIT(); 205 205 … … 221 221 222 222 _PR_InitThreads(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0); 223 223 224 224 #ifdef WIN16 225 225 { … … 227 227 _pr_top_of_task_stack = (char *) ⊤ 228 228 } 229 #endif 229 #endif 230 230 231 231 #ifndef _PR_GLOBAL_THREADS_ONLY … … 256 256 _pr_init_ipv6(); 257 257 #endif 258 258 259 259 _PR_MD_FINAL_INIT(); 260 260 } … … 335 335 * _PR_CleanupBeforeExit -- 336 336 * 337 * Perform the cleanup work before exiting the process. 337 * Perform the cleanup work before exiting the process. 338 338 * We first do the cleanup generic to all platforms. Then 339 339 * we call _PR_MD_CLEANUP_BEFORE_EXIT(), where platform-dependent … … 350 350 _PR_CleanupBeforeExit(void) 351 351 { 352 /* 352 /* 353 353 Do not make any calls here other than to destroy resources. For example, 354 354 do not make any calls that eventually may end up in PR_Lock. Because the … … 383 383 * PR_Cleanup() does not exit the primordial thread (which would 384 384 * in turn exit the process). 385 * 385 * 386 386 * PR_Cleanup() only responds when it is called by the primordial 387 387 * thread. Calls by any other thread are silently ignored. … … 481 481 *------------------------------------------------------------------------ 482 482 * PR_ProcessExit -- 483 * 483 * 484 484 * Cause an immediate, nongraceful, forced termination of the process. 485 485 * It takes a PRIntn argument, which is the exit status code of the 486 486 * process. 487 * 487 * 488 488 * See also: PR_Cleanup() 489 489 * … … 658 658 name, (PRIntn)fd->methods->file_type, fd->secret->md.osfd); 659 659 } 660 attr->fdInheritBufferUsed += nwritten; 660 attr->fdInheritBufferUsed += nwritten; 661 661 return PR_SUCCESS; 662 662 } … … 746 746 const PRProcessAttr *attr) 747 747 { 748 #ifndef _PR_MD_CREATE_PROCESS_DETACHED 748 749 PRProcess *process; 749 750 PRStatus rv; 750 751 s 751 752 #ifdef XP_OS2 752 753 process = _PR_CreateOS2ProcessEx(path, argv, envp, attr, PR_TRUE); … … 764 765 } 765 766 return PR_SUCCESS; 767 #else /* _PR_MD_CREATE_PROCESS_DETACHED */ 768 return _PR_MD_CREATE_PROCESS_DETACHED(path, argv, envp, attr); 769 #endif /* _PR_MD_CREATE_PROCESS_DETACHED */ 766 770 } 767 771
Note:
See TracChangeset
for help on using the changeset viewer.