* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
-//applet:IF_RMMOD(APPLET(rmmod, _BB_DIR_SBIN, _BB_SUID_DROP))
+//applet:IF_RMMOD(APPLET(rmmod, BB_DIR_SBIN, BB_SUID_DROP))
+
+//usage:#if !ENABLE_MODPROBE_SMALL
+//usage:#define rmmod_trivial_usage
+//usage: "[-wfa] [MODULE]..."
+//usage:#define rmmod_full_usage "\n\n"
+//usage: "Unload kernel modules\n"
+//usage: "\n -w Wait until the module is no longer used"
+//usage: "\n -f Force unload"
+//usage: "\n -a Remove all unused modules (recursively)"
+//usage:#define rmmod_example_usage
+//usage: "$ rmmod tulip\n"
+//usage:#endif
#include "libbb.h"
#include "modutils.h"
/* Parse command line. */
n = getopt32(argv, "wfas"); // -s ignored
argv += optind;
- if (n & 1) // --wait
+ if (n & 1) // --wait
flags &= ~O_NONBLOCK;
- if (n & 2) // --force
+ if (n & 2) // --force
flags |= O_TRUNC;
if (n & 4) {
/* Unload _all_ unused modules via NULL delete_module() call */
filename2modname(bname, modname);
if (bb_delete_module(modname, flags))
bb_error_msg_and_die("can't unload '%s': %s",
- modname, moderror(errno));
+ modname, moderror(errno));
}
return EXIT_SUCCESS;