diff options
author | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2002-11-05 17:50:46 +0000 |
---|---|---|
committer | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2002-11-05 17:50:46 +0000 |
commit | b9001e1be5f38f81a5854ab6a6264ff8dc9f164c (patch) | |
tree | fbfcd84461d0c99307a5998c9b296e91c89dfaa0 | |
parent | 5af9eb542c4c5a11884baf5e8ba666741c073603 (diff) | |
download | ATCD-b9001e1be5f38f81a5854ab6a6264ff8dc9f164c.tar.gz |
ChangeLogTag:Tue Nov 5 11:24:03 2002 Nanbor Wang <nanbor@cs.wustl.edu>
-rw-r--r-- | ChangeLog | 14 | ||||
-rw-r--r-- | ChangeLogs/ChangeLog-03a | 14 | ||||
-rw-r--r-- | ace/Process.h | 24 | ||||
-rw-r--r-- | ace/Process.i | 10 |
4 files changed, 52 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog index 8b9dae0e47a..4ccfeb477ff 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +Tue Nov 5 11:24:03 2002 Nanbor Wang <nanbor@cs.wustl.edu> + + * ace/Process.h: + * ace/Process.i: Added a new method <return_value> which returns + the actual value returned or <exit>'ed by the child process. + The <exit_code> accessor returns the raw exit status returned by + the system APIs and the value is OS dependent. Changed the + <exit_code> mutator to be a proctected method and declare + ACE_Process_Manager a fried of ACE_Process as <exit_code> + mutator should only be used by ACE_Process_Manager. + + Thanks to Stephen Blake <sblake@speakeasy.net> for reporting the + problem. + Tue Nov 5 05:12:16 2002 Ossama Othman <ossama@uci.edu> * ace/Acceptor.h: diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a index 8b9dae0e47a..4ccfeb477ff 100644 --- a/ChangeLogs/ChangeLog-03a +++ b/ChangeLogs/ChangeLog-03a @@ -1,3 +1,17 @@ +Tue Nov 5 11:24:03 2002 Nanbor Wang <nanbor@cs.wustl.edu> + + * ace/Process.h: + * ace/Process.i: Added a new method <return_value> which returns + the actual value returned or <exit>'ed by the child process. + The <exit_code> accessor returns the raw exit status returned by + the system APIs and the value is OS dependent. Changed the + <exit_code> mutator to be a proctected method and declare + ACE_Process_Manager a fried of ACE_Process as <exit_code> + mutator should only be used by ACE_Process_Manager. + + Thanks to Stephen Blake <sblake@speakeasy.net> for reporting the + problem. + Tue Nov 5 05:12:16 2002 Ossama Othman <ossama@uci.edu> * ace/Acceptor.h: diff --git a/ace/Process.h b/ace/Process.h index 9d2e0da6531..a28fca18b65 100644 --- a/ace/Process.h +++ b/ace/Process.h @@ -412,6 +412,8 @@ protected: ACE_TCHAR process_name_[MAXPATHLEN + 1]; }; +//class ACE_Process_Manager; + /** * @class ACE_Process * @@ -428,6 +430,7 @@ protected: class ACE_Export ACE_Process { public: + friend class ACE_Process_Manager; /// Default construction. Must use <ACE_Process::spawn> to start. ACE_Process (void); @@ -511,18 +514,14 @@ public: /// Return 1 if running; 0 otherwise. int running (void) const; - /// Return the Process' exit code + /// Return the Process' exit code. This method returns the raw + /// exit status returned from system APIs (such as <wait> or + /// <waitpid>). This value is system dependent. ACE_exitcode exit_code (void) const; - /** - * Set the Process' exit code (completely unrelated to whether the - * Process has actually exited)! A parent process can use this - * method before spawning the child process to set the exit_code to - * some value that it knows the chile process will not return and - * use it to identify if the parent process has retrieve the exit - * status of child process correctly. - */ - void exit_code (ACE_exitcode code); + /// Return the Process' return value. This method returns the + /// actual return value that a child process returns or <exit>s. + int return_value (void) const; /// Close all the handles in the set obtained from the /// @arg ACE_Process_Options::dup_handles object used to spawn @@ -539,6 +538,11 @@ public: #endif /* ACE_WIN32 */ protected: + /// Set this process' <exit_code_>. ACE_Process_Manager uses this + /// method to set the <exit_code_> after successfully waiting for + /// this proecess to exit. + void exit_code (ACE_exitcode code); + #if defined (ACE_WIN32) PROCESS_INFORMATION process_info_; #else /* ACE_WIN32 */ diff --git a/ace/Process.i b/ace/Process.i index 99e12d7591b..df46318b7b1 100644 --- a/ace/Process.i +++ b/ace/Process.i @@ -67,6 +67,16 @@ ACE_Process::terminate (void) return -1; } +ACE_INLINE int +ACE_Process::return_value (void) const +{ +#if defined (ACE_WIN32) + return this->exit_code_; +#else + return WEXITSTATUS (this->exit_code_); +#endif /* ACE_WIN32 */ +} + ACE_INLINE ACE_exitcode ACE_Process::exit_code (void) const { |