Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add NetBSD as a supported platform, use case for PLATFORM test #434

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -420,10 +420,13 @@ fi
[ -z "${STRIPOPTS+IS_SET}" ] && STRIPOPTS="-s"

## Verify PLATFORM value
if [ "$PLATFORM" != "Linux" ] && [ "$PLATFORM" != "FreeBSD" ] && \
[ "$PLATFORM" != "OpenBSD" ] && [ "$PLATFORM" != "Darwin" ]; then
warning "$PLATFORM platform is unknown!" "Known Platforms are: Linux, FreeBSD, OpenBSD, Darwin"
fi
case "$PLATFORM" in
Linux|FreeBSD|NetBSD|OpenBSD|Darwin)
;;
*) warning "$PLATFORM platform is unknown!" \
"Known Platforms are: Linux, FreeBSD, NetBSD, OpenBSD, Darwin"
;;
esac

## Create testfile.cc to test c++ compiler
configtmpdir=`mktmpdir`
Expand Down
12 changes: 12 additions & 0 deletions src/shutdown.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down