summaryrefslogtreecommitdiff
path: root/rmmod.c
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2023-05-07 14:36:49 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2023-05-07 14:36:49 +0200
commitf2c131bc5294d0531edb3486874f37019b0b1413 (patch)
tree6923a9d65ecc21b53a16f73abdabf1a21d58d819 /rmmod.c
parentd017ac75f05c65e2e736f6dea271b69d7c9524bb (diff)
downloadabase-f2c131bc5294d0531edb3486874f37019b0b1413.tar.gz
abase-f2c131bc5294d0531edb3486874f37019b0b1413.tar.bz2
added a simple rmmod
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;
+}