summaryrefslogtreecommitdiff
path: root/modutils/rmmod.c
diff options
context:
space:
mode:
authorEric Andersen2003-12-11 01:42:13 +0000
committerEric Andersen2003-12-11 01:42:13 +0000
commite7047887b040da7035f11d0fe48d76bd67381c9c (patch)
tree4fc4c04847936656adf9d1d3aef35edd1ac5ffe7 /modutils/rmmod.c
parent37f4116ecb03fcf5de2bc8aab8d480b9b063bab5 (diff)
downloadbusybox-e7047887b040da7035f11d0fe48d76bd67381c9c.zip
busybox-e7047887b040da7035f11d0fe48d76bd67381c9c.tar.gz
Update modutils with 2.6 module support
Diffstat (limited to 'modutils/rmmod.c')
-rw-r--r--modutils/rmmod.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/modutils/rmmod.c b/modutils/rmmod.c
index a4ea704..311b03d 100644
--- a/modutils/rmmod.c
+++ b/modutils/rmmod.c
@@ -25,6 +25,8 @@
#include <unistd.h>
#include <stdlib.h>
#include <getopt.h>
+#include <fcntl.h>
+#include <sys/syscall.h>
#include "busybox.h"
extern int delete_module(const char * name);
@@ -37,10 +39,17 @@ extern int rmmod_main(int argc, char **argv)
size_t pnmod = -1; /* previous number of modules */
void *buf; /* hold the module names which we ignore but must get */
size_t bufsize = 0;
+ unsigned int flags = O_NONBLOCK|O_EXCL;
/* Parse command line. */
while ((n = getopt(argc, argv, "a")) != EOF) {
switch (n) {
+ case 'w': // --wait
+ flags &= ~O_NONBLOCK;
+ break;
+ case 'f': // --force
+ flags |= O_TRUNC;
+ break;
case 'a':
/* Unload _all_ unused modules via NULL delete_module() call */
/* until the number of modules does not change */
@@ -67,7 +76,7 @@ extern int rmmod_main(int argc, char **argv)
bb_show_usage();
for (n = optind; n < argc; n++) {
- if (delete_module(argv[n]) < 0) {
+ if (syscall(__NR_delete_module, argv[n], flags) < 0) {
bb_perror_msg("%s", argv[n]);
ret = EXIT_FAILURE;
}