diff options
author | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2003-12-11 01:42:13 +0000 |
---|---|---|
committer | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2003-12-11 01:42:13 +0000 |
commit | dd4ca727ce71cabfe7ee80ccb2281dedda6a75f0 (patch) | |
tree | 4fc4c04847936656adf9d1d3aef35edd1ac5ffe7 /modutils/rmmod.c | |
parent | 173d97e04827d42a7d32d6992ef599fdffbbb56f (diff) | |
download | busybox-w32-dd4ca727ce71cabfe7ee80ccb2281dedda6a75f0.tar.gz busybox-w32-dd4ca727ce71cabfe7ee80ccb2281dedda6a75f0.tar.bz2 busybox-w32-dd4ca727ce71cabfe7ee80ccb2281dedda6a75f0.zip |
Update modutils with 2.6 module support
git-svn-id: svn://busybox.net/trunk/busybox@8068 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'modutils/rmmod.c')
-rw-r--r-- | modutils/rmmod.c | 11 |
1 files changed, 10 insertions, 1 deletions
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 @@ | |||
25 | #include <unistd.h> | 25 | #include <unistd.h> |
26 | #include <stdlib.h> | 26 | #include <stdlib.h> |
27 | #include <getopt.h> | 27 | #include <getopt.h> |
28 | #include <fcntl.h> | ||
29 | #include <sys/syscall.h> | ||
28 | #include "busybox.h" | 30 | #include "busybox.h" |
29 | 31 | ||
30 | extern int delete_module(const char * name); | 32 | extern int delete_module(const char * name); |
@@ -37,10 +39,17 @@ extern int rmmod_main(int argc, char **argv) | |||
37 | size_t pnmod = -1; /* previous number of modules */ | 39 | size_t pnmod = -1; /* previous number of modules */ |
38 | void *buf; /* hold the module names which we ignore but must get */ | 40 | void *buf; /* hold the module names which we ignore but must get */ |
39 | size_t bufsize = 0; | 41 | size_t bufsize = 0; |
42 | unsigned int flags = O_NONBLOCK|O_EXCL; | ||
40 | 43 | ||
41 | /* Parse command line. */ | 44 | /* Parse command line. */ |
42 | while ((n = getopt(argc, argv, "a")) != EOF) { | 45 | while ((n = getopt(argc, argv, "a")) != EOF) { |
43 | switch (n) { | 46 | switch (n) { |
47 | case 'w': // --wait | ||
48 | flags &= ~O_NONBLOCK; | ||
49 | break; | ||
50 | case 'f': // --force | ||
51 | flags |= O_TRUNC; | ||
52 | break; | ||
44 | case 'a': | 53 | case 'a': |
45 | /* Unload _all_ unused modules via NULL delete_module() call */ | 54 | /* Unload _all_ unused modules via NULL delete_module() call */ |
46 | /* until the number of modules does not change */ | 55 | /* until the number of modules does not change */ |
@@ -67,7 +76,7 @@ extern int rmmod_main(int argc, char **argv) | |||
67 | bb_show_usage(); | 76 | bb_show_usage(); |
68 | 77 | ||
69 | for (n = optind; n < argc; n++) { | 78 | for (n = optind; n < argc; n++) { |
70 | if (delete_module(argv[n]) < 0) { | 79 | if (syscall(__NR_delete_module, argv[n], flags) < 0) { |
71 | bb_perror_msg("%s", argv[n]); | 80 | bb_perror_msg("%s", argv[n]); |
72 | ret = EXIT_FAILURE; | 81 | ret = EXIT_FAILURE; |
73 | } | 82 | } |