bors [Wed, 26 Feb 2020 14:15:55 +0000 (14:15 +0000)]
Auto merge of #1152 - divergentdave:shim-directory, r=RalfJung
Add directory-related shims
This PR adds support for `mkdir`, `rmdir`, `opendir`, `closedir`, and `readdir64_r`.
Open directory streams are tracked through a HashMap indexed by pointer locations, which holds directory iterators. Since `DIR` is an opaque type in glibc, I represent them with 1-byte allocations, and then just use their pointers in HashMap lookups.
Tests are included to exercise the new functionality.
bors [Mon, 24 Feb 2020 13:45:51 +0000 (13:45 +0000)]
Auto merge of #1136 - Aaron1011:feature/check-libstd, r=RalfJung
Use 'cargo check' to build the sysroot and target crate
Fixes #1057
I'm using my original approach from PR #1048. Ideally, we would
distinguish between build-deps/dependencies/'final crate' via a
different approach (e.g. the target directory). However, I
haven't been able to get that to work just yet.
However, everything should be working with the approach I'm using. At a
minimum, we can use this PR to verify that everything works as expected
when we don't actually produce native build outputs.
Aaron Hill [Wed, 1 Jan 2020 09:12:27 +0000 (04:12 -0500)]
Use 'cargo check' to build the sysroot and target crate
Fixes #1057
Since we are no longer using "cargo rustc", we now use the rustc
arguments passed by Cargo to determine whether we are building a
build dependency, normal dependency, or "target" (final binary or test)
crate.
bors [Sun, 23 Feb 2020 17:03:30 +0000 (17:03 +0000)]
Auto merge of #1167 - christianpoveda:shims-refactor, r=RalfJung
Reorganize shims by platform
Fixes https://github.com/rust-lang/miri/issues/1161. I am currently testing which shims belong to which platform. If you are reading this and know the answer for any of those please write me :P
Edit: this is a list of the shims I haven't been able to figure out to which platform they belong:
-~~`malloc`~~
-~~`calloc`~~
-~~`posix_memalign`~~
-~~`free`~~
-~~`realloc`~~
-~~`__rust_alloc`~~
-~~`__rust_alloc_zeroed`~~
-~~`__rust_dealloc`~~
-~~`__rust_realloc`~~
-~~`__rust_maybe_catch_panic`~~
-~~`syscall`~~
-~~`getrandom`~~
-~~`dlsym`~~
-~~`memcmp`~~
-~~`memrchr`~~
-~~`memchr`~~
-~~`strlen`~~
-~~`signal`~~
-~~`sigaction`~~
-~~`sigaltstack`~~
-~~`sysconf`~~
-~~`sched_getaffinity`~~
-~~`isatty`~~
-~~`pthread_key_create`~~
-~~`pthread_key_delete`~~
-~~`pthread_getspecific`~~
-~~`pthread_setspecific`~~
-~~`pthread_attr_init`~~
-~~`pthread_attr_destroy`~~
-~~`pthread_self`~~
-~~`pthread_attr_setstacksize`~~
-~~`pthread_attr_getstack`~~
-~~`pthread_create`~~
-~~`pthread_mutexattr_init`~~
-~~`pthread_mutexattr_settype`~~
-~~`pthread_mutex_init`~~
-~~`pthread_mutexattr_destroy`~~
-~~`pthread_mutex_lock`~~
-~~`pthread_mutex_unlock`~~
-~~`pthread_mutex_destroy`~~
-~~`pthread_rwlock_rdlock`~~
-~~`pthread_rwlock_unlock`~~
-~~`pthread_rwlock_wrlock`~~
-~~`pthread_rwlock_destroy`~~
-~~`pthread_condattr_init`~~
-~~`pthread_condattr_setclock`~~
-~~`pthread_cond_init`~~
-~~`pthread_condattr_destroy`~~
-~~`pthread_cond_destroy`~~
-~~`pthread_atfork`~~
-~~`posix_fadvise`~~
-~~`mmap`~~
-~~`mprotect`~~
bors [Fri, 21 Feb 2020 07:36:14 +0000 (07:36 +0000)]
Auto merge of #1184 - divergentdave:rename-error-test, r=RalfJung
Test error case of std::fs::rename
As suggested [here](https://github.com/rust-lang/miri/pull/1158#issuecomment-586459463) this PR adds an additional test case for calling rename on a file path that doesn't exist.
bors [Wed, 19 Feb 2020 08:45:04 +0000 (08:45 +0000)]
Auto merge of #1156 - divergentdave:fcntl-F_DUPFD_CLOEXEC, r=RalfJung
Add F_DUPFD/F_DUPFD_CLOEXEC to fcntl shim
This adds support for `F_DUPFD` and `F_DUPFD_CLOEXEC` to the shim for `fcntl`. (The `FileHandler` does not track the `FD_CLOEXEC` flag for open files, so these commands are effectively the same.) These changes enable using `File::try_clone`.
I also changed the initial value of the `low` field in `FileHandler`, so that it matches the intent of the preceding comment. The `open` shim was pre-incrementing it when choosing new file descriptor numbers, so FD 3 was being skipped.