Advertisement
mattrix

Untitled

May 28th, 2018
472
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.51 KB | None | 0 0
  1. #include <linux/reboot.h>
  2. #include <sys/syscall.h>
  3. #include <signal.h>
  4. #include <stdlib.h>
  5.  
  6. int main(int argc, char *argv[])  {
  7.     char *param = NULL;
  8.     int cmd;
  9.    
  10.     if(argc == 2) {
  11.         param = argv[1];
  12.         cmd = LINUX_REBOOT_CMD_RESTART2;
  13.     }
  14.     else {
  15.         cmd = LINUX_REBOOT_CMD_RESTART;
  16.     }
  17.  
  18.     sync();
  19.     system("/etc/init.d/rcK || /etc/init.d/rc 0");
  20.  
  21.     sync();
  22.     syscall(SYS_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, cmd, param);
  23.    
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement