summaryrefslogtreecommitdiffstats
path: root/02_exercise/process.h
diff options
context:
space:
mode:
authorStefan Zabka <zabkaste@hu-berlin.de>2020-05-21 23:37:38 +0200
committerStefan Zabka <zabkaste@hu-berlin.de>2020-05-21 23:37:38 +0200
commitf959165cdece3c1bfae8abce834a2bb78db96190 (patch)
treec8f060d804a0c8aed5cbba2bd37a5ecb114dc21b /02_exercise/process.h
parent45b35365a5d0f895caeb6178f5f0a70cfe4464ee (diff)
downloadbetriebssysteme-f959165cdece3c1bfae8abce834a2bb78db96190.tar.gz
betriebssysteme-f959165cdece3c1bfae8abce834a2bb78db96190.zip
Process parse_line working
Diffstat (limited to '02_exercise/process.h')
-rw-r--r--02_exercise/process.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/02_exercise/process.h b/02_exercise/process.h
new file mode 100644
index 0000000..f1cdfa0
--- /dev/null
+++ b/02_exercise/process.h
@@ -0,0 +1,30 @@
+//
+// Created by stefan on 21.05.20.
+//
+
+#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, unsigned timeout);
+
+int free_processes(process ** processes);
+
+
+
+#endif // SHELL_PROCESS_H