mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-26 03:31:36 +01:00
bak
This commit is contained in:
25
userland/linux/init_env_poweroff.c
Normal file
25
userland/linux/init_env_poweroff.c
Normal file
@@ -0,0 +1,25 @@
|
||||
#define _XOPEN_SOURCE 700
|
||||
#include <stdio.h>
|
||||
#include <sys/reboot.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
int i;
|
||||
|
||||
puts("args:");
|
||||
for (i = 0; i < argc; ++i)
|
||||
puts(argv[i]);
|
||||
puts("");
|
||||
|
||||
puts("env:");
|
||||
extern char **environ;
|
||||
char **env = environ;
|
||||
while (*env) {
|
||||
printf("%s\n", *env);
|
||||
env++;
|
||||
}
|
||||
puts("");
|
||||
|
||||
/* Poweroff. */
|
||||
reboot(RB_POWER_OFF);
|
||||
}
|
||||
Reference in New Issue
Block a user