Commit Graph

932 Commits

Author SHA1 Message Date
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
Josh Megnauth 64d9847e37 Linux support for syslog.h
Linux's syslog is a local socket, so this uses the recent UDS work.

* Most of redox.rs is refactored into mod.rs now which has all of the C
  facing functions and consts.
* I wrapped the global logger in a Mutex instead of a RwLock. The logger
  is almost always locked for writing so a Mutex is simpler as RwLock
  provides no benefits.
* I implemented LOG_PERROR which also prints errors to stderr as well as
  the log.
* Syslog should be sys/syslog.h with syslog.h as an alias (the
  original code only had syslog.h).
2025-07-24 21:46:49 -04:00
Jeremy Soller 6babec246d Merge branch 'fix-gocgo' into 'master'
Update pthread_attr_getstacksize to fix Go CGO

See merge request redox-os/relibc!676
2025-07-21 07:54:37 -06:00
Wildan Mubarok 2c4bd8d061 Fix grp.h and gid_t/uid_t for Go 2025-07-21 00:15:02 +00:00
Wildan Mubarok b23ac06a01 Update pthread_attr_getstacksize to fix Go CGO 2025-07-20 17:01:47 +00:00
Jeremy Soller eb2d61fdff Merge branch 'impl_syslog' into 'master'
Implement syslog functionality

See merge request redox-os/relibc!626
2025-07-17 22:49:51 -06:00
Bendeguz Pisch 4fc80ea7b0 Implement syslog functionality 2025-07-17 22:49:51 -06:00
Jeremy Soller 46c2f99919 Merge branch 'unix-domain-socket' into 'master'
feat: Implement Unix Domain Socket and related features.

See merge request redox-os/relibc!662
2025-07-17 22:48:37 -06:00
Ibuki Omatsu 206239f9a2 feat: Implement Unix Domain Socket and related features. 2025-07-17 22:48:37 -06:00
Ron Williams 770dc71816 Fix CI, Add signal.h constants 2025-07-11 20:28:45 -06:00
Josh Megnauth 1d5179eb71 Const calculate buffer size for strerror
The current buffer size is hard set to 256. Using const evaluation, the
maximum buf size can be calculated at compile time.
2025-07-10 03:18:17 +00:00
Jeremy Soller 5673575354 Revert "Merge branch 'rustifying' into 'master'"
This reverts merge request !663
2025-07-06 12:54:39 -06:00
Jeremy Soller 84bbf90ce1 Fix ___tls_get_addr on x86 2025-07-03 10:52:46 -06:00
David DA SILVA 7fd3a8d698 Rustify some functions (following TODO) 2025-06-25 08:39:01 -06:00
Jeremy Soller be49c1936a Make x86_64 mcontext not opaque 2025-05-13 10:05:32 -06:00
Jeremy Soller ac3eb38c0d Include bits/sys/ioctl.h in sys/ioctl.h 2025-05-13 08:13:49 -06:00
Jeremy Soller b2a6f00429 Use u64 for relibc internal fd set definition, does not affect C definition 2025-05-07 09:25:15 -06:00
Jeremy Soller a31584cdef Fix dangling pointer with empty scandir 2025-05-06 21:28:05 -06:00
Jeremy Soller d194554fdc Temporarily use insertion sort for qsort 2025-05-06 13:52:35 -06:00
Jeremy Soller 38cca8acc0 Fix select macros 2025-05-06 11:34:48 -06:00
Jeremy Soller 70d6a11606 openpty: terminate path with NUL 2025-05-06 09:28:58 -06:00
Jeremy Soller 1e48b13948 Debug recvmsg on redox 2025-05-04 09:32:10 -06:00
Jeremy Soller bb105d41ad scanf: fix parsing 0 when using %i 2025-05-03 21:15:58 -06:00
Jeremy Soller f8da7399d8 Use crates.io posix-regex and support extended regex 2025-05-03 16:31:04 -06:00
Jeremy Soller bce8eac3c7 Move CMSG functions to C macros 2025-05-03 11:21:27 -06:00
Josh Megnauth f85b33c3ed Handle unwraps in get_dns_server() 2025-05-02 23:01:12 -04:00
Jeremy Soller cafdcd35d1 Expose setegid and seteuid 2025-05-02 11:36:51 -06:00
Jeremy Soller 863171105d Move htonl, htons, ntohl, ntohs to netinet/in.h to support more packages 2025-05-02 09:49:37 -06:00
Jeremy Soller 58572ceefc Define _SC_NPROCESSORS_CONF 2025-05-01 14:54:04 -06:00
Ron Williams c779c1d941 Mark setitimer as unimplemented, obsolete 2025-04-21 23:29:35 -07:00
4lDO2 32c5e89c82 Return ID of new session in setsid. 2025-04-20 17:10:51 +02:00
4lDO2 e6c06a7cf7 Fix signals for spawned threads, and async signal waiting. 2025-04-19 19:27:03 +02:00
4lDO2 26c92af7ba Fix SigSet length. 2025-04-19 19:27:01 +02:00