Commit Graph

151 Commits

Author SHA1 Message Date
auronandace 8414205d04 only import the needed types 2025-12-22 17:47:29 +00:00
auronandace 8deb1f32c3 mark two functions unsafe 2025-12-22 17:40:51 +00:00
Jeremy Soller b1c9847b97 Include sys/stat.h and unistd.h in fcntl.h, remove bits/fcntl.h 2025-12-19 13:01:45 -07:00
Jeremy Soller 3765148270 Fix incompatible functions 2025-12-19 12:55:43 -07:00
Jeremy Soller 0405048890 Format limits and sysconf 2025-12-19 11:46:38 -07:00
Jeremy Soller 7e987b67bc Add more limits and expose them through sysconf 2025-12-19 10:18:15 -07:00
Jeremy Soller 4daa52a6bd Implement _Fork, which is fork without pthread_atfork hooks 2025-12-19 08:49:53 -07: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
Jeremy Soller a33bb699e6 Remove weak linkage from getopt functions and globals 2025-10-30 14:39:27 -06:00
Wildan M efad028739 Fix getting total memory 2025-10-09 21:15:03 +07:00
Wildan M cc325b8b0a Fix compile 2025-10-09 13:24:03 +07:00
Wildan M a118d5659b Implement reading memory 2025-10-09 13:15:05 +07:00
Wildan M 38a64f2247 Define stub memory constants 2025-10-07 20:27:32 +07: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
Jacob Lorentzon 9c5f11fbc8 Add Out<T> wrapper 2025-09-21 14:36:12 +02:00
Wildan M b541ee43be Change PATH separator to double colon 2025-09-19 21:48:38 +07: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
Wildan M d527cf455f Implement reading CPU count 2025-09-14 18:45:38 +07: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
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
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 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
Ron Williams b7589a63c5 Fixes to improve signals for openposixtestsuite 2025-08-04 07:37:14 -06:00
Jeremy Soller 5673575354 Revert "Merge branch 'rustifying' into 'master'"
This reverts merge request !663
2025-07-06 12:54:39 -06:00
David DA SILVA 7fd3a8d698 Rustify some functions (following TODO) 2025-06-25 08:39:01 -06:00
Jeremy Soller cafdcd35d1 Expose setegid and seteuid 2025-05-02 11:36:51 -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 a4dc232a33 Impl getres[ug]id C function. 2025-04-19 19:26:59 +02:00
Jeremy Soller 121e733990 Merge branch 'fix_arm64' into 'master'
Fix building for arm64

See merge request redox-os/relibc!636
2025-03-30 16:26:41 +00:00
bjorn3 50766b0469 Fix building on newer nighlies 2025-03-30 16:37:13 +02:00
Josh Megnauth 51c04d2470 Use C string literals & deprecate c_str! 2025-03-14 21:17:53 -04:00
Peter Limkilde Svendsen 85f01e8412 Add stubs for missing functions 2025-02-01 18:36:07 +01:00
Peter Limkilde Svendsen 26fdc200bf Add docs for unistd submodules 2025-02-01 18:07:51 +01:00
Peter Limkilde Svendsen 99e0948e0c Reexport ctermid, cuserid 2025-02-01 18:07:23 +01:00
Peter Limkilde Svendsen 5116c80d2f Reorder functions alphabetically 2025-02-01 17:34:20 +01:00
Peter Limkilde Svendsen bfde89c7cc Add docs and deprecations for unistd.h 2025-02-01 17:23:36 +01:00
Ron Williams c528c0885f Make nanosleep and sleep handle interrupts correctly, plus fix alarm 2025-01-31 21:10:14 +00:00
Josh Megnauth 90f934c769 Exit should return never (!)
`_Exit`, `exit`, and related functions should return `!` because they
don't return. This also signals to cbindgen that it should emit
`[[noreturn]]` for those functions.
2024-11-23 03:33:00 -05:00
Jeremy Soller ce7b85b0df Merge branch 'dont-overallocate-cstrings' into 'master'
Avoid over allocations & reallocations

See merge request redox-os/relibc!558
2024-11-17 16:17:22 +00:00
Josh Megnauth 5348273ccc Emit C attributes via cbindgen 2024-11-17 16:15:07 +00: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
Dorian Davi efcbbb8592 Add C code necessary for libuv to work 2024-10-24 16:58:52 +00: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