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).)