Skip to content

Commit b2ca1a4

Browse files
iMilnbdavmac314
authored andcommitted
Add shutdown support for NetBSD
1 parent 60dcf0e commit b2ca1a4

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/shutdown.cc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,11 @@ void do_system_shutdown(shutdown_type_t shutdown_type)
496496

497497
sub_buf.append("Issuing shutdown via kernel...\n");
498498
loop.poll(); // give message a chance to get to console
499+
#ifdef __NetBSD__
500+
reboot(reboot_type, NULL);
501+
#else
499502
reboot(reboot_type);
503+
#endif
500504
}
501505

502506
// Watcher for subprocess output.
@@ -637,7 +641,11 @@ static loop_t::child_proc_watcher::proc_status_t run_process(const char * prog_a
637641
static void unmount_disks(loop_t &loop, subproc_buffer &sub_buf)
638642
{
639643
try {
644+
#ifdef __NetBSD__
645+
const char * unmount_args[] = { "/sbin/umount", "-a", nullptr };
646+
#else
640647
const char * unmount_args[] = { "/bin/umount", "-a", "-r", nullptr };
648+
#endif
641649
run_process(unmount_args, loop, sub_buf);
642650
}
643651
catch (std::exception &e) {
@@ -650,7 +658,11 @@ static void unmount_disks(loop_t &loop, subproc_buffer &sub_buf)
650658
static void swap_off(loop_t &loop, subproc_buffer &sub_buf)
651659
{
652660
try {
661+
#ifdef __NetBSD__
662+
const char * swapoff_args[] = { "/sbin/swapctl", "-U", nullptr };
663+
#else
653664
const char * swapoff_args[] = { "/sbin/swapoff", "-a", nullptr };
665+
#endif
654666
run_process(swapoff_args, loop, sub_buf);
655667
}
656668
catch (std::exception &e) {

0 commit comments

Comments
 (0)