Solemn's Site
Buggy software since 200X
reboot(2)? What's that?

Posted in Linux on 15 Apr 2008 at 21:07 UTC

To reboot Linux you use a syscall named reboot, the reboot(2) manpage shows that the libc reboot() function should have the same arguments as the syscall:
int reboot(int magic, int magic2, int flag, void *arg);
However, the uClibc developers decided to be clever, they instead made a reboot() function that takes a single argument (flag), of course they don't include a declaration in the headers, then you would KNOW they don't use the normal arguments. After several hours of debugging and finding that flag was 4276215469 (magic1) in sys_reboot() I eventually downloaded the uClibc source, lo and behold!
int reboot(int flag)
	return (_reboot((int) 0xfee1dead, 672274793, flag));
This has been very productive.


No comments have been posted

Comments are currently disabled