/* ** Copyright 2001, Travis Geiselbrecht. All rights reserved. ** Distributed under the terms of the NewOS License. */ #include #include #include #include static void setup_io() { int i; for(i= 0; i< 256; i++) { close(i); } /* XXX - open currently ignores these flags, but they * should be checked once it doesn't :) * Is STDERR really O_WRONLY? */ open("/dev/console", O_RDONLY, 0); /* stdin */ open("/dev/console", O_WRONLY, 0); /* stdout */ open("/dev/console", O_WRONLY, 0); /* stderr */ } int main() { setup_io(); printf("Welcome to OpenBeOS!\n"); if(1) { team_id pid; pid = sys_create_team("/boot/bin/fortune", "/boot/bin/fortune", NULL, 0, NULL, 0, 5); if (pid >= 0) { int retcode; sys_wait_on_team(pid, &retcode); } else { printf("Failed to create a team for fortune.\n"); } } while(1) { team_id pid; pid = sys_create_team("/boot/bin/shell", "/boot/bin/shell", NULL, 0, NULL, 0, 5); if(pid >= 0) { int retcode; printf("init: spawned shell, pid 0x%lx\n", pid); sys_wait_on_team(pid, &retcode); printf("init: shell exited with return code %d\n", retcode); } else { printf("Failed to start a shell :(\n"); } } printf("init exiting\n"); return 0; }