Commit Graph

660 Commits

Author SHA1 Message Date
Wildan M f56bfc4883 Adapt inet socket implementing SYS_CALL 2026-01-08 04:05:19 +07:00
Wildan M 99c942318a Fix inet hang, don't accept() on recvfrom 2026-01-07 22:59:20 +07:00
Wildan M 7d1c3961b5 Implement malloc_usable_size 2026-01-04 02:15:29 +07:00
Wildan M 08485648f6 Convert strtold to Rust 2025-12-25 16:11:36 +07:00
Wildan M 74341384d2 Fix statat tests 2025-12-21 23:05:26 +07:00
Wildan M ff60a2483b Implement clock_getres 2025-12-21 15:13:46 +07:00
Jeremy Soller 3654575ca1 Implement fexecve on Linux 2025-12-19 12:18:02 -07:00
Jeremy Soller 3b963b2745 Add missing sigsetsize argument to EPOLL_PWAIT syscall on Linux 2025-12-19 11:46:11 -07:00
Jeremy Soller 9d15760ef5 Fix chown on linux by adding fchownat flags to syscall 2025-12-19 08:59:18 -07:00
Ibuki Omatsu efa5b73015 refactor: Replace unlink and rmdir with unlinkat. Improve fork using ForkScratchPad. 2025-12-17 18:32:07 -07:00
bjorn3 dc77995b57 redox-rt: Remove unnecessary image_file field from FexecResult::Interp 2025-12-09 22:22:09 +01:00
bjorn3 0158b111e0 redox-rt: Use non-fixed and anonymous remote mmap 2025-12-09 21:04:40 +01:00
bjorn3 1ede79fe88 Move cloexec and deactivate_tcb handling into redox-rt 2025-12-08 22:19:57 +01:00
bjorn3 b607877c07 Move cloexec handling to happen right before the final exec
This way if the target can't be executed, cloexec fds remain open as
expected.
2025-12-08 20:39:55 +01:00
bjorn3 4dae665cbf Hard code the default scheme to file
Init no longer changes the default scheme to initfs at any point in
time. And for sandboxing you would be switching scheme namespace, not
default scheme.

It should be possible to mix and match relibc version from before and
after this change without breaking exec, though I haven't tested it.
2025-12-07 19:51:45 +01:00
bjorn3 6021ece539 Calculate total_args_envs_size in redox_rt::proc::fexec_impl
Calculating it earlier is a micro-optimization that doesn't seem like it
matters at all compared to all other costs of spawning a process. But at
the same time it makes things more fragile. And in fact bootstrap
actually passed the wrong value. It passed the
total_args_envs_auxvpointee_size that it computed rather than the
total_args_envs_size. While over-approximation doesn't cause UB, it
unnecessarily increases the amount of memory used after exec.

In addition pass &[&[u8]] rather than iterators for args and envs to
enable precomputing the total arg and env size. This also prevents you
from forgetting to pass a reversed iterator.
2025-12-07 18:52:47 +01:00
Anhad Singh e7b6c25d72 fix(platform/redox): add missing imports
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2025-12-05 01:07:18 +11:00
Anhad Singh 5e1036bc15 fix(platform/redox): fstatat
This commit fixes multiple issues with `fstatat` implementation for
Redox.

1. `flags` are now properly handled. The `flags` argument specifies AT_* flags
   not O_* flags.
2. Open with O_PATH to avoid actually *opening* the file which may block
   or cause permission issues.
3. Close the temporary file descriptor regardless of success of failure.

Signed-off-by: Anhad Singh <andypython@protonmail.com>
2025-12-04 11:31:24 +11:00
Anhad Singh 6bcdac4202 fix(platform/linux): use FCHOWNAT to implement lchown(2)
`LCHOWN` syscall is not available on aarch64.

Signed-off-by: Anhad Singh <andypython@protonmail.com>
2025-12-01 14:46:08 +11:00
Anhad Singh 6d68ca9957 fix(platform/linux): use FACCESSAT to implement access(2)
`ACCESS` syscall is not available on aarch64.

Signed-off-by: Anhad Singh <andypython@protonmail.com>
2025-12-01 14:46:08 +11:00
Anhad Singh 90963fdfb9 feat(platform/linux): stub rlct_clone
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2025-12-01 14:46:07 +11:00
Josh Megnauth 8e5937ca25 Implement posix_fallocate
`posix_fallocate` ensures that a byte range in a file is allocated so
that subsequent writes don't fail. Unlike ftruncate, posix_fallocate
does not shrink files.

The Linux syscall fallocate is similar to posix_fallocate except with
far more control over how byte ranges are allocated (e.g. it supports
file holes and other features). This MR doesn't implement fallocate as
it requires syscall and redoxfs support.

Finally, I changed the flags for flock from usize to c_int. That matches
what we have in libc and also avoids some silly, needless type casting.
2025-11-28 19:49:21 -05:00
Wildan M c90bb71deb Fix netstack triggering EOPNOTSUPP 2025-11-23 22:00:26 -08:00
Jeremy Soller 0844e6fc90 WIP: use upper fd table 2025-11-15 07:55:37 -07:00
Jeremy Soller aeb243746c Add recv/sendmsg flags to metadata 2025-11-13 10:19:45 -07:00
Ibuki Omatsu e675da5a30 fix: Ignore EOPNOTSUPP error from sys_call in setsockopt. 2025-11-12 06:00:44 -07:00
4lDO2 512c4f0aa8 Clarification of st_mode bits extraction code. 2025-11-12 12:10:11 +01:00
Ibuki Omatsu 06d5cb0bfd fix: Fix getpeername for unix sockets adding SocketCall::GetPeerName and using SYS_CALL. 2025-11-10 06:20:46 -07:00
Jeremy Soller ed5a2a66ad Merge branch 'master' of https://gitlab.redox-os.org/redox-os/relibc 2025-11-08 20:59:05 -07:00
Jeremy Soller 052f000668 Ensure pipes have O_RDONLY or O_WRONLY set 2025-11-08 20:58:58 -07:00
4lDO2 3ad0420b85 Add derive macro to check types vs libc crate. 2025-11-08 17:30:34 +01:00
Jeremy Soller 9eaa9e82b0 Pass through all SOL_SOCKET options, fix getsockopt option_len handling 2025-11-08 08:00:43 -07:00
Jeremy Soller f7cfacfbc8 Remove leftover dbg 2025-11-07 20:17:16 -07:00
Jeremy Soller 0ee947c389 Fix recvmsg stream being too small by one usize 2025-11-07 20:11:59 -07:00
Jeremy Soller ef5e54547f Close accepted socket on getpeername error 2025-11-07 18:46:54 -07:00
Jeremy Soller 443145fdee On Redox, if recvfrom/sendto has flags, use recvmsg/sendmsg 2025-11-07 11:05:04 -07:00
Josh Megnauth f5d432644f Implement renameat, renameat2
Like the other "at" functions, renameat renames files with respect with
a directory descriptor. "renameat2" is Linux specific but really nice -
it adds a flag which supports atomically swapping two files or failing
if the target already exists. The latter is easily supported in relibc.
The former requires redoxfs support.

Besides the impl itself, I refactored "cap_path_at" into what it really
is: a mini openat2-like function.
2025-10-21 14:47:39 -04:00
Wildan M c8fce67873 Support SIGEV_SIGNAL and TIMER_ABSTIME 2025-10-16 22:37:24 +07:00
Wildan Mubarok 2efcd20fbc Implement POSIX timer functions 2025-10-15 08:10:06 -06:00
Wildan M 1712290deb Define posix_dent for posix_getdents 2025-10-12 20:25:37 +07:00
4lDO2 24cf96393c Expand Out wrapper and use it in utsname. 2025-10-05 20:01:12 +02:00
Jeremy Soller ced734c162 Add RawCell::unsafe_set 2025-10-04 07:50:16 -06:00
Jeremy Soller 82084440ad Support nightly-2025-10-03 2025-10-03 21:51:10 -06:00
Jeremy Soller f35ddf0ec1 Merge branch 'getpeername-fix' into 'master'
Fix panic on getpeername

See merge request redox-os/relibc!728
2025-09-26 14:25:16 -06:00
Wildan M 8fa68e2927 fmt 2025-09-27 01:13:14 +07:00
Wildan M 7527de3a25 Fix panic on getpeername 2025-09-27 01:02:20 +07:00
Josh Megnauth b22f333319 Fix Linux build 2025-09-26 02:05:03 -04:00
Wildan Mubarok 7416ba6ff3 Implement posix_getdents 2025-09-23 10:57:13 -06:00
Josh Megnauth 85c5e889fb Implement fchmodat
Capability based `fchmod`. I also implemented unit tests for chmod,
fchmod, and fchmodat.

The unit tests check Redox-specific behavior, so some of the tests are
disabled for Linux.
2025-09-21 10:04:11 -04:00
Jacob Lorentzon 9c5f11fbc8 Add Out<T> wrapper 2025-09-21 14:36:12 +02:00