Home | History | Annotate | Download | only in tests
      1 #include "tests.h"
      2 #include <asm/unistd.h>
      3 
      4 #ifdef __NR_reboot
      5 
      6 # include <stdio.h>
      7 # include <linux/reboot.h>
      8 # include <unistd.h>
      9 
     10 # define INVALID_MAGIC 319887762
     11 # define INVALID_CMD 0x01234568
     12 
     13 int
     14 main(void)
     15 {
     16 	static const char buf[] = "reboot";
     17 	long rc = syscall(__NR_reboot, LINUX_REBOOT_MAGIC1,
     18 			  INVALID_MAGIC, LINUX_REBOOT_CMD_RESTART2, buf);
     19 	printf("reboot(LINUX_REBOOT_MAGIC1, %#x /* LINUX_REBOOT_MAGIC_??? */,"
     20 	       " LINUX_REBOOT_CMD_RESTART2, \"%s\") = %ld %s (%m)\n",
     21 	       INVALID_MAGIC, buf, rc, errno2name());
     22 
     23 	rc = syscall(__NR_reboot, LINUX_REBOOT_MAGIC1,
     24 		     LINUX_REBOOT_MAGIC2, INVALID_CMD);
     25 	printf("reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2,"
     26 	       " %#x /* LINUX_REBOOT_CMD_??? */) = %ld %s (%m)\n",
     27 	       INVALID_CMD, rc, errno2name());
     28 
     29 	puts("+++ exited with 0 +++");
     30 	return 0;
     31 }
     32 
     33 #else
     34 
     35 SKIP_MAIN_UNDEFINED("__NR_reboot")
     36 
     37 #endif
     38