Exemplo n.º 1
0
/* gee, I'd like a execvpe */
int ROKEN_LIB_FUNCTION
simple_execve_timed(const char *file, char *const args[], char *const envp[],
		    time_t (*func)(void *), void *ptr, time_t timeout)
{
    pid_t pid = fork();
    switch(pid){
    case -1:
	return -2;
    case 0:
	execve(file, args, envp);
	exit((errno == ENOENT) ? EX_NOTFOUND : EX_NOEXEC);
    default:
	return wait_for_process_timed(pid, func, ptr, timeout);
    }
}
Exemplo n.º 2
0
ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
simple_execvp_timed(const char *file, char *const args[],
		    time_t (*func)(void *), void *ptr, time_t timeout)
{
    pid_t pid = fork();
    switch(pid){
    case -1:
	return SE_E_FORKFAILED;
    case 0:
	execvp(file, args);
	exit((errno == ENOENT) ? EX_NOTFOUND : EX_NOEXEC);
    default:
	return wait_for_process_timed(pid, func, ptr, timeout);
    }
}
Exemplo n.º 3
0
ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
wait_for_process(pid_t pid)
{
    return wait_for_process_timed(pid, NULL, NULL, 0);
}