Samrat Man Singh
563fb8e43d
Implement dup and close for stdin/stdout/stderr
...
Support F_DUPFD on stdin/stdout/stderr
Enable `close`-ing stdin/stdout/stderr
For `dup`, check if FD is `File` first
If not, clone the appropriate standard IO stream
Merge POSIX `close` and `dup` tests into same module
Also, add assertion that `write` on a closed FD returns an error.
Add `dup` as FileDescriptor trait fn
Also:
- Fix `close` so it drops `self` instead of reference to it
- Remove FD clamping in insert_fd_with_min_fd, since FDs 0-2 can be
closed
Fix fs_libc tests
Make error message when closing stdin/out/err more specific
Return io::Result from `FileDescriptor::dup`
Change error message when closing stdin/out/err
Refactor `FileDescriptor::dup` impl for `FileHandle`
Remove empty line
2020-09-09 23:26:33 +05:30
David Cook
b06f0d16a9
Use try block instead of closure
2020-09-07 15:09:34 -05:00
David Cook
597360f499
Simplify read_timespec error handling
2020-09-07 11:31:28 -05:00
David Cook
33e928c9ca
Review comments
2020-09-07 10:54:39 -05:00
David Cook
417ac2939a
Implement libc::nanosleep shim
2020-09-06 18:07:17 -05:00
David Cook
6d323e1032
Refactor timespec parsing, improve error handling
2020-09-06 18:07:14 -05:00
LeSeulArtichaut
4f2f87b2df
Change ty.kind
-> ty.kind()
2020-09-04 22:03:45 +02:00
David Cook
a6746ad893
Add comment
2020-09-02 20:58:41 -05:00
David Cook
7a2c6812b9
Per-thread errno storage
2020-09-02 20:57:20 -05:00
David Cook
da2f268443
Review comments
2020-08-31 19:32:14 -05:00
David Cook
3ba7f46058
Move panic payload state from Machine to Thread
2020-08-29 21:38:37 -05:00
Ralf Jung
d4e5943259
use real align_offset unless we symbolic alignment check is enabled
2020-08-16 18:26:04 +02:00
Ralf Jung
664706662f
adjust diagnostics to alignment check mode
2020-08-16 17:16:53 +02:00
Ralf Jung
cb985670c1
make alignment check integer-based by default, and add an option to make it symbolic
2020-08-16 17:08:38 +02:00
Ralf Jung
df311293e2
fix Stderr::as_file_handle error message
2020-08-13 14:27:03 +02:00
Samrat Man Singh
0c25064117
Remove unnecessary whitespace
...
Co-authored-by: Ralf Jung <post@ralfj.de>
2020-08-13 16:18:08 +05:30
Samrat Man Singh
46852d736e
Remove lifetime from FileDescriptor trait
...
Also:
- Remove type annotate `handles` declaration instead of every insert.
- Add note about flush being unnecessary when writing to stderr
2020-08-13 15:01:52 +05:30
Ralf Jung
80929e17ae
add test for unused ill-formed constant
...
also use better span in TopFrameInfo
2020-08-13 08:33:36 +02:00
Oliver Scherer
94f13efefd
Bump for rustc changes
2020-08-11 11:37:29 +02:00
Ralf Jung
5ea5e9fc2c
accept ReferencedConstant errors in Miri (can happen post-monomorphization)
2020-08-10 09:02:45 +02:00
Ralf Jung
5657f08bea
fs: move isolation handling to inside trait
2020-08-08 15:24:30 +02:00
bors
eaf5d32ac7
Auto merge of #1501 - samrat:fix-fs-error-handling, r=RalfJung
...
Bubble up errors from FileDescriptor::as_file_handle
Instead of indicating incorrectly that a handle was not found, return the error from `as_file_handle` indicating the operation is not supported on the FD.
Addresses some comments in #1495
2020-08-08 12:28:08 +00:00
Ralf Jung
07a4383ac8
rustup
2020-08-08 14:05:11 +02:00
Samrat Man Singh
1069f6b174
Fix handling of as_file_handle error for fullfsync
2020-08-08 17:28:41 +05:30
Samrat Man Singh
045bcab1eb
Add FIXME's for dup
and other syscalls to support stdin/out/err
2020-08-08 15:08:29 +05:30
Samrat Man Singh
773dfb31f0
Bubble up error from FileDescriptor::as_file_handle
...
...instead of handle_not_found
2020-08-08 14:42:50 +05:30
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