xv6-cs450/userfs.c

40 lines
645 B
C
Raw Normal View History

#include "user.h"
2006-08-08 20:07:37 +02:00
#include "types.h"
#include "fs.h"
2006-07-10 18:27:15 +02:00
// file system tests
char buf[1024];
2006-07-29 00:33:07 +02:00
char *args[] = { "echo", "hello", "goodbye", 0 };
2006-07-10 18:27:15 +02:00
int
2006-07-17 03:25:22 +02:00
main(void)
2006-07-10 18:27:15 +02:00
{
2006-07-29 11:35:02 +02:00
int fd;
2006-07-11 03:07:40 +02:00
puts("userfs running\n");
2006-07-10 18:27:15 +02:00
block();
2006-08-08 20:07:37 +02:00
if (mknod ("console", T_DEV, 1, 1) < 0)
puts ("mknod failed\n");
else
puts ("made a node\n");
2006-07-29 11:35:02 +02:00
fd = open("echo", 0);
if(fd >= 0){
puts("open echo ok\n");
close(fd);
} else {
puts("open echo failed!\n");
}
fd = open("doesnotexist", 0);
if(fd >= 0){
puts("open doesnotexist succeeded!\n");
close(fd);
} else {
puts("open doesnotexist failed\n");
}
2006-07-29 00:33:07 +02:00
exec("echo", args);
return 0;
2006-07-10 18:27:15 +02:00
}