pexec - execute file in an interprocess channel
#include "pexec.h"
int pexecl(pid_t *pid, const char *path, const char *arg , ...);
int pexeclp(pid_t *pid, const char *file, const char *arg , ...);
int pexecle(pid_t *pid, const char *path, const char *arg , ...);
int pexecv(pid_t *pid, const char *path, char * const argv[]);
int pexecvp(pid_t *pid, const char *file, char * const argv[]);
int pexecve(pid_t *pid, const char *path, char * const argv[], char * const envp[]);
#ifdef _GNU_SOURCE
pid_t pexecvpe(const char *file, char * const argv[] , char * const envp[]);
#endif
The pexec(3) familly of functions combines pipe(3p), fork(2) and exec(3) functions.
These functions open a pipe(3p) between the caller and the new created process.
The process is fork(2)'ed and its image is exec(3)'ed with the content of path or file given in parameter using argv as argument and envp as environment.
For a more thorough description of the pexec(3) functions familly, please refers theirs exec(3) equivalents.
Upon successful completion, these functions return the file descriptor of the created pipe; if not NULL, the PID of the child process is set to pid. Otherwise, these functions shall return −1 and set errno to indicate the error.
Written by Gaël PORTAY gael.portay@savoirfairelinux.com
Copyright (c) 2017 Gaël PORTAY
This program is free software: you can redistribute it and/or modify it under the terms of the MIT License.
pipe(3p), fork(2), exec(3)