diff options
Diffstat (limited to 'src/os')
-rw-r--r-- | src/os/deps-lib/os-freebsd | 3 | ||||
-rw-r--r-- | src/os/deps-lib/os-linux | 2 | ||||
-rw-r--r-- | src/os/freebsd-os_kbspecials.c | 9 | ||||
-rw-r--r-- | src/os/freebsd-os_mount_devtmpfs.c | 11 | ||||
-rw-r--r-- | src/os/freebsd-os_mount_tmpfs.c | 32 | ||||
-rw-r--r-- | src/os/freebsd-os_reboot.c | 11 |
6 files changed, 66 insertions, 2 deletions
diff --git a/src/os/deps-lib/os-freebsd b/src/os/deps-lib/os-freebsd index a8c2a99..54edc05 100644 --- a/src/os/deps-lib/os-freebsd +++ b/src/os/deps-lib/os-freebsd @@ -1,3 +1,4 @@ -freebsd-os_reboot.o freebsd-os_kbspecials.o +freebsd-os_mount_devtmpfs.o freebsd-os_mount_tmpfs.o +freebsd-os_reboot.o diff --git a/src/os/deps-lib/os-linux b/src/os/deps-lib/os-linux index 56fe3fc..f58c20e 100644 --- a/src/os/deps-lib/os-linux +++ b/src/os/deps-lib/os-linux @@ -1,4 +1,4 @@ -linux-os_reboot.o linux-os_kbspecials.o linux-os_mount_devtmpfs.o linux-os_mount_tmpfs.o +linux-os_reboot.o diff --git a/src/os/freebsd-os_kbspecials.c b/src/os/freebsd-os_kbspecials.c new file mode 100644 index 0000000..71a0480 --- /dev/null +++ b/src/os/freebsd-os_kbspecials.c @@ -0,0 +1,9 @@ +/* ISC license. */ + +#include "os.h" + +void os_kbspecials (int inns) +{ + if (inns) return ; + return ; +} diff --git a/src/os/freebsd-os_mount_devtmpfs.c b/src/os/freebsd-os_mount_devtmpfs.c new file mode 100644 index 0000000..033a4c4 --- /dev/null +++ b/src/os/freebsd-os_mount_devtmpfs.c @@ -0,0 +1,11 @@ +/* ISC license. */ + +#include <sys/param.h> +#include <sys/mount.h> + +#include "os.h" + +int os_mount_devtmpfs (char const *point) +{ + return mount("devfs", point, "devfs", MNT_NOEXEC | MNT_NOSUID, "") ; +} diff --git a/src/os/freebsd-os_mount_tmpfs.c b/src/os/freebsd-os_mount_tmpfs.c new file mode 100644 index 0000000..27a4f1f --- /dev/null +++ b/src/os/freebsd-os_mount_tmpfs.c @@ -0,0 +1,32 @@ +/* ISC license. */ + +#include <errno.h> + +#include <sys/param.h> +#include <sys/mount.h> + +#include <skalibs/strerr2.h> + +#include "os.h" + +void os_mount_tmpfs (char const *point, unsigned int mounttype) +{ + if (mounttype) + { + if (mounttype == 2) + { + if (mount("tmpfs", point, "tmpfs", MNT_UPDATE | MNT_NOSUID, "mode=0755") == -1) + strerr_diefu2sys(111, "remount ", point) ; + } + else + { + if (unmount(point, MNT_FORCE) == -1) + { + if (errno != EINVAL) + strerr_warnwu2sys("umount ", point) ; + } + if (mount("tmpfs", point, "tmpfs", MNT_NOSUID, "mode=0755") == -1) + strerr_diefu2sys(111, "mount tmpfs on ", point) ; + } + } +} diff --git a/src/os/freebsd-os_reboot.c b/src/os/freebsd-os_reboot.c new file mode 100644 index 0000000..159fd97 --- /dev/null +++ b/src/os/freebsd-os_reboot.c @@ -0,0 +1,11 @@ +/* ISC license. */ + +#include <unistd.h> +#include <sys/reboot.h> + +#include "os.h" + +void os_reboot (int what) +{ + reboot(what == 3 ? RB_AUTOBOOT : what == 2 ? RB_POWEROFF : RB_HALT) ; +} |