]> Devi Nivas Git - cs3210-lab0.git/commitdiff
Add user.h for prototypes.
authorrsc <rsc>
Sun, 16 Jul 2006 15:36:31 +0000 (15:36 +0000)
committerrsc <rsc>
Sun, 16 Jul 2006 15:36:31 +0000 (15:36 +0000)
Add cons_puts for cleaner output.

ulib.c
user.h [new file with mode: 0644]
user1.c
userfs.c
usertests.c
usys.S

diff --git a/ulib.c b/ulib.c
index 543323cf408d9a68177d28af8926f20110b43a3a..97afc8c2c6560e39178bdb1492642b543b1c3900 100644 (file)
--- a/ulib.c
+++ b/ulib.c
@@ -1,5 +1,13 @@
+#include "user.h"
+
 int
 puts(char *s)
+{
+  return cons_puts(s);
+}
+
+int
+puts1(char *s)
 {
   int i;
 
diff --git a/user.h b/user.h
new file mode 100644 (file)
index 0000000..7571767
--- /dev/null
+++ b/user.h
@@ -0,0 +1,15 @@
+int fork(void);
+int exit(void) __attribute__((noreturn));
+int wait(void);
+int cons_putc(int);
+int pipe(int*);
+int write(int, void*, int);
+int read(int, void*, int);
+int close(int);
+int block(void);
+int kill(int);
+int panic(char*);
+int cons_puts(char*);
+
+int puts(char*);
+int puts1(char*);
diff --git a/user1.c b/user1.c
index d4146996bc7ba63d020a537094fda0b1fa01ce35..bbe6f5b673abbcea3220db7679b5494258b76478 100644 (file)
--- a/user1.c
+++ b/user1.c
@@ -1,5 +1,8 @@
+#include "user.h"
+
 char buf[32];
 
+int
 main()
 {
   int pid, fds[2], n;
@@ -15,6 +18,5 @@ main()
     puts(buf);
     puts("\n");
   }
-  while(1)
-    ;
+  for(;;);
 }
index 5de90e62d09526f13ba549a166e9a9a262df0a6a..f7da24b33b11c2851c3075aaf614a65082b1d2b0 100644 (file)
--- a/userfs.c
+++ b/userfs.c
@@ -1,9 +1,13 @@
+#include "user.h"
+
 // file system tests
 
 char buf[1024];
 
+int
 main()
 {
   puts("userfs running\n");
   block();
+  return 0;
 }
index e277839382db210c27ea9d42eb544a2154fde797..78b9477751854e5990e7705b9db9c0263bc927cf 100644 (file)
@@ -1,3 +1,5 @@
+#include "user.h"
+
 char buf[2048];
 
 // simple fork and pipe read/write
@@ -17,10 +19,10 @@ pipe1()
         buf[i] = seq++;
       if(write(fds[1], buf, 1033) != 1033){
         panic("pipe1 oops 1\n");
-        exit(1);
+        exit();
       }
     }
-    exit(0);
+    exit();
   } else {
     close(fds[1]);
     total = 0;
@@ -109,12 +111,13 @@ exitwait()
         return;
       }
     } else {
-      exit(0);
+      exit();
     }
   }
   puts("exitwait ok\n");
 }
 
+int
 main()
 {
   puts("usertests starting\n");
@@ -123,5 +126,6 @@ main()
   preempt();
   exitwait();
 
-  panic("usertests finished successfuly");
+  panic("usertests succeeded");
+  return 0;
 }
diff --git a/usys.S b/usys.S
index 0e350359c383fd4591d179993c1948d73a80f127..45d6ca854a0a26182cfb6c3c6fdc003c695a6081 100644 (file)
--- a/usys.S
+++ b/usys.S
@@ -19,3 +19,4 @@ STUB(close)
 STUB(block)
 STUB(kill)
 STUB(panic)
+STUB(cons_puts)