![]() |
tgrekov-pipex
HIVE pipex May 2024
|
Definition in file dispatcher.c.
#include <stdlib.h>#include <unistd.h>#include "../../mandatory/utils/utils.h"Go to the source code of this file.
Functions | |
| void | dispatch (char **paths, char *args, char **envp, int *in_out) |
Dispatch child process with argument string args, environment envp, and stdin / stdout in_out[0] / in_out[1]. | |
| int | wait_all (int *pids, int n, int override) |
Wait for first n processes in pids to change state and return the last process's exit code, if it could be resolved, or 1. | |
| int | dispatcher (int n, char ***str_arrs, int *in_out) |
Dispatch n child processes with argument strings str_arrs[1][i], environment pointer str_arrs[2], where stdin for the first process is in_out[0] and stdout for the last process is in_out[1]. | |
| void dispatch | ( | char ** | paths, |
| char * | args, | ||
| char ** | envp, | ||
| int * | in_out | ||
| ) |
Dispatch child process with argument string args, environment envp, and stdin / stdout in_out[0] / in_out[1].
| paths | Null-terminated array of paths with trailing forward slashes to search for the executable name in |
| args | String of arguments that will be split and passed as argv to the child process |
| envp | Environment pointer for the child process |
| in_out | stdin and stdout for the child process |
Definition at line 67 of file dispatch.c.
References arr_free(), ft_printf(), and ft_split().
| int dispatcher | ( | int | n, |
| char *** | str_arrs, | ||
| int * | in_out | ||
| ) |
Dispatch n child processes with argument strings str_arrs[1][i], environment pointer str_arrs[2], where stdin for the first process is in_out[0] and stdout for the last process is in_out[1].
| n | Number of processes |
| str_arrs | Null-terminated arrays paths, argv, and envp |
| in_out | stdin for the first process and stdout for the last process |
| int | Exit code of the last process, if available, else 1, or if an error was encountered in the parent process, 1. |
Definition at line 85 of file dispatcher.c.
References err().
| int wait_all | ( | int * | pids, |
| int | n, | ||
| int | override | ||
| ) |
Wait for first n processes in pids to change state and return the last process's exit code, if it could be resolved, or 1.
| pids | Process ids to wait on |
| n | Number of process ids |
| override | Overrides return value if non-zero |
| int | Last process's exit code or 1 |
Definition at line 31 of file wait_all.c.