Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add shutdown support for NetBSD
Browse files Browse the repository at this point in the history
iMilnb committed Jan 28, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 9a96cbb commit 6da99cf
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/shutdown.cc
Original file line number Diff line number Diff line change
@@ -496,7 +496,11 @@ void do_system_shutdown(shutdown_type_t shutdown_type)

sub_buf.append("Issuing shutdown via kernel...\n");
loop.poll(); // give message a chance to get to console
#ifdef __NetBSD__
reboot(reboot_type, NULL);
#else
reboot(reboot_type);
#endif
}

// Watcher for subprocess output.
@@ -637,7 +641,11 @@ static loop_t::child_proc_watcher::proc_status_t run_process(const char * prog_a
static void unmount_disks(loop_t &loop, subproc_buffer &sub_buf)
{
try {
#ifdef __NetBSD__
const char * unmount_args[] = { "/sbin/umount", "-a", nullptr };
#else
const char * unmount_args[] = { "/bin/umount", "-a", "-r", nullptr };
#endif
run_process(unmount_args, loop, sub_buf);
}
catch (std::exception &e) {
@@ -650,7 +658,11 @@ static void unmount_disks(loop_t &loop, subproc_buffer &sub_buf)
static void swap_off(loop_t &loop, subproc_buffer &sub_buf)
{
try {
#ifdef __NetBSD__
const char * swapoff_args[] = { "/sbin/swapctl", "-U", nullptr };
#else
const char * swapoff_args[] = { "/sbin/swapoff", "-a", nullptr };
#endif
run_process(swapoff_args, loop, sub_buf);
}
catch (std::exception &e) {

0 comments on commit 6da99cf

Please sign in to comment.