mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
your inits are belongz to uz
This commit is contained in:
@@ -11,9 +11,11 @@ These programs can also be compiled and used on host.
|
||||
1. Standalone
|
||||
1. [myinsmod](myinsmod.c)
|
||||
1. [myrmmod](myrmmod.c)
|
||||
1. [init_hello](init_hello.c)
|
||||
1. [usermem](usermem.c)
|
||||
1. [pagemap_dump](pagemap_dump.c)
|
||||
1. inits
|
||||
1. [init_hello](init_hello.c)
|
||||
1. [init_poweroff](init_poweroff.c)
|
||||
1. [uio_read](uio_read.c)
|
||||
1. Module tests
|
||||
1. [anonymous_inode](anonymous_inode.c)
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <unistd.h>
|
||||
|
||||
int main(void) {
|
||||
puts("hello world");
|
||||
puts(__FILE__);
|
||||
while (1)
|
||||
sleep(0xFFFFFFFF);
|
||||
}
|
||||
|
||||
11
kernel_module/user/init_poweroff.c
Normal file
11
kernel_module/user/init_poweroff.c
Normal file
@@ -0,0 +1,11 @@
|
||||
/* Userspace is for the weak. Die.
|
||||
* https://stackoverflow.com/questions/28812514/how-to-shutdown-linux-using-c-or-qt-without-call-to-system */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/reboot.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(void) {
|
||||
puts(__FILE__);
|
||||
reboot(RB_POWER_OFF);
|
||||
}
|
||||
Reference in New Issue
Block a user