/* * Main routine */ int main(int argc, char *argv[]) { char test_str[] = "test stdout...\n\n"; syslog(LOG_INFO, "\nfileio: fs test program\n"); /* Wait 1 sec until loading fs server */ timer_sleep(1000, 0); /* * Prepare to use a file system. */ fslib_init(); /* * Mount file systems */ mount("", "/", "ramfs", 0, NULL); mkdir("/dev", 0); mount("", "/dev", "devfs", 0, NULL); /* device */ mkdir("/boot", 0); mount("/dev/ram0", "/boot", "arfs", 0, NULL); /* archive */ mkdir("/tmp", 0); /* * Prepare stdio */ open("/dev/tty", O_RDWR); /* stdin */ dup(0); /* stdout */ dup(0); /* stderr */ /* Test device write */ write(STDOUT_FILENO, test_str, strlen(test_str)); test_write(); cat_file(); /* test read/write */ test_invalid(); /* test invalid request */ test_read(); /* test read loop */ test_open(); /* test open/close loop */ /* * Disconnect from a file system. */ fslib_exit(); return 0; }
static int exec_boot(struct msg *msg) { /* Check client's capability. */ if (task_chkcap(msg->hdr.task, CAP_PROTSERV) != 0) return EPERM; /* Register to process server */ register_process(); /* Register to file server */ fslib_init(); return 0; }
/* * Main routine */ int main(int argc, char *argv[]) { syslog(LOG_INFO, "\nfifo: fs test program\n"); /* Wait 1 sec until loading fs server */ timer_sleep(1000, 0); /* * Prepare to use a file system. */ fslib_init(); /* * Mount file systems */ mount("", "/", "ramfs", 0, NULL); mkdir("/dev", 0); mount("", "/dev", "devfs", 0, NULL); /* device */ mkdir("/tmp", 0); /* * Prepare stdio */ open("/dev/tty", O_RDWR); /* stdin */ dup(0); /* stdout */ dup(0); /* stderr */ if (mkfifo(fifo_name, 0) < 0) err(1, "mkfifo(%s)", fifo_name); blocking_test(); nonblock_test(); /* sleep a bit */ timer_sleep(2000/*ms*/, NULL); /* * Disconnect from a file system. */ fslib_exit(); return 0; }