From e7047887b040da7035f11d0fe48d76bd67381c9c Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Thu, 11 Dec 2003 01:42:13 +0000 Subject: Update modutils with 2.6 module support --- modutils/rmmod.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'modutils/rmmod.c') diff --git a/modutils/rmmod.c b/modutils/rmmod.c index a4ea70410..311b03dc4 100644 --- a/modutils/rmmod.c +++ b/modutils/rmmod.c @@ -25,6 +25,8 @@ #include #include #include +#include +#include #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; } -- cgit v1.2.3