I'm writing a custom reboot program in C and trying to decide if I should use reboot(2) directly or call system("/sbin/reboot").
Both reboot(8) and init 6 change the runlevel and gracefully shut down services, then unmount all filesystems. But, reboot(2) does neither of these things.
When should reboot(2) be used in preference to reboot(8)?
(I know from the man page to call sync(2) before reboot(2).)
reboot,halt,shutdown,initandpoweroff. – PersianGulf May 11 '15 at 22:24reboot(2). Do you want to shut down services and unmount filesystems in a special way? Usereboot(2). Do you want the system to gracefully shut down services and unmount all filesystems for you? Usereboot(8). – G-Man Says 'Reinstate Monica' May 12 '15 at 01:46