summaryrefslogtreecommitdiff
path: root/src/cmd
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-10-18 14:33:38 -0400
committerIan Moffett <ian@osmora.org>2025-10-18 14:34:38 -0400
commit2a1fccad8a72cf0f1f5dea81ae17f4772183ce50 (patch)
tree987aa3ab30e714142feb9f9eed6fa1d9ec71e984 /src/cmd
parent3daa6fbf07d635a3dbd74a2d22d2c4e22eeb55cf (diff)
cmd: init: Attempt to mount tmpfs to /tmp
During startup, it is up to the init system to mount the filesystems. This commit mounts the tmpfs filesystem to /tmp on startup Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'src/cmd')
-rw-r--r--src/cmd/init/init.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/cmd/init/init.c b/src/cmd/init/init.c
index 3f39743..9875306 100644
--- a/src/cmd/init/init.c
+++ b/src/cmd/init/init.c
@@ -28,13 +28,29 @@
*/
#include <sys/spawn.h>
+#include <sys/mount.h>
#include <stddef.h>
+#include <stdio.h>
void
main(void)
{
char login_path[] = "/usr/sbin/login";
char *argv_dmmy[] = { "/usr/sbin/login", NULL };
+ int error;
+
+ /* Mount tmpfs */
+ error = mount(
+ NULL,
+ "/tmp",
+ MOUNT_TMPFS,
+ 0,
+ NULL
+ );
+
+ if (error < 0) {
+ printf("init: failed to mount tmpfs\n");
+ }
spawn(login_path, argv_dmmy);
for (;;);