Find the answer to your Linux question:
Results 1 to 2 of 2
Hi, Guys can u please convert the psuedo code here to proper linux/C/kernel syntax. Ive finally managed to invoke the custom syscall in my codes but I require it to ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Oct 2011
    Posts
    1

    Custom reboot system call


    Hi,

    Guys can u please convert the psuedo code here to proper linux/C/kernel syntax. Ive finally managed to invoke the custom syscall in my codes but I require it to do more than just print to screen


    Code:
    #include <linux/linkage.h>
    #include <linux/kernel.h>
    #include <unistd.h>
    #include <linux/reboot.h>
    #include <linux/timer.h>
    #include <sys/reboot.h> 
    
    asmlinkage long sys_customreboot ( int delay)
    {
    
    printk("<1>You have successfully called a custom syscall");
    
    // value= get current time  + delay (seconds);
    //
    // while ( current time != value)   /*after factor seconds*/
    // {};           /* wait here*/
    // reboot();
    
    return 1;
    }

  2. #2
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    So you just want to run a command (i.e., /sbin/reboot)? Tried the system func? Or do you mean something else?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •