Fixes to Libc, Doxygen Comments and VTerm layout
[tpg/acess2.git] / Usermode / Applications / init_src / main.c
1 /*
2  * Acess2 System Init Task
3  */
4 #include <acess/sys.h>
5
6 // === CONSTANTS ===
7 #define NULL    ((void*)0)
8 #define NUM_TERMS       4
9 #define DEFAULT_TERMINAL        "/Devices/VTerm/0"
10 #define DEFAULT_SHELL   "/Acess/SBin/login"
11
12 // === CODE ===
13 /**
14  * \fn int main(int argc, char *argv[])
15  * \brief Entrypoint
16  */
17 int main(int argc, char *argv[])
18 {
19          int    tid;
20         // int  i;
21         char    termpath[sizeof(DEFAULT_TERMINAL)+1] = DEFAULT_TERMINAL;
22         
23         //for( i = 0; i < NUM_TERMS; i++ )
24         //{
25                 //termpath[ sizeof(DEFAULT_TERMINAL)-1 ] = '0' + i;
26                 open(termpath, OPENFLAG_READ);  // Stdin
27                 open(termpath, OPENFLAG_WRITE); // Stdout
28                 open(termpath, OPENFLAG_WRITE); // Stderr
29                 
30                 tid = clone(CLONE_VM, 0);
31                 if(tid == 0)
32                 {
33                         execve(DEFAULT_SHELL, NULL, NULL);
34                         for(;;) __asm__ __volatile__("hlt");
35                 }
36         //}
37         
38         for(;;) sleep();
39         
40         return 42;
41 }

UCC git Repository :: git.ucc.asn.au