Commit Graph

151 Commits

Author SHA1 Message Date
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
4lDO2 24cf96393c Expand Out wrapper and use it in utsname. 2025-10-05 20:01:12 +02:00
Jeremy Soller 82084440ad Support nightly-2025-10-03 2025-10-03 21:51:10 -06: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
Josh Megnauth c555503a35 Implement readlinkat
Like readlink except capability based. Most of this patch is refactoring
fstatat into a reusable, openat-like private function.
2025-09-18 01:27:55 +00:00
Josh Megnauth c899feb774 Implement fstatat
Linux's variant uses the syscall as intended. Redox's variant uses fpath
to build a path to pass to fstat from the file descriptor plus the file
name. Unlike the syscall, this isn't atomic so the liminal space between
fpath/getcwd and fstat is subject to TOCTOU.

Beyond fstatat, I moved the stat test to its correct location and added
an assert since the output of the test is unchecked.

I also added AT_FDCWD which seems to be -100 across Unixes. The other
AT_* constants are unimplemented for now.
2025-08-27 08:21:41 -04:00
Ron Williams 770dc71816 Fix CI, Add signal.h constants 2025-07-11 20:28:45 -06:00
4lDO2 32c5e89c82 Return ID of new session in setsid. 2025-04-20 17:10:51 +02:00
4lDO2 a4dc232a33 Impl getres[ug]id C function. 2025-04-19 19:26:59 +02:00
4lDO2 d68f5d8d3d Make redox itimer relibc stub rather than kernel stub. 2025-04-13 18:18:05 +02:00
Josh Megnauth d6ac5f8947 Avoid over allocations & reallocations
As we know, vectors amortize the cost of adding new elements by reserving
space for multiple elements when full. This is useful but may lead to
allocating more memory than necessary.

`relibc` generally avoids over allocations by reserving the exact amount
of space when possible. I fixed a few areas that still over allocated or
reallocated unnecessarily by leveraging iterators that are more likely
to know sizes.
2024-11-14 22:53:12 -05:00
Peter Limkilde Svendsen 06fec0b843 Add various basic docstrings 2024-10-27 23:25:57 +01:00
4lDO2 07af4e49f7 Add sigaltstack test. 2024-09-28 16:51:17 +02:00
4lDO2 eee603efa8 Remove the "-1 errno" e() function. 2024-09-27 15:35:04 +02:00
4lDO2 070b4cd05c Switch PalPtrace to Rusty error handling. 2024-09-27 15:35:04 +02:00
4lDO2 d474163e0e Switch to Rusty error handling in PalSocket. 2024-09-27 15:35:01 +02:00
4lDO2 4da5ad37d1 Convert PalEpoll to Rusty error handling. 2024-09-27 11:22:36 +02:00
4lDO2 1a46a24c70 Rustify PalSignal error handling. 2024-09-27 11:12:19 +02:00
4lDO2 8b8b00da01 Use unsigned return values in read()-like Pal fns.
Returning a negative number of bytes makes absolutely no sense, besides
the "-1 and errno" pattern, which is now converted to Result<_, Errno>.
2024-09-27 10:39:26 +02:00
4lDO2 986754e7b3 Remove all remaining errno interfaces from Pal. 2024-09-27 10:29:32 +02:00
4lDO2 313b32c815 Switch almost all of Pal to Rusty error handling. 2024-09-27 10:19:44 +02:00
4lDO2 4b687c25d2 Convert more Pal methods to Result. 2024-09-26 16:24:01 +02:00
4lDO2 6e5959b3fa Convert a bunch of c_int to Result<(), Errno>. 2024-09-26 16:21:34 +02:00
4lDO2 fed49a29af Properly deallocate thread stack on pthread_exit. 2024-09-24 19:34:53 +02:00
4lDO2 2b7a1ea94b Fix sigsuspend and add it to the sigqueue test. 2024-09-24 19:34:53 +02:00
4lDO2 9701e9c544 Add sigtimedwait to test, and various fixes. 2024-09-24 19:34:53 +02:00
4lDO2 5c78356290 Implement sigtimedwait on Redox. 2024-09-24 19:34:52 +02:00
4lDO2 8e5ddbd654 Implement sigsuspend. 2024-09-24 19:34:52 +02:00
4lDO2 abc2ec7bb5 Add prototype ucontext_t support. 2024-09-24 19:34:51 +02:00
4lDO2 13e7b77643 Implement basic support for (kernel) rt signals. 2024-09-24 19:34:50 +02:00
Kamil Koczurek 408a7b2ab6 Add capability to set the default scheme 2024-09-23 14:36:45 +00:00
4lDO2 7e38bb1476 Fix Linux compilation. 2024-09-21 13:42:43 +02:00
Jeremy Soller 4d29614ea8 Better stub for sigsuspend on redox 2024-09-19 21:01:07 -06:00
Jeremy Soller 1ac8c4834b Format 2024-09-19 16:09:11 -06:00
Jeremy Soller 1b7d059707 Add getrusage 2024-09-19 16:08:54 -06:00
4lDO2 c0e7af5289 Backwards-compatibly rewrite getdents to use special syscall. 2024-09-11 23:32:19 +02:00
4lDO2 198caa3bc5 Rustify Sys::open and some fs:: error handling. 2024-09-11 23:22:32 +02:00
4lDO2 4bd0d2a1ef Move pthread::Errno to separate module. 2024-09-11 23:22:29 +02:00
4lDO2 ac5ac928f2 Implement raise() using pthread_kill. 2024-07-18 23:59:48 +02:00
4lDO2 bf26de70e2 Add setresuid/setresgid (suid/sgid stub on Redox). 2024-07-18 23:54:46 +02:00
4lDO2 4c20a9abb2 Enable syscall restart in futex_wait. 2024-07-16 11:55:06 +02:00
4lDO2 8298417dee Implement sigpending on Redox. 2024-07-09 15:00:58 +02:00
4lDO2 c639fd37ba Implement sigaltstack. 2024-07-09 15:00:57 +02:00
4lDO2 f37bb3cb16 Fix sigaction test on Linux, and rustfmt. 2024-07-09 15:00:55 +02:00
4lDO2 0ea2b5d45f Fix compilation on Linux. 2024-07-09 15:00:55 +02:00