Index: /trunk/src/libs/xpcom18a4/nsprpub/pr/include/md/_unixos.h
===================================================================
--- /trunk/src/libs/xpcom18a4/nsprpub/pr/include/md/_unixos.h	(revision 32970)
+++ /trunk/src/libs/xpcom18a4/nsprpub/pr/include/md/_unixos.h	(revision 32971)
@@ -173,5 +173,5 @@
 
 #if defined(DEBUG) && !defined(DARWIN) && !defined(NEXTSTEP)
-#if !defined(SOLARIS)	
+#if !defined(SOLARIS)
 #include <string.h>  /* for memset() */
 #define _MD_INIT_STACK(ts,REDZONE)					\
@@ -218,5 +218,5 @@
 #endif	/* DEBUG */
 
-#if !defined(SOLARIS) 
+#if !defined(SOLARIS)
 
 #define PR_SET_INTSOFF(newval)
@@ -246,4 +246,15 @@
 );
 
+#ifdef VBOX
+/* Create a new detached process (fork() + exec()) */
+#define _MD_CREATE_PROCESS_DETACHED _MD_CreateUnixProcessDetached
+extern PRStatus _MD_CreateUnixProcessDetached(
+    const char *path,
+    char *const *argv,
+    char *const *envp,
+    const struct PRProcessAttr *attr
+);
+#endif /* VBOX */
+
 #define _MD_DETACH_PROCESS _MD_DetachUnixProcess
 extern PRStatus _MD_DetachUnixProcess(struct PRProcess *process);
@@ -297,5 +308,5 @@
 
 extern void		_MD_MakeNonblock(PRFileDesc *fd);
-#define _MD_MAKE_NONBLOCK			_MD_MakeNonblock		
+#define _MD_MAKE_NONBLOCK			_MD_MakeNonblock
 
 /************************************************************************/
@@ -401,5 +412,5 @@
 #define _MD_SHUTDOWN	_MD_shutdown
 
-extern PRInt32		_MD_recv(PRFileDesc *fd, void *buf, PRInt32 amount, 
+extern PRInt32		_MD_recv(PRFileDesc *fd, void *buf, PRInt32 amount,
                                PRIntn flags, PRIntervalTime timeout);
 #define _MD_RECV	_MD_recv
Index: /trunk/src/libs/xpcom18a4/nsprpub/pr/include/private/primpl.h
===================================================================
--- /trunk/src/libs/xpcom18a4/nsprpub/pr/include/private/primpl.h	(revision 32970)
+++ /trunk/src/libs/xpcom18a4/nsprpub/pr/include/private/primpl.h	(revision 32971)
@@ -91,11 +91,11 @@
 
 /*
-NSPR 2.0 must implement its function across a range of platforms 
+NSPR 2.0 must implement its function across a range of platforms
 including: MAC, Windows/16, Windows/95, Windows/NT, and several
-variants of Unix. Each implementation shares common code as well 
+variants of Unix. Each implementation shares common code as well
 as having platform dependent portions. This standard describes how
 the model dependent portions are to be implemented.
 
-In header file pr/include/primpl.h, each publicly declared 
+In header file pr/include/primpl.h, each publicly declared
 platform dependent function is declared as:
 
@@ -103,5 +103,5 @@
 #define _PR_MD_FUNCTION _MD_FUNCTION
 
-In header file pr/include/md/<platform>/_<platform>.h, 
+In header file pr/include/md/<platform>/_<platform>.h,
 each #define'd macro is redefined as one of:
 
@@ -113,11 +113,11 @@
 Where:
 
-<blanks> is no definition at all. In this case, the function is not implemented 
-and is never called for this platform. 
-For example: 
+<blanks> is no definition at all. In this case, the function is not implemented
+and is never called for this platform.
+For example:
 #define _MD_INIT_CPUS()
 
-<expanded macro> is a C language macro expansion. 
-For example: 
+<expanded macro> is a C language macro expansion.
+For example:
 #define        _MD_CLEAN_THREAD(_thread) \
     PR_BEGIN_MACRO \
@@ -126,11 +126,11 @@
     PR_END_MACRO
 
-<osFunction> is some function implemented by the host operating system. 
-For example: 
+<osFunction> is some function implemented by the host operating system.
+For example:
 #define _MD_EXIT        exit
 
-<_MD_function> is the name of a function implemented for this platform in 
-pr/src/md/<platform>/<soruce>.c file. 
-For example: 
+<_MD_function> is the name of a function implemented for this platform in
+pr/src/md/<platform>/<soruce>.c file.
+For example:
 #define        _MD_GETFILEINFO         _MD_GetFileInfo
 
@@ -181,5 +181,5 @@
 
 /*
- * bits defined for pthreads 'state' field 
+ * bits defined for pthreads 'state' field
  */
 #define PT_THREAD_DETACHED  0x01    /* thread can't be joined */
@@ -207,5 +207,5 @@
 #endif /* GC_LEAK_DETECTOR */
 
-/* 
+/*
 ** Possible values for thread's suspend field
 ** Note that the first two can be the same as they are really mutually exclusive,
@@ -247,11 +247,11 @@
 #ifdef _PR_LOCAL_THREADS_ONLY
 
-#define        _PR_MD_SUSPEND_THREAD(thread)        
-#define        _PR_MD_RESUME_THREAD(thread)        
-#define        _PR_MD_SUSPEND_CPU(cpu)        
-#define        _PR_MD_RESUME_CPU(cpu)        
-#define        _PR_MD_BEGIN_SUSPEND_ALL()        
-#define        _PR_MD_END_SUSPEND_ALL()        
-#define        _PR_MD_BEGIN_RESUME_ALL()        
+#define        _PR_MD_SUSPEND_THREAD(thread)
+#define        _PR_MD_RESUME_THREAD(thread)
+#define        _PR_MD_SUSPEND_CPU(cpu)
+#define        _PR_MD_RESUME_CPU(cpu)
+#define        _PR_MD_BEGIN_SUSPEND_ALL()
+#define        _PR_MD_END_SUSPEND_ALL()
+#define        _PR_MD_BEGIN_RESUME_ALL()
 #define        _PR_MD_END_RESUME_ALL()
 #define _PR_MD_INIT_ATTACHED_THREAD(thread) PR_FAILURE
@@ -294,5 +294,5 @@
     PRThread *idle_thread;      /* user-level idle thread for this CPUThread */
 
-    PRIntervalTime last_clock;  /* the last time we went into 
+    PRIntervalTime last_clock;  /* the last time we went into
                                  * _PR_ClockInterrupt() on this CPU
                                  */
@@ -317,5 +317,5 @@
 #endif
 
-#ifdef _PR_LOCAL_THREADS_ONLY 
+#ifdef _PR_LOCAL_THREADS_ONLY
 
 NSPR_API(struct _PRCPU *)              _pr_currentCPU;
@@ -405,5 +405,5 @@
     PR_END_MACRO
 
-#ifdef _PR_LOCAL_THREADS_ONLY 
+#ifdef _PR_LOCAL_THREADS_ONLY
 
 #define _PR_IS_NATIVE_THREAD(thread) 0
@@ -435,8 +435,8 @@
 
 #define _PR_ADD_SLEEPQ(_thread, _timeout) \
-    _PR_AddSleepQ(_thread, _timeout);   
+    _PR_AddSleepQ(_thread, _timeout);
 
 #define _PR_DEL_SLEEPQ(_thread, _propogate) \
-    _PR_DelSleepQ(_thread, _propogate);  
+    _PR_DelSleepQ(_thread, _propogate);
 
 #define _PR_ADD_JOINQ(_thread, _cpu) \
@@ -470,5 +470,5 @@
     _PR_MD_LOCK(&(_cpu)->queue->runQLock );\
     PR_END_MACRO
-    
+
 #define _PR_RUNQ_UNLOCK(_cpu) \
     PR_BEGIN_MACRO \
@@ -519,10 +519,10 @@
     PR_ASSERT((_thread)->queueCount == 0); \
     (_thread)->queueCount = QUEUE_SLEEP; \
-    _PR_AddSleepQ(_thread, _timeout);  
+    _PR_AddSleepQ(_thread, _timeout);
 
 #define _PR_DEL_SLEEPQ(_thread, _propogate) \
     PR_ASSERT((_thread)->queueCount == QUEUE_SLEEP);\
     (_thread)->queueCount = 0; \
-    _PR_DelSleepQ(_thread, _propogate);  
+    _PR_DelSleepQ(_thread, _propogate);
 
 #define _PR_ADD_JOINQ(_thread, _cpu) \
@@ -577,5 +577,5 @@
 #define _PR_LOCK_UNLOCK(_lock) \
     _PR_MD_UNLOCK(&(_lock)->ilock);
-    
+
 extern void _PR_UnblockLockWaiter(PRLock *lock);
 
@@ -586,5 +586,5 @@
 
 #define _PR_CVAR_LOCK(_cvar) \
-    _PR_MD_LOCK(&(_cvar)->ilock); 
+    _PR_MD_LOCK(&(_cvar)->ilock);
 #define _PR_CVAR_UNLOCK(_cvar) \
     _PR_MD_UNLOCK(&(_cvar)->ilock);
@@ -626,5 +626,5 @@
 #define _PR_STACK_PRIMORDIAL    0x4    /* stack for primordial thread */
 
-/* 
+/*
 ** If the default stcksize from the client is zero, we need to pick a machine
 ** dependent value.  This is only for standard user threads.  For custom threads,
@@ -996,5 +996,5 @@
 #define    _PR_MD_END_RESUME_ALL _MD_END_RESUME_ALL
 
-#if defined(IRIX) 
+#if defined(IRIX)
 NSPR_API(void) _PR_IRIX_CHILD_PROCESS(void);
 #endif        /* IRIX */
@@ -1017,7 +1017,7 @@
 
 extern PRStatus _PR_MD_CREATE_THREAD(
-                        PRThread *thread, 
-                        void (*start) (void *), 
-                        PRThreadPriority priority,                      
+                        PRThread *thread,
+                        void (*start) (void *),
+                        PRThreadPriority priority,
                         PRThreadScope scope,
                         PRThreadState state,
@@ -1191,14 +1191,14 @@
 #define    _PR_MD_SHUTDOWN _MD_SHUTDOWN
 
-extern PRInt32 _PR_MD_RECV(PRFileDesc *fd, void *buf, PRInt32 amount, 
+extern PRInt32 _PR_MD_RECV(PRFileDesc *fd, void *buf, PRInt32 amount,
                                PRIntn flags, PRIntervalTime timeout);
 #define    _PR_MD_RECV _MD_RECV
 
 extern PRInt32 _PR_MD_SEND(
-    PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags, 
+    PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags,
     PRIntervalTime timeout);
 #define    _PR_MD_SEND _MD_SEND
 
-extern PRInt32 _PR_MD_ACCEPT_READ(PRFileDesc *sd, PRInt32 *newSock, 
+extern PRInt32 _PR_MD_ACCEPT_READ(PRFileDesc *sd, PRInt32 *newSock,
                                 PRNetAddr **raddr, void *buf, PRInt32 amount,
                                 PRIntervalTime timeout);
@@ -1206,5 +1206,5 @@
 
 #ifdef WIN32
-extern PRInt32 _PR_MD_FAST_ACCEPT(PRFileDesc *fd, PRNetAddr *addr, 
+extern PRInt32 _PR_MD_FAST_ACCEPT(PRFileDesc *fd, PRNetAddr *addr,
                                 PRUint32 *addrlen, PRIntervalTime timeout,
                                 PRBool fast,
@@ -1212,5 +1212,5 @@
                                 void *callbackArg);
 
-extern PRInt32 _PR_MD_FAST_ACCEPT_READ(PRFileDesc *sd, PRInt32 *newSock, 
+extern PRInt32 _PR_MD_FAST_ACCEPT_READ(PRFileDesc *sd, PRInt32 *newSock,
                                 PRNetAddr **raddr, void *buf, PRInt32 amount,
                                 PRIntervalTime timeout, PRBool fast,
@@ -1223,5 +1223,5 @@
 
 extern PRInt32 _PR_MD_SENDFILE(
-    PRFileDesc *sock, PRSendFileData *sfd, 
+    PRFileDesc *sock, PRSendFileData *sfd,
 	PRInt32 flags, PRIntervalTime timeout);
 #define _PR_MD_SENDFILE _MD_SENDFILE
@@ -1301,6 +1301,6 @@
         } else { \
                 PR_SetError(PR_IO_TIMEOUT_ERROR, 0); \
-        }                                                        
-                
+        }
+
 extern void *_PR_MD_GET_SP(PRThread *thread);
 #define    _PR_MD_GET_SP _MD_GET_SP
@@ -1454,5 +1454,5 @@
     struct PRThread *owner;         /* current lock owner */
     PRCList waitQ;                  /* list of threads waiting for lock */
-    PRThreadPriority priority;      /* priority of lock */ 
+    PRThreadPriority priority;      /* priority of lock */
     PRThreadPriority boostPriority; /* boosted priority of lock owner */
     _MDLock ilock;                  /* Internal Lock to protect user-level fields */
@@ -1662,5 +1662,5 @@
     PRUint32 threadAllocatedOnStack;/* boolean */
 
-    /* When an async IO is in progress and a second async IO cannot be 
+    /* When an async IO is in progress and a second async IO cannot be
      * initiated, the io_pending flag is set to true.  Some platforms will
      * not use the io_pending flag.  If the io_pending flag is true, then
@@ -1669,10 +1669,10 @@
     PRBool io_pending;
     PRInt32 io_fd;
- 
+
     /* If a timeout occurs or if an outstanding IO is interrupted and the
-     * OS doesn't support a real cancellation (NT or MAC), then the 
+     * OS doesn't support a real cancellation (NT or MAC), then the
      * io_suspended flag will be set to true.  The thread will be resumed
      * but may run into trouble issuing additional IOs until the io_pending
-     * flag can be cleared 
+     * flag can be cleared
      */
     PRBool io_suspended;
@@ -1744,5 +1744,5 @@
 #endif
 #if !defined(XP_UNIX)   /* BugZilla: 4090 */
-    PRBool  appendMode;                             
+    PRBool  appendMode;
 #endif
     _MDFileDesc md;
@@ -1762,8 +1762,8 @@
 
 #ifdef MOZ_UNICODE
-struct PRDirUTF16 { 
-    PRDirEntry d; 
-    _MDDirUTF16 md; 
-}; 
+struct PRDirUTF16 {
+    PRDirEntry d;
+    _MDDirUTF16 md;
+};
 #endif /* MOZ_UNICODE */
 
@@ -1896,4 +1896,8 @@
 #define    _PR_MD_CREATE_PROCESS _MD_CREATE_PROCESS
 
+#ifdef _MD_CREATE_PROCESS_DETACHED
+# define _PR_MD_CREATE_PROCESS_DETACHED _MD_CREATE_PROCESS_DETACHED
+#endif
+
 extern PRStatus _PR_MD_DETACH_PROCESS(PRProcess *process);
 #define    _PR_MD_DETACH_PROCESS _MD_DETACH_PROCESS
@@ -1903,5 +1907,5 @@
 
 extern PRStatus _PR_MD_KILL_PROCESS(PRProcess *process);
-#define    _PR_MD_KILL_PROCESS _MD_KILL_PROCESS        
+#define    _PR_MD_KILL_PROCESS _MD_KILL_PROCESS
 
 /* Current Time */
@@ -2000,5 +2004,5 @@
 ** Declare PRSharedMemory.
 */
-struct PRSharedMemory 
+struct PRSharedMemory
 {
     char        *ipcname; /* after conversion to native */
@@ -2018,6 +2022,6 @@
 #define _PR_SHM_IDENT 0xdeadbad
 };
-                                                      
-extern PRSharedMemory * _MD_OpenSharedMemory( 
+
+extern PRSharedMemory * _MD_OpenSharedMemory(
     const char *name,
     PRSize      size,
@@ -2039,5 +2043,5 @@
 #define _PR_MD_DELETE_SHARED_MEMORY  _MD_DeleteSharedMemory
 
-extern PRFileMap* _md_OpenAnonFileMap( 
+extern PRFileMap* _md_OpenAnonFileMap(
     const char *dirName,
     PRSize      size,
Index: /trunk/src/libs/xpcom18a4/nsprpub/pr/src/md/unix/uxproces.c
===================================================================
--- /trunk/src/libs/xpcom18a4/nsprpub/pr/src/md/unix/uxproces.c	(revision 32970)
+++ /trunk/src/libs/xpcom18a4/nsprpub/pr/src/md/unix/uxproces.c	(revision 32971)
@@ -64,4 +64,10 @@
 #endif
 
+#ifdef VBOX
+#include <iprt/err.h>
+#include <iprt/env.h>
+#include <iprt/process.h>
+#endif
+
 /*
  **********************************************************************
@@ -179,5 +185,5 @@
 #ifdef VMS
     char VMScurdir[FILENAME_MAX+1] = { '\0' } ;
-#endif	
+#endif
 
     process = PR_NEW(PRProcess);
@@ -530,4 +536,54 @@
 
 #endif  /* _PR_SHARE_CLONES */
+
+#ifdef VBOX
+PRStatus
+_MD_CreateUnixProcessDetached(
+    const char *path,
+    char *const *argv,
+    char *const *envp,
+    const PRProcessAttr *attr)
+{
+    int vrc;
+    int nEnv, idx;
+    RTENV childEnv;
+    RTENV newEnv = RTENV_DEFAULT;
+
+    if (PR_CallOnce(&pr_wp.once, _MD_InitProcesses) == PR_FAILURE) {
+	    return PR_FAILURE;
+    }
+    /* this code doesn't support all attributes */
+    PR_ASSERT(!attr || !attr->currentDirectory);
+    PR_ASSERT(!attr || !attr->stdinFd);
+    PR_ASSERT(!attr || !attr->stdoutFd);
+    PR_ASSERT(!attr || !attr->stderrFd);
+    /* no custom environment, please */
+    PR_ASSERT(!envp);
+
+    childEnv = RTENV_DEFAULT;
+    if (attr && attr->fdInheritBuffer) {
+        vrc = RTEnvClone(&newEnv, childEnv);
+        if (RT_FAILURE(vrc))
+            return PR_FAILURE;
+        vrc = RTEnvPutEx(newEnv, attr->fdInheritBuffer);
+        if (RT_FAILURE(vrc))
+        {
+            RTEnvDestroy(newEnv);
+            return PR_FAILURE;
+        }
+        childEnv = newEnv;
+    }
+
+    vrc = RTProcCreate(path, (const char **)argv, childEnv,
+                       RTPROC_FLAGS_DETACHED, NULL);
+    if (newEnv != RTENV_DEFAULT) {
+        RTEnvDestroy(newEnv);
+    }
+    if (RT_SUCCESS(vrc))
+        return PR_SUCCESS;
+    else
+        return PR_FAILURE;
+}  /* _MD_CreateUnixProcessDetached */
+#endif
 
 /*
@@ -688,5 +744,5 @@
              * waitpid() cannot return 0 because we did not invoke it
              * with the WNOHANG option.
-             */ 
+             */
 	    PR_ASSERT(0 != pid);
 
@@ -745,5 +801,5 @@
 	PR_Lock(pr_wp.ml);
 #endif
-	    
+
         do {
             rv = read(pr_wp.pipefd[0], buf, sizeof(buf));
Index: /trunk/src/libs/xpcom18a4/nsprpub/pr/src/misc/prinit.c
===================================================================
--- /trunk/src/libs/xpcom18a4/nsprpub/pr/src/misc/prinit.c	(revision 32970)
+++ /trunk/src/libs/xpcom18a4/nsprpub/pr/src/misc/prinit.c	(revision 32971)
@@ -41,5 +41,5 @@
 #ifdef VBOX_USE_IPRT_IN_NSPR
 # include <iprt/initterm.h>
-#endif 
+#endif
 
 PRLogModuleInfo *_pr_clock_lm;
@@ -178,5 +178,5 @@
 #ifdef VBOX_USE_IPRT_IN_NSPR
     RTR3Init();
-#endif 
+#endif
 #ifdef _PR_ZONE_ALLOCATOR
     _PR_InitZones();
@@ -200,6 +200,6 @@
 	_pr_shm_lm = PR_NewLogModule("shm");
 	_pr_shma_lm = PR_NewLogModule("shma");
-      
-    /* NOTE: These init's cannot depend on _PR_MD_CURRENT_THREAD() */ 
+
+    /* NOTE: These init's cannot depend on _PR_MD_CURRENT_THREAD() */
     _PR_MD_EARLY_INIT();
 
@@ -221,5 +221,5 @@
 
     _PR_InitThreads(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0);
-    
+
 #ifdef WIN16
 	{
@@ -227,5 +227,5 @@
     _pr_top_of_task_stack = (char *) &top;
 	}
-#endif    
+#endif
 
 #ifndef _PR_GLOBAL_THREADS_ONLY
@@ -256,5 +256,5 @@
 	_pr_init_ipv6();
 #endif
-	
+
     _PR_MD_FINAL_INIT();
 }
@@ -335,5 +335,5 @@
  * _PR_CleanupBeforeExit --
  *
- *   Perform the cleanup work before exiting the process. 
+ *   Perform the cleanup work before exiting the process.
  *   We first do the cleanup generic to all platforms.  Then
  *   we call _PR_MD_CLEANUP_BEFORE_EXIT(), where platform-dependent
@@ -350,5 +350,5 @@
 _PR_CleanupBeforeExit(void)
 {
-/* 
+/*
 Do not make any calls here other than to destroy resources.  For example,
 do not make any calls that eventually may end up in PR_Lock.  Because the
@@ -383,5 +383,5 @@
  *   PR_Cleanup() does not exit the primordial thread (which would
  *   in turn exit the process).
- *   
+ *
  *   PR_Cleanup() only responds when it is called by the primordial
  *   thread. Calls by any other thread are silently ignored.
@@ -481,9 +481,9 @@
  *------------------------------------------------------------------------
  * PR_ProcessExit --
- * 
+ *
  *   Cause an immediate, nongraceful, forced termination of the process.
  *   It takes a PRIntn argument, which is the exit status code of the
  *   process.
- *   
+ *
  * See also: PR_Cleanup()
  *
@@ -658,5 +658,5 @@
                 name, (PRIntn)fd->methods->file_type, fd->secret->md.osfd);
     }
-    attr->fdInheritBufferUsed += nwritten; 
+    attr->fdInheritBufferUsed += nwritten;
     return PR_SUCCESS;
 }
@@ -746,7 +746,8 @@
     const PRProcessAttr *attr)
 {
+#ifndef _PR_MD_CREATE_PROCESS_DETACHED
     PRProcess *process;
     PRStatus rv;
-
+s
 #ifdef XP_OS2
     process = _PR_CreateOS2ProcessEx(path, argv, envp, attr, PR_TRUE);
@@ -764,4 +765,7 @@
     }
     return PR_SUCCESS;
+#else /* _PR_MD_CREATE_PROCESS_DETACHED */
+    return _PR_MD_CREATE_PROCESS_DETACHED(path, argv, envp, attr);
+#endif /* _PR_MD_CREATE_PROCESS_DETACHED */
 }
 
