Commit Graph

301 Commits

Author SHA1 Message Date
jD91mZM2 0776de1ae6 Fix inttypes 2018-06-26 11:10:44 +02:00
jD91mZM2 257040e164 Fix a few stat-related things 2018-06-26 10:47:48 +02:00
jD91mZM2 ad324a0e4d Use global_asm for setjmp instead 2018-06-26 10:21:44 +02:00
jD91mZM2 feed73ffcc inttypes 2018-06-26 09:51:07 +02:00
jD91mZM2 441bf9f00b Add the few last things to get gcc_complete working 2018-06-25 11:43:44 +02:00
Jeremy Soller f265d7c5be Fix linking issues with lang items 2018-06-24 09:56:08 -06:00
Jeremy Soller 878f466b67 Update to new ralloc, new panic implementation, new compiler-builtins 2018-06-24 09:50:15 -06:00
jD91mZM2 2283243d95 Replace setjmp lib.rs with empty file 2018-06-23 17:38:15 +02:00
jD91mZM2 4e99b55417 Implement basic setjmp using musl's awesome existing code 2018-06-23 17:38:10 +02:00
jD91mZM2 12ce441f5c Use static mut over UnsafeCell 2018-06-22 22:40:30 +02:00
jD91mZM2 ea24699798 Fix undefined behavior
Transmuting from an immutable to a mutable reference is undefined
behavior in Rust, with the exception of UnsafeCell which tells the
optimizer to not draw too many conclusions. Sadly UnsafeCell::get cannot
yet be used in statics (see https://github.com/rust-lang/rust/issues/51718),
so this works around that by making the statics into functions and
making C macros to call those.
2018-06-22 21:17:44 +02:00
jD91mZM2 3034114c14 Fix broken comment 2018-06-22 15:02:34 +02:00
jD91mZM2 0a3c8abe95 Fix setlocale return value 2018-06-22 14:54:16 +02:00
jD91mZM2 996445a6a3 Add empty locale functions 2018-06-22 14:54:10 +02:00
jD91mZM2 5936c7a76e Add scanf 2018-06-21 17:16:56 +02:00
Jasen Borisov 06a8d5d89d sys_wait: implement C macros properly
Remove the broken Rust functions and instead provide C macros in a
`include/bits` header. The C macros were taken from musl.
2018-06-20 19:40:38 +01:00
Jeremy Soller 895e250564 Add aligned_alloc 2018-06-20 09:53:27 -06:00
Jeremy Soller 9d38494435 Fix missing strtol, strtoul 2018-06-20 09:44:09 -06:00
Jeremy Soller 1b653c4e60 Update ralloc, fix invalid c++ names 2018-06-20 08:48:56 -06:00
Jasen Borisov 326078a578 Fix compilation error in sys_wait 2018-06-14 20:15:25 +01:00
stratact 3fa220237d Add sys_wait functions (Fixes #81) 2018-06-14 05:08:55 -07:00
Jeremy Soller 1f9f7ce6c8 Merge pull request #127 from stratact/master
Update `platform::rawfile`
2018-05-24 14:36:06 -06:00
stratact 3aa01b6907 Remove pointless cast 2018-05-24 13:27:24 -07:00
stratact a7a415603f Fix stupid mistake 2018-05-24 13:04:58 -07:00
stratact 16c51a297d Use the right C types from platform::types 2018-05-24 12:29:59 -07:00
Jeremy Soller f0227e737e Merge pull request #128 from ids1024/lifetime
Make functions taking raw pointer return &'a instead of &'static
2018-05-24 12:44:19 -06:00
Ian Douglas Scott 5bcf1d42ff Simplify cstr_from_bytes_with_nul_unchecked()
The original implementation is modified from the `Cstr` method, but the
complexity there exists because it is trying to convert to the DST `Cstr`.
2018-05-24 11:27:35 -07:00
Ian Douglas Scott cbd0d0473c Make functions taking raw pointer return &'a instead of &'static
This is technically more correct, and matches the pointer methods in the
standard library.
2018-05-24 11:13:55 -07:00
stratact b389e4831d Have open() and dup() match -1 for Err instead of 0 2018-05-24 10:33:15 -07:00
stratact 9daae71c2a Use the super module instead of sys 2018-05-23 19:35:28 -07:00
stratact bb9d0e4aa1 Implement RawFile::from_raw_fd() 2018-05-23 13:14:42 -07:00
stratact 285d1b05c4 Implement RawFile::open() and add *_raw_df() convenience methods 2018-05-23 11:05:43 -07:00
stratact 7ca5fac214 Implement RawFile::dup() completely 2018-05-23 08:00:53 -07:00
Jeremy Soller c647fdfed3 Merge pull request #116 from matijaskala/patch-1
Add optimized version of memchr
2018-05-15 18:33:31 -06:00
Jeremy Soller 8eec109cc0 Merge pull request #120 from Majora320/master
Implement clock() and add CLOCK_* constants
2018-05-15 18:32:29 -06:00
Matija Skala 9bbb070104 Add optimized version of memchr 2018-05-15 21:06:17 +02:00
Alex Lyon f5ded007c6 stdlib: recurse into the smaller partition when sorting 2018-05-13 16:16:48 -07:00
Alex Lyon 4d3ac1c0dc stdlib: save stack space by looping in introsort_helper() 2018-05-13 03:29:53 -07:00
Alex Lyon b15aa83a8a stdlib: move insertion sort from introsort() into a separate function 2018-05-13 03:15:16 -07:00
Alex Lyon aa21e5fc3f stdlib: implement qsort() as an introsort 2018-05-13 03:07:00 -07:00
Alex Lyon 0cabecd5b5 stdio, string, platform: fix a bug in printf() involving chars
Because we were previously converting the bytes in the format
string into Rust's char type and then printing that using the
format machinery, byte values that were not valid single-byte
UTF-8 characters failed to print correctly.  I found this while
trying to implement qsort() because the output of my test program
was mysteriously incorrect despite it working when I used glibc.
2018-05-11 23:09:12 -07:00
Moses Miller d14d0b5965 Fix various formatting issues 2018-05-11 22:01:51 -07:00
Moses Miller 766e00c69e Implement conversion of nanoseconds to clocks in terms of CLOCKS_PER_SEC 2018-05-11 17:22:01 -07:00
Moses Miller 3d1a66f270 Add CLOCKS_PER_SEC 2018-05-11 16:26:56 -07:00
Moses Miller 9d8758006d Change 1000000 to 1_000_000 2018-05-11 11:41:18 -07:00
Alex Lyon 1bcc40c08f stdlib: manually fix formatting 2018-05-11 09:31:58 -07:00
Alex Lyon 7647db27c0 stdlib: implement strtoul() and strtol() using a macro 2018-05-11 01:48:27 -07:00
Moses Miller 56458e5e4c Condense 5 lines into 1 2018-05-10 20:48:13 -07:00
Moses Miller 1ecd5f8f21 Implement clock() and add CLOCK_* constants 2018-05-10 20:31:35 -07:00
Jeremy Soller 018f950851 Merge branch 'master' of https://github.com/jeizsm/relibc 2018-04-26 20:14:53 -06:00