CS350 COS
COS
Loading...
Searching...
No Matches
init.c
Go to the documentation of this file.
1
2#include <stdio.h>
3#include <syscall.h>
4int
5main(int argc, const char *argv[])
6{
7 uint64_t status;
8
9 fputs("Init spawning shell\n", stdout);
10
11 const char *args[] = { "/bin/shell", NULL };
12 status = OSSpawn("/bin/shell", &args[0]);
13 if (status > 100) {
14 printf("init: Could not spawn shell %016lx\n", status);
15 }
16
17#if 0
18 while (1) {
19 status = OSWait(0);
20 printf("init: Zombie process exited (%016lx)\n", status);
21 }
22#else
23 for (;;)
24 ;
25#endif
26}
27
uint64_t OSSpawn(const char *path, const char *argv[])
Definition: syscall.c:29
uint64_t OSWait(uint64_t pid)
Definition: syscall.c:35
int main(int argc, const char *argv[])
Definition: init.c:5
#define NULL
Definition: stddef.h:6
int printf(const char *fmt,...)
Definition: printf.c:212
int fputs(const char *str, FILE *fh)
Definition: file.c:132
FILE * stdout
Definition: file.c:16
unsigned long uint64_t
Definition: types.h:13