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.
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.
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`~~