summaryrefslogtreecommitdiff
path: root/rmmod.c
diff options
context:
space:
mode:
Diffstat (limited to 'rmmod.c')
-rw-r--r--rmmod.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/rmmod.c b/rmmod.c
new file mode 100644
index 0000000..e0545d3
--- /dev/null
+++ b/rmmod.c
@@ -0,0 +1,34 @@
+/* See LICENSE file for copyright and license details. */
+#include <fcntl.h>
+#include <sys/syscall.h>
+#include <unistd.h>
+
+#include "util.h"
+
+static void
+usage(void)
+{
+ eprintf("usage: %s <module>\n", argv0);
+}
+
+int
+main(int argc, char *argv[])
+{
+ char *module;
+
+ ARGBEGIN {
+ default:
+ usage();
+ } ARGEND
+
+ if (argc != 1) {
+ weprintf("Expecting exactly one 'module' to remove\n");
+ usage();
+ }
+ module = argv[0];
+
+ if (syscall(__NR_delete_module, module, O_NONBLOCK) < 0)
+ eprintf("delete_module:");
+
+ return 0;
+}