#include <gwenhywfar/gwenhywfarapi.h>
#include <gwenhywfar/types.h>
#include <gwenhywfar/bufferedio.h>
#include <gwenhywfar/error.h>
Go to the source code of this file.
#define GWEN_PROCESS_FLAGS_DEFAULT 0 |
#define GWEN_PROCESS_FLAGS_REDIR_STDERR 0x00000004 |
redirect the child processes stderr channel
#define GWEN_PROCESS_FLAGS_REDIR_STDIN 0x00000001 |
redirect the child processes stdin channel
#define GWEN_PROCESS_FLAGS_REDIR_STDOUT 0x00000002 |
redirect the child processes stdout channel
typedef struct GWEN_PROCESS GWEN_PROCESS |
enum GWEN_PROCESS_STATE |
States a process can assume.
GWENHYWFAR_API void GWEN_Process_AddFlags | ( | GWEN_PROCESS * | pr, | |
GWEN_TYPE_UINT32 | f | |||
) |
Adds the given flag to the current process flags (see GWEN_PROCESS_FLAGS_REDIR_STDOUT and others)
GWENHYWFAR_API GWEN_PROCESS_STATE GWEN_Process_CheckState | ( | GWEN_PROCESS * | pr | ) |
Checks for the current state of the given process.
GWENHYWFAR_API void GWEN_Process_free | ( | GWEN_PROCESS * | pr | ) |
Frees process data. This does not stop the process represented by this data. You should only free this data after the process has terminated or if you are not interested in the result of the process (because after freeing this data there is no way to communicate with the process).
GWENHYWFAR_API GWEN_TYPE_UINT32 GWEN_Process_GetFlags | ( | const GWEN_PROCESS * | pr | ) |
Returns the current process flags (see GWEN_PROCESS_FLAGS_REDIR_STDOUT and others)
GWENHYWFAR_API int GWEN_Process_GetResult | ( | GWEN_PROCESS * | pr | ) |
Returns the result of a process. This process must have terminated in order to return a result.
GWENHYWFAR_API GWEN_BUFFEREDIO* GWEN_Process_GetStderr | ( | const GWEN_PROCESS * | pr | ) |
Returns a GWEN_BUFFEREDIO which can be used to read data written by the process via stderr. Returns 0 if the process does not have the flag GWEN_PROCESS_FLAGS_REDIR_STDERR set.
GWENHYWFAR_API GWEN_BUFFEREDIO* GWEN_Process_GetStdin | ( | const GWEN_PROCESS * | pr | ) |
Returns a GWEN_BUFFEREDIO which can be used to write data to be received by the process via stdin. Returns 0 if the process does not have the flag GWEN_PROCESS_FLAGS_REDIR_STDIN set.
GWENHYWFAR_API GWEN_BUFFEREDIO* GWEN_Process_GetStdout | ( | const GWEN_PROCESS * | pr | ) |
Returns a GWEN_BUFFEREDIO which can be used to read data written by the process via stdout. Returns 0 if the process does not have the flag GWEN_PROCESS_FLAGS_REDIR_STDOUT set.
GWENHYWFAR_API GWEN_ERRORCODE GWEN_Process_ModuleFini | ( | ) |
De-Initialize this module.
GWENHYWFAR_API GWEN_ERRORCODE GWEN_Process_ModuleInit | ( | ) |
Initialize this module.
GWENHYWFAR_API GWEN_PROCESS* GWEN_Process_new | ( | ) |
Creates a process representation. This does not start a process, it simply prepares some data for starting a process.
GWENHYWFAR_API void GWEN_Process_SetFlags | ( | GWEN_PROCESS * | pr, | |
GWEN_TYPE_UINT32 | f | |||
) |
Sets the process flags to the given value (see GWEN_PROCESS_FLAGS_REDIR_STDOUT and others)
GWENHYWFAR_API GWEN_PROCESS_STATE GWEN_Process_Start | ( | GWEN_PROCESS * | pr, | |
const char * | prg, | |||
const char * | args | |||
) |
Starts the given process.
pr | pointer to process data | |
prg | path and name of the program to start | |
args | command line arguments for the program (MUST NOT contain the name of the program) |
GWENHYWFAR_API void GWEN_Process_SubFlags | ( | GWEN_PROCESS * | pr, | |
GWEN_TYPE_UINT32 | f | |||
) |
Removes the given flag from the current process flags (see GWEN_PROCESS_FLAGS_REDIR_STDOUT and others)
GWENHYWFAR_API int GWEN_Process_Terminate | ( | GWEN_PROCESS * | pr | ) |
Terminates a process immediately (on POSIX systems this is performed by sending a KILL signal). This function waits for the process to terminate.
GWENHYWFAR_API int GWEN_Process_Wait | ( | GWEN_PROCESS * | pr | ) |
Waits for the termination of the given process.