-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmain.c
More file actions
37 lines (27 loc) · 734 Bytes
/
main.c
File metadata and controls
37 lines (27 loc) · 734 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <stdlib.h>
#include <sys/env.h>
#include <stdio.h>
#include <errno.h>
#include <time.h>
#include <buildin/sighandler.h>
#include <buildin/thread.h>
extern int main(int argc, char* argv[], char* envp[]);
void _start() {
for (int i = 0; i < 33; i++) {
env_set2(ENV_SIGHANDLER, i, __libc_sighandler);
}
env_set2(ENV_SIGHANDLER, SIG_KASSERT_FAIL, __libc_sighandler);
env_set2(ENV_SIGHANDLER, SIG_INTR, __libc_intr_sighandler);
__libc_init_alloc();
__libc_init_stdio();
__libc_init_childs_list();
env_set(ENV_ERRNO, &__errno);
char** argv = env(ENV_ARGV);
char** envp = env(ENV_ENVP);
int argc = 0;
while(argv[argc] != NULL) {
argc++;
}
int return_code = main(argc, argv, envp);
exit(return_code);
}