Opens /scheme/sys/proc/{pid}/groups for writing, converts
the gid_t array to little-endian u32 bytes, and writes to the
procfs handle. The kernel's Groups writer (proc.rs:1600) reads
the bytes and updates the context's groups list.
Cross-referenced with Linux 7.1 kernel/groups.c setgroups().
Validation:
- size=0, list=NULL: clear all groups (per Linux man page)
- size>0, list=NULL: return EFAULT
- size>NGROUPS_MAX: return EINVAL
- File open/write errors: return EIO/EACCES
gtty(): set errno=ENOTTY instead of silently logging TODO. The
function always fails on Red Bear (no terminal ioctl subsystem).
Modern equivalent is tcgetattr(3) in <termios.h>.
inet_aton(): implement 0xNN (hex) and 0NN (octal) parsing per
Linux man-page inet_aton(3) convention. Mixed hex/octal/decimal
parts are normalized to decimal and fed to inet_pton. Previous
behavior logged TODO and returned 0 for any non-decimal part.
Replaced todo_skip stub with vswprintf() that writes to a wchar_t buffer.
WcharWriter implements relibc's io::Write trait: each input byte
is written as a wchar_t to the output buffer. The wprintf::wprintf
function handles all format parsing; the writer adapter captures
the output. This matches the POSIX spec: wchar_t output array.
Note: output is byte-by-byte cast to wchar_t, not full UTF-16/UTF-32
encoding. This is a known limitation of the current wprintf pipeline
which outputs UTF-8 bytes even in Wide mode.
Replaced todo_skip stub with proper wcsxfrm() implementation.
The wide-char string transformation uses the current locale's
collation. Red Bear has no locale support, so the transformation
is the identity (same as C/POSIX locale). Cross-referenced with
Linux 7.1 time/wcsxfrm.c.
Behavior:
- n=0: count length of ws2 (excluding null terminator)
- n>0: copy ws2 to ws1 with null terminator, cap at n-1 chars
- Returns number of wide chars written (excluding null terminator)
Implemented wcsftime() as wide-char variant of strftime.
Cross-referenced from Linux 7.1 time/wcsftime.c.
Algorithm: convert wchar format to UTF-8 byte string (non-ASCII
chars replaced with '?'), call strftime::strftime with byte format
to format into a byte buffer, then convert each output byte to
a wchar_t in the output buffer (maxsize-1 chars + null terminator).
Also exposed time::strftime module as pub for cross-module access.
Replaced ENOSYS stub with proper POSIX madvise() implementation
cross-referenced from Linux 7.1 mm/madvise.c.
Flag validation: MADV_NORMAL, RANDOM, SEQUENTIAL, WILLNEED, DONTNEED.
Address must be page-aligned. Unknown flags → EINVAL.
Red Bear has no page cache, swap, or lazy allocation. All MADV_*
flags are no-ops: the hints are advisory and the kernel is free to
ignore them. MADV_DONTNEED would need page table teardown support
which is not implemented.
Replaced ENOSYS stub with proper POSIX msync() implementation
cross-referenced from Linux 7.1 mm/msync.c:42-55.
Flag validation: MS_ASYNC|MS_INVALIDATE|MS_SYNC, rejects unknown
flags and MS_ASYNC|MS_SYNC combination. Address page-aligned check.
Length rounded to page boundary with overflow check.
Red Bear filesystem I/O is synchronous (no writeback cache).
MS_SYNC/MS_ASYNC are no-ops. MS_INVALIDATE not implemented (needs
kernel cache invalidation), but stale cache is not a concern
with direct filesystem reads.
Adds a submodules convenience target to main makefile. Submodules must
be initialized before other targets can run successfully.
Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
* load TLS segment for executable - while we can skip PT_LOAD for executable,
we still have to load TLS segment.
* set TCB address based on if elf is position independent
Typically it's the other way around, but we can't have shared library named libc.so.6 in target/release directory.
cargo includes 'target/release' in LD_LIBRARY_PATH for build script, so even if clean build runs fine,
every subsquent run will make build script link with relibc.