Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | RSS feed

  1. #include <ksys.h>
  2. #include <string.h>
  3. #include <stdlib.h>
  4.  
  5. char __shell_shm_name[32];
  6. char*__shell_shm=NULL;
  7. int __shell_is_init=0;
  8.  
  9. int __shell_shm_init()
  10. {
  11.     __shell_is_init=1;
  12.     ksys_proc_table_t *proc_info = (ksys_proc_table_t*)malloc(sizeof(ksys_proc_table_t));
  13.     if(proc_info == NULL){
  14.         return -1;
  15.     }
  16.     unsigned PID;
  17.  
  18.     _ksys_process_info(proc_info, -1);
  19.     PID = proc_info->pid;
  20.     free(proc_info);
  21.  
  22.     itoa(PID, __shell_shm_name);
  23.     strcat(__shell_shm_name, "-SHELL");
  24.     return _ksys_shm_open(__shell_shm_name,  KSYS_SHM_OPEN_ALWAYS | KSYS_SHM_WRITE, 1024*16, &__shell_shm);
  25. }
  26.  
  27. int __shell_init()
  28. {
  29.     if(__shell_is_init){
  30.         return 0;
  31.     }
  32.     if(__shell_shm_init()){
  33.         debug_printf("Shell problems detected!\n");
  34.         return -1;
  35.     }
  36.     return 0;
  37. }