Commit Graph

77 Commits

Author SHA1 Message Date
jD91mZM2 e749d23030 Solve stdin/out/err UB in a better way 2018-07-25 14:29:14 +02:00
stratact 42811717da Remove unneeded reference 2018-07-24 23:22:00 -07:00
stratact 5f6309d87c Implement tmpfile (squashed) 2018-07-24 23:14:18 -07:00
Jeremy Soller dc443a8cc3 Format 2018-07-13 09:53:44 -06:00
Jeremy Soller 4c4ce80fcd Fix warnings 2018-07-13 09:52:53 -06:00
jD91mZM2 a7cc95cd90 Comment out #[no_mangle] on unimplemented functions
This stops configure scripts from identifying them as valid
2018-07-12 21:39:53 +02:00
jD91mZM2 30d91b82b2 Run fmt.sh 2018-07-08 08:51:15 +02:00
jD91mZM2 d3f6985ee9 Add a few things necessary for openssl (not all) 2018-07-08 08:44:23 +02:00
jD91mZM2 985a83ee69 Use style = Tag everywhere possible 2018-07-06 17:02:23 +02:00
Jeremy Soller 42abc98a99 Cleanup allocation functions 2018-07-03 19:40:47 -06:00
Jeremy Soller b6b34a7026 Ralloc fixes and fixes for Redox execution 2018-07-03 19:07:07 -06:00
jD91mZM2 9c169a186f Run fmt.sh 2018-07-03 09:33:41 +02:00
Tom Almeida 53a03cb0ba Made sure errors were properly handled by printf 2018-07-03 14:50:38 +08:00
Tom Almeida ebe1ed15f8 Fix fgets 2018-07-03 14:34:40 +08:00
Tom Almeida bf2973e857 Ensure we correctly insert null character in gets 2018-07-03 12:50:04 +08:00
Tom Almeida d7a0f3d526 Ensure gets stops on newline or bufchar 2018-07-03 12:36:41 +08:00
Tom Almeida bf6db91993 Actually remove stdlib from stdio. This should have been done with wchar being put in, but I messed something up 2018-07-03 12:24:51 +08:00
Tom Almeida 72177be0fa Add a working implementation of gets 2018-07-03 12:14:30 +08:00
Tom Almeida 7277286efd Implement Drop for FILE, so we flush when the process exits 2018-07-03 10:05:12 +08:00
Tom Almeida 81107f8cd1 Don't reset read/write every time we check if we can read or write 2018-07-03 10:01:48 +08:00
Tom Almeida e9cecfead3 Return -1 for error in printf 2018-07-03 09:48:21 +08:00
Tom Almeida 0d61f9f4fd Make sure we can actually write before writing anything when using printf 2018-07-03 09:13:48 +08:00
Tom Almeida da664d4919 Merged relibc with branch 2018-07-03 08:39:04 +08:00
Stephan Vedder cc210361d6 wchar support 2018-07-01 20:59:37 +02:00
Tom Almeida 05b4b76426 Fix some issues 2018-06-30 17:49:34 +08:00
Tom Almeida 10a9081b66 Made sure that something that's unsafe is actually marked as unsafe 2018-06-30 17:47:30 +08:00
Tom Almeida 18418254b9 Made sure lazy_static works with no_std 2018-06-30 17:37:26 +08:00
Tom Almeida 8075447fad Changed FILE to use a vector as a buffer instead of raw pointers. This allows us to remove the large majority of unsafe blocks from the code 2018-06-30 17:37:26 +08:00
Tom Almeida 57f7de1e6d Changed FILE to use a vector as a buffer instead of raw pointers. This allows us to remove the large majority of unsafe blocks from the code 2018-06-30 17:33:02 +08:00
Tom Almeida 4c65f14f9a Fixed some issues with temporary files and moved some raw pointers to Option<&T>s 2018-06-30 17:26:39 +08:00
Tom Almeida 71fa4026f5 Changed FILE to use a vector as a buffer instead of raw pointers. This allows us to remove the large majority of unsafe blocks from the code 2018-06-30 17:26:35 +08:00
Tom Almeida a2dc22123f Merge branch 'master' into 'master'
# Conflicts:
#   src/stdio/src/default.rs
2018-06-30 09:19:54 +00:00
Tom Almeida 7e731e0b01 Made sure lazy_static works with no_std 2018-06-23 13:08:28 +08:00
Tom Almeida c7bdd31a18 Merged relibc (#311db758) with branch 2018-06-23 05:13:02 +08:00
Tom Almeida 6bc28203ca Changed FILE to use a vector as a buffer instead of raw pointers. This allows us to remove the large majority of unsafe blocks from the code 2018-06-23 05:01:43 +08:00
jD91mZM2 12ce441f5c Use static mut over UnsafeCell 2018-06-22 22:40:30 +02:00
Tom Almeida b5529c9b71 Fixed some issues with temporary files and moved some raw pointers to Option<&T>s 2018-06-23 04:28:03 +08:00
Tom Almeida 5921f00e90 Changed FILE to use a vector as a buffer instead of raw pointers. This allows us to remove the large majority of unsafe blocks from the code 2018-06-23 04:28:00 +08:00
Tom Almeida 50bfebfe3e Fixed some issues with temporary files and moved some raw pointers to Option<&T>s 2018-06-23 03:44:33 +08:00
Tom Almeida 90c6937f17 Changed FILE to use a vector as a buffer instead of raw pointers. This allows us to remove the large majority of unsafe blocks from the code 2018-06-23 03:44:30 +08: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 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
Jeremy Soller 1b653c4e60 Update ralloc, fix invalid c++ names 2018-06-20 08:48:56 -06: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
Jeremy Soller dabd8dc6a2 Move memory handling into string, do not use compiler_builtins for memory handling 2018-03-27 21:28:48 -06:00
Dan Robertson 57a17cb05f stdio: Implement rename 2018-03-25 14:41:42 +00:00
Tom Almeida dbc3e413cc Fixed clearerr actually doing nothing 2018-03-20 23:43:42 +08:00
Tom Almeida c24d1e2b36 Removed all function pointers in FILE, moved internal functions to be member functions of FILE, made relevant *mut FILEs into &mut FILE and made suitable functions safe again 2018-03-18 00:20:21 +08:00