Add user.h for prototypes.

Add cons_puts for cleaner output.
This commit is contained in:
rsc 2006-07-16 15:36:31 +00:00
parent b903b693ec
commit 9b37d1bfaa
6 changed files with 40 additions and 6 deletions

8
ulib.c
View file

@ -1,5 +1,13 @@
#include "user.h"
int
puts(char *s)
{
return cons_puts(s);
}
int
puts1(char *s)
{
int i;

15
user.h Normal file
View file

@ -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*);

View file

@ -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(;;);
}

View file

@ -1,9 +1,13 @@
#include "user.h"
// file system tests
char buf[1024];
int
main()
{
puts("userfs running\n");
block();
return 0;
}

View 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;
}

1
usys.S
View file

@ -19,3 +19,4 @@ STUB(close)
STUB(block)
STUB(kill)
STUB(panic)
STUB(cons_puts)