about summary refs log tree commit diff
path: root/src/libstd/sys
AgeCommit message (Collapse)AuthorLines
2018-08-02Auto merge of #52847 - upsuper:thread-stack-reserve, r=alexcrichtonbors-1/+4
Don't commit thread stack on Windows On Windows, there is a system level resource limitation called commit limit, which is roughly the sum of physical memory + paging files[1]. `CreateThread` by default commits the stack size[2], which unnecessarily takes such resource from the shared limit. This PR changes it to only reserve the stack size rather than commit it. Reserved memory would only take the address space of the current process until it's actually accessed. This should make the behavior on Windows match other platforms, and is also a pretty standard practice on Windows nowadays. [1] https://blogs.technet.microsoft.com/markrussinovich/2008/11/17/pushing-the-limits-of-windows-virtual-memory/ [2] https://docs.microsoft.com/zh-cn/windows/desktop/api/processthreadsapi/nf-processthreadsapi-createthread
2018-07-31Fix coding style.Colin Finck-1/+4
2018-07-30Add targets for HermitCore (https://hermitcore.org) to the Rust compiler and ↵Colin Finck-14/+33
port libstd to it. As a start, the port uses the simplest possible configuration (no jemalloc, abort on panic) and makes use of existing Unix-specific code wherever possible. It adds targets for x86_64 (current main HermitCore platform) and aarch64 (HermitCore platform under development). Together with the patches to "liblibc" and "llvm", this enables HermitCore applications to be written in Rust.
2018-07-30Auto merge of #52805 - ljedrz:format_str_literal, r=petrochenkovbors-1/+1
Don't format!() string literals Prefer `to_string()` to `format!()` take 2, this time targetting string literals. In some cases (`&format!("...")` -> `"..."`) also removes allocations. Occurences of `format!("")` are changed to `String::new()`.
2018-07-30Don't commit thread stack on WindowsXidorn Quan-1/+4
2018-07-29Auto merge of #52738 - ljedrz:push_to_extend, r=eddybbors-11/+8
Replace push loops with extend() where possible Or set the vector capacity where I couldn't do it. According to my [simple benchmark](https://gist.github.com/ljedrz/568e97621b749849684c1da71c27dceb) `extend`ing a vector can be over **10 times** faster than `push`ing to it in a loop: 10 elements (6.1 times faster): ``` test bench_extension ... bench: 75 ns/iter (+/- 23) test bench_push_loop ... bench: 458 ns/iter (+/- 142) ``` 100 elements (11.12 times faster): ``` test bench_extension ... bench: 87 ns/iter (+/- 26) test bench_push_loop ... bench: 968 ns/iter (+/- 3,528) ``` 1000 elements (11.04 times faster): ``` test bench_extension ... bench: 311 ns/iter (+/- 9) test bench_push_loop ... bench: 3,436 ns/iter (+/- 233) ``` Seems like a good idea to use `extend` as much as possible.
2018-07-29Replace push loops with collect() and extend() where possibleljedrz-11/+8
2018-07-29Auto merge of #52767 - ljedrz:avoid_format, r=petrochenkovbors-1/+1
Prefer to_string() to format!() Simple benchmarks suggest in some cases it can be faster by even 37%: ``` test converting_f64_long ... bench: 339 ns/iter (+/- 199) test converting_f64_short ... bench: 136 ns/iter (+/- 34) test converting_i32_long ... bench: 87 ns/iter (+/- 16) test converting_i32_short ... bench: 87 ns/iter (+/- 49) test converting_str ... bench: 54 ns/iter (+/- 15) test formatting_f64_long ... bench: 349 ns/iter (+/- 176) test formatting_f64_short ... bench: 145 ns/iter (+/- 14) test formatting_i32_long ... bench: 98 ns/iter (+/- 14) test formatting_i32_short ... bench: 93 ns/iter (+/- 15) test formatting_str ... bench: 86 ns/iter (+/- 23) ```
2018-07-28Don't format!() string literalsljedrz-1/+1
2018-07-27Auto merge of #52336 - ishitatsuyuki:dyn-rollup, r=Mark-Simulacrumbors-10/+10
Rollup of bare_trait_objects PRs All deny attributes were moved into bootstrap so they can be disabled with a line of config. Warnings for external tools are allowed and it's up to the tool's maintainer to keep it warnings free. r? @Mark-Simulacrum cc @ljedrz @kennytm
2018-07-27Prefer to_string() to format!()ljedrz-1/+1
2018-07-25Merge remote-tracking branches 'ljedrz/dyn_libcore', 'ljedrz/dyn_libstd' and ↵Tatsuyuki Ishi-8/+8
'ljedrz/dyn_libterm' into dyn-rollup
2018-07-25Add missing dynTatsuyuki Ishi-2/+2
2018-07-24Rollup merge of #52656 - jD91mZM2:stablize-uds, r=alexcrichtonMark Rousskov-1/+41
Stablize Redox Unix Sockets I don't know if I did this correctly, but I basically spammed the `#[stable]` attribute everywhere :^)
2018-07-24Stablize Redox Unix SocketsjD91mZM2-1/+41
2018-07-23Change single char str patterns to charsljedrz-3/+3
2018-07-13Fix redox libstd leftoverTatsuyuki Ishi-2/+2
2018-07-11Use fast TLS on FuchsiaTaylor Cramer-6/+1
2018-07-11Auto merge of #51553 - jD91mZM2:uds, r=sfacklerbors-1/+740
Unix sockets on redox This is done using the ipcd daemon. It's not exactly like unix sockets because there is not actually a physical file for the path, but it's close enough for a basic implementation :) This allows mio-uds and tokio-uds to work with a few modifications as well, which is exciting!
2018-07-10Add missing `dyn` for cloudabi, redox, unix and wasmljedrz-7/+7
2018-07-10Deny bare trait objects in `src/libstd`.ljedrz-1/+1
2018-07-08Delete leftover filesjD91mZM2-606/+0
2018-07-07Add is_unnamedjD91mZM2-0/+27
2018-07-07Revert unification of interfacesjD91mZM2-29/+1539
2018-07-03Rollup merge of #51809 - drrlvn:rw_exact_all_at, r=alexcrichtonPietro Albini-0/+127
Add read_exact_at and write_all_at methods to FileExt on unix This PR adds `FileExt::read_exact_at()` and `FileExt::write_all_at()`, which are to `read_at()` and `write_at()` as `read_exact()` and `write_all()` are to `read()` and `write()`. This allows the user to not have to deal with `ErrorKind::Interrupted` and calling the functions in a loop. I was unsure as to how to mark these new methods so I marked them `unstable`, please let me know if I should have done it differently. I asked in Discord and was told that as this change is small it does not require an RFC.
2018-07-03Remove stability attributes on private types and leftover docsjD91mZM2-18/+0
2018-07-02Fill in tracking issue number for read_exact_at/write_all_atDror Levin-2/+2
2018-06-28Change traits to bare FnMut where possible.moxian-111/+67
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