about summary refs log tree commit diff
path: root/src/libstd/sys
AgeCommit message (Collapse)AuthorLines
2018-06-28Make msvc symbol extraction/printing functions generic.moxian-103/+137
2018-06-28Make stackwalking generic instead of matching on enum variants.moxian-133/+147
2018-06-28Load backtrace-related functions only oncemoxian-41/+77
.. and pass them around in BacktraceContext.
2018-06-28Split separate stackwalk variants into their own functionsmoxian-204/+238
.. rather than having them be one giant match statement.
2018-06-28Add a fallback for stacktrace printing for older Windows versions.moxian-108/+331
PR #47252 switched stack inspection functions of dbghelp.dll to their newer alternatives that also capture inlined context. Unfortunately, said new alternatives are not present in older dbghelp.dll versions. In particular Windows 7 at the time of writing has dbghelp.dll version 6.1.7601 from 2010, that lacks StackWalkEx and friends. Fixes #50138
2018-06-27Add is_unnamed on redoxjD91mZM2-24/+30
2018-06-27[fuchsia] Update zx_cprng_draw to target semanticsAdam Barth-26/+2
This change is the final step in improving the semantics of zx_cprng_draw. Now the syscall always generates the requested number of bytes. If the syscall would have failed to generate the requested number of bytes, the syscall either terminates the entire operating system or terminates the calling process, depending on whether the error is a result of the kernel misbehaving or the userspace program misbehaving.
2018-06-27Fix tidy checksjD91mZM2-5/+19
2018-06-27Horrible attempt at cleaning things up that probably just made it worsejD91mZM2-1549/+643
2018-06-26Revert "Remove functions that always error"jD91mZM2-0/+181
This reverts commit 21d09b983de87fec2e98832f4c30b52f12d6342f.
2018-06-26Mention redox' behavior in doc commentsjD91mZM2-0/+12
2018-06-26Remove functions that always errorjD91mZM2-181/+0
2018-06-26Disallow constructing SocketAddr from third-party codejD91mZM2-2/+2
2018-06-26Make feature unstablejD91mZM2-40/+1
2018-06-26Custom feature gate (I think?)jD91mZM2-40/+40
2018-06-26Trim all lines to 100jD91mZM2-3/+10
2018-06-26Make UnixStream::take_error return None on redoxjD91mZM2-3/+3
2018-06-26Unix sockets on redox!jD91mZM2-1/+733
2018-06-26Add read_exact_at and write_all_at methods to FileExt on unixDror Levin-0/+127
2018-06-26Rollup merge of #51786 - cuviper:stat64-pointers, r=Mark-SimulacrumPietro Albini-2/+2
Remove unnecessary stat64 pointer casts In effect, these just casted `&mut stat64` to `*mut stat64`, twice. That's harmless, but it masked a problem when this was copied to new code calling `fstatat`, which takes a pointer to `struct stat`. That will be fixed by #51785, but let's remove the unnecessary casts here too.
2018-06-26Rollup merge of #51642 - GuillaumeGomez:fix-unknown-windows-build, r=oli-obkPietro Albini-0/+3
Fix unknown windows build Fixes #51618.
2018-06-26Auto merge of #50630 - sharkdp:fix-50619, r=sfacklerbors-7/+24
Fix possibly endless loop in ReadDir iterator Certain directories in `/proc` can cause the `ReadDir` iterator to loop indefinitely. We get an error code (22) when calling libc's `readdir_r` on these directories, but `entry_ptr` is `NULL` at the same time, signalling the end of the directory stream. This change introduces an internal state to the iterator such that the `Some(Err(..))` value will only be returned once when calling `next`. Subsequent calls will return `None`. fixes #50619
2018-06-25Remove unnecessary stat64 pointer castsJosh Stone-2/+2
In effect, these just casted `&mut stat64` to `*mut stat64`, twice. That's harmless, but it masked a problem when this was copied to new code calling `fstatat`, which takes a pointer to `struct stat`. That will be fixed by #51785, but let's remove the unnecessary casts here too.
2018-06-25Use fstatat64 where availableJosh Stone-6/+5
2018-06-25Add missing \[allow(missing_docs)\]Guillaume Gomez-0/+1
2018-06-20Fix doc build on unknown windows targetGuillaume Gomez-0/+2
2018-06-19Update zx_cprng_draw_new on FuchsiaAdam Barth-4/+3
Fuchsia is changing the semantics for zx_cprng_draw and zx_cprng_draw_new is a temporary name for the new semantics.
2018-06-17Auto merge of #51529 - nodakai:improve-sys_common-mutex, r=oli-obkbors-36/+20
libstd: add an RAII utility for sys_common::mutex::Mutex It is indeed debatable whether or not we should introduce more sophistication like this to the lowest layer of a system library. In fact, `Drop::drop()` cannot be `unsafe` (IIRC there was a discussion on introducing an unsafe variant of `Drop` whose entire scope must be within `unsafe`)
2018-06-17Auto merge of #51555 - ccesare:remove_unused_variables_redox_os, r=kennytmbors-3/+0
Removed two unused variables in os.rs Issue #51419 suggested removing two unused variables in `libstd/sys/redox/os.rs`. This PR implements that change. It compiles for me locally, but I haven't run any other tests.
2018-06-17libstd: add an RAII utility for sys_common::mutex::MutexNODA, Kai-36/+20
Signed-off-by: NODA, Kai <nodakai@gmail.com>
2018-06-15Fix issue on unixGuillaume Gomez-0/+1
2018-06-14Removed two unused variablesChris Cesare-3/+0
2018-06-13Add missing allow_missing_docsGuillaume Gomez-0/+1
2018-06-12Fix possibly endless loop in ReadDir iteratorsharkdp-7/+24
Certain directories in `/proc` can cause the `ReadDir` iterator to loop indefinitely. We get an error code (22) when calling libc's `readdir_r` on these directories, but `entry_ptr` is `NULL` at the same time, signalling the end of the directory stream. This change introduces an internal state to the iterator such that the `Some(Err(..))` value will only be returned once when calling `next`. Subsequent calls will return `None`. fixes #50619
2018-06-09Auto merge of #51359 - cramertj:fdio_spawn, r=sfacklerbors-109/+51
[fuchsia] Migrate from launchpad to fdio_spawn_etc fdio_spawn_etc is the preferred way of creating processes on Fuchsia now. cc @abarth
2018-06-07[fuchsia] Migrate from launchpad to fdio_spawn_etcAdam Barth-109/+51
fdio_spawn_etc is the preferred way of creating processes on Fuchsia now.
2018-06-05Rollup merge of #51255 - avdv:patch-1, r=kennytmMark Simulacrum-2/+2
Fix confusing error message for sub_instant When subtracting an Instant from another, the function will panick when `RHS > self`, but the error message confusingly displays a different error: ```rust let i = Instant::now(); let other = Instant::now(); if other > i { println!("{:?}", i - other); } ``` This results in a panic: ``` thread 'test_instant' panicked at 'other was less than the current instant', libstd/sys/unix/time.rs:292:17 ``` But clearly, `other` was actually greater than the current instant.
2018-06-04Clarify error phrase in `sub_instant` functionClaudio Bley-2/+2
Uses the same wording as [`src/libstd/sys/windows/time.rs`][1]. 1: https://github.com/avdv/rust/blob/95e2bf253d864c5e14ad000ffa2040ce85916056/src/libstd/sys/windows/time.rs#L65
2018-06-01fs: copy: Add EPERM to fallback error conditionsNicolas Koch-5/+12
Fixes #51266
2018-05-31Rollup merge of #51213 - nicokoch:copy_permissions, r=cramertjGuillaume Gomez-5/+5
fs: copy: Use File::set_permissions instead of fs::set_permissions We already got the open file descriptor at this point. Don't make the kernel resolve the path again.
2018-05-31Fix confusing error message for sub_instantClaudio Bley-1/+1
When subtracting an Instant from another, the function will panick when `RHS > self`, but the error message confusingly displays a different error: ```rust let i = Instant::now(); let other = Instant::now(); if other > i { println!("{:?}", i - other); } ``` This results in a panic: ``` thread 'test_instant' panicked at 'other was less than the current instant', libstd/sys/unix/time.rs:292:17 ```
2018-05-31libstd/sys/unix/fs.rs: fix compilation on fuchsiaGuillaume Girol-1/+1
2018-05-30std::fs::DirEntry.metadata(): use fstatat instead of lstat when possibleGuillaume Girol-11/+32
2018-05-30Remobve unused importNicolas Koch-1/+1
2018-05-30fs: copy: Use File::set_permissions instead of fs::set_permissionsNicolas Koch-4/+4
We already got the open file descriptor at this point. Don't make the kernel resolve the path again.
2018-05-29Auto merge of #50772 - nicokoch:fastcopy, r=alexcrichtonbors-0/+88
fs: copy: use copy_file_range on Linux Linux 4.5 introduced a new system call [copy_file_range](http://man7.org/linux/man-pages/man2/copy_file_range.2.html) to copy data from one file to another. This PR uses the new system call (if available). This has several advantages: 1. No need to constantly copy data from userspace to kernel space, if the buffer is small or the file is large 2. On some filesystems, like BTRFS, the kernel can leverage internal fs mechanisms for huge performance gains 3. Filesystems on the network dont need to copy data between the host and the client machine (they have to in the current read/write implementation) I have created a small library that also implements the new system call for some huge performance gains here: https://github.com/nicokoch/fastcopy Benchmark results are in the README
2018-05-29Fix additional nits:Nicolas Koch-7/+3
- compute bytes_to_copy more elegantly - add assert that written is 0 in fallback case
2018-05-28Use FIXME instead of TODO; Move bytes_to_copy calculation inside ifNicolas Koch-6/+7
branch
2018-05-24Implement suggestions from the PRNicolas Koch-1/+3
- Move loading of atomic bool outside the loop - Add comment about TryFrom for future improvement
2018-05-17Store ENOSYS in a global to avoid unnecessary system callsNicolas Koch-10/+25