add new function - lsmod

This function input list loaded drivers.

git-svn-id: svn://kolibrios.org@9780 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Doczom 2022-04-23 21:37:05 +00:00
parent 953d47e06c
commit 5cbb298e24
5 changed files with 38 additions and 1 deletions

View File

@ -76,6 +76,7 @@ void get_file_dir_loc(char *filepath, char *dir_path);
#include "cmd/cmd_ver.c" #include "cmd/cmd_ver.c"
#include "cmd/cmd_pwd.c" #include "cmd/cmd_pwd.c"
#include "cmd/cmd_ls.c" #include "cmd/cmd_ls.c"
#include "cmd/cmd_lsmod.c"
#include "cmd/cmd_ps.c" #include "cmd/cmd_ps.c"
#include "cmd/cmd_kill.c" #include "cmd/cmd_kill.c"
#include "cmd/cmd_pkill.c" #include "cmd/cmd_pkill.c"

View File

@ -0,0 +1,33 @@
struct service_str{
char name[16];
struct service_str* fd;
struct service_str* bk;
uint32_t base; // base addreass service for kernel_free
uint32_t entry; //unsigned drvEntry(int action, char *cmdline)
uint32_t srv_proc; // static int __stdcall service_proc(ioctl_t *my_ctl)
//void* srv_proc_kern;
};
int cmd_lsmod(char param[]) {
struct service_str* fd;
struct service_str* bk;
struct service_str srv_str;
asm_inline(
"int $0x40"
:"=b"(fd), "=c"(bk)
:"a"(68), "b"(31), "c"(1)
);
srv_str.fd = fd;
printf("%-*s Hendler Service_proc\n\r", 16, " Name");
while (1) {
asm_inline(
"int $0x40"
::"a"(68), "b"(31), "c"(2), "d"(fd), "D"(&srv_str)
);
printf("%-*s 0x%X 0x%X \n", 16, srv_str.name, fd, srv_str.srv_proc);
if (fd == bk) break;
fd = srv_str.fd;
};
return TRUE;
}

View File

@ -54,6 +54,7 @@ int cmd_help(char cmd[]);
int cmd_kill(char process[]); int cmd_kill(char process[]);
int cmd_pkill(char process_name[]); int cmd_pkill(char process_name[]);
int cmd_ls(char dir[]); int cmd_ls(char dir[]);
int cmd_lsmod(char param[]);
int cmd_mkdir(char dir[]); int cmd_mkdir(char dir[]);
int cmd_more(char file[]); int cmd_more(char file[]);
int cmd_ps(char arg[]); int cmd_ps(char arg[]);

View File

@ -18,6 +18,7 @@ const command_t COMMANDS[]=
{"kill", " Stops a running process. Usage:\n\r kill <PID of process>\n\r kill all\n\r", &cmd_kill}, {"kill", " Stops a running process. Usage:\n\r kill <PID of process>\n\r kill all\n\r", &cmd_kill},
{"pkill", " Kills all processes by name. Usage:\n\r pkill <process_name>\n\r", &cmd_pkill}, {"pkill", " Kills all processes by name. Usage:\n\r pkill <process_name>\n\r", &cmd_pkill},
{"ls", " Lists the files in a directory. Usage:\n\r ls ;lists the files in current directory\n\r ls <directory> ;lists the files at specified folder\n\r ls -1 ;lists the files in a single column\n\r", &cmd_ls}, {"ls", " Lists the files in a directory. Usage:\n\r ls ;lists the files in current directory\n\r ls <directory> ;lists the files at specified folder\n\r ls -1 ;lists the files in a single column\n\r", &cmd_ls},
{"lsmod", " list working driver \n\r", &cmd_lsmod},
{"mkdir", " Create directory and parent directories as needed. Usage:\n\r mkdir <folder/name>\n\r", &cmd_mkdir}, {"mkdir", " Create directory and parent directories as needed. Usage:\n\r mkdir <folder/name>\n\r", &cmd_mkdir},
{"more", " Displays a file data to the screen. Usage:\n\r more <file name>\n\r", &cmd_more}, {"more", " Displays a file data to the screen. Usage:\n\r more <file name>\n\r", &cmd_more},
{"ps", " Lists the current processes running\n\r or shows more info on <procname> and save LASTPID\n\r", &cmd_ps}, {"ps", " Lists the current processes running\n\r or shows more info on <procname> and save LASTPID\n\r", &cmd_ps},

View File

@ -19,7 +19,8 @@ const command_t COMMANDS[]=
{"kill", " “¡¨¢ ¥â ¯à®æ¥áá. ˆá¯®«ì§®¢ ­¨¥:\n\r kill <PID ¯à®æ¥áá >\n\r kill all\n\r", &cmd_kill}, {"kill", " “¡¨¢ ¥â ¯à®æ¥áá. ˆá¯®«ì§®¢ ­¨¥:\n\r kill <PID ¯à®æ¥áá >\n\r kill all\n\r", &cmd_kill},
{"pkill", " “¡¨¢ ¥â ¢á¥ ¯à®æ¥ááë ¯® ¨¬¥­¨. ˆá¯®«ì§®¢ ­¨¥:\n\r pkill <¨¬ï_¯à®æ¥áá >\n\r", &cmd_pkill}, {"pkill", " “¡¨¢ ¥â ¢á¥ ¯à®æ¥ááë ¯® ¨¬¥­¨. ˆá¯®«ì§®¢ ­¨¥:\n\r pkill <¨¬ï_¯à®æ¥áá >\n\r", &cmd_pkill},
{"ls", " ‚뢮¤¨â ᯨ᮪ ä ©«®¢. ˆá¯®«ì§®¢ ­¨¥:\n\r ls ;ᯨ᮪ ä ©«®¢ ¢ ⥪ã饬 ª â «®£¥\n\r ls <¤¨à¥ªâ®à¨ï> ;ᯨ᮪ ä ©«®¢ ¨§ § ¤ ­­®© ¤¨à¥ªâ®à¨¨\n\r", &cmd_ls}, {"ls", " ‚뢮¤¨â ᯨ᮪ ä ©«®¢. ˆá¯®«ì§®¢ ­¨¥:\n\r ls ;ᯨ᮪ ä ©«®¢ ¢ ⥪ã饬 ª â «®£¥\n\r ls <¤¨à¥ªâ®à¨ï> ;ᯨ᮪ ä ©«®¢ ¨§ § ¤ ­­®© ¤¨à¥ªâ®à¨¨\n\r", &cmd_ls},
{"mkdir", " ‘®§¤ ¥â ª â «®£ ¨ த¨â¥«ì᪨¥ ª â «®£¨ ¯à¨ ­¥®¡å®¤¨¬®áâ¨. ˆá¯®«ì§®¢ ­¨¥:\n\r mkdir <¨¬ï/¯ ¯ª¨>", &cmd_mkdir}, {"lsmod", " list working driver \n\r", &cmd_lsmod},
{"mkdir", " ‘®§¤ ¥â ª â «®£ ¨ த¨â¥«ì᪨¥ ª â «®£¨ ¯à¨ ­¥®¡å®¤¨¬®áâ¨. ˆá¯®«ì§®¢ ­¨¥:\n\r mkdir <¨¬ï/¯ ¯ª¨>", &cmd_mkdir},
{"more", " ‚뢮¤¨â ᮤ¥à¦¨¬®¥ ä ©«  ­  íªà ­. ˆá¯®«ì§®¢ ­¨¥:\n\r more <¨¬ï ä ©« >\n\r", &cmd_more}, {"more", " ‚뢮¤¨â ᮤ¥à¦¨¬®¥ ä ©«  ­  íªà ­. ˆá¯®«ì§®¢ ­¨¥:\n\r more <¨¬ï ä ©« >\n\r", &cmd_more},
{"ps", " ‚뢮¤¨â ᯨ᮪ ¯à®æ¥áᮢ\n\r …᫨ 㪠§ ­® <¨¬ï¯à®æ¥áá >, ¯®ª §ë¢ ¥â ¡®«ìè¥ ¤ ­­ëå ¨ á®åà ­ï¥â LASTPID\n\r", &cmd_ps}, {"ps", " ‚뢮¤¨â ᯨ᮪ ¯à®æ¥áᮢ\n\r …᫨ 㪠§ ­® <¨¬ï¯à®æ¥áá >, ¯®ª §ë¢ ¥â ¡®«ìè¥ ¤ ­­ëå ¨ á®åà ­ï¥â LASTPID\n\r", &cmd_ps},
{"pwd", " <20>®ª §ë¢ ¥â ¨¬ï ⥪ã饩 ¤¨à¥ªâ®à¨¨\n\r", &cmd_pwd}, {"pwd", " <20>®ª §ë¢ ¥â ¨¬ï ⥪ã饩 ¤¨à¥ªâ®à¨¨\n\r", &cmd_pwd},