diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 1999-08-22 00:15:58 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 1999-08-22 00:15:58 +0000 |
commit | d0926187c2935db3e8fabdc7ce42509ac3ff23fd (patch) | |
tree | 133c77094fc7028a005c0faaa34b0f0d60d1bceb /ace/Process.cpp | |
parent | adf928c454d675a3e9736c5900405165eb784624 (diff) | |
download | ATCD-d0926187c2935db3e8fabdc7ce42509ac3ff23fd.tar.gz |
ChangeLogTag:Sat Aug 21 12:36:40 1999 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu>
Diffstat (limited to 'ace/Process.cpp')
-rw-r--r-- | ace/Process.cpp | 73 |
1 files changed, 18 insertions, 55 deletions
diff --git a/ace/Process.cpp b/ace/Process.cpp index 8dfc46f2ef3..7bed8bf9cd4 100644 --- a/ace/Process.cpp +++ b/ace/Process.cpp @@ -17,7 +17,7 @@ ACE_Process::ACE_Process (void) #endif /* !defined (ACE_WIN32) */ { #if defined (ACE_WIN32) - ACE_OS::memset ((void *) &this->process_info_, + ACE_OS::memset ((void *) &this->process_info__, 0, sizeof this->process_info_); #endif /* ACE_WIN32 */ } @@ -53,8 +53,8 @@ ACE_Process::spawn (ACE_Process_Options &options) // CreateProcess failed. return -1; #elif defined (CHORUS) - // This only works if we exec. Chorus does not really support - // forking + // This only works if we <exec>. Chorus does not really support + // <fork>. if (ACE_BIT_ENABLED (options.creation_flags (), ACE_Process_Options::NO_EXEC)) ACE_NOTSUP_RETURN (-1); @@ -96,7 +96,8 @@ ACE_Process::spawn (ACE_Process_Options &options) options.avoid_zombies ()); // If we're not supposed to exec, return the process id. - if (ACE_BIT_ENABLED (options.creation_flags (), ACE_Process_Options::NO_EXEC)) + if (ACE_BIT_ENABLED (options.creation_flags (), + ACE_Process_Options::NO_EXEC)) return this->child_id_; switch (this->child_id_) @@ -108,13 +109,16 @@ ACE_Process::spawn (ACE_Process_Options &options) // Child process. { if (options.get_stdin () != ACE_INVALID_HANDLE - && ACE_OS::dup2 (options.get_stdin (), ACE_STDIN) == -1) + && ACE_OS::dup2 (options.get_stdin (), + ACE_STDIN) == -1) ACE_OS::exit (errno); else if (options.get_stdout () != ACE_INVALID_HANDLE - && ACE_OS::dup2 (options.get_stdout (), ACE_STDOUT) == -1) + && ACE_OS::dup2 (options.get_stdout (), + ACE_STDOUT) == -1) ACE_OS::exit (errno); else if (options.get_stderr () != ACE_INVALID_HANDLE - && ACE_OS::dup2 (options.get_stderr (), ACE_STDERR) == -1) + && ACE_OS::dup2 (options.get_stderr (), + ACE_STDERR) == -1) ACE_OS::exit (errno); // close down unneeded descriptors @@ -122,7 +126,8 @@ ACE_Process::spawn (ACE_Process_Options &options) ACE_OS::close (options.get_stdout ()); ACE_OS::close (options.get_stderr ()); - // If we must, set the working directory for the child process. + // If we must, set the working directory for the child + // process. if (options.working_directory () != 0) ACE_OS::chdir (options.working_directory ()); @@ -136,13 +141,12 @@ ACE_Process::spawn (ACE_Process_Options &options) else { #if defined( ghs ) - // GreenHills 1.8.8 (for VxWorks 5.3.x) can't compile - // this code. Processes aren't supported on VxWorks - // anyways. + // GreenHills 1.8.8 (for VxWorks 5.3.x) can't compile this + // code. Processes aren't supported on VxWorks anyways. ACE_NOTSUP_RETURN (-1); #else - // Add the new environment variables to the environment context - // of the context before doing an <execvp>. + // Add the new environment variables to the environment + // context of the context before doing an <execvp>. for (char *const *user_env = options.env_argv (); *user_env != 0; user_env++) @@ -174,47 +178,6 @@ ACE_Process::spawn (ACE_Process_Options &options) #endif /* ACE_WIN32 */ } -int -ACE_Process::wait (int *status) -{ -#if defined (ACE_WIN32) - int result; - - // Don't try to get the process exit status if wait failed so we can - // keep the original error code intact. - result = ::WaitForSingleObject (process_info_.hProcess, - INFINITE); - if (result == WAIT_OBJECT_0) - { - if (status != 0) - // The error status of GetExitCodeProcess is nonetheless not - // tested. (Don't know how to return the value.) - ::GetExitCodeProcess (process_info_.hProcess, (LPDWORD) status); - - return this->getpid (); - } - else - return -1; -#else /* ACE_WIN32 */ - // This takes care of the EINTR return case. - ACE_OSCALL_RETURN(ACE_OS::waitpid (this->child_id_, status, 0), int, -1); -#endif /* ACE_WIN32 */ -} - -int -ACE_Process::wait (const ACE_Time_Value &tv) -{ -#if defined (ACE_WIN32) - return ::WaitForSingleObject (process_info_.hProcess, - tv.msec ()); -#else /* ACE_WIN32 */ - ACE_UNUSED_ARG (tv); - ACE_NOTSUP_RETURN (-1); -#endif /* ACE_WIN32 */ -} - -// ************************************************************ - ACE_Process_Options::ACE_Process_Options (int ie, int cobl, int ebl, @@ -222,7 +185,7 @@ ACE_Process_Options::ACE_Process_Options (int ie, : #if !defined (ACE_HAS_WINCE) inherit_environment_ (ie), -#endif +#endif /* ACE_HAS_WINCE */ creation_flags_ (0), #if !defined (ACE_HAS_WINCE) #if defined (ACE_WIN32) |