Summary Files Commits Branches @commit @diff @stats
path: root / Year 3 / System programming / Practicum4 / ex1.c
diff options
context:
space:
mode:
1 files changed, 11 insertions, 0 deletions
-rw-r--r--Year 3/System programming/Practicum4/ex1.c11
diff --git a/Year 3/System programming/Practicum4/ex1.c b/Year 3/System programming/Practicum4/ex1.c
new file mode 100644
index 0000000..7958de4
--- /dev/null
+++ b/Year 3/System programming/Practicum4/ex1.c
@@ -0,0 +1,11 @@
+#include <sys/types.h>
+#include <unistd.h>
+#include <stdio.h>
+
+int main() {
+ pid_t pid = getpid();
+ pid_t parentPID = getppid();
+
+ printf("Current: %d\nParent: %d\n", pid, parentPID);
+ execlp("ps", "ps", (char*)NULL);
+}