summaryrefslogtreecommitdiff
path: root/user/fork.c
diff options
context:
space:
mode:
authorGalen Sagarin <gps5307@rit.edu>2025-04-29 14:18:40 -0400
committerGalen Sagarin <gps5307@rit.edu>2025-04-29 14:18:40 -0400
commitae2cdd83ba4a0cae161db0b29031d5591005fa34 (patch)
tree82fbdfcbb1fe4e3b5e232db195c8c331d69489fd /user/fork.c
parentStarted writing fat.c (diff)
parentfs header changes (diff)
downloadcomus-ae2cdd83ba4a0cae161db0b29031d5591005fa34.tar.gz
comus-ae2cdd83ba4a0cae161db0b29031d5591005fa34.tar.bz2
comus-ae2cdd83ba4a0cae161db0b29031d5591005fa34.zip
Merge branch 'main' of https://github.com/kenshineto/kern into fat32
Merging main into here
Diffstat (limited to 'user/fork.c')
-rw-r--r--user/fork.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/user/fork.c b/user/fork.c
new file mode 100644
index 0000000..d534fcf
--- /dev/null
+++ b/user/fork.c
@@ -0,0 +1,20 @@
+#include <unistd.h>
+#include <stdio.h>
+
+int main(void)
+{
+ printf("im going to print some a's and b's. get ready\n");
+
+ int pid = fork();
+ if (pid < 0) {
+ fprintf(stderr, "fork failed!\n");
+ return 1;
+ }
+
+ for (int i = 0; i < 10; i++) {
+ putchar(pid == 0 ? 'a' : 'b');
+ putchar('\n');
+ }
+
+ return 0;
+}