Files
linux-kernel-module-cheat/packages/kernel_module/user/myrmmod.c
Ciro Santilli 66fe5f6647 build runs, lots of uncommented and lots of untested though
Refactor everything. Create nice submodules/ and packages/ folders.
2018-09-07 10:08:59 +01:00

25 lines
556 B
C

/* https://github.com/cirosantilli/linux-kernel-module-cheat#myinsmod */
#define _GNU_SOURCE
#include <fcntl.h>
#include <stdio.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
#define delete_module(name, flags) syscall(__NR_delete_module, name, flags)
int main(int argc, char **argv) {
if (argc != 2) {
puts("Usage ./prog mymodule");
return EXIT_FAILURE;
}
if (delete_module(argv[1], O_NONBLOCK) != 0) {
perror("delete_module");
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}