summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFelipe Boeira <felipe.boeira@liu.se>2020-03-04 14:56:13 +0100
committerFelipe Boeira <felipe.boeira@liu.se>2020-03-04 14:56:13 +0100
commitf3156831364fb2d3bec8c2f7ba7e8c10e91be13e (patch)
tree00d41d6dae12ba082b238362d737e553576582cd /src
parentaa02564229d69a16da3d34a3742233aac81fd8b1 (diff)
downloadpintos-f3156831364fb2d3bec8c2f7ba7e8c10e91be13e.tar.gz
Added missing files
Diffstat (limited to 'src')
-rw-r--r--src/examples/recursor_ng.c52
-rw-r--r--src/userprog/start_pfs.sh10
-rw-r--r--src/userprog/start_recursor.sh6
3 files changed, 68 insertions, 0 deletions
diff --git a/src/examples/recursor_ng.c b/src/examples/recursor_ng.c
new file mode 100644
index 0000000..fcf6b3c
--- /dev/null
+++ b/src/examples/recursor_ng.c
@@ -0,0 +1,52 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <syscall.h>
+
+#define MAX_SPAWN 100
+
+int main (int argc, char *argv[])
+{
+ char buffer[128];
+ pid_t pid[MAX_SPAWN];
+ int retval = 0;
+ int i, spawn;
+ int ret = 0;
+
+ if (argc != 4)
+ {
+ printf ("usage: recursor_ng <string> <depth> <waitp>\n");
+ exit (1);
+ }
+
+ /* Print args. */
+ //printf ("%s %s %s %s\n", argv[0], argv[1], argv[2], argv[3]);
+ printf("+");
+ /* Execute child and wait for it to finish if requested. */
+ spawn = atoi (argv[2]);
+
+ if (spawn > MAX_SPAWN) {
+ printf("Greater than MAX_SPAWN\n");
+ exit(-1);
+ }
+
+ if (spawn != 0)
+ {
+ for (i = 0; i < spawn;i++) {
+ snprintf (buffer, sizeof buffer,
+ "recursor_ng %s %d %s", argv[1], atoi (argv[2]) - 1, argv[3]);
+ pid[i] = exec (buffer);
+ }
+ if (atoi (argv[3])) {
+ for (i = 0; i < spawn;i++) {
+ retval = wait (pid[i]);
+ if (retval < 0)
+ ret = 1;
+ }
+ }
+
+ /* Done. */
+ if (ret)
+ printf("YOU HAVE FAILED\n");
+ }
+ exit (ret);
+}
diff --git a/src/userprog/start_pfs.sh b/src/userprog/start_pfs.sh
new file mode 100644
index 0000000..b4acc54
--- /dev/null
+++ b/src/userprog/start_pfs.sh
@@ -0,0 +1,10 @@
+make -j4
+cd build
+pintos-mkdisk fs.dsk 800
+dd if=/dev/urandom of=random bs=1 count=100
+pintos --qemu -- -f -q
+pintos --qemu -p random -a random -- -q
+pintos --qemu -p ../../examples/pfs -a pfs -- -q
+pintos --qemu -p ../../examples/pfs_writer -a pfs_writer -- -q
+pintos --qemu -p ../../examples/pfs_reader -a pfs_reader -- -q
+pintos --qemu -- run pfs
diff --git a/src/userprog/start_recursor.sh b/src/userprog/start_recursor.sh
new file mode 100644
index 0000000..ed80e1a
--- /dev/null
+++ b/src/userprog/start_recursor.sh
@@ -0,0 +1,6 @@
+make -j4
+cd build
+pintos-mkdisk fs.dsk 400
+pintos --qemu -- -f -q
+pintos --qemu -p ../../examples/recursor_ng -a recursor_ng -- -q
+pintos --qemu -m 128 -- run "recursor_ng pintosmaster 6 1"