summaryrefslogtreecommitdiffstats
path: root/shell/process.h
diff options
context:
space:
mode:
authorStefan Zabka <zabkaste@hu-berlin.de>2020-05-24 12:09:46 +0200
committerStefan Zabka <zabkaste@hu-berlin.de>2020-05-24 12:09:46 +0200
commit65966ded0cc15c5966c6568cf0ff2f2bbe1fc29a (patch)
tree60af69be16926ef0f24ad2a954d9205ce9277450 /shell/process.h
parent3b7e61eab8ce5d230bc1b172942c1ab9459ed161 (diff)
downloadbetriebssysteme-65966ded0cc15c5966c6568cf0ff2f2bbe1fc29a.tar.gz
betriebssysteme-65966ded0cc15c5966c6568cf0ff2f2bbe1fc29a.zip
Big remodelling
Diffstat (limited to 'shell/process.h')
-rw-r--r--shell/process.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/shell/process.h b/shell/process.h
new file mode 100644
index 0000000..3b7e833
--- /dev/null
+++ b/shell/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