Samrat Man Singh
bdef57ea45
Flush to stdout from FileDescriptor::write for Stdout
...
Also, remove unnecessary `-Zmiri-disable-isolation` in test
2020-08-04 20:40:48 +05:30
Samrat Man Singh
bea7113eb8
Add impl FileDescriptor
for stdin, stdout, stderr
...
- Use `FileDescriptor::read` for stdin reads
- Use `FileDescriptor::write` for stdout/err writes
- Handle stdout/err reads in `FileDescriptor::read`
2020-08-04 01:14:52 +05:30
bors
69d050fb6b
Auto merge of #1495 - samrat:fd-trait, r=oli-obk
...
Add FileDescriptor trait to abstract fn's on File's and Stdin,Stdout,Stderr
Related issue: #1486
Instead of mapping FDs to `FileHandle`, map them to a `FileDescriptor` trait object. The goal is to eventually have both `FileHandle` as well as `Stdin`, `Stdout` and `Stderr` implement this trait so that syscalls involving FDs can handle both `File`s as well as the standard IO streams.
This PR adds the `FileDescriptor` trait and an `impl` for `FileHandle`. I'll open a separate PR for implementing the trait for the standard IO streams.
2020-08-03 15:50:30 +00:00
Samrat Man Singh
79e066fc95
Remove unnecessary clone()
on writable
2020-08-03 20:39:09 +05:30
Samrat Man Singh
3386f12eca
Wrap io::Result from FileDescriptor::{read,write,seek}
in InterpResult
...
The outer InterpResult will be used to indicate that a fn is not
implemented for a struct(eg. `write` for Stdin).
The inner io::Result is just the result from the read/write/seek.
2020-08-03 11:01:42 +05:30
Samrat Man Singh
e3956f4200
Add FileDescriptor trait to abstract fn's on File's and Std{in,out,err}
2020-08-01 20:53:50 +05:30
Ralf Jung
2dfde5b696
remove upstreamed intrinsic impls
2020-07-30 18:31:40 +02:00
Ralf Jung
d340933112
rustup
2020-07-30 18:31:19 +02:00
Ralf Jung
bec7aab7fd
Typos
...
Co-authored-by: Oliver Scherer <github35764891676564198441@oli-obk.de>
2020-07-27 23:32:15 +02:00
Ralf Jung
6fbaa72642
fix diagnostics printing when triggered during TLS dtor scheduling
2020-07-27 23:32:15 +02:00
Ralf Jung
c77540ce13
deallocate thread-local statics when the thread dies
2020-07-27 23:32:15 +02:00
Ralf Jung
2a42f8e93c
fix and test order of TLS dtors and thread joining
2020-07-27 23:32:15 +02:00
Ralf Jung
7b07fc385c
get_or_create_thread_local_alloc_id: share code with Memory::get_global_alloc
2020-07-27 23:32:15 +02:00
Ralf Jung
0a4e8caa8c
adjust to canonical_alloc_id removal
2020-07-27 23:32:15 +02:00
Philippe Nadon
6dd700fd17
Changed not_undef to check_init in foreign_items.rs
...
Due to changes from upstream, a commit using not_undef was inserted, which had to be updated to use check_init.
related issue #71193
2020-07-27 13:07:25 -06:00
Philippe Nadon
21268157ff
renamed Immediate::to_scalar_or_undef
...
to Immediate::to_scalar_or_uninit
in src/shims/intrinsics.rs
related issue #71193
2020-07-26 16:05:20 -06:00
Philippe Nadon
5161ba346c
renamed ScalarMaybeUninit::not_undef to check_init
...
Related to PR https://github.com/rust-lang/rust/pull/74664
2020-07-26 16:05:20 -06:00
Ralf Jung
bc0569253f
enable leak check tests on Windows
2020-07-23 15:56:38 +02:00
Ralf Jung
fef5fa2ae1
add a Miri extern fn to mark an allocation as being a static root for leak checking
2020-07-23 15:47:33 +02:00
Ralf Jung
4033358956
make miri_start_panic intrinsic an FFI function
2020-07-23 15:20:36 +02:00
bors
592b140880
Auto merge of #1482 - canova:remote-unreachable, r=RalfJung
...
Remove unreachable intrinsic
This is now supported by the interpreter with https://github.com/rust-lang/rust/pull/74459 . We can remove this intrinsic implementation here.
This is covered by this test: https://github.com/rust-lang/miri/blob/master/tests/compile-fail/unreachable.rs
I guess we need to wait until the rust-lang/rust PR merges into nightly, and then we can update `rust-version` hash in the PR, right?
r? @oli-obk
2020-07-23 09:14:08 +00:00
Ralf Jung
7d6aec6887
rustup
2020-07-23 10:40:13 +02:00
Ralf Jung
cded9b7142
set errno on stdout write failure
2020-07-18 17:58:21 +02:00
bors
b021209b0e
Auto merge of #1436 - samrat:support-stdin-read, r=RalfJung
...
Handle `read`s on STDIN
Closes #1434
2020-07-18 14:56:38 +00:00
Nazım Can Altınova
d1aee6965b
Remove unreachable intrinsic
2020-07-18 12:48:26 +02:00
Samrat Man Singh
f4d1841811
Remove unnecessary cast
2020-07-18 10:45:06 +05:30
Samrat Man Singh
4c1beb2e45
Ensure buffer for reading from Stdin is smaller than machine usize
...
Also, set appropriate error code on failure
2020-07-17 20:18:07 +05:30
Ralf Jung
545aa60195
fix typo
...
Co-authored-by: Oliver Scherer <github35764891676564198441@oli-obk.de>
2020-07-17 13:40:13 +02:00
Ralf Jung
d617d615e4
fix non-fatal diagnostics stacktraces
2020-07-17 12:55:45 +02:00
Ralf Jung
c28786d320
remove an unnecessary intermediate cast
2020-07-16 12:16:43 +02:00
Ralf Jung
ce5ed69eac
rustup; fix Windows TLS
2020-07-15 08:42:15 +02:00
Samrat Man Singh
74ff4f805a
Read into buffer of fixed size for read
s to STDIN
...
Also:
- Check isolation is disabled.
- Add FIXMEs to set error numbers in `read` and `write`.
2020-07-12 20:27:19 +05:30
Samrat Man Singh
2602e951c0
Handle read
s on STDIN
2020-07-11 14:06:49 +05:30
Justus K
22e7a6263b
Early exit if program doesn't contain a main fn
2020-07-09 13:16:38 +02:00
Ralf Jung
dcb0f6309e
we cannot track all machine memory any more due to int-ptr-casts
2020-07-08 12:01:49 +02:00
Gary Guo
c5b324b031
Remove likely and unlikely from intrinsics shim
...
They are now implemented in MIR interpreter by rust-lang/rust#73778
2020-07-02 20:00:27 +01:00
Ralf Jung
c379793cde
add option to track call IDs
2020-07-02 10:33:54 +02:00
Ralf Jung
3a5bcb97ed
move rwlock dequeuing to shared code, and use that code for Windows rwlocks
2020-06-28 11:28:46 +02:00
Ralf Jung
a9dc2796ca
Move get/set_at_offset helpers to global helpers file
2020-06-28 09:23:01 +02:00
Ralf Jung
e54619b5e1
with this, we support panics on Windows
2020-06-27 14:43:37 +02:00
Ralf Jung
8e92969948
implement Windows SRWLock shims
2020-06-27 14:36:05 +02:00
Ralf Jung
dca00ab85e
introduce platform-specific module hierarchy for dlsym (similar to foreign_items)
2020-06-27 14:36:05 +02:00
bors
bde2eb4a44
Auto merge of #1460 - RalfJung:modules, r=RalfJung
...
Re-organize platform-specific shims
Move platform-specific code to `shims::{posix::{linux, macos}, windows}`. Also make it private in these modules to ensure we are reasonably structured.
2020-06-27 11:27:36 +00:00
Ralf Jung
af5887e869
module organization: move platform-specific code to shims::{posix::{linux, macos}, windows}
2020-06-27 13:22:49 +02:00
Ralf Jung
395f5d40dc
Rename shims::{sync -> posic_sync} and move sync_singlethread test to other sync test
2020-06-27 12:37:12 +02:00
Ralf Jung
b46f946c81
supply our own implementation of the CTFE pointer comparison intrinsics
2020-06-27 11:57:43 +02:00
Ralf Jung
5c5b61ffb0
rustup
2020-06-15 17:38:27 +02:00
Ralf Jung
e063ce2737
rustup; and a bit of UnsafeCell detection refactoring
2020-06-13 11:30:31 +02:00
bors
ffd03b3caa
Auto merge of #1418 - divergentdave:file-sync, r=RalfJung
...
Add file sync shims
This PR adds shim implementations for these related file syncing functions.
* `fsync`, for POSIX targets, backed by `File::sync_all()`
* `fdatasync`, for POSIX targets, backed by `File::sync_data()`
* `fcntl` with command `F_FULLFSYNC`, for macOS targets, backed by `File::sync_all()`
* `sync_file_range`, for Linux targets, backed by `File::sync_data()`
2020-06-09 08:48:40 +00:00
David Cook
a60c130b0d
Extract common logic for Windows host workaround
2020-06-08 23:34:02 +00:00