incubator-stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Farid Zaripov <Far...@kyiv.vdiweb.com>
Subject [PATCH] RE: testsuite process helpers
Date Fri, 20 Oct 2006 14:45:40 GMT
   Attached is a new patch of process helpers.

 > -----Original Message-----
 > From: Martin Sebor [mailto:sebor@roguewave.com]
 > Sent: Wednesday, August 02, 2006 8:30 PM
 > To: stdcxx-dev@incubator.apache.org
 > Subject: Re: testsuite process helpers [PATCH]
[...]
 >
 > >     (rw_wait_pid): Added the timeout parameter.
 >
 > Excellent! Although I think the UNIX branch should probably
 > try to be more robust about handling an existing alarm (or
 > avoiding the function and using some other mechanism).

   In this patch SIGCHLD signal was using.

 > >     (rw_process_kill): New function to kill the specified process.
 >
 > FYI: sending a process the KILL signal is considered quite
 > drastic since the signal cannot be caught and so the process
 > cannot clean up after itself and release system resources.
 > That's why the default behavior of the POSIX kill utility
 > (i.e., when the -s option is not specified) is to send the
 > TERM signal. I think rw_process_kill should behave similarly.
 >
 > I would suggest to add a second argument like this
 >
 >      rw_process_kill (rw_pid_t, int signo = -1);
 >
 > When (signo == -1) the function should provide the same
 > behavior as the analogous code in wait_for_child() here
 > (i.e., start by sending SIGHUP, then SIGINT, then SIGTERM,
 > and only as the last resort, SIGKILL):
 > http://svn.apache.org/repos/asf/incubator/stdcxx/trunk/util/exec.cpp
 > (The Windows branch of the code can ignore the argument
 > unless there is some similar functionality in Win32).

   Done.

   ChangeLog:
      * rw_process.h (rw_pid_t): The type long changed to _RWSTD_SSIZE_T.
      (rw_wait_pid): Added the timeout parameter.
      (rw_process_kill): New function to terminate the specified process.
      * process.cpp [_WIN32] (__rw_map_errno): New function to get errno
      value from WinAPI last error code
      (__rw_split_cmd): Moved to #ifndef _WIN32/#endif
      [_WIN32] (_rw_vprocess_create): Used CreateProcess instead of
      rw_process_create(char*, char* [])
      [_WIN32] (rw_process_create): Used rw_process_create(char*, ...)
      instead of spawnp
      * 0.process.cpp: New test exercising the rw_process_create(),
      rw_process_kill() and rw_waitpid() functions.


Farid.

Mime
View raw message