Commit Graph

2573 Commits

Author SHA1 Message Date
Guillaume Gielly ffd5edd283 Add strptime() module and clean up unused strptime function 2025-01-05 20:10:50 +01:00
Guillaume Gielly ba225e2000 Refactor strftime() to use langinfo constants for locale-based formatting :
- replaced hardcoded day and month names with calls to nl_langinfo,
- integrated langinfo constants  DAY_1, ABDAY_1, MON_1, ABMON_1) for weekday and month names,
- used AM_STR and PM_STR for AM/PM strings in %p and %P specifiers,
- add comments.
2025-01-05 19:45:29 +01:00
Guillaume Gielly 770e768818 Implement 'langinfo.h' 2025-01-05 18:20:42 +01:00
Jeremy Soller 25b0da4876 Merge branch 'sigsetjmp_x64_implementation' into 'master'
Implement sigsetjmp and siglongjmp for X64

See merge request redox-os/relibc!478
2025-01-04 00:29:19 +00:00
Bendeguz Pisch 35a3efd936 Implement sigsetjmp and siglongjmp for X64 2025-01-04 00:29:19 +00:00
Jeremy Soller 9265b778c6 Merge branch 'impr_time' into 'master'
Adding `tzset`, timezone awareness, and some tweaks

See merge request redox-os/relibc!596
2025-01-02 20:19:34 +00:00
Darley Barreto c14b2cee4c Adding tzset, timezone awareness, and some tweaks 2025-01-02 20:19:34 +00:00
Jeremy Soller 94e264d253 Merge branch 'patch5' into 'master'
fix(ld.so): errors UB

See merge request redox-os/relibc!595
2025-01-01 14:18:37 +00:00
Anhad Singh bfe1c0b545 fix(ld.so): redox build
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-12-31 19:30:37 +11:00
Anhad Singh 01e6eda258 misc(dlfcn): cleanup
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-12-31 19:03:05 +11:00
Anhad Singh 42d884c6a3 fix(ld.so): errors UB
Currently, how ld.so errors are handled by functions in dlfcn is wrong.
dlopen calls `linker.load_library` which returns a
`Result<ObjectHandler, goblin::Error>`. Now `goblin::Error` may have
variants that are heap allocated. For example:
`Error::Malformed(format!("invalid path: '{}': {}", path, err))`. The
error string would be allocated by ld.so's allocator but will be dropped
inside libc. This is UB.

After this patch, we now return a custom `DlError` instead. To get more
information about the error, `LD_DEBUG=all` can be set.

Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-12-31 18:35:20 +11:00
Anhad Singh 9cf72fd0b2 feat(ld.so): add all option for LD_DEBUG
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-12-31 18:00:45 +11:00
Anhad Singh 60f700fb50 chore(linker): remove todo
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-12-31 15:26:23 +11:00
Anhad Singh c25292ae21 misc(ld.so): clippy fixes
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-12-31 15:25:40 +11:00
Jeremy Soller f08952b1b0 Merge branch 'patch5' into 'master'
feat: rwlock

Closes #196

See merge request redox-os/relibc!594
2024-12-30 17:17:05 +00:00
Jeremy Soller e4162ef850 Merge branch 'monetary' into 'master'
Implement 'monetary.h' and and a basic strfmon() function

See merge request redox-os/relibc!589
2024-12-30 17:15:35 +00:00
Jeremy Soller ac9505c246 Merge branch 'fix-199-improved-hashbang' into 'master'
Handle prepended whitespace for hashbang

See merge request redox-os/relibc!591
2024-12-30 17:14:24 +00:00
Josh Megnauth 513f1951fe Handle prepended whitespace for hashbang 2024-12-30 17:14:24 +00:00
Anhad Singh 0449c35e52 chore: fix formatting
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-12-31 01:23:51 +11:00
Anhad Singh 5eeb59dad2 feat(rand48): rwlock for global params
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-12-31 01:23:20 +11:00
Anhad Singh bc51d8e1d5 fix(pal/redox): use RwLock instead of InnerRwLock
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-12-31 01:07:36 +11:00
Anhad Singh 4232858b89 misc(tests/ptrace): update expected
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-12-31 00:54:58 +11:00
Anhad Singh 2c307616d8 fix(tests/ptrace.c): persistent logs
Even though it might seem like it, it is not necessary that write(2) is
the only system call performed. It could be that the libc has to
allocate memory (via MMAP) or makes use of a futex. To produce
consistant results, only log on SYS_write and when the syscall number
has been patched.

Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-12-31 00:54:58 +11:00
Anhad Singh cfe89f828a feat: rwlock instead of mutex for global scope
* Rwlock -> InnerRwLock
* RwLock makes use of InnerRwLock.

Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-12-31 00:54:52 +11:00
Jeremy Soller 647141a3fc Merge branch 'popen-test-fix' into 'master'
fix popen tests

See merge request redox-os/relibc!593
2024-12-29 00:58:44 +00:00
Ron Williams a4ca5b4e85 fix popen tests 2024-12-28 16:34:27 -08:00
Jeremy Soller 1196bea3e4 Merge branch 'imp_str' into 'master'
Add missing functions to `string.h`

See merge request redox-os/relibc!592
2024-12-28 22:46:45 +00:00
Darley Barreto ae5a5256b4 Add missing functions to string.h 2024-12-28 22:46:45 +00:00
Jeremy Soller 841abb180a Merge branch 'dup2-tests' into 'master'
fix popen, improve tests

See merge request redox-os/relibc!590
2024-12-27 14:02:55 +00:00
Ron Williams 9df3708a1a fix popen, improve tests 2024-12-26 17:14:15 -08:00
Guillaume Gielly ff940da768 Simplify text alignement 2024-12-26 20:49:30 +01:00
Guillaume Gielly 1658d16b4e Prevents buffer overflow on 'scale' 2024-12-26 20:40:49 +01:00
Guillaume Gielly 2f96ac181a Refactor and logic of format_monetary() 2024-12-26 20:35:43 +01:00
Guillaume Gielly ed4c1f089e Refactor strfmon() 2024-12-26 19:33:16 +01:00
Guillaume Gielly 4bcf779119 Remove useless custon floatingpoint and use libm instead 2024-12-26 19:10:57 +01:00
Jeremy Soller 8deec75e45 Merge branch 'patch5' into 'master'
feat(ld.so): lazy binding and scopes

See merge request redox-os/relibc!586
2024-12-25 13:18:31 +00:00
Anhad Singh 1ffd7187ef feat(dlfcn): define RTLD_DEFAULT
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-12-25 19:27:31 +11:00
Anhad Singh 2be4316aec feat(dlfcn): return DSO as the handle
Fine because:
> The value of this handle should not be interpreted in any way by the
> caller.
From: https://pubs.opengroup.org/onlinepubs/009696599/functions/dlopen.html

* Add tests for unload
* Implement NOLOAD so we can test that the loaded object has been
  destroyed.
* Minor cleanup.

Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-12-25 16:17:51 +11:00
Anhad Singh 1612c78774 fix(ld.so): disable lazy binding on non-x86_64
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-12-24 20:51:53 +11:00
Anhad Singh 023a005688 fix(ld.so): non-pie lazy
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-12-24 20:51:53 +11:00
Anhad Singh 1db68ab978 feat(ld.so): scopes
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-12-24 20:51:53 +11:00
Anhad Singh 13d819ac89 misc(ld.so: __plt_resolve_inner): println -> trace
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-12-24 20:51:53 +11:00
Anhad Singh e3587017f6 fix(ld.so): stub plt stub for non-x86_64
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-12-24 20:51:53 +11:00
Anhad Singh 0a0ecb018f fix(ld.so: adjust_stack): remove dead code
Does not do anything.

Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-12-24 20:51:53 +11:00
Anhad Singh c6fd0517ac feat(ld.so: config): handle LD_BIND_NOW
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-12-24 20:51:53 +11:00
Anhad Singh 5ae1b8e974 feat(ld.so): lazy binding
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-12-24 20:51:53 +11:00
Anhad Singh 30970e111a feat(ld.so): enable warnings just for ld.so
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-12-24 20:51:53 +11:00
Anhad Singh 959982b8a4 fix(ld.so): use Strtab::get_at()
> use of deprecated method `goblin::strtab::Strtab::<'a>::get`: Bad performance, use get_at() instead

Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-12-24 20:51:53 +11:00
Anhad Singh cc5e0ceebc fix(ld.so): function signature
No longer expects a self TLS.

Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-12-24 20:51:53 +11:00
Anhad Singh eb82f9afeb misc(lint): unused variables and imports
Signed-off-by: Anhad Singh <andypython@protonmail.com>
2024-12-24 20:51:53 +11:00