Alexandre Julliard : kernel: Better support for detached processes.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Mar 6 15:28:05 CST 2006


Module: wine
Branch: refs/heads/master
Commit: a401f3c4bb5819e6fcfefa9587eca60796531c4a
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=a401f3c4bb5819e6fcfefa9587eca60796531c4a

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Mar  6 22:22:30 2006 +0100

kernel: Better support for detached processes.

Call setsid() in the new process to create a new Unix process group
when CREATE_NEW_PROCESS_GROUP, CREATE_NEW_CONSOLE, or DETACHED_PROCESS
are specified.

---

 dlls/kernel/process.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/dlls/kernel/process.c b/dlls/kernel/process.c
index 62b6669..d1ff341 100644
--- a/dlls/kernel/process.c
+++ b/dlls/kernel/process.c
@@ -1116,7 +1116,7 @@ static char **build_envp( const WCHAR *e
  * Fork and exec a new Unix binary, checking for errors.
  */
 static int fork_and_exec( const char *filename, const WCHAR *cmdline,
-                          const WCHAR *env, const char *newdir )
+                          const WCHAR *env, const char *newdir, DWORD flags )
 {
     int fd[2];
     int pid, err;
@@ -1135,6 +1135,8 @@ static int fork_and_exec( const char *fi
         char **envp = build_envp( env );
         close( fd[0] );
 
+        if (flags & (CREATE_NEW_PROCESS_GROUP | CREATE_NEW_CONSOLE | DETACHED_PROCESS)) setsid();
+
         /* Reset signals that we previously set to SIG_IGN */
         signal( SIGPIPE, SIG_DFL );
         signal( SIGCHLD, SIG_DFL );
@@ -1302,6 +1304,8 @@ static BOOL create_process( HANDLE hFile
         if (read( startfd[0], &dummy, 1 ) != 1) _exit(1);
 
         close( startfd[0] );
+        if (flags & (CREATE_NEW_PROCESS_GROUP | CREATE_NEW_CONSOLE | DETACHED_PROCESS)) setsid();
+
         /* Reset signals that we previously set to SIG_IGN */
         signal( SIGPIPE, SIG_DFL );
         signal( SIGCHLD, SIG_DFL );
@@ -1743,7 +1747,7 @@ BOOL WINAPI CreateProcessW( LPCWSTR app_
 
             if ((unix_name = wine_get_unix_file_name( name )))
             {
-                retv = (fork_and_exec( unix_name, tidy_cmdline, envW, unixdir ) != -1);
+                retv = (fork_and_exec( unix_name, tidy_cmdline, envW, unixdir, flags ) != -1);
                 HeapFree( GetProcessHeap(), 0, unix_name );
             }
         }




More information about the wine-cvs mailing list