diff options
author | Brad King <brad.king@kitware.com> | 2006-03-08 17:36:14 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2006-03-08 17:36:14 (GMT) |
commit | 95f86d5d6f37d800cc641baba30152d5ef750398 (patch) | |
tree | 6f5890c8e946b0510f38ed17c4234366025d6632 | |
parent | 17d79233ff8693d1c10c1d28baea0b62b75c34af (diff) | |
download | CMake-95f86d5d6f37d800cc641baba30152d5ef750398.zip CMake-95f86d5d6f37d800cc641baba30152d5ef750398.tar.gz CMake-95f86d5d6f37d800cc641baba30152d5ef750398.tar.bz2 |
ENH: Enabled process tree killing for FreeBSD and Sun.
-rw-r--r-- | Source/kwsys/ProcessUNIX.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/Source/kwsys/ProcessUNIX.c b/Source/kwsys/ProcessUNIX.c index e343bfe..14258ce 100644 --- a/Source/kwsys/ProcessUNIX.c +++ b/Source/kwsys/ProcessUNIX.c @@ -1899,15 +1899,14 @@ static pid_t kwsysProcessFork(kwsysProcess* cp, } /*--------------------------------------------------------------------------*/ -/* For systems without the /proc filesystem we try to obtain process - information by invoking the ps command. Here we define the command - to call on each platform and the corresponding parsing format - string. The parsing format should have two integers to store: the - pid and then the ppid. */ -#if defined(__linux__) || defined(__APPLE__) +/* We try to obtain process information by invoking the ps command. + Here we define the command to call on each platform and the + corresponding parsing format string. The parsing format should + have two integers to store: the pid and then the ppid. */ +#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) # define KWSYSPE_PS_COMMAND "ps axo pid,ppid" # define KWSYSPE_PS_FORMAT "%d %d\n" -#elif defined(__hpux) +#elif defined(__hpux) || defined(__sparc) # define KWSYSPE_PS_COMMAND "ps -ef" # define KWSYSPE_PS_FORMAT "%*s %d %d %*[^\n]\n" #endif @@ -1920,8 +1919,9 @@ static void kwsysProcessKill(pid_t process_id) /* Suspend the process to be sure it will not create more children. */ kill(process_id, SIGSTOP); - /* Kill all children if we can find them. First try using the /proc - filesystem. */ + /* Kill all children if we can find them. */ +#if defined(__linux__) + /* First try using the /proc filesystem. */ if((procdir = opendir("/proc")) != NULL) { #if defined(MAXPATHLEN) @@ -1976,8 +1976,9 @@ static void kwsysProcessKill(pid_t process_id) } closedir(procdir); } -#if defined(KWSYSPE_PS_COMMAND) else +#endif +#if defined(KWSYSPE_PS_COMMAND) { /* Try running "ps" to get the process information. */ FILE* ps = popen(KWSYSPE_PS_COMMAND, "r"); |