01fa8f6f3368a9eae779fca4d3aea9cd10c3ecb3
2 * Copyright (C) 2013 Felix Fietkau <nbd@openwrt.org>
3 * Copyright (C) 2013 John Crispin <blogic@openwrt.org>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License version 2.1
7 * as published by the Free Software Foundation
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
16 #include <sys/syscall.h>
18 #include <sys/utsname.h>
22 #include <sys/syscall.h>
23 #include <sys/types.h>
35 #include <libubox/avl.h>
36 #include <libubox/avl-cmp.h>
37 #include <libubox/utils.h>
38 #include <libubox/ulog.h>
39 #include <libubox/kvlist.h>
40 #include <libubox/list.h>
42 #define DEF_MOD_PATH "/modules/%s/"
43 #define MOD_BUILTIN "modules.builtin"
44 #define MOD_BUILTIN_MODINFO "modules.builtin.modinfo"
45 /* duplicated from in-kernel include/linux/module.h */
46 #define MODULE_NAME_LEN (64 - sizeof(unsigned long))
52 struct list_head list
;
72 int refcnt
; /* number of references from module_node.m */
81 static struct avl_tree modules
;
82 static KVLIST(options
, kvlist_strlen
);
84 static char **module_folders
= NULL
;
86 static void free_module(struct module
*m
);
88 static int init_module_folders(void)
93 char *s
, *e
, *p
, path
[330], ldpath
[256];
96 s
= getenv("LD_LIBRARY_PATH");
99 e
+= snprintf(ldpath
, sizeof(ldpath
), "%s:", s
);
101 e
+= snprintf(e
, sizeof(ldpath
) - (e
- ldpath
), "/lib");
105 for (s
= p
= ldpath
; p
<= e
; p
++) {
106 if (*p
!= ':' && *p
!= '\0')
110 snprintf(path
, sizeof(path
), "%s" DEF_MOD_PATH
, s
, ver
.release
);
112 if (!stat(path
, &st
) && S_ISDIR(st
.st_mode
)) {
113 module_folders
= realloc(module_folders
, sizeof(p
) * (n
+ 2));
115 if (!module_folders
) {
116 ULOG_ERR("out of memory\n");
120 module_folders
[n
++] = strdup(path
);
126 if (!module_folders
) {
127 ULOG_ERR("no module folders for kernel version %s found\n", ver
.release
);
131 module_folders
[n
] = NULL
;
135 static void free_module_folders(void)
141 while (module_folders
[n
])
142 free(module_folders
[n
++]);
143 free(module_folders
);
146 static struct module
*find_module(const char *name
)
148 struct module_node
*mn
;
149 mn
= avl_find_element(&modules
, name
, mn
, avl
);
156 static void free_modules(void)
158 struct module_node
*mn
, *tmp
;
160 avl_remove_all_elements(&modules
, mn
, avl
, tmp
) {
161 struct module
*m
= mn
->m
;
170 static char* get_module_path(char *name
)
173 static char path
[256];
176 if (!stat(name
, &s
) && S_ISREG(s
.st_mode
))
179 for (p
= module_folders
; *p
; p
++) {
180 snprintf(path
, sizeof(path
), "%s%s.ko", *p
, name
);
181 if (!stat(path
, &s
) && S_ISREG(s
.st_mode
))
188 static char* get_module_name(char *path
)
190 static char name
[MODULE_NAME_LEN
];
193 strncpy(name
, basename(path
), sizeof(name
) - 1);
195 t
= strstr(name
, ".ko");
202 static int elf64_find_section(char *map
, const char *section
, unsigned int *offset
, unsigned int *size
)
204 const char *secnames
;
209 e
= (Elf64_Ehdr
*) map
;
210 sh
= (Elf64_Shdr
*) (map
+ e
->e_shoff
);
212 secnames
= map
+ sh
[e
->e_shstrndx
].sh_offset
;
213 for (i
= 0; i
< e
->e_shnum
; i
++) {
214 if (!strcmp(section
, secnames
+ sh
[i
].sh_name
)) {
215 *size
= sh
[i
].sh_size
;
216 *offset
= sh
[i
].sh_offset
;
224 static int elf32_find_section(char *map
, const char *section
, unsigned int *offset
, unsigned int *size
)
226 const char *secnames
;
231 e
= (Elf32_Ehdr
*) map
;
232 sh
= (Elf32_Shdr
*) (map
+ e
->e_shoff
);
234 secnames
= map
+ sh
[e
->e_shstrndx
].sh_offset
;
235 for (i
= 0; i
< e
->e_shnum
; i
++) {
236 if (!strcmp(section
, secnames
+ sh
[i
].sh_name
)) {
237 *size
= sh
[i
].sh_size
;
238 *offset
= sh
[i
].sh_offset
;
246 static int elf_find_section(char *map
, const char *section
, unsigned int *offset
, unsigned int *size
)
248 int clazz
= map
[EI_CLASS
];
249 int endian
= map
[EI_DATA
];
251 #if __BYTE_ORDER == __LITTLE_ENDIAN
252 if (endian
!= ELFDATA2LSB
)
253 #elif __BYTE_ORDER == __BIG_ENDIAN
254 if (endian
!= ELFDATA2MSB
)
256 #error "unsupported endian"
259 ULOG_ERR("invalid endianess: %d\n", endian
);
263 if (clazz
== ELFCLASS32
)
264 return elf32_find_section(map
, section
, offset
, size
);
265 else if (clazz
== ELFCLASS64
)
266 return elf64_find_section(map
, section
, offset
, size
);
268 ULOG_ERR("unknown elf format %d\n", clazz
);
273 static struct module_node
*
274 alloc_module_node(const char *name
, struct module
*m
, bool is_alias
)
276 struct module_node
*mn
;
279 mn
= calloc_a(sizeof(*mn
),
280 &_name
, strlen(name
) + 1);
282 mn
->avl
.key
= strcpy(_name
, name
);
284 mn
->is_alias
= is_alias
;
285 avl_insert(&modules
, &mn
->avl
);
291 static struct module
*
292 alloc_module(const char *name
, const char * const *aliases
, int naliases
, const char *depends
, int size
)
298 m
= calloc_a(sizeof(*m
),
299 &_name
, strlen(name
) + 1,
300 &_dep
, depends
? strlen(depends
) + 2 : 0);
304 m
->name
= strcpy(_name
, name
);
308 m
->depends
= strcpy(_dep
, depends
);
318 alloc_module_node(m
->name
, m
, false);
319 for (i
= 0; i
< naliases
; i
++)
320 alloc_module_node(aliases
[i
], m
, true);
325 static void free_module(struct module
*m
)
332 static int scan_loaded_modules(void)
339 fp
= fopen("/proc/modules", "r");
341 ULOG_ERR("failed to open /proc/modules\n");
345 while (getline(&buf
, &buf_len
, fp
) > 0) {
349 m
.name
= strtok(buf
, " ");
350 m
.size
= atoi(strtok(NULL
, " "));
351 m
.usage
= atoi(strtok(NULL
, " "));
352 m
.depends
= strtok(NULL
, " ");
354 if (!m
.name
|| !m
.depends
)
357 n
= find_module(m
.name
);
359 /* possibly a module outside /lib/modules/<ver>/ */
360 n
= alloc_module(m
.name
, NULL
, 0, m
.depends
, m
.size
);
363 ULOG_ERR("Failed to allocate memory for module\n");
378 static char *mmap_modinfo(const char *module
, const char *name
, struct stat
*s
, unsigned int *offset
, unsigned int *size
)
380 const bool is_builtin
= (module
== NULL
);
381 const char *mpath
= NULL
;
382 char *map
= MAP_FAILED
;
387 for (f
= module_folders
; *f
; f
++) {
388 snprintf(path
, sizeof(path
), "%s%s", *f
, MOD_BUILTIN_MODINFO
);
389 if (!stat(path
, s
) && S_ISREG(s
->st_mode
)) {
398 ULOG_ERR("cannot find modinfo path of module - %s\n", name
);
402 fd
= open(mpath
, O_RDONLY
);
404 ULOG_ERR("failed to open %s\n", mpath
);
408 if (fstat(fd
, s
) == -1) {
409 ULOG_ERR("failed to stat %s\n", mpath
);
413 map
= mmap(NULL
, s
->st_size
, PROT_READ
, MAP_PRIVATE
, fd
, 0);
414 if (map
== MAP_FAILED
) {
415 ULOG_ERR("failed to mmap %s\n", mpath
);
422 } else if (elf_find_section(map
, ".modinfo", offset
, size
)) {
423 ULOG_ERR("failed to load the .modinfo section from %s\n", mpath
);
424 munmap(map
, s
->st_size
);
434 static struct module
* get_module_info(const char *module
, const char *name
)
436 const bool is_builtin
= (module
== NULL
);
437 unsigned int offset
, size
;
438 char *map
, *strings
, *dep
= NULL
;
439 const char **aliases
= NULL
;
440 const char **aliasesr
;
442 struct module
*m
= NULL
;
445 map
= mmap_modinfo(module
, name
, &s
, &offset
, &size
);
446 if (map
== MAP_FAILED
)
449 strings
= map
+ offset
;
451 char *end
= map
+ offset
+ size
;
455 while ((strings
< end
) && !strings
[0])
460 sep
= strstr(strings
, ".");
463 if (strlen(name
) == (sep
- strings
) &&
464 !strncmp(strings
, name
, sep
- strings
))
469 sep
= strstr(strings
, "=");
474 if (!strncmp(strings
, "depends=", len
+ 1))
476 else if (!strncmp(strings
, "alias=", len
+ 1)) {
477 aliasesr
= realloc(aliases
, sizeof(sep
) * (naliases
+ 1));
479 ULOG_ERR("out of memory\n");
484 aliases
[naliases
++] = sep
;
487 strings
= &sep
[strlen(sep
)];
490 m
= alloc_module(name
, aliases
, naliases
, dep
, is_builtin
? 0 : s
.st_size
);
493 m
->state
= is_builtin
? BUILTIN
: SCANNED
;
496 if (map
!= MAP_FAILED
)
497 munmap(map
, s
.st_size
);
504 static int scan_builtin_modules(void)
513 if (!module_folders
&& init_module_folders())
515 for (p
= module_folders
; *p
; p
++) {
516 snprintf(path
, sizeof(path
), "%s%s", *p
, MOD_BUILTIN
);
517 fp
= fopen(path
, "r");
521 if (!fstat(fileno(fp
), &st
) && S_ISREG(st
.st_mode
))
524 /* Not regular file, close it and check next */
529 return 0; /* OK if modules.builtin unavailable */
531 while (getline(&buf
, &buf_len
, fp
) > 0) {
535 name
= get_module_name(buf
);
538 m
= find_module(name
);
539 if (m
&& !strcmp(m
->name
, name
)) {
540 ULOG_WARN("found duplicate builtin module %s\n", name
);
543 m
= get_module_info(NULL
, name
);
545 ULOG_ERR("failed to find info for builtin module %s\n", name
);
558 static int scan_module_folder(const char *dir
)
560 int gl_flags
= GLOB_NOESCAPE
| GLOB_MARK
;
565 path
= alloca(strlen(dir
) + sizeof("*.ko") + 1);
566 sprintf(path
, "%s*.ko", dir
);
568 if (glob(path
, gl_flags
, NULL
, &gl
) < 0)
571 for (j
= 0; j
< gl
.gl_pathc
; j
++) {
572 char *name
= get_module_name(gl
.gl_pathv
[j
]);
579 m
= find_module(name
);
583 m
= get_module_info(gl
.gl_pathv
[j
], name
);
589 opts
= kvlist_get(&options
, name
);
594 m
->state
= BLACKLISTED
;
596 m
->opts
= strdup(opts
);
604 static int scan_module_folders(void)
609 if (init_module_folders())
612 for (p
= module_folders
; *p
; p
++)
613 rv
|= scan_module_folder(*p
);
618 static int print_modinfo(const struct module
*m
)
620 const bool is_builtin
= (m
->state
== BUILTIN
);
621 unsigned int offset
, size
;
624 char *map
, *strings
, *mpath
;
629 mpath
= get_module_path(m
->name
);
630 map
= mmap_modinfo(mpath
, m
->name
, &s
, &offset
, &size
);
631 if (map
== MAP_FAILED
)
634 strings
= map
+ offset
;
636 printf("name:\t\t%s\n", m
->name
);
637 printf("filename:\t%s\n", is_builtin
? "(builtin)" : mpath
);
639 char *end
= map
+ offset
+ size
;
644 while ((strings
< end
) && !strings
[0])
649 sep
= strstr(strings
, ".");
652 if (strlen(m
->name
) == (sep
- strings
) &&
653 !strncmp(strings
, m
->name
, sep
- strings
))
658 sep
= strstr(strings
, "=");
661 dup
= strndup(strings
, sep
- strings
);
663 if (strncmp(strings
, "parm", 4)) {
665 printf("%s:\t\t%s\n", dup
, sep
);
667 printf("%s:\t%s\n", dup
, sep
);
669 sep2
= strstr(sep
, ":");
675 pname
= strndup(sep
, sep2
- sep
);
677 pdata
= strdup(sep2
);
679 list_for_each_entry(p
, ¶ms
, list
)
680 if (!strcmp(pname
, p
->name
))
683 if (list_entry_is_h(p
, ¶ms
, list
)) {
684 p
= alloca(sizeof(*p
));
686 p
->desc
= p
->type
= NULL
;
687 list_add(&p
->list
, ¶ms
);
692 if (!strcmp(dup
, "parmtype"))
700 strings
= &sep
[strlen(sep
)];
703 list_for_each_entry(p
, ¶ms
, list
) {
704 printf("parm:\t\t%s", p
->name
);
706 printf(":%s", p
->desc
);
708 printf(" (%s)", p
->type
);
718 if (map
!= MAP_FAILED
)
719 munmap(map
, s
.st_size
);
724 static int deps_available(struct module
*m
, int verbose
)
729 if (!m
->depends
|| !strcmp(m
->depends
, "-") || !strcmp(m
->depends
, ""))
735 m
= find_module(dep
);
738 ULOG_ERR("missing dependency %s\n", dep
);
739 if (verbose
&& m
&& (m
->state
!= LOADED
))
740 ULOG_ERR("dependency not loaded %s\n", dep
);
741 if (!m
|| (m
->state
!= LOADED
))
743 dep
+= strlen(dep
) + 1;
749 static int insert_module(char *path
, const char *options
)
756 ULOG_ERR("Path not specified\n");
760 if (stat(path
, &s
)) {
761 ULOG_ERR("missing module %s\n", path
);
765 fd
= open(path
, O_RDONLY
);
767 ULOG_ERR("cannot open %s\n", path
);
771 data
= malloc(s
.st_size
);
773 ULOG_ERR("out of memory\n");
777 if (read(fd
, data
, s
.st_size
) == s
.st_size
) {
778 ret
= syscall(__NR_init_module
, data
, (unsigned long) s
.st_size
, options
);
783 ULOG_ERR("failed to read full module %s\n", path
);
792 static void load_moddeps(struct module
*_m
)
797 if (!strcmp(_m
->depends
, "-") || !strcmp(_m
->depends
, ""))
803 m
= find_module(dep
);
806 ULOG_ERR("failed to find dependency %s\n", dep
);
807 if (m
&& (m
->state
!= LOADED
)) {
812 dep
= dep
+ strlen(dep
) + 1;
816 static int load_modprobe(bool allow_load_retry
)
818 int loaded
, skipped
, failed
;
819 struct module_node
*mn
;
821 bool load_retry
= false;
822 static bool first_iteration
= true;
824 avl_for_each_element(&modules
, mn
, avl
) {
828 if (m
->state
== PROBE
)
836 avl_for_each_element(&modules
, mn
, avl
) {
840 if ((m
->state
== PROBE
) && (!deps_available(m
, 0)) && (!m
->error
|| load_retry
)) {
841 if (!insert_module(get_module_path(m
->name
), (m
->opts
) ? (m
->opts
) : (""))) {
853 else if (m
->state
== PROBE
)
857 if (allow_load_retry
) {
858 /* if we can't load anything else let's try to load failed modules */
859 load_retry
= loaded
? (failed
&& !skipped
) : (failed
&& !load_retry
&& !first_iteration
);
862 first_iteration
= false;
863 } while (loaded
|| load_retry
);
865 return skipped
+ failed
;
868 static int print_insmod_usage(void)
870 ULOG_INFO("Usage:\n\tinsmod filename [args]\n");
875 static int print_modprobe_usage(void)
879 "\tmodprobe [-q] [-v] filename\n"
880 "\tmodprobe -a [-q] [-v] filename [filename...]\n"
886 static int print_usage(char *arg
)
888 ULOG_INFO("Usage:\n\t%s module\n", arg
);
893 static int main_insmod(int argc
, char **argv
)
895 char *name
, *path
, *cur
, *opts
= NULL
;
896 int i
, ret
= -1, len
;
899 return print_insmod_usage();
901 name
= get_module_name(argv
[1]);
903 ULOG_ERR("cannot find module - %s\n", argv
[1]);
907 if (scan_loaded_modules())
910 if (find_module(name
)) {
911 ULOG_ERR("module is already loaded - %s\n", name
);
916 for (len
= 1, i
= 2; i
< argc
; i
++)
917 len
+= strlen(argv
[i
]) + 1;
921 ULOG_ERR("out of memory\n");
927 for (i
= 2; i
< argc
; i
++) {
932 cur
+= sprintf(cur
, "%s", argv
[i
]);
935 if (init_module_folders()) {
936 fprintf(stderr
, "Failed to find the folder holding the modules\n");
940 if (!(path
= get_module_path(argv
[1])) ||
941 (path
= get_module_path(name
))) {
942 fprintf(stderr
, "Failed to find %s. Maybe it is a built in module ?\n", name
);
946 ret
= insert_module(path
, opts
);
948 ULOG_ERR("failed to insert %s\n", get_module_path(name
));
953 free_module_folders();
958 static int main_rmmod(int argc
, char **argv
)
965 return print_usage("rmmod");
967 if (scan_loaded_modules())
970 if (scan_builtin_modules())
973 name
= get_module_name(argv
[1]);
974 m
= find_module(name
);
976 ULOG_ERR("module is not loaded\n");
979 if (m
->state
== BUILTIN
) {
980 ULOG_ERR("module is builtin\n");
983 ret
= syscall(__NR_delete_module
, m
->name
, 0);
986 ULOG_ERR("unloading the module failed\n");
990 free_module_folders();
995 static int main_lsmod(int argc
, char **argv
)
997 struct module_node
*mn
;
1001 if (scan_loaded_modules())
1004 avl_for_each_element(&modules
, mn
, avl
) {
1008 if (m
->state
== LOADED
) {
1009 printf("%-20s%8d%3d ",
1010 m
->name
, m
->size
, m
->usage
);
1011 if (m
->depends
&& strcmp(m
->depends
, "-") && strcmp(m
->depends
, "")) {
1015 dep
= dep
+ strlen(dep
) + 1;
1029 static int main_modinfo(int argc
, char **argv
)
1036 return print_usage("modinfo");
1038 if (scan_module_folders())
1041 if (scan_builtin_modules())
1044 name
= get_module_name(argv
[1]);
1045 m
= find_module(name
);
1047 ULOG_ERR("cannot find module - %s\n", argv
[1]);
1056 free_module_folders();
1061 static int main_modprobe(int argc
, char **argv
)
1063 struct module_node
*mn
;
1067 int log_level
= LOG_WARNING
;
1070 bool use_all
= false;
1072 while ((opt
= getopt(argc
, argv
, "aqv")) != -1 ) {
1077 case 'q': /* shhhh! */
1081 log_level
= LOG_DEBUG
;
1084 return print_modprobe_usage();
1090 return print_modprobe_usage(); /* expected module after options */
1092 /* after print_modprobe_usage() so it won't be filtered out */
1093 ulog_threshold(log_level
);
1095 if (scan_module_folders())
1098 if (scan_loaded_modules())
1101 if (scan_builtin_modules())
1107 name
= get_module_name(argv
[optind
]);
1108 m
= find_module(name
);
1110 if (m
&& m
->state
== BLACKLISTED
) {
1112 ULOG_INFO("%s is blacklisted\n", name
);
1113 } else if (m
&& m
->state
== LOADED
) {
1115 ULOG_INFO("%s is already loaded\n", name
);
1116 } else if (m
&& m
->state
== BUILTIN
) {
1118 ULOG_INFO("%s is builtin\n", name
);
1121 ULOG_ERR("failed to find a module named %s\n", name
);
1128 } while (use_all
&& optind
< argc
);
1130 load_fail
= load_modprobe(true);
1132 ULOG_ERR("%d module%s could not be probed\n",
1133 load_fail
, (load_fail
== 1) ? ("") : ("s"));
1135 avl_for_each_element(&modules
, mn
, avl
) {
1139 if ((m
->state
== PROBE
) || m
->error
)
1140 ULOG_ERR("- %s\n", m
->name
);
1147 free_module_folders();
1152 static int main_loader(int argc
, char **argv
)
1154 int gl_flags
= GLOB_NOESCAPE
| GLOB_MARK
;
1155 char *dir
= "/etc/modules.d/";
1156 struct module_node
*mn
;
1160 int ret
= 0, fail
, j
;
1165 path
= malloc(strlen(dir
) + 2);
1167 ULOG_ERR("out of memory\n");
1174 if (scan_module_folders()) {
1179 if (scan_loaded_modules()) {
1184 ULOG_INFO("loading kernel modules from %s\n", path
);
1186 if (glob(path
, gl_flags
, NULL
, &gl
) < 0)
1189 for (j
= 0; j
< gl
.gl_pathc
; j
++) {
1190 FILE *fp
= fopen(gl
.gl_pathv
[j
], "r");
1195 ULOG_ERR("failed to open %s\n", gl
.gl_pathv
[j
]);
1199 while (getline(&mod
, &mod_len
, fp
) > 0) {
1200 char *nl
= strchr(mod
, '\n');
1207 opts
= strchr(mod
, ' ');
1211 m
= find_module(get_module_name(mod
));
1212 if (!m
|| m
->state
== LOADED
|| m
->state
== BLACKLISTED
)
1217 char *prev
= m
->opts
;
1219 fail
= asprintf(&m
->opts
, "%s %s", prev
, opts
);
1222 ULOG_ERR("out of memory for opts %s\n", opts
);
1229 m
->opts
= strdup(opts
);
1233 if (basename(gl
.gl_pathv
[j
])[0] - '0' <= 9)
1234 load_modprobe(false);
1241 fail
= load_modprobe(true);
1244 ULOG_ERR("%d module%s could not be probed\n",
1245 fail
, (fail
== 1) ? ("") : ("s"));
1247 avl_for_each_element(&modules
, mn
, avl
) {
1251 if ((m
->state
== PROBE
) || (m
->error
))
1252 ULOG_ERR("- %s - %d\n", m
->name
, deps_available(m
, 1));
1255 ULOG_INFO("done loading kernel modules from %s\n", path
);
1261 free_module_folders();
1268 static inline char weight(char c
)
1270 return c
== '_' ? '-' : c
;
1273 static int avl_modcmp(const void *k1
, const void *k2
, void *ptr
)
1275 const char *s1
= k1
;
1276 const char *s2
= k2
;
1278 while (*s1
&& (weight(*s1
) == weight(*s2
)))
1284 return (unsigned char)weight(*s1
) - (unsigned char)weight(*s2
);
1290 static char buf
[512];
1294 f
= fopen("/etc/modules.conf", "r");
1298 while ((s
= fgets(buf
, sizeof(buf
), f
)) != NULL
) {
1299 char *c
, *cmd
, *mod
;
1312 while (c
> s
&& isspace(c
[-1])) {
1317 cmd
= strsep(&s
, " \t");
1324 mod
= strsep(&s
, " \t");
1328 if (!strcmp(cmd
, "blacklist")) {
1329 kvlist_set(&options
, mod
, "\x01");
1333 if (!strcmp(cmd
, "options")) {
1334 char *prev
= kvlist_get(&options
, mod
);
1343 if (prev
&& prev
[0] == '\x01')
1347 kvlist_set(&options
, mod
, s
);
1351 if (asprintf(&val
, "%s %s", prev
, s
) < 0)
1354 kvlist_set(&options
, mod
, val
);
1363 int main(int argc
, char **argv
)
1365 char *exec
= basename(*argv
);
1367 avl_init(&modules
, avl_modcmp
, false, NULL
);
1368 if (!strcmp(exec
, "insmod"))
1369 return main_insmod(argc
, argv
);
1371 if (!strcmp(exec
, "rmmod"))
1372 return main_rmmod(argc
, argv
);
1374 if (!strcmp(exec
, "lsmod"))
1375 return main_lsmod(argc
, argv
);
1377 if (!strcmp(exec
, "modinfo"))
1378 return main_modinfo(argc
, argv
);
1382 if (!strcmp(exec
, "modprobe"))
1383 return main_modprobe(argc
, argv
);
1385 ulog_open(ULOG_KMSG
, LOG_USER
, "kmodloader");
1386 return main_loader(argc
, argv
);