summaryrefslogtreecommitdiff
path: root/rmmod.c
blob: e0545d352dfc8da4e9ea2dd8668b068ce8eea496 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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;
}