diff options
author | Andreas Baumann <mail@andreasbaumann.cc> | 2023-05-07 14:36:49 +0200 |
---|---|---|
committer | Andreas Baumann <mail@andreasbaumann.cc> | 2023-05-07 14:36:49 +0200 |
commit | f2c131bc5294d0531edb3486874f37019b0b1413 (patch) | |
tree | 6923a9d65ecc21b53a16f73abdabf1a21d58d819 /rmmod.c | |
parent | d017ac75f05c65e2e736f6dea271b69d7c9524bb (diff) | |
download | abase-f2c131bc5294d0531edb3486874f37019b0b1413.tar.gz abase-f2c131bc5294d0531edb3486874f37019b0b1413.tar.bz2 |
added a simple rmmod
Diffstat (limited to 'rmmod.c')
-rw-r--r-- | rmmod.c | 34 |
1 files changed, 34 insertions, 0 deletions
@@ -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; +} |