aboutsummaryrefslogtreecommitdiff
path: root/toys/pending
diff options
context:
space:
mode:
Diffstat (limited to 'toys/pending')
-rw-r--r--toys/pending/modprobe.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/toys/pending/modprobe.c b/toys/pending/modprobe.c
index 50ec60f5..c701f5bf 100644
--- a/toys/pending/modprobe.c
+++ b/toys/pending/modprobe.c
@@ -373,6 +373,19 @@ static int ins_mod(char *modules, char *flags)
int len, res;
int fd = xopenro(modules);
+ while (flags && strlen(toybuf) + strlen(flags) + 2 < sizeof(toybuf)) {
+ strcat(toybuf, flags);
+ strcat(toybuf, " ");
+ }
+
+#ifdef __NR_finit_module
+ res = syscall(__NR_finit_module, fd, toybuf, 0);
+ if (!res || errno != ENOSYS) {
+ xclose(fd);
+ return res;
+ }
+#endif
+
// TODO xreadfile()
len = fdlength(fd);
@@ -380,10 +393,6 @@ static int ins_mod(char *modules, char *flags)
xreadall(fd, buf, len);
xclose(fd);
- while (flags && strlen(toybuf) + strlen(flags) + 2 < sizeof(toybuf)) {
- strcat(toybuf, flags);
- strcat(toybuf, " ");
- }
res = syscall(__NR_init_module, buf, len, toybuf);
if (CFG_TOYBOX_FREE && buf != toybuf) free(buf);
return res;