summaryrefslogtreecommitdiff
path: root/usertests.c
diff options
context:
space:
mode:
Diffstat (limited to 'usertests.c')
-rw-r--r--usertests.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/usertests.c b/usertests.c
index 78b9477..370054b 100644
--- a/usertests.c
+++ b/usertests.c
@@ -5,7 +5,7 @@ char buf[2048];
// simple fork and pipe read/write
void
-pipe1()
+pipe1(void)
{
int fds[2], pid;
int seq = 0, i, n, cc, total;
@@ -27,10 +27,7 @@ pipe1()
close(fds[1]);
total = 0;
cc = 1;
- while(1){
- n = read(fds[0], buf, cc);
- if(n < 1)
- break;
+ while((n = read(fds[0], buf, cc)) > 0){
for(i = 0; i < n; i++){
if((buf[i] & 0xff) != (seq++ & 0xff)){
panic("pipe1 oops 2\n");
@@ -52,19 +49,19 @@ pipe1()
// meant to be run w/ at most two CPUs
void
-preempt()
+preempt(void)
{
int pid1, pid2, pid3;
int pfds[2];
pid1 = fork();
if(pid1 == 0)
- while(1)
+ for(;;)
;
pid2 = fork();
if(pid2 == 0)
- while(1)
+ for(;;)
;
pipe(pfds);
@@ -74,7 +71,7 @@ preempt()
if(write(pfds[1], "x", 1) != 1)
panic("preempt write error");
close(pfds[1]);
- while(1)
+ for(;;)
;
}
@@ -95,7 +92,7 @@ preempt()
// try to find any races between exit and wait
void
-exitwait()
+exitwait(void)
{
int i, pid;
@@ -118,7 +115,7 @@ exitwait()
}
int
-main()
+main(void)
{
puts("usertests starting\n");