diff options
author | Niklas Halle <niklas@niklashalle.net> | 2020-05-22 09:53:42 +0200 |
---|---|---|
committer | Niklas Halle <niklas@niklashalle.net> | 2020-05-22 09:53:42 +0200 |
commit | 3b7e61eab8ce5d230bc1b172942c1ab9459ed161 (patch) | |
tree | 73da9a772782d7d1504770c8cc7582c03cf41310 /02_exercise/process.h | |
parent | 68f5ff29c0aae1a176c25996aab0144badd0f092 (diff) | |
parent | 4f80f043aacc568fac0e3681b62aa1971a97291a (diff) | |
download | betriebssysteme-3b7e61eab8ce5d230bc1b172942c1ab9459ed161.tar.gz betriebssysteme-3b7e61eab8ce5d230bc1b172942c1ab9459ed161.zip |
Merge branch 'process_and_pipes' into dev/niklas
Diffstat (limited to '02_exercise/process.h')
-rw-r--r-- | 02_exercise/process.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/02_exercise/process.h b/02_exercise/process.h new file mode 100644 index 0000000..3b7e833 --- /dev/null +++ b/02_exercise/process.h @@ -0,0 +1,29 @@ +#ifndef SHELL_PROCESS_H +#define SHELL_PROCESS_H +#include <stdbool.h> +#include <stddef.h> + +typedef struct { + char **argv; + size_t argc; + int in_fd; + int out_fd; + int pid; + bool blocking; +} Process; + +/* + * Parses the given line and creates an array of processes at *processes + * Expects tail -F file | grep panic & to mean that both processes should + * run in the background + */ +int parse_line(char const *line, Process ** processes); + +/* + * returns the return code of the executed program + */ +int exec_command(Process p); + +void free_processes(Process ** processes); + +#endif // SHELL_PROCESS_H |