Commit Graph

370 Commits

Author SHA1 Message Date
4lDO2 5cd110a92b WIP: Add pthread tests. 2023-05-06 17:02:54 +02:00
4lDO2 7e91f3f950 Add pthread tests. 2023-05-06 17:02:54 +02:00
David Carlier 116583cdc7 sys_mman: adding madvise. 2023-04-15 10:41:42 +01:00
David Carlier ec6243bc5b wctrans/towctrans implementation proposal.
close #32
2023-03-27 19:15:08 +01:00
David Carlier 3fe37e36fa reallocarray introduction available on glibc 2.26. allocates an array of m*n elements but checking for overflow. 2023-03-26 08:35:44 +01:00
David Carlier 34f2fff983 strlcpy/strlcat api for portability's sake.
those functions differently than the strn* ones as
they do not pad with zero to remaining bytes but guarantees
a null terminator.
2023-03-24 09:44:33 +00:00
David Carlier 44f343bec8 explicit_bzero implementation proposal 2023-03-22 06:25:26 +00:00
Jeremy Soller 393489b38b Add wcswidth and test 2022-12-16 17:39:06 -07:00
Jeremy Soller 7d27737c3f Disable dynamic tests as they are not compiling 2022-12-16 17:18:07 -07:00
Nagy Tibor 5b2a12ca6d strtof, strtod: Fix parsing floats with exponents 2022-07-28 01:11:55 +02:00
Jeremy Soller 65bd3ed1e3 Fixes for program_invocation_name and program_invocation_short_name 2021-11-30 10:27:24 -07:00
Jeremy Soller 0cd4e349c0 Formatting of tests runner 2021-03-02 08:01:26 -07:00
Jeremy Soller 7fd366be70 Convert test runner to rust 2021-03-01 21:19:04 -07:00
Peter Limkilde Svendsen e3a0fdbc4a Test for time.h constants 2021-02-23 18:35:24 +01:00
Mateusz Tabaka 02f202ff83 Use BufWriter (instead of LineWriter) for FILEs other than stdout and stderr
BufWriter has more capacity (8k vs 1k) and doesn't flush the stream after '\n'.
That change helps to reduce the number of syscalls, especially when dealing with text files.

Since BufWriter has a different way of getting number of pending elements than LineWriter -
Pending trait was introduced to deal with that.
2021-01-14 18:45:14 +01:00
Jeremy Soller ccee7eae5f Merge branch 'tlssym' into 'master'
Fix dlsym of TLS variables

See merge request redox-os/relibc!327
2021-01-05 23:03:10 +00:00
Mateusz Tabaka 19ac34f2a0 Extend dlfcn tests 2021-01-05 22:48:41 +01:00
Mateusz Tabaka 6332828725 Call DSO destructors during exit() 2021-01-05 20:39:36 +01:00
Mateusz Tabaka 021a8e00fc Fix stdio/scanf test case
inner_scanf prematurely exited before parsing collected string
2021-01-03 16:07:43 +01:00
Mateusz Tabaka a7480ea656 Fix global symbols relocations
Instead of a single source of symbols, now linker keeps a list of DSO (former Library) objects
with their own symbols map. That helps to process R_X86_64_COPY relocations correctly.
For example, if 'a.out' executable with dependencies ['libstdc++.so', 'libc.so'] is being loaded
and 'a.out' uses 'stdout' symbol from 'libc.so', its relocation process goes as follows:
- linker processes relocation entry 'stdout' of type R_X86_64_GLOB_DAT from 'libc.so',
- it goes through object list ['a.out', 'libstdc++.so', 'libc.so'] to find first object
  that exports 'stdout' symbol. The symbol is in 'a.out' with the value e.g. '0x404070',
- linker sets 'stdout' symbol GOT entry in 'libc.so' to '0x404070',
....
- linker processes relocation entry 'stdout' of type R_X86_64_COPY from 'a.out',
- it goes through object list excluding 'a.out': ['libstdc++.so', 'libc.so']. The symbol is found in 'libc.so',
- linker copies the 'stdout' symbol content from 'libc.so' to memory at address '0x404070' (in 'a.out' object).

Objects are relocated in reverse order they were loaded. So in the example above, linker starts with relocating
'libc.so' and ends with 'a.out'. It is necessary e.g. when linking with 'libstdc++.so' - there are many
relocations which symbols are found in 'libstdc++.so', so they need to be resolved before their contents are
copied to 'a.out'. That also matches GNU ld.so behavior.
2021-01-03 16:04:40 +01:00
Jeremy Soller 1a0edd8eeb Add program_invocation_short_name 2020-12-23 20:24:04 -07:00
Jeremy Soller 5efaffe0f9 Ensure that nul test is passed after last commit and failed before 2020-12-23 08:25:44 -07:00
Jeremy Soller 3e49323a3a Merge branch 'dlopen' into 'master'
Add support for dlopen(NULL, ...)

See merge request redox-os/relibc!315
2020-10-02 03:21:42 +00:00
Mateusz Tabaka eee9a80baa Fix tls tests for dynamic linker
* load TLS segment for executable - while we can skip PT_LOAD for executable,
  we still have to load TLS segment.
* set TCB address based on if elf is position independent
2020-10-01 15:45:55 +02:00
Mateusz Tabaka c11aad71b8 Add support for dlopen(NULL, ...) 2020-09-30 11:04:10 +02:00
Mateusz Tabaka 675101ac0e Add tests for dynamic linker 2020-09-29 23:01:52 +02:00
Peter Limkilde Svendsen 00642dd940 Test extreme tm member values 2020-09-17 23:10:13 +02:00
Jeremy Soller 2ed55a926b Merge branch 'gmtime-refactor' into 'master'
Refactor gmtime_r(), fix localtime() test

See merge request redox-os/relibc!309
2020-09-08 18:45:20 +00:00
Jeremy Soller 9f25fa39ea Merge branch 'gmtime-tests' into 'master'
Add more gmtime() tests

See merge request redox-os/relibc!308
2020-09-08 18:44:55 +00:00
Peter Limkilde Svendsen ff6bc68260 Add more gmtime() tests 2020-09-08 18:44:55 +00:00
Peter Limkilde Svendsen 59b0a36e81 Fix localtime() test 2020-08-27 23:16:17 +02:00
Peter Limkilde Svendsen aec4a84e90 Include stdlib.h so free() can be used 2020-08-20 20:43:28 +02:00
jD91mZM2 72532b8280 Fix printf issue found in GDB 2020-08-05 16:49:10 +02:00
Jeremy Soller 2008296a10 Add sys_mman expected output 2020-08-02 14:34:56 -06:00
jD91mZM2 4c148c1860 Make munmap use funmap2 2020-07-30 13:39:20 +02:00
Wren Turkal 9a1e9c327a Make byte stream functions set stream orientation.
When a byte-oriented stream function touches a stream, that stream
should be set to byte-oriented mode if it hasn't been set yet. If
it has been set, the opertion should only succeed if the stream is
already in byte-oriented mode.

Signed-off-by: Wren Turkal <wt@penguintechs.org>
2020-07-08 14:33:11 -07:00
Wren Turkal b623e245c0 Make freopen reset the stream orientation.
Signed-off-by: Wren Turkal <wt@penguintechs.org>
2020-07-08 14:33:11 -07:00
Wren Turkal 865b7962a1 Add implmentation for fwide posix function.
This function is used to set the orientation of a stream to either
byte-oriented or wchar-oriented.

More info on this function is here:
https://man7.org/linux/man-pages/man3/fwide.3p.html

This implementation only impmlemnts the manual switching and does
not yet guard against using a byte-oriented stream with wchar
functions and vice versa. Those step will come in additional
commits.

Signed-off-by: Wren Turkal <wt@penguintechs.org>
2020-07-08 14:33:06 -07:00
jD91mZM2 29ad5b75c9 Fix broken CVec
Oops, forgot to initiate the pointer after uses of CVec::new()
2020-06-29 21:03:29 +02:00
Peter Limkilde Svendsen 59b040258a Rename lcg48 as rand48 2020-06-23 18:34:44 +02:00
Jeremy Soller 22a7f71282 Merge branch 'ctime_r' into 'master'
Add test for ctime_r(), replace mem::uninitialized()

See merge request redox-os/relibc!273
2020-06-22 21:57:04 +00:00
Peter Limkilde Svendsen cc33874363 Implement random() and friends 2020-06-22 21:56:39 +00:00
Giuseppe Longo 12beb13987 netdb: implement getnetbynane and getnetent
This patch implements getnetbyname and getnetent functions.
2020-06-07 14:02:41 +02:00
oddcoder 92d6735e3f Add more scanf tests 2020-06-03 23:20:53 +02:00
oddcoder 018f7a3f38 Fix scanf.stdout as per glibc 2020-06-03 23:20:52 +02:00
Peter Limkilde Svendsen b15c90ee32 Add test for ctime_r() 2020-05-26 00:20:14 +02:00
Peter Limkilde Svendsen cf9c2ed0ba Don't accept null pointer when requesting aligned memory 2020-05-24 18:39:53 +02:00
oddcoder 7eba6d88df Add test for negative pad stupport in printf 2020-05-23 16:20:20 +02:00
oddcoder 1b131b8c60 Test off by one bug in vfscanf 2020-05-23 16:20:20 +02:00
oddcoder 6fba592fdb Implement regression test for ftell-ungetc bug 2020-05-23 16:20:20 +02:00