Process-in-Process
|
Functions | |
void | pip_spawn_from_main (pip_spawn_program_t *progp, char *prog, char **argv, char **envv, void *exp, void *aux) |
Setting information to invoke a PiP task starting from the main function. More... | |
void | pip_spawn_from_func (pip_spawn_program_t *progp, char *prog, char *funcname, void *arg, char **envv, void *exp, void *aux) |
Setting information to invoke a PiP task starting from a function defined in a program. More... | |
void | pip_spawn_hook (pip_spawn_hook_t *hook, pip_spawnhook_t before, pip_spawnhook_t after, void *hookarg) |
Setting invocation hook information. More... | |
int | pip_task_spawn (pip_spawn_program_t *progp, uint32_t coreno, uint32_t opts, int *pipidp, pip_spawn_hook_t *hookp) |
Spawning a PiP task. More... | |
int | pip_spawn (char *filename, char **argv, char **envv, uint32_t coreno, int *pipidp, pip_spawnhook_t before, pip_spawnhook_t after, void *hookarg) |
spawn a PiP task (PiP v1 API and deprecated) More... | |
int | pip_blt_spawn (pip_spawn_program_t *progp, uint32_t coreno, uint32_t opts, int *pipidp, pip_task_t **bltp, pip_task_queue_t *queue, pip_spawn_hook_t *hookp) |
spawn a PiP BLT/ULP (Bi-Level Task / User-Level Process) More... | |
void pip_spawn_from_main | ( | pip_spawn_program_t * | progp, |
char * | prog, | ||
char ** | argv, | ||
char ** | envv, | ||
void * | exp, | ||
void * | aux | ||
) |
pip_spawn_program_t
structure for spawning a PiP task, starting from the mmain function.[out] | progp | Pointer to the pip_spawn_program_t structure in which the program invokation information will be set |
[in] | prog | Path to the executiable file. |
[in] | argv | Argument vector. |
[in] | envv | Environment variables. If this is NULL , then the environ variable is used for the spawning PiP task. |
[in] | exp | Export value to the spawning PiP task |
[in] | aux | Auxiliary data to be associated with the created PiP task |
void pip_spawn_from_func | ( | pip_spawn_program_t * | progp, |
char * | prog, | ||
char * | funcname, | ||
void * | arg, | ||
char ** | envv, | ||
void * | exp, | ||
void * | aux | ||
) |
main()
function. The function should have the function prototype as shown below; main
function. This implies that the pip_wait
function family called from the PiP root can retrieve the return code.[out] | progp | Pointer to the pip_spawn_program_t structure in which the program invokation information will be set |
[in] | prog | Path to the executiable file. |
[in] | funcname | Function name to be started |
[in] | arg | Argument which will be passed to the start function |
[in] | envv | Environment variables. If this is NULL , then the environ variable is used for the spawning PiP task. |
[in] | exp | Export value to the spawning PiP task |
[in] | aux | Auxiliary data to be associated with the created PiP task |
void pip_spawn_hook | ( | pip_spawn_hook_t * | hook, |
pip_spawnhook_t | before, | ||
pip_spawnhook_t | after, | ||
void * | hookarg | ||
) |
The before and after functions are introduced to follow the programming model of the fork
and exec
. before function does the prologue found between the fork
and exec
. after function is to free the argument if it is malloc()ed
, for example.
[out] | hook | Pointer to the pip_spawn_hook_t structure in which the invocation hook information will be set |
[in] | before | Just before the executing of the spawned PiP task, this function is called so that file descriptors inherited from the PiP root, for example, can deal with. This is only effective with the PiP process mode. This function is called with the argument hookarg described below. |
[in] | after | This function is called when the PiP task terminates for the cleanup purpose. This function is called with the argument hookarg described below. |
[in] | hookarg | The argument for the before and after function call. |
int pip_task_spawn | ( | pip_spawn_program_t * | progp, |
uint32_t | coreno, | ||
uint32_t | opts, | ||
int * | pipidp, | ||
pip_spawn_hook_t * | hookp | ||
) |
progp
. FD_CLOEXEC
flag is closed and will not be passed to the spawned PiP task. This simulated close-on-exec will not take place in the pthread execution mode.[out] | progp | pip_spawn_program_t |
[in] | coreno | CPU core number for the PiP task to be bound to. By default, coreno is set to zero, for example, then the calling task will be bound to the 'first' core available. This is in mind that the available core numbers are not contiguous. To specify an absolute core number, coreno must be bitwise-ORed with PIP_CPUCORE_ABS . If PIP_CPUCORE_ASIS is specified, then the core binding will not take place. |
[in] | opts | option flags |
[in,out] | pipidp | Specify PiP ID of the spawned PiP task. If PIP_PIPID_ANY is specified, then the PiP ID of the spawned PiP task is up to the PiP library and the assigned PiP ID will be returned. |
[in] | hookp | Hook information to be invoked before and after the program invokation. |
EPERM | PiP library is not yet initialized |
EPERM | PiP task tries to spawn child task |
EINVAL | progp is NULL |
EINVAL | opts is invalid and/or unacceptable |
EINVAL | the value off pipidp is invalid |
EINVAL | the coreno is larger than or equal to PIP_CPUCORE_CORENO_MAX |
EBUSY | specified PiP ID is alredy occupied |
ENOMEM | not enough memory |
ENXIO | dlmopen failss |
int pip_spawn | ( | char * | filename, |
char ** | argv, | ||
char ** | envv, | ||
uint32_t | coreno, | ||
int * | pipidp, | ||
pip_spawnhook_t | before, | ||
pip_spawnhook_t | after, | ||
void * | hookarg | ||
) |
FD_CLOEXEC
flag is closed and will not be passed to the spawned PiP task. This simulated close-on-exec will not take place in the pthread execution mode.[in] | filename | The executable to run as a PiP task |
[in] | argv | Argument(s) for the spawned PiP task |
[in] | envv | Environment variables for the spawned PiP task |
[in] | coreno | CPU core number for the PiP task to be bound to. By default, coreno is set to zero, for example, then the calling task will be bound to the first core available. This is in mind that the available core numbers are not contiguous. To specify an absolute core number, coreno must be bitwise-ORed with PIP_CPUCORE_ABS . If PIP_CPUCORE_ASIS is specified, then the core binding will not take place. |
[in,out] | pipidp | Specify PiP ID of the spawned PiP task. If PIP_PIPID_ANY is specified, then the PiP ID of the spawned PiP task is up to the PiP library and the assigned PiP ID will be returned. |
[in] | before | Just before the executing of the spawned PiP task, this function is called so that file descriptors inherited from the PiP root, for example, can deal with. This is only effective with the PiP process mode. This function is called with the argument hookarg described below. |
[in] | after | This function is called when the PiP task terminates for the cleanup purpose. This function is called with the argument hookarg described below. |
[in] | hookarg | The argument for the before and after function call. |
EPERM | PiP library is not yet initialized |
EPERM | PiP task tries to spawn child task |
EINVAL | progp is NULL |
EINVAL | opts is invalid and/or unacceptable |
EINVAL | the value off pipidp is invalid |
EINVAL | the coreno is larger than or equal to PIP_CPUCORE_CORENO_MAX |
EBUSY | specified PiP ID is alredy occupied |
ENOMEM | not enough memory |
ENXIO | dlmopen failss |
int pip_blt_spawn | ( | pip_spawn_program_t * | progp, |
uint32_t | coreno, | ||
uint32_t | opts, | ||
int * | pipidp, | ||
pip_task_t ** | bltp, | ||
pip_task_queue_t * | queue, | ||
pip_spawn_hook_t * | hookp | ||
) |
progp
. The created annd returned BLT is another form of a PiP task. It is an opaque object, essentially a double-linked list. Thus created BLT can be enqueued or dequeued to/from a pip_task_queue_t
. FD_CLOEXEC
flag is closed and will not be passed to the spawned PiP task. This simulated close-on-exec will not take place in the pthread execution mode.[out] | progp | pip_spawn_program_t |
[in] | coreno | CPU core number for the PiP task to be bound to. By default, coreno is set to zero, for example, then the calling task will be bound to the first core available. This is in mind that the available core numbers are not contiguous. To specify an absolute core number, coreno must be bitwise-ORed with PIP_CPUCORE_ABS . If PIP_CPUCORE_ASIS is specified, then the core binding will not take place. |
[in] | opts | option flags. If PIP_TASK_INACTIVE is set, the created BLT is suspended and enqueued to the specified queue . Otherwise the BLT will schedules the BLTs in queue . |
[in,out] | pipidp | Specify PiP ID of the spawned PiP task. If PIP_PIPID_ANY is specified, then the PiP ID of the spawned PiP task is up to the PiP library and the assigned PiP ID will be returned. The PiP execution mode can also be specified (see below). |
[in,out] | bltp | returns created BLT |
[in] | queue | PiP task queue. See the above opts description. |
[in] | hookp | Hook information to be invoked before and after the program invokation. |
EPERM | PiP library is not yet initialized |
EPERM | PiP task tries to spawn child task |
EINVAL | progp is NULL |
EINVAL | opts is invalid and/or unacceptable |
EINVAL | the value off pipidp is invalid |
EBUSY | specified PiP ID is alredy occupied |
ENOMEM | not enough memory |
ENXIO | dlmopen failss |