Changes in uspace/lib/c/generic/libc.c [47b7006:64d2b10] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/libc.c
r47b7006 r64d2b10 43 43 #include <stdio.h> 44 44 #include <unistd.h> 45 #include <stdlib.h>46 45 #include <malloc.h> 47 46 #include <tls.h> 47 #include <thread.h> 48 48 #include <fibril.h> 49 #include <task.h> 49 #include <async.h> 50 #include <as.h> 50 51 #include <loader/pcb.h> 51 52 #include "private/libc.h" 52 #include "private/async.h"53 #include "private/async_sess.h"54 #include "private/malloc.h"55 #include "private/io.h"56 53 57 static bool env_setup = false; 54 void _exit(int status) 55 { 56 thread_exit(status); 57 } 58 58 59 59 void __main(void *pcb_ptr) 60 60 { 61 61 /* Initialize user task run-time environment */ 62 __ malloc_init();62 __heap_init(); 63 63 __async_init(); 64 __async_sess_init();65 66 64 fibril_t *fibril = fibril_setup(); 67 if (fibril == NULL)68 abort();69 70 65 __tcb_set(fibril->tcb); 71 66 … … 73 68 __pcb = (pcb_t *) pcb_ptr; 74 69 75 /* The basic run-time environment is setup */76 env_setup = true;77 78 70 int argc; 79 71 char **argv; 80 72 81 /* 82 * Get command line arguments and initialize 83 * standard input and output 84 */ 73 /* Get command line arguments and initialize 74 standard input and output */ 85 75 if (__pcb == NULL) { 86 76 argc = 0; … … 94 84 } 95 85 96 /* 97 * Run main() and set task return value 98 * according the result 99 */ 100 int retval = main(argc, argv); 101 exit(retval); 86 /* Run main() and set task return value 87 according the result */ 88 (void) task_retval(main(argc, argv)); 102 89 } 103 90 104 void exit(int status)91 void __exit(void) 105 92 { 106 if (env_setup) { 107 __stdio_done(); 108 task_retval(status); 109 fibril_teardown(__tcb_get()->fibril_data); 110 } 111 112 __SYSCALL1(SYS_TASK_EXIT, false); 113 114 /* Unreachable */ 115 while (1); 116 } 117 118 void abort(void) 119 { 120 __SYSCALL1(SYS_TASK_EXIT, true); 121 122 /* Unreachable */ 123 while (1); 93 __stdio_done(); 94 fibril_teardown(__tcb_get()->fibril_data); 95 _exit(0); 124 96 } 125 97
Note:
See TracChangeset
for help on using the changeset viewer.