]> Projects (at) Tadryanom (dot) Me - AdrOS.git/commit
kernel+init: migrate /dev /proc /tmp mounts to userspace init
authorTulio A M Mendes <[email protected]>
Wed, 20 May 2026 02:39:58 +0000 (23:39 -0300)
committerTulio A M Mendes <[email protected]>
Wed, 20 May 2026 02:39:58 +0000 (23:39 -0300)
commitec4b30b08a7584c0c34ae77f07b880b37b3ec7a5
tree4b1caf2c60ea6245fa429ee087d3830088525ee4
parente93e60ca6ca9695e60f8b3bce027b9d74e1b5e77
kernel+init: migrate /dev /proc /tmp mounts to userspace init

Add devfs, procfs, and auto-mkdir support to SYSCALL_MOUNT so that
userspace can mount virtual filesystems via the mount() syscall.

Userspace migration:
- init (user/cmds/init/init.c) now calls mount() directly to mount
  devfs on /dev, procfs on /proc, and tmpfs on /tmp before spawning
  the shell or running inittab entries.
- This mirrors how Linux init handles these mounts from userspace.

Kernel fallback:
- Kernel-side mounts for /dev, /proc, /tmp are kept as fallback for
  non-init boot paths (e.g. init=/sbin/fulltest). When /sbin/init
  runs, it re-mounts these; vfs_mount replaces existing entries so
  this is a harmless overlap.

Other changes:
- SYSCALL_MOUNT: add devfs and procfs as recognized fstype strings,
  with auto-mkdir of the mountpoint directory (like Linux mount(8))
- Makefile: add /etc/init.d/rcS to initrd (placeholder for future
  shell-script-based startup when shebang/-c support is added)
- rootfs/etc/init.d/rcS: placeholder script
Makefile
rootfs/etc/init.d/rcS [new file with mode: 0644]
src/kernel/init.c
src/kernel/syscall.c
user/cmds/init/init.c