Commit Graph

835 Commits

Author SHA1 Message Date
auronandace 94b2f29beb tackle various clippy lints 2026-06-05 14:36:06 +01:00
sourceturner e39106835a fix compiler warnings 2026-06-04 17:33:37 +02:00
Wildan M 959e7d6cca Implement event timeout with EVENT_TIMEOUT_ID 2026-05-30 01:03:37 +07:00
Ibuki Omatsu c2bcf91339 feat: Implement relpathat 2026-05-27 16:36:44 +02:00
sourceturner 4b4dc2ce94 implement housekeeping for posix timers 2026-05-24 19:14:02 +02:00
sourceturner d16183732c use raw borrow operator instead of pointer cast
clippy dislikes the pointer cast - let's make clippy happy
2026-05-24 19:12:05 +02:00
Wildan M c4924fba79 Workaround epoll edge cases 2026-05-21 11:06:54 +07:00
Jeremy Soller e3514fa329 Merge branch 'shm' into 'master'
Implement key_t, sys/ipc and sys/shm

See merge request redox-os/relibc!1367
2026-05-20 10:11:58 -06:00
Jeremy Soller 6ef45672d1 Merge branch 'fix-fstatat' into 'master'
fix: Fix fstatat by passing O_PATH when calling openat2

See merge request redox-os/relibc!1362
2026-05-20 06:29:10 -06:00
Wildan M bc6ea5ba99 Implement key_t, sys/ipc and sys/shm 2026-05-20 18:51:53 +07:00
Ibuki.O 0e2f24125a fix: Fix fstatat by passing O_PATH when calling openat2 2026-05-20 12:11:11 +09:00
Wildan M 4a7f2d80ff Avoid StringWriter cast and string format 2026-05-20 09:10:25 +07:00
David Finder 1dbc61932a Alarm fix 2026-05-18 16:52:04 -06:00
Wildan M 519bc8ebc8 Remove ld.so cache 2026-05-13 07:11:36 +07:00
Speedy_Lex eff610eac6 Fix many clippy lints 2026-05-07 00:05:07 +02:00
auronandace e1d26137b4 eliminate export function for struct iovec 2026-05-06 08:57:33 +01:00
Connor-GH e2486379b1 Remove redundant code and impl them in terms of *at functions
The following functions were replaced with their *at variants or
similar:
- lstat -> lstat -> fstatat
- stat -> stat -> fstatat
- fstat -> fstatat
- fchmod -> fchmodat
- fchown -> fchownat
- lchown -> fchownat
- mkfifo -> mkfifoat
- open -> openat
- renameat -> renameat2
- rmdir -> unlinkat
- unlink -> unlinkat
- symlink-> symlinkat

The `open_flags` logic for fstatat was redundant, as this is already
handled (and better so) in `openat2`.

Additionally, the fstatat test succeeds in os-test, and no longer
returns EINVAL. This is because `O_SYMLINK` is no longer
unconditionally passed like it was before. This is a problem because
redoxfs returns EINVAL if a node isn't a symlink but set `O_SYMLINK`.
2026-05-05 15:30:46 -05:00
Connor-GH 03103893ef add utimensat
This addition removes duplicated code and also passes an os-test.

The `AT_EMPTY_PATH` duplicated code will be taken care of in the future.
2026-05-05 10:42:32 -05:00
Wildan M 90cb143523 Unify alarm implementation 2026-05-05 09:35:50 +07:00
Connor-GH 1016fdf01e fix test regression caused by !1250
MR https://gitlab.redox-os.org/redox-os/relibc/-/merge_requests/1250 was
done in order to try and patch out an `EINVAL` error, and it was
successful in doing so. Unfortunately, fixing one failure caused
another.

I will continue to do what I can to make relibc's FS layer and redoxFS
smaller, as they have way too much duplicated code.
2026-05-04 14:20:02 -05:00
Connor-GH cf65eedbaf platform/redox: migrate more functions to use their *at variants
Additionally, this adds the `SYMLOOP_MAX` constant in `limits.h` to
replace the `MAX_LEVEL` magic number used during symlink resolution.

`fstat` was kept because it is more difficult than the others to do a
drop-in replacement in terms of `fstatat` for since a naive approach
would cause mutual recursion.
2026-05-04 11:44:53 -05:00
auronandace 8cec0c2280 import socklen_t from sys_socket instead of bits 2026-05-03 16:54:46 +01:00
auronandace 05b8ffbcb7 import timespec from time rather than bits 2026-05-03 14:33:39 +01:00
Wildan M ea667cdca1 Support disarming timer 2026-05-03 05:06:25 +07:00
Wildan M 9188a9e354 Make timer_internal_t atomic 2026-05-03 05:02:29 +07:00
Wildan M d16dfade59 Use less cloning for timespec 2026-05-03 03:21:06 +07:00
Wildan M 7b0354ca3d Use type casts for timespec conversion 2026-05-03 03:09:52 +07:00
Connor-GH 76d801f7cd openat2: fix internal assumption causing EINVAL
Inside of `openat2`, we are assuming that if we are passed
`AT_SYMLINK_NOFOLLOW` that we are also passed a symlink. This is simply
not the case, as POSIX defines the flag to only have a noticable effect
if the resolved path is a symlink. Therefore, we cannot assume that we
have a symlink if we see `AT_SYMLINK_NOFOLLOW`. The previous behavior
caused an `EINVAL` in redoxfs because we do a consistency check to
error out if we are passed `O_SYMLINK` (which was added because
`AT_SYMLINK_NOFOLLOW` was observed) and aren't a symlink.

Hmm, maybe a special errno like `ENOTLNK` should be deployed for this? It's
specific enough that it could possibly be added to a future POSIX.
2026-05-01 17:01:39 -05:00
Connor-GH 7c8259dfd6 fix some lints caught by Clippy
Most of these changes are very simple. Among the changes made involve
taking advantage of auto-deref (`(*val).foo()` -> `val.foo()`) and
removing instances where we create a ref and immediately dereference it
(`&*val` -> `val`). There was a pretty neat case in `posix_openpt` where
some pointer verbosity was able to be reduced by using the more modern C
strings rather than the byte strings with an explicit NUL at the end.

Additionally, `exit()` now calls `unreachable!()` at the end. We
previously did `loop {}`, but clippy didn't like this. It can be up for
debate whether we want to make this `unreachable_unchecked` or similar.

There is only one change that might cause any sort of concern, and that
is the change from `.skip_while(!p).next()` -> `.find(p)`. This, like
everything else, was caught in a Clippy lint but I believe it deserves
some explanation because it isn't immediately obvious. Info about the
lint is here: https://rust-lang.github.io/rust-clippy/rust-1.89.0/index.html#skip_while_next
2026-04-30 19:02:35 -05:00
Wildan M 598d34d8a0 Fix open permission and add umask test 2026-04-30 16:08:05 +07:00
Connor-GH 22faf6b615 fchownat: fix behavior for uid == -1 && gid == -1
Previously, this would error with EINVAL since the conversion to
unsigned int would fail on -1. Now, we do a bitwise conversion via
an `as` cast.
2026-04-29 15:23:56 -05:00
auronandace 6a490be2c6 split out sigset_t from signal header 2026-04-29 12:29:43 +01:00
Jeremy Soller 54d16f7a65 Merge branch 'remove-allowed-unused-imports' into 'master'
remove unused imports and #[allow(unused_imports)] annotations

See merge request redox-os/relibc!1223
2026-04-24 07:00:04 -06:00
sourceturner 8daf17e4f7 remove unused imports and #[allow(unused_imports)] annotations 2026-04-23 21:41:24 +02:00
Connor-GH 313f2be0f8 Pal: Add default method impls and remove duplicated code
I noticed that the Linux and Redox PALs both do very similar things for
a given FS function and its *at variant. For example, `mkdir()` is just
a call to `mkdirat()`. POSIX requires these to be equivalent.
Additionally, we use AT_EMPTY_PATH in some places but note that this is
not POSIX and is instead an extension that Linux (and Redox) implement.
That doesn't really matter though, since this is an implementation
detail. Implementations can choose to implement these functions anyway
and ignore the default impl. Such a case is `fstat`, because the current
Redox impl of `fstatat` relies on `fstat`, and this would cause infinite
recursion.

Future work:

POSIX says that `fcntl(fd, F_DUPFD, 0);` shall be equivalent to
`dup(fd);`. `dup2` might have cases where it can be implemented using
`dup3`. `dup` seemingly cannot be implemented in terms of `dup2`, so the
`fcntl` default implementation is sufficient. `pipe(fds)` is equivalent to
`pipe2(fds, 0);`.
2026-04-23 14:18:04 -05:00
Jeremy Soller 30cc2de953 Merge branch 'faccessat-fchownat' into 'master'
add faccessat(2) and fchownat(2)

See merge request redox-os/relibc!1213
2026-04-20 16:33:30 -06:00
Connor-GH 24e250c339 add faccessat(2) and fchownat(2)
Additionally, we were using the `access` syscall for x86_64 for our
linux PAL. I looked at the linux source and found that using the
`access`
syscall is equivalent to using `faccessat` as we do now: https://elixir.bootlin.com/linux/v6.17.5/source/fs/open.c#L550

Also, some of the `fcntl.h` functions were accidentally implemented and exported from `unistd.h`. They are supposed to be implemented in `fcntl.h` and exported to `unistd.h`. This is now the behavior.
2026-04-20 17:20:18 -05:00
sourceturner 2873086f39 replace deprecated setitimer() in alarm() implementation 2026-04-20 21:37:52 +00:00
sourceturner 4ffd337b9b add #[allow(deprecated)] annotations
allow using deprecated functions and data structures
in deprecated functions
2026-04-20 21:37:52 +00:00
Connor-GH 0ff79b80a2 add unlinkat(2), symlinkat(2), linkat(2) and expose openat(2)
`linkat(2)` doesn't have `AT_EMPTY_PATH` as a valid flag in this
implementation because it isn't POSIX. We have it (and have
support for it), but it is more effort to add it. If we need it at some
point, it can be added in about 3 lines.

`openat(2)` previously wasn't exposed, and William was not aware of
`Sys::openat`'s existence. We use it under the hood for `mkfifoat(2)`
and friends, so expose it as a libc API. This helps to pass more os-test tests.

Lastly, the 3 implemented syscalls here help pass some os-test tests.
2026-04-20 10:58:25 -05:00
Akshit Gaur 87b16e6d12 Priority Scheduler 2026-04-17 18:45:46 -06:00
Jeremy Soller c35c291bea Merge branch 'susecond-t' into 'master'
Fix linux suseconds_t to fix alarm test

See merge request redox-os/relibc!1203
2026-04-16 06:49:46 -06:00
Wildan M 9ef2789287 Fix linux suseconds_t to fix alarm test 2026-04-16 00:11:44 +07:00
Wildan M b73dd22020 Disable SIGARLM timer delivery 2026-04-15 21:03:36 +07:00
auronandace 8c41979aba fix redox compilation for sa_family_t 2026-04-14 08:52:31 +01:00
Peter Limkilde Svendsen fbccaff46c Move setgroups() to grp.h 2026-04-13 22:56:56 +02:00
Benton60 7bf209dc8e Move to separate 0.0.0.0:0 and disconnected states for udp AF_UNSPEC 2026-04-10 18:55:26 +01:00
auronandace 49f96a96e6 rename bits_time to bits_timespec for consistency 2026-04-09 10:50:04 +01:00
Mathew John Roberts e599c37a40 Merge branch 'pal-socket-docs' into 'master'
Add docs for PalSocket

See merge request redox-os/relibc!1170
2026-04-09 07:55:53 +01:00
Mathew John Roberts 6af45691f6 Merge branch 'pal-signal-docs' into 'master'
Add docs for PalSignal

See merge request redox-os/relibc!1169
2026-04-09 07:52:50 +01:00