]> Projects (at) Tadryanom (dot) Me - AdrOS.git/commit
POSIX compliance audit: fix syscall wrappers, headers, and commands
authorTulio A M Mendes <[email protected]>
Sun, 19 Apr 2026 18:38:13 +0000 (15:38 -0300)
committerTulio A M Mendes <[email protected]>
Sun, 19 Apr 2026 18:38:13 +0000 (15:38 -0300)
commitec905308f7f0d0bded28075c83f447d844918c2e
treeebbeccfb5a8f10e15e020e8bc50fd345d6138264
parentc559f0125b8119b7b5f2564e08cbe91dcfedb395
POSIX compliance audit: fix syscall wrappers, headers, and commands

ulibc fixes:
- mkdir(): change from variadic to (path, mode_t) per POSIX
- stat/fstat/fstatat: use struct stat* instead of void*
- wait4: use pid_t return and struct rusage* parameter
- waitid: use siginfo_t* instead of void*
- lseek: return off_t instead of int
- pread/pwrite: return ssize_t, use off_t offset
- truncate/ftruncate: use off_t length
- chmod: use mode_t instead of int
- open(): extract mode from va_args (was silently ignored)
- openat(): extract mode and pass as 4th syscall arg
- Add pivot_root() wrapper (syscall 120 existed but had no wrapper)
- Add lstat() (delegates to stat, no symlinks in AdrOS)
- Add fchmod() stub (ENOSYS, no kernel syscall yet)

ulibc header fixes:
- unistd.h: add sys/types.h include, forward declare struct stat/rusage
- fcntl.h: add O_EXCL, O_NOCTTY, O_DIRECTORY, O_NOFOLLOW, AT_FDCWD,
  AT_SYMLINK_NOFOLLOW, AT_REMOVEDIR, AT_SYMLINK_FOLLOW, AT_EACCESS
- sys/stat.h: add lstat, fchmod declarations, fix mkdir/chmod types

newlib fixes:
- openat(): extract mode from va_args, pass as 4th arg (was _sc3)
- Add pivot_root() wrapper

command fixes:
- mkdir: pass mode 0755 to mkdir() calls (was calling with 0 args)
- stat: remove unnecessary void* cast
- df: replace hardcoded stub with /proc/mounts reader

Tests: 103/103 PASS, 16/16 battery, 69/69 host
newlib/libgloss/adros/posix_stubs.c
user/cmds/df/df.c
user/cmds/mkdir/mkdir.c
user/cmds/stat/stat.c
user/ulibc/include/fcntl.h
user/ulibc/include/sys/stat.h
user/ulibc/include/unistd.h
user/ulibc/src/unistd.c