Rev 8632 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
8629 | turbocat | 1 | #include |
2 | #include |
||
3 | #include |
||
8632 | turbocat | 4 | #include "shell.h" |
8635 | turbocat | 5 | #include |
8629 | turbocat | 6 | |
7 | char __shell_shm_name[32]; |
||
8 | char*__shell_shm=NULL; |
||
9 | int __shell_is_init=0; |
||
10 | |||
11 | int __shell_shm_init() |
||
12 | { |
||
13 | __shell_is_init=1; |
||
14 | ksys_proc_table_t *proc_info = (ksys_proc_table_t*)malloc(sizeof(ksys_proc_table_t)); |
||
15 | if(proc_info == NULL){ |
||
16 | return -1; |
||
17 | } |
||
18 | unsigned PID; |
||
19 | |||
20 | _ksys_process_info(proc_info, -1); |
||
21 | PID = proc_info->pid; |
||
22 | free(proc_info); |
||
23 | |||
24 | itoa(PID, __shell_shm_name); |
||
25 | strcat(__shell_shm_name, "-SHELL"); |
||
8632 | turbocat | 26 | return _ksys_shm_open(__shell_shm_name, KSYS_SHM_OPEN_ALWAYS | KSYS_SHM_WRITE, SHELL_SHM_MAX, &__shell_shm); |
8629 | turbocat | 27 | } |
28 | |||
8635 | turbocat | 29 | void __shell_init() |
8629 | turbocat | 30 | { |
8635 | turbocat | 31 | if(!__shell_is_init){ |
32 | if(__shell_shm_init()){ |
||
33 | debug_printf("SHELL problems detected!\n"); |
||
34 | _ksys_exit(); |
||
35 | } |
||
36 | |||
37 | if(!shell_ping()){ |
||
38 | debug_printf("No SHELL found!\n"); |
||
39 | _ksys_exit(); |
||
40 | } |
||
8629 | turbocat | 41 | } |
42 | } |