Commit Graph

964 Commits

Author SHA1 Message Date
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 43b0f235ca Implement pthread_getattr_np 2025-09-30 12:49:22 -06:00
Wildan Mubarok 7416ba6ff3 Implement posix_getdents 2025-09-23 10:57:13 -06:00
Wildan Mubarok a4aa1a30a3 Fix timespec for semaphore 2025-09-23 00:44:02 +00:00
Jeremy Soller 6110a77044 Merge branch 'cstr_strchr' into 'master'
Add safe strchr method for CStr.

See merge request redox-os/relibc!723
2025-09-21 10:35:10 -06:00
4lDO2 9aeb9abd97 Add safe strchr method for CStr. 2025-09-21 17:00:45 +02:00
Jeremy Soller 38d667a58e Merge branch 'printf-use-float-abs' into 'master'
printf: Use f64::abs

See merge request redox-os/relibc!639
2025-09-21 08:17:46 -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 1a2c8175d4 printf: Use f64::abs 2025-09-21 06:52:59 +00:00
Wildan M b541ee43be Change PATH separator to double colon 2025-09-19 21:48:38 +07:00
Jeremy Soller f4a7bcf92d Merge branch 'shadow-h' into 'master'
Implement shadow.h and argon2 crypt

See merge request redox-os/relibc!718
2025-09-19 06:45:18 -06:00
Wildan M b8598f50ff Add argon2 crypt 2025-09-19 15:41:05 +07:00
Wildan M d3e44fa6b9 Apparently need to import FILE constant 2025-09-19 14:37:49 +07:00
Wildan M 0636af21a4 Add shadow.h support 2025-09-19 14:04:55 +07:00
auronandace 1bacd51b81 specify the type properly 2025-09-18 16:30:30 +01:00
auronandace 6607549abf add constant to fnmatch.h 2025-09-18 16:17:11 +01:00
Josh Megnauth 03c0e3024c Export fexecve
It turns out we have fexecve but it wasn't exported in unistd.h.

Related: #184
2025-09-18 02:38:15 -04: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 c6a9a165ec Implement fdopendir and fdclosedir
`fdopendir` takes ownership of a directory file descriptor instead of
opening one with a path. `fdclosedir` is a FreeBSD extension that
transfers ownership of the file descriptor in DIR to the user.
2025-09-17 08:24:48 -04:00
Wildan Mubarok 2f35c4a665 Fix getgrouplist len 2025-09-15 21:29:27 +00:00
Wildan Mubarok 94fbdd5159 Fix grp implementation 2025-09-15 21:14:53 +00:00
Jeremy Soller fdb7532a67 Merge branch 'null_getaddrinfo' into 'master'
Implement getaddrinfo NULL nodename, AI_PASSIVE, AI_NUMERICHOST

Closes #223

See merge request redox-os/relibc!710
2025-09-15 06:47:27 -06:00
Wildan M 726a0fb1a8 Implement getaddrinfo NULL nodename, AI_PASSIVE, AI_NUMERICHOST 2025-09-15 15:10:50 +07:00
Josh Megnauth 28901b1b62 Impl AT_SYMLINK_NOFOLLOW and AT_EMPTY_PATH
AT_SYMLINK_NOFOLLOW acts on the symlink itself rather than following it.

AT_EMPTY_PATH acts on the directory if path is empty.

Currently, this is implemented in fstatat itself but the code is general
enough to be refactored once we get the other *at functions. It could
likely just live in openat itself.
2025-09-15 06:12:10 +00:00
Jeremy Soller e1fa1ee7b7 Merge branch 'real_cpu' into 'master'
Implement reading CPU count

See merge request redox-os/relibc!709
2025-09-14 06:31:16 -06:00
Wildan M d527cf455f Implement reading CPU count 2025-09-14 18:45:38 +07:00
Jeremy Soller 0a13e2574f Fix sigsetjmp definition on riscv64 2025-09-07 20:04:10 -06:00
Jeremy Soller 705270dba3 Merge branch 'const-init-pthread_atfork' into 'master'
Const init pthread_atfork; export in pthread.h

See merge request redox-os/relibc!698
2025-09-06 07:13:16 -06:00
Josh Megnauth 51bc7f7d2c Const init pthread_atfork; export in pthread.h
`pthread_atfork` should be exported in pthread.h according to the
standard. We only exported our function in unistd.h. `glibc` exports it
in both pthread.h and unistd.h whereas musl only exports it in pthread.h
(which is standards compliant).

I exported it in both headers. Cbindgen doesn't seem to reexport `pub
use` so I declared the function twice. We might have to reexamine our
`pub use` to check what's exported and what isn't.
2025-09-01 22:21:15 -04:00
Wildan M 4c6c5da8f2 fix fmt 2025-08-28 16:13:16 +07:00
Wildan M 80ea3bc6a1 Add sem_clockwait and fix timedwait clock_id 2025-08-28 12:58:54 +07:00
Wildan M 7ab71a0ad5 Add sem_timedwait 2025-08-28 08:36:16 +07: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
Josh Megnauth 9d2f5d95dc Implement confstr (unistd.h)
The implementation for confstr is straightforward. Most of the constants
return 1 on both musl and glibc. The only constant that doesn't is
required for Fish.

I also switched an #[unsafe(no_mangle)] from my last patch back
to a #[no_mangle] because we need to bump cbindgen. #[unsafe(no_mangle)]
is required for Rust 2024.
2025-08-22 22:13:51 -04:00
Jeremy Soller 4758685217 Merge branch 'netdb-openssh' into 'master'
Implement getnameinfo and getaddrinfo loopback

See merge request redox-os/relibc!693
2025-08-20 06:59:31 -06:00
Jeremy Soller d513ba003c Merge branch 'fix-linux-sysconf' into 'master'
Improve sysconf.h on Linux

Closes #218

See merge request redox-os/relibc!691
2025-08-20 06:58:27 -06:00
Wildan M 14bb1c87c3 Fix fmt 2025-08-20 18:40:18 +07:00
Wildan M 5334455a20 Implement getnameinfo and getaddrinfo loopback 2025-08-20 18:26:27 +07:00
Wildan Mubarok c3437b70a9 Add termios IXANY 2025-08-20 07:39:15 +00:00
Josh Megnauth 70ae45ff85 Improve sysconf.h on Linux
I copied the constants and definitions from musl which we can presume is
correct. Relibc is missing some features which affects our sysconf as
well, such as constants in limits.h or a working resources.h.
2025-08-20 02:05:05 -04:00
Josh Megnauth d14ae1c148 Switch resource.h enum to c_int instead of u64
Most platforms use a c_int though glibc uses a u32. GNU defines a type,
__rlimit_resource_t, for the RLIMIT enum that is a u32.

Using a c_int is nicer for a few reasons. The first is that our
(unimplemented) functions receive a c_int for the enum - using a u32 is
technically wrong but doesn't affect anything since the constants are
turned into macros by cbindgen.

The second reason is that a c_int is nicer for libc and nix (the crate)
too since we don't need to pollute the crates with guards for Redox.
2025-08-16 23:52:03 -04:00
Josh Megnauth c3c9e3f619 Add termios constant for VDISABLE
_POSIX_VDISABLE is an extension that disables terminal special
characters.

See:
* redox-os/termios!3
* redox-os/base!27
2025-08-14 01:57:24 -04:00
Jeremy Soller f5bc50f104 Merge branch 'paths-h' into 'master'
Add paths.h for Fish

See merge request redox-os/relibc!687
2025-08-11 14:14:58 -06:00
Josh Megnauth cfe00d3316 Add paths.h for Fish
Fish only requires BSHELL. The constants are implementation specific so
this header will evolve as needed.

Cbindgen doesn't emit defines for strings (even CStrs) so I only
provided what's needed for Fish in a C header for now with the ideal
implementation, in Rust, unbuilt.
2025-08-09 01:16:12 -04:00
Josh Megnauth 728fb55203 Add %m to printf & fix CI
%m is a format specifier that prints an error string for errno. The
specifier is technically only for syslog, but musl and glibc implement
it for printf itself. Parsing for a single specifier in a single
function is error prone, especially when syslog itself is variadic.
2025-08-06 02:38:47 -04:00
Jeremy Soller 4a805ea97c Add some compatibility defines for libssh 2025-08-04 19:54:45 -06:00
Ron Williams b7589a63c5 Fixes to improve signals for openposixtestsuite 2025-08-04 07:37:14 -06:00
Josh Megnauth e677ad55d5 Better priorities & LOG_UPTO for syslog.h
* Fix PERROR to match musl/glibc better
* More unit tests + enabled on Linux
* Pack priority and facility into one i32 and check the bits with
  bitflags
* Add LOG_UPTO (logic is straight from musl)

Not done:
* "%m" - this could just be added to printf
* LOG_CONS
2025-08-01 23:45:26 -04:00