Public Types |
enum | { DEFAULT_COMMAND_LINE_BUF_LEN = 1024,
NO_EXEC = 0
} |
Public Methods |
| ACE_Process_Options (int inherit_environment=1, int command_line_buf_len=DEFAULT_COMMAND_LINE_BUF_LEN, int env_buf_len=ENVIRONMENT_BUFFER, int max_env_args=MAX_ENVIRONMENT_ARGS) |
| If <inherit_environment> == 1, the new process will inherit the environment of the current process. More...
|
| ~ACE_Process_Options (void) |
| Destructor. More...
|
int | set_handles (ACE_HANDLE std_in, ACE_HANDLE std_out=ACE_INVALID_HANDLE, ACE_HANDLE std_err=ACE_INVALID_HANDLE) |
| Set the standard handles of the new process to the respective handles. More...
|
void | release_handles (void) |
| Felease the standard handles previously set with set_handles;. More...
|
int | setenv (const ACE_TCHAR *format,...) |
| <format> must be of the form "VARIABLE=VALUE". There can not be any spaces between VARIABLE and the equal sign. More...
|
int | setenv (const ACE_TCHAR *variable_name, const ACE_TCHAR *format,...) |
| Set a single environment variable, <variable_name>. More...
|
int | setenv (ACE_TCHAR *envp[]) |
| Same as above with argv format. <envp> must be null terminated. More...
|
void | working_directory (const char *wd) |
| Set the working directory for the process. strlen of <wd> must be <= MAXPATHLEN. More...
|
void | working_directory (const wchar_t *wd) |
| wchar_t version of working_directory. More...
|
int | command_line (const ACE_TCHAR *format,...) |
| Set the command-line arguments. More...
|
int | command_line (const ACE_ANTI_TCHAR *format,...) |
| Anti-TChar version of command_line (). More...
|
int | command_line (const ACE_TCHAR *const argv[]) |
| Same as above in argv format. <argv> must be null terminated. More...
|
void | process_name (const ACE_TCHAR *name) |
| Specify the full path or relative path, or just the executable name for the process. More...
|
const ACE_TCHAR * | process_name (void) |
| Return the process_name. If the <process_name(name)> set method is not called, this method will return argv[0]. More...
|
u_long | creation_flags (void) const |
| Get the creation flags. More...
|
void | creation_flags (u_long) |
| Set the creation flags. More...
|
ACE_TCHAR * | working_directory (void) |
| Current working directory. Returns "" if nothing has been set. More...
|
ACE_TCHAR * | command_line_buf (int *max_len=0) |
| Buffer of command-line options. Returns a pointer to a buffer that contains the list of command line options. Prior to a call to command_line_argv(), this is a single string of space separated arguments independent of which form of command_line() was used to create it. After a call to command_line_argv(), this is a list of strings each terminated by '\0'. [Note: spawn() will call command_line_argv().] The total length of all these strings is the same as the single string in the prior case and can be obtained by providing max_len.
- max_len, if non-zero, provides a location into which the total length of the command line buffer is returned.
More...
|
ACE_TCHAR *const * | command_line_argv (void) |
| argv-style command-line options. More...
|
ACE_TCHAR * | env_buf (void) |
| Null-terminated buffer of null terminated strings. More...
|
pid_t | getgroup (void) const |
| Get the process group. On UNIX, these methods are used by the <ACE_Process_Manager> to manage groups of processes. More...
|
pid_t | setgroup (pid_t pgrp) |
| Set the process group. On UNIX, these methods are used by the <ACE_Process_Manager> to manage groups of processes. More...
|
int | handle_inheritence (void) |
| Default is TRUE. Allows disabling of handle inheritence. More...
|
void | handle_inheritence (int) |
int | pass_handle (ACE_HANDLE) |
| The specified handle value will be included in the spawned process's command line as
- +H
- handle, if a new program is spawned (always on Win32; else if NO_EXEC is not set in creation flags).
More...
|
int | dup_handles (ACE_Handle_Set &set) const |
| Any handles created through duplication of those passed into
- pass_handle are returned in
- set.
More...
|
int | passed_handles (ACE_Handle_Set &set) const |
| Any handles previously passed to
- pass_handle are returned in
- set.
More...
|
void | avoid_zombies (int) |
| Set value for avoid_zombies (has no real effect except on *nix). More...
|
int | avoid_zombies (void) |
| Get current value for avoid_zombies. More...
|
ACE_TEXT_STARTUPINFO * | startup_info (void) |
| Used for setting and getting. More...
|
LPSECURITY_ATTRIBUTES | get_process_attributes (void) const |
| Get the process_attributes. Returns NULL if set_process_attributes has not been set. More...
|
LPSECURITY_ATTRIBUTES | set_process_attributes (void) |
| If this is called, a non-null process attributes is sent to CreateProcess. More...
|
LPSECURITY_ATTRIBUTES | get_thread_attributes (void) const |
| Get the thread_attributes. Returns NULL if set_thread_attributes has not been set. More...
|
LPSECURITY_ATTRIBUTES | set_thread_attributes (void) |
| If this is called, a non-null thread attributes is sent to CreateProcess. More...
|
Protected Types |
enum | { MAX_COMMAND_LINE_OPTIONS = 128,
ENVIRONMENT_BUFFER = 16 * 1024,
MAX_ENVIRONMENT_ARGS = 512
} |
Protected Methods |
int | setenv_i (ACE_TCHAR *assignment, size_t len) |
| Add <assignment> to environment_buf_ and adjust environment_argv_. <len> is the strlen of <assignment>. More...
|
void | inherit_environment (void) |
| Helper function to grab win32 environment and stick it in environment_buf_ using this->setenv_i. More...
|
Protected Attributes |
int | inherit_environment_ |
| Whether the child process inherits the current process environment. More...
|
u_long | creation_flags_ |
| Default 0. More...
|
int | avoid_zombies_ |
| Avoid zombies for spawned processes. More...
|
int | environment_inherited_ |
| Ensures once only call to inherit environment. More...
|
ACE_TEXT_STARTUPINFO | startup_info_ |
BOOL | handle_inheritence_ |
| Default TRUE. More...
|
LPSECURITY_ATTRIBUTES | process_attributes_ |
| Pointer to security_buf1_. More...
|
LPSECURITY_ATTRIBUTES | thread_attributes_ |
| Pointer to security_buf2_. More...
|
SECURITY_ATTRIBUTES | security_buf1_ |
| Data for process_attributes_. More...
|
SECURITY_ATTRIBUTES | security_buf2_ |
| Data for thread_attributes_. More...
|
int | set_handles_called_ |
| Is 1 if stdhandles was called. More...
|
size_t | environment_buf_index_ |
| Pointer into environment_buf_. This should point to the next free spot. More...
|
int | environment_argv_index_ |
| Pointer to environment_argv_. More...
|
ACE_TCHAR * | environment_buf_ |
| Pointer to buffer of the environment settings. More...
|
size_t | environment_buf_len_ |
| Size of the environment buffer. Configurable. More...
|
ACE_TCHAR ** | environment_argv_ |
| Pointers into environment_buf_. More...
|
int | max_environment_args_ |
| Maximum number of environment variables. Configurable. More...
|
int | max_environ_argv_index_ |
| Maximum index of environment_argv_ buffer. More...
|
ACE_TCHAR | working_directory_ [MAXPATHLEN+1] |
| The current working directory. More...
|
int | command_line_argv_calculated_ |
| Ensures command_line_argv is only calculated once. More...
|
ACE_TCHAR * | command_line_buf_ |
| Pointer to buffer of command-line arguments. E.g., "-f foo -b bar". More...
|
int | command_line_buf_len_ |
| Max length of command_line_buf_. More...
|
ACE_TCHAR * | command_line_argv_ [MAX_COMMAND_LINE_OPTIONS] |
| Argv-style command-line arguments. More...
|
pid_t | process_group_ |
| Process-group on Unix; unused on Win32. More...
|
ACE_Handle_Set | handles_passed_ |
| Set of handles that were passed in pass_handle (). More...
|
ACE_Handle_Set | dup_handles_ |
| Results of duplicating handles passed in pass_handle (). More...
|
ACE_TCHAR | process_name_ [MAXPATHLEN+1] |
| Pathname for the process. Relative path or absolute path or just the program name. More...
|
This class controls the options passed to <CreateProcess> (or <fork> and <exec>). Notice that on Windows CE, creating a process merely means instantiating a new process. You can't set the handles (since there's no stdin, stdout and stderr,) specify process/thread options, set environment,... So, basically, this class only set the command line and nothing else. Notice that on UNIX platforms, if the <setenv> is used, the <spawn> is using the <execve> system call. It means that the <command_line> should include a full path to the program file (<execve> does not search the PATH). If <setenv> is not used then, the <spawn> is using the <execvp> which searches for the program file in the PATH variable.