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 if (avl_insert(&modules
, &mn
->avl
) == 0)
293 static struct module
*
294 alloc_module(const char *name
, const char * const *aliases
, int naliases
, const char *depends
, int size
)
300 m
= calloc_a(sizeof(*m
),
301 &_name
, strlen(name
) + 1,
302 &_dep
, depends
? strlen(depends
) + 2 : 0);
306 m
->name
= strcpy(_name
, name
);
310 m
->depends
= strcpy(_dep
, depends
);
320 alloc_module_node(m
->name
, m
, false);
321 for (i
= 0; i
< naliases
; i
++)
322 alloc_module_node(aliases
[i
], m
, true);
327 static void free_module(struct module
*m
)
334 static int scan_loaded_modules(void)
341 fp
= fopen("/proc/modules", "r");
343 ULOG_ERR("failed to open /proc/modules\n");
347 while (getline(&buf
, &buf_len
, fp
) > 0) {
351 m
.name
= strtok(buf
, " ");
352 m
.size
= atoi(strtok(NULL
, " "));
353 m
.usage
= atoi(strtok(NULL
, " "));
354 m
.depends
= strtok(NULL
, " ");
356 if (!m
.name
|| !m
.depends
)
359 n
= find_module(m
.name
);
361 /* possibly a module outside /lib/modules/<ver>/ */
362 n
= alloc_module(m
.name
, NULL
, 0, m
.depends
, m
.size
);
365 ULOG_ERR("Failed to allocate memory for module\n");
380 static char *mmap_modinfo(const char *module
, const char *name
, struct stat
*s
, unsigned int *offset
, unsigned int *size
)
382 const bool is_builtin
= (module
== NULL
);
383 const char *mpath
= NULL
;
384 char *map
= MAP_FAILED
;
389 for (f
= module_folders
; *f
; f
++) {
390 snprintf(path
, sizeof(path
), "%s%s", *f
, MOD_BUILTIN_MODINFO
);
391 if (!stat(path
, s
) && S_ISREG(s
->st_mode
)) {
400 ULOG_ERR("cannot find modinfo path of module - %s\n", name
);
404 fd
= open(mpath
, O_RDONLY
);
406 ULOG_ERR("failed to open %s\n", mpath
);
410 if (fstat(fd
, s
) == -1) {
411 ULOG_ERR("failed to stat %s\n", mpath
);
415 map
= mmap(NULL
, s
->st_size
, PROT_READ
, MAP_PRIVATE
, fd
, 0);
416 if (map
== MAP_FAILED
) {
417 ULOG_ERR("failed to mmap %s\n", mpath
);
424 } else if (elf_find_section(map
, ".modinfo", offset
, size
)) {
425 ULOG_ERR("failed to load the .modinfo section from %s\n", mpath
);
426 munmap(map
, s
->st_size
);
436 static struct module
* get_module_info(const char *module
, const char *name
)
438 const bool is_builtin
= (module
== NULL
);
439 unsigned int offset
, size
;
440 char *map
, *strings
, *dep
= NULL
;
441 const char **aliases
= NULL
;
442 const char **aliasesr
;
444 struct module
*m
= NULL
;
447 map
= mmap_modinfo(module
, name
, &s
, &offset
, &size
);
448 if (map
== MAP_FAILED
)
451 strings
= map
+ offset
;
453 char *end
= map
+ offset
+ size
;
457 while ((strings
< end
) && !strings
[0])
462 sep
= strstr(strings
, ".");
465 if (strlen(name
) == (sep
- strings
) &&
466 !strncmp(strings
, name
, sep
- strings
))
471 sep
= strstr(strings
, "=");
476 if (!strncmp(strings
, "depends=", len
+ 1))
478 else if (!strncmp(strings
, "alias=", len
+ 1)) {
479 aliasesr
= realloc(aliases
, sizeof(sep
) * (naliases
+ 1));
481 ULOG_ERR("out of memory\n");
486 aliases
[naliases
++] = sep
;
489 strings
= &sep
[strlen(sep
)];
492 m
= alloc_module(name
, aliases
, naliases
, dep
, is_builtin
? 0 : s
.st_size
);
495 m
->state
= is_builtin
? BUILTIN
: SCANNED
;
498 if (map
!= MAP_FAILED
)
499 munmap(map
, s
.st_size
);
506 static int scan_builtin_modules(void)
515 if (!module_folders
&& init_module_folders())
517 for (p
= module_folders
; *p
; p
++) {
518 snprintf(path
, sizeof(path
), "%s%s", *p
, MOD_BUILTIN
);
519 fp
= fopen(path
, "r");
523 if (!fstat(fileno(fp
), &st
) && S_ISREG(st
.st_mode
))
526 /* Not regular file, close it and check next */
531 return 0; /* OK if modules.builtin unavailable */
533 while (getline(&buf
, &buf_len
, fp
) > 0) {
537 name
= get_module_name(buf
);
540 m
= find_module(name
);
541 if (m
&& !strcmp(m
->name
, name
)) {
542 ULOG_WARN("found duplicate builtin module %s\n", name
);
545 m
= get_module_info(NULL
, name
);
547 ULOG_ERR("failed to find info for builtin module %s\n", name
);
560 static int scan_module_folder(const char *dir
)
562 int gl_flags
= GLOB_NOESCAPE
| GLOB_MARK
;
567 path
= alloca(strlen(dir
) + sizeof("*.ko") + 1);
568 sprintf(path
, "%s*.ko", dir
);
570 if (glob(path
, gl_flags
, NULL
, &gl
) < 0)
573 for (j
= 0; j
< gl
.gl_pathc
; j
++) {
574 char *name
= get_module_name(gl
.gl_pathv
[j
]);
581 m
= find_module(name
);
585 m
= get_module_info(gl
.gl_pathv
[j
], name
);
591 opts
= kvlist_get(&options
, name
);
596 m
->state
= BLACKLISTED
;
598 m
->opts
= strdup(opts
);
606 static int scan_module_folders(void)
611 if (init_module_folders())
614 for (p
= module_folders
; *p
; p
++)
615 rv
|= scan_module_folder(*p
);
620 static int print_modinfo(const struct module
*m
)
622 const bool is_builtin
= (m
->state
== BUILTIN
);
623 unsigned int offset
, size
;
626 char *map
, *strings
, *mpath
;
631 mpath
= get_module_path(m
->name
);
632 map
= mmap_modinfo(mpath
, m
->name
, &s
, &offset
, &size
);
633 if (map
== MAP_FAILED
)
636 strings
= map
+ offset
;
638 printf("name:\t\t%s\n", m
->name
);
639 printf("filename:\t%s\n", is_builtin
? "(builtin)" : mpath
);
641 char *end
= map
+ offset
+ size
;
646 while ((strings
< end
) && !strings
[0])
651 sep
= strstr(strings
, ".");
654 if (strlen(m
->name
) == (sep
- strings
) &&
655 !strncmp(strings
, m
->name
, sep
- strings
))
660 sep
= strstr(strings
, "=");
663 dup
= strndup(strings
, sep
- strings
);
665 if (strncmp(strings
, "parm", 4)) {
667 printf("%s:\t\t%s\n", dup
, sep
);
669 printf("%s:\t%s\n", dup
, sep
);
671 sep2
= strstr(sep
, ":");
677 pname
= strndup(sep
, sep2
- sep
);
679 pdata
= strdup(sep2
);
681 list_for_each_entry(p
, ¶ms
, list
)
682 if (!strcmp(pname
, p
->name
))
685 if (list_entry_is_h(p
, ¶ms
, list
)) {
686 p
= alloca(sizeof(*p
));
688 p
->desc
= p
->type
= NULL
;
689 list_add(&p
->list
, ¶ms
);
694 if (!strcmp(dup
, "parmtype"))
702 strings
= &sep
[strlen(sep
)];
705 list_for_each_entry(p
, ¶ms
, list
) {
706 printf("parm:\t\t%s", p
->name
);
708 printf(":%s", p
->desc
);
710 printf(" (%s)", p
->type
);
720 if (map
!= MAP_FAILED
)
721 munmap(map
, s
.st_size
);
726 static int deps_available(struct module
*m
, int verbose
)
731 if (!m
->depends
|| !strcmp(m
->depends
, "-") || !strcmp(m
->depends
, ""))
737 m
= find_module(dep
);
740 ULOG_ERR("missing dependency %s\n", dep
);
741 if (verbose
&& m
&& (m
->state
!= LOADED
))
742 ULOG_ERR("dependency not loaded %s\n", dep
);
743 if (!m
|| (m
->state
!= LOADED
))
745 dep
+= strlen(dep
) + 1;
751 static int insert_module(char *path
, const char *options
)
758 ULOG_ERR("Path not specified\n");
762 if (stat(path
, &s
)) {
763 ULOG_ERR("missing module %s\n", path
);
767 fd
= open(path
, O_RDONLY
);
769 ULOG_ERR("cannot open %s\n", path
);
773 data
= malloc(s
.st_size
);
775 ULOG_ERR("out of memory\n");
779 if (read(fd
, data
, s
.st_size
) == s
.st_size
) {
780 ret
= syscall(__NR_init_module
, data
, (unsigned long) s
.st_size
, options
);
785 ULOG_ERR("failed to read full module %s\n", path
);
794 static void load_moddeps(struct module
*_m
)
799 if (!strcmp(_m
->depends
, "-") || !strcmp(_m
->depends
, ""))
805 m
= find_module(dep
);
808 ULOG_ERR("failed to find dependency %s\n", dep
);
809 if (m
&& (m
->state
!= LOADED
)) {
814 dep
= dep
+ strlen(dep
) + 1;
818 static int load_modprobe(bool allow_load_retry
)
820 int loaded
, skipped
, failed
;
821 struct module_node
*mn
;
823 bool load_retry
= false;
824 static bool first_iteration
= true;
826 avl_for_each_element(&modules
, mn
, avl
) {
830 if (m
->state
== PROBE
)
838 avl_for_each_element(&modules
, mn
, avl
) {
842 if ((m
->state
== PROBE
) && (!deps_available(m
, 0)) && (!m
->error
|| load_retry
)) {
843 if (!insert_module(get_module_path(m
->name
), (m
->opts
) ? (m
->opts
) : (""))) {
855 else if (m
->state
== PROBE
)
859 if (allow_load_retry
) {
860 /* if we can't load anything else let's try to load failed modules */
861 load_retry
= loaded
? (failed
&& !skipped
) : (failed
&& !load_retry
&& !first_iteration
);
864 first_iteration
= false;
865 } while (loaded
|| load_retry
);
867 return skipped
+ failed
;
870 static int print_insmod_usage(void)
872 ULOG_INFO("Usage:\n\tinsmod filename [args]\n");
877 static int print_modprobe_usage(void)
881 "\tmodprobe [-q] [-v] filename\n"
882 "\tmodprobe -a [-q] [-v] filename [filename...]\n"
888 static int print_usage(char *arg
)
890 ULOG_INFO("Usage:\n\t%s module\n", arg
);
895 static int main_insmod(int argc
, char **argv
)
897 char *name
, *path
, *cur
, *opts
= NULL
;
898 int i
, ret
= -1, len
;
901 return print_insmod_usage();
903 name
= get_module_name(argv
[1]);
905 ULOG_ERR("cannot find module - %s\n", argv
[1]);
909 if (scan_loaded_modules())
912 if (find_module(name
)) {
913 ULOG_ERR("module is already loaded - %s\n", name
);
918 for (len
= 1, i
= 2; i
< argc
; i
++)
919 len
+= strlen(argv
[i
]) + 1;
923 ULOG_ERR("out of memory\n");
929 for (i
= 2; i
< argc
; i
++) {
934 cur
+= sprintf(cur
, "%s", argv
[i
]);
937 if (init_module_folders()) {
938 fprintf(stderr
, "Failed to find the folder holding the modules\n");
942 if (!(path
= get_module_path(argv
[1])) ||
943 (path
= get_module_path(name
))) {
944 fprintf(stderr
, "Failed to find %s. Maybe it is a built in module ?\n", name
);
948 ret
= insert_module(path
, opts
);
950 ULOG_ERR("failed to insert %s\n", get_module_path(name
));
955 free_module_folders();
960 static int main_rmmod(int argc
, char **argv
)
967 return print_usage("rmmod");
969 if (scan_loaded_modules())
972 if (scan_builtin_modules())
975 name
= get_module_name(argv
[1]);
976 m
= find_module(name
);
978 ULOG_ERR("module is not loaded\n");
981 if (m
->state
== BUILTIN
) {
982 ULOG_ERR("module is builtin\n");
985 ret
= syscall(__NR_delete_module
, m
->name
, 0);
988 ULOG_ERR("unloading the module failed\n");
992 free_module_folders();
997 static int main_lsmod(int argc
, char **argv
)
999 struct module_node
*mn
;
1003 if (scan_loaded_modules())
1006 avl_for_each_element(&modules
, mn
, avl
) {
1010 if (m
->state
== LOADED
) {
1011 printf("%-20s%8d%3d ",
1012 m
->name
, m
->size
, m
->usage
);
1013 if (m
->depends
&& strcmp(m
->depends
, "-") && strcmp(m
->depends
, "")) {
1017 dep
= dep
+ strlen(dep
) + 1;
1031 static int main_modinfo(int argc
, char **argv
)
1038 return print_usage("modinfo");
1040 if (scan_module_folders())
1043 if (scan_builtin_modules())
1046 name
= get_module_name(argv
[1]);
1047 m
= find_module(name
);
1049 ULOG_ERR("cannot find module - %s\n", argv
[1]);
1058 free_module_folders();
1063 static int main_modprobe(int argc
, char **argv
)
1065 struct module_node
*mn
;
1069 int log_level
= LOG_WARNING
;
1072 bool use_all
= false;
1074 while ((opt
= getopt(argc
, argv
, "aqv")) != -1 ) {
1079 case 'q': /* shhhh! */
1083 log_level
= LOG_DEBUG
;
1086 return print_modprobe_usage();
1092 return print_modprobe_usage(); /* expected module after options */
1094 /* after print_modprobe_usage() so it won't be filtered out */
1095 ulog_threshold(log_level
);
1097 if (scan_module_folders())
1100 if (scan_loaded_modules())
1103 if (scan_builtin_modules())
1109 name
= get_module_name(argv
[optind
]);
1110 m
= find_module(name
);
1112 if (m
&& m
->state
== BLACKLISTED
) {
1114 ULOG_INFO("%s is blacklisted\n", name
);
1115 } else if (m
&& m
->state
== LOADED
) {
1117 ULOG_INFO("%s is already loaded\n", name
);
1118 } else if (m
&& m
->state
== BUILTIN
) {
1120 ULOG_INFO("%s is builtin\n", name
);
1123 ULOG_ERR("failed to find a module named %s\n", name
);
1130 } while (use_all
&& optind
< argc
);
1132 load_fail
= load_modprobe(true);
1134 ULOG_ERR("%d module%s could not be probed\n",
1135 load_fail
, (load_fail
== 1) ? ("") : ("s"));
1137 avl_for_each_element(&modules
, mn
, avl
) {
1141 if ((m
->state
== PROBE
) || m
->error
)
1142 ULOG_ERR("- %s\n", m
->name
);
1149 free_module_folders();
1154 static int main_loader(int argc
, char **argv
)
1156 int gl_flags
= GLOB_NOESCAPE
| GLOB_MARK
;
1157 char *dir
= "/etc/modules.d/";
1158 struct module_node
*mn
;
1162 int ret
= 0, fail
, j
;
1167 path
= malloc(strlen(dir
) + 2);
1169 ULOG_ERR("out of memory\n");
1176 if (scan_module_folders()) {
1181 if (scan_loaded_modules()) {
1186 ULOG_INFO("loading kernel modules from %s\n", path
);
1188 if (glob(path
, gl_flags
, NULL
, &gl
) < 0)
1191 for (j
= 0; j
< gl
.gl_pathc
; j
++) {
1192 FILE *fp
= fopen(gl
.gl_pathv
[j
], "r");
1197 ULOG_ERR("failed to open %s\n", gl
.gl_pathv
[j
]);
1201 while (getline(&mod
, &mod_len
, fp
) > 0) {
1202 char *nl
= strchr(mod
, '\n');
1209 opts
= strchr(mod
, ' ');
1213 m
= find_module(get_module_name(mod
));
1214 if (!m
|| m
->state
== LOADED
|| m
->state
== BLACKLISTED
)
1219 char *prev
= m
->opts
;
1221 fail
= asprintf(&m
->opts
, "%s %s", prev
, opts
);
1224 ULOG_ERR("out of memory for opts %s\n", opts
);
1231 m
->opts
= strdup(opts
);
1235 if (basename(gl
.gl_pathv
[j
])[0] - '0' <= 9)
1236 load_modprobe(false);
1243 fail
= load_modprobe(true);
1246 ULOG_ERR("%d module%s could not be probed\n",
1247 fail
, (fail
== 1) ? ("") : ("s"));
1249 avl_for_each_element(&modules
, mn
, avl
) {
1253 if ((m
->state
== PROBE
) || (m
->error
))
1254 ULOG_ERR("- %s - %d\n", m
->name
, deps_available(m
, 1));
1257 ULOG_INFO("done loading kernel modules from %s\n", path
);
1263 free_module_folders();
1270 static inline char weight(char c
)
1272 return c
== '_' ? '-' : c
;
1275 static int avl_modcmp(const void *k1
, const void *k2
, void *ptr
)
1277 const char *s1
= k1
;
1278 const char *s2
= k2
;
1280 while (*s1
&& (weight(*s1
) == weight(*s2
)))
1286 return (unsigned char)weight(*s1
) - (unsigned char)weight(*s2
);
1292 static char buf
[512];
1296 f
= fopen("/etc/modules.conf", "r");
1300 while ((s
= fgets(buf
, sizeof(buf
), f
)) != NULL
) {
1301 char *c
, *cmd
, *mod
;
1314 while (c
> s
&& isspace(c
[-1])) {
1319 cmd
= strsep(&s
, " \t");
1326 mod
= strsep(&s
, " \t");
1330 if (!strcmp(cmd
, "blacklist")) {
1331 kvlist_set(&options
, mod
, "\x01");
1335 if (!strcmp(cmd
, "options")) {
1336 char *prev
= kvlist_get(&options
, mod
);
1345 if (prev
&& prev
[0] == '\x01')
1349 kvlist_set(&options
, mod
, s
);
1353 if (asprintf(&val
, "%s %s", prev
, s
) < 0)
1356 kvlist_set(&options
, mod
, val
);
1365 int main(int argc
, char **argv
)
1367 char *exec
= basename(*argv
);
1369 avl_init(&modules
, avl_modcmp
, false, NULL
);
1370 if (!strcmp(exec
, "insmod"))
1371 return main_insmod(argc
, argv
);
1373 if (!strcmp(exec
, "rmmod"))
1374 return main_rmmod(argc
, argv
);
1376 if (!strcmp(exec
, "lsmod"))
1377 return main_lsmod(argc
, argv
);
1379 if (!strcmp(exec
, "modinfo"))
1380 return main_modinfo(argc
, argv
);
1384 if (!strcmp(exec
, "modprobe"))
1385 return main_modprobe(argc
, argv
);
1387 ulog_open(ULOG_KMSG
, LOG_USER
, "kmodloader");
1388 return main_loader(argc
, argv
);