mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-25 19:21:35 +01:00
Split ins_rm_mod
This commit is contained in:
22
kernel_module/test/myrmmod.c
Normal file
22
kernel_module/test/myrmmod.c
Normal file
@@ -0,0 +1,22 @@
|
||||
#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_modul");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
Reference in New Issue
Block a user