about summary refs log tree commit diff
path: root/src/libstd/sys
AgeCommit message (Collapse)AuthorLines
2019-07-26Rollup merge of #62862 - BaoshanPang:cleanup, r=alexcrichtonMazdak Farrokhzad-1042/+1
code cleanup remove all codes that are not used by vxWorks
2019-07-25std: win: Disable stack overflow handling on UWPHugo Beauzée-Luyssen-29/+45
The required functions are not available, so hope for the best
2019-07-25std: win: Don't use console APIs on UWPHugo Beauzée-Luyssen-26/+119
2019-07-25std: win: Don't use GetFileInformationByHandle on UWPHugo Beauzée-Luyssen-19/+76
2019-07-25std: win: Don't use GetUserProfileDirectoryW on UWPHugo Beauzée-Luyssen-13/+26
2019-07-25std: win: Don't expose link() on UWPHugo Beauzée-Luyssen-4/+11
Or rather expose it, but always return an error
2019-07-25std: win: Don't use SetHandleInformation on UWPHugo Beauzée-Luyssen-19/+61
Attempt to create sockets with the WSA_FLAG_NO_HANDLE_INHERIT flag, and handle the potential error gracefully (as the flag isn't support on Windows 7 before SP1)
2019-07-25std: rand: Use BCrypt on UWPHugo Beauzée-Luyssen-2/+41
As Rtl* functions are not allowed there
2019-07-25libstd: windows: compat: Allow use of attributesHugo Beauzée-Luyssen-0/+2
2019-07-23Use raw pointers in std::sys::cloudabi when passing MaybeUninit valuesNathan-6/+6
2019-07-23Cleanup std::sys::cloudabiNathan-19/+19
2019-07-23Modify CloudABI ReentrantMutex to use MaybeUninitNathan-14/+18
Remove uses of mem::uninitialized, which is now deprecated
2019-07-22Remove uses of mem::uninitialized in std::sys::cloudabiNathan-16/+30
Usages still appear in cloudabi tests and in the reentrant mutex implementation
2019-07-21code cleanupBaoshan Pang-1042/+1
2019-07-19warn about deprecated-in-future in most of libstdRalf Jung-1/+1
2019-07-16Add supporting for vxWorksBaoshan Pang-1/+8265
r? @alexcrichton
2019-07-11Rollup merge of #62425 - cyphar:linux-cloexec-use-fcntl, r=alexcrichtonMazdak Farrokhzad-0/+2
filedesc: don't use ioctl(FIOCLEX) on Linux All `ioctl(2)`s will fail on `O_PATH` file descriptors on Linux (because they use `&empty_fops` as a security measure against `O_PATH` descriptors affecting the backing file). As a result, `File::try_clone()` and various other methods would always fail with `-EBADF` on `O_PATH` file descriptors. The solution is to simply use `F_SETFD` (as is used on other unices) which works on `O_PATH` descriptors because it operates through the `fnctl(2)` layer and not through `ioctl(2)`s. Since this code is usually only used in strange error paths (a broken or ancient kernel), the extra overhead of one syscall shouldn't cause any dramas. Most other systems programming languages also use the fnctl(2) so this brings us in line with them. Fixes: rust-lang/rust#62314 Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2019-07-10filedesc: don't use ioctl(FIOCLEX) on LinuxAleksa Sarai-0/+2
All ioctl(2)s will fail on O_PATH file descriptors on Linux (because they use &empty_fops as a security measure against O_PATH descriptors affecting the backing file). As a result, File::try_clone() and various other methods would always fail with -EBADF on O_PATH file descriptors. The solution is to simply use F_SETFD (as is used on other unices) which works on O_PATH descriptors because it operates through the fnctl(2) layer and not through ioctl(2)s. Since this code is usually only used in strange error paths (a broken or ancient kernel), the extra overhead of one syscall shouldn't cause any dramas. Most other systems programming languages also use the fnctl(2) so this brings us in line with them. Fixes: rust-lang/rust#62314 Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2019-07-06Rollup merge of #62296 - RalfJung:memalign, r=alexcrichtonMazdak Farrokhzad-1/+9
request at least ptr-size alignment from posix_memalign Fixes https://github.com/rust-lang/rust/issues/62251
2019-07-05Remove last use of mem::uninitialized in SGXJethro Beekman-3/+1
2019-07-05Rollup merge of #62123 - jeremystucki:needless_lifetimes_std, r=alexcrichtonMazdak Farrokhzad-5/+5
Remove needless lifetimes (std) Split from #62039
2019-07-04Permit use of mem::uninitialized via allow(deprecated)Mark Rousskov-0/+4
2019-07-04Add missing lifetime specifierJeremy Stucki-1/+1
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-07-03fix unused-import error on androidRalf Jung-2/+1
2019-07-02improve and deduplicate commentsRalf Jung-4/+3
2019-07-02request at least ptr-size alignment from posix_memalignRalf Jung-1/+11
2019-07-01Convert more usages overChris Gregory-1/+1
2019-07-01Remove needless lifetimesJeremy Stucki-5/+5
2019-06-26Use pointer::write_bytes for android sigemptysetJosh Stone-5/+3
2019-06-26Avoid mem::uninitialized() in std::sys::unixJosh Stone-58/+57
For `libc` types that will be initialized in FFI calls, we can just use `MaybeUninit` and then pass around raw pointers. For `sun_path_offset()`, which really wants `offset_of`, all callers have a real `sockaddr_un` available, so we can use that reference.
2019-06-20Auto merge of #60341 - mtak-:macos-tlv-workaround, r=alexcrichtonbors-116/+1
macos tlv workaround fixes: #60141 Includes: * remove dead code: `requires_move_before_drop`. This hasn't been needed for a while now (oops I should have removed it in #57655) * redox had a copy of `fast::Key` (not sure why?). That has been removed. * Perform a `read_volatile` on OSX to reduce `tlv_get_addr` calls per `__getit` from (4-2 depending on context) to 1. `tlv_get_addr` is relatively expensive (~1.5ns on my machine). Previously, in contexts where `__getit` was inlined, 4 calls to `tlv_get_addr` were performed per lookup. For some reason when `__getit` is not inlined this is reduced to 2x - and performance improves to match. After this PR, I have only ever seen 1x call to `tlv_get_addr` per `__getit`, and macos now benefits from situations where `__getit` is inlined. I'm not sure if the `read_volatile(&&__KEY)` trick is working around an LLVM bug, or a rustc bug, or neither. r? @alexcrichton
2019-06-17Make use of `ptr::null(_mut)` instead of casting zeroLzu Tao-2/+2
2019-06-10std: Remove internal definitions of `cfg_if!` macroAlex Crichton-5/+5
This is duplicated in a few locations throughout the sysroot to work around issues with not exporting a macro in libstd but still wanting it available to sysroot crates to define blocks. Nowadays though we can simply depend on the `cfg-if` crate on crates.io, allowing us to use it from there!
2019-05-29Rollup merge of #61202 - oberien:permissionext-print-octal, r=varkorMazdak Farrokhzad-2/+2
Print PermissionExt::mode() in octal in Documentation Examples Printing the file permission mode on unix systems in decimal feels unintuitive. Printing it in octal gives the expected form of e.g. `664`.
2019-05-26Print file mode of PermissionExt in octal in Examplesoberien-2/+2
2019-05-25std: Depend on `backtrace` crate from crates.ioAlex Crichton-1794/+0
This commit removes all in-tree support for generating backtraces in favor of depending on the `backtrace` crate on crates.io. This resolves a very longstanding piece of duplication where the standard library has long contained the ability to generate a backtrace on panics, but the code was later extracted and duplicated on crates.io with the `backtrace` crate. Since that fork each implementation has seen various improvements one way or another, but typically `backtrace`-the-crate has lagged behind libstd in one way or another. The goal here is to remove this duplication of a fairly critical piece of code and ensure that there's only one source of truth for generating backtraces between the standard library and the crate on crates.io. Recently I've been working to bring the `backtrace` crate on crates.io up to speed with the support in the standard library which includes: * Support for `StackWalkEx` on MSVC to recover inline frames with debuginfo. * Using `libbacktrace` by default on MinGW targets. * Supporting `libbacktrace` on OSX as an option. * Ensuring all the requisite support in `backtrace`-the-crate compiles with `#![no_std]`. * Updating the `libbacktrace` implementation in `backtrace`-the-crate to initialize the global state with the correct filename where necessary. After reviewing the code in libstd the `backtrace` crate should be at exact feature parity with libstd today. The backtraces generated should have the same symbols and same number of frames in general, and there's not known divergence from libstd currently. Note that one major difference between libstd's backtrace support and the `backtrace` crate is that on OSX the crates.io crate enables the `coresymbolication` feature by default. This feature, however, uses private internal APIs that aren't published for OSX. While they provide more accurate backtraces this isn't appropriate for libstd distributed as a binary, so libstd's dependency on the `backtrace` crate explicitly disables this feature and forces OSX to use `libbacktrace` as a symbolication strategy. The long-term goal of this refactoring is to eventually move us towards a world where we can drop `libbacktrace` entirely and simply use Gimli and the surrounding crates for backtrace support. That's still aways off but hopefully will much more easily enabled by having the source of truth for backtraces live in crates.io! Procedurally if we go forward with this I'd like to transfer the `backtrace-rs` crate to the rust-lang GitHub organization as well, but I figured I'd hold off on that until we get closer to merging.
2019-05-22Revert "Add implementations of last in terms of next_back on a bunch of ↵Steven Fackler-8/+0
DoubleEndedIterators." This reverts commit 3e86cf36b5114f201868bf459934fe346a76a2d4.
2019-05-22Rollup merge of #60581 - hellow554:fix_60580, r=alexcrichtonMazdak Farrokhzad-57/+46
convert custom try macro to `?` resolves #60580 r? @frewsxcv
2019-05-20Rollup merge of #60453 - tbu-:pr_getrandom_enoperm, r=sfacklerMazdak Farrokhzad-1/+6
Fall back to `/dev/urandom` on `EPERM` for `getrandom` This can happen because of seccomp or some VMs. Fixes #52609.
2019-05-15restructure thread_local! for better codegen (especially on macos)tyler-1/+1
2019-05-15Revert "ensure fast thread local lookups occur once per access on macos"tyler-26/+1
This reverts commit d252f3b77f3b7d4cd59620588f9d026633c05816.
2019-05-15ensure fast thread local lookups occur once per access on macostyler-1/+26
2019-05-15redox had a copy of fast thread local (oversight?)tyler-104/+1
2019-05-15remove dead code: requires_move_before_droptyler-12/+0
2019-05-15Auto merge of #60775 - hellow554:no_bitrig, r=joshtriplettbors-35/+9
Remove bitrig support from rust Resolves #60743 using `find` and `rg` I delete every occurence of "bitrig" in the sources, expect for the llvm submodule (is this correct?). There's also this file https://github.com/rust-lang/rls/blob/5b8e99bb61958ca8abcb7c5eda70521726be1065/rls-analysis/test_data/rust-analysis/libstd-af9bacceee784405.json which contains a bitrig string in it. What to do with that?
2019-05-14Rollup merge of #60780 - RalfJung:miri, r=oli-obkMazdak Farrokhzad-4/+1
fix Miri This reverts https://github.com/rust-lang/rust/pull/60156, which turned out to be a dead end (see https://github.com/rust-lang/rust/pull/60469). r? @oli-obk
2019-05-14Rollup merge of #60130 - khuey:efficient_last, r=sfacklerMazdak Farrokhzad-0/+8
Add implementations of last in terms of next_back on a bunch of DoubleEndedIterators Provided a `DoubleEndedIterator` has finite length, `Iterator::last` is equivalent to `DoubleEndedIterator::next_back`. But searching forwards through the iterator when it's unnecessary is obviously not good for performance. I ran into this on one of the collection iterators. I tried adding appropriate overloads for a bunch of the iterator adapters like filter, map, etc, but I ran into a lot of type inference failures after doing so. The other interesting case is what to do with `Repeat`. Do we consider it part of the contract that `Iterator::last` will loop forever on it? The docs do say that the iterator will be evaluated until it returns None. This is also relevant for the adapters, it's trivially easy to observe whether a `Map` adapter invoked its closure a zillion times or just once for the last element.
2019-05-13Revert "use SecRandomCopyBytes on macOS in Miri"Ralf Jung-4/+1
This reverts commit 54aefc6a2d076b74921a8d78c5d8c68c13bfa4a7.
2019-05-13Remove bitrig support from rustMarcel Hellwig-35/+9
2019-05-06use exhaustive_patterns to be able to use `?`Marcel Hellwig-12/+15