about summary refs log tree commit diff
path: root/src/libstd/sys/unix/thread.rs
AgeCommit message (Collapse)AuthorLines
2019-04-10Eliminate `FnBox` usages from libstd.CrLF0710-2/+1
2019-02-28libstd => 2018Taiki Endo-22/+21
2018-12-25Remove licensesMark Rousskov-10/+0
2018-12-14Remove dead codeOliver Scherer-21/+0
2018-12-06Change sys::Thread::new to take the thread entry as Box<dyn FnBox() + 'static>̣Jethro Beekman-1/+2
2018-07-30Add targets for HermitCore (https://hermitcore.org) to the Rust compiler and ↵Colin Finck-1/+2
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-10Add missing `dyn` for cloudabi, redox, unix and wasmljedrz-1/+1
2018-05-02Add comments and unify guard page setup.Martin Husemann-16/+13
While currently only NetBSD seems to be affected, all systems implementing PAX MPROTECT in strict mode need this treatment, and it does not hurt others.
2018-04-30Map the stack guard page with max protection on NetBSDMartin Husemann-4/+16
On NetBSD the initial mmap() protection of a mapping can not be made less restrictive with mprotect(). So when mapping a stack guard page, use the maximum protection we ever want to use, then mprotect() it to the permission we want it to have initially.
2018-04-12Import the `alloc` crate as `alloc_crate` in stdSimon Sapin-1/+1
… to make the name `alloc` available.
2018-04-03Fix importsTatsuyuki Ishi-1/+1
2018-03-28Use mprotect instead of mmapTatsuyuki Ishi-3/+2
2018-03-25Use a more conservative way to deinit stack guardTatsuyuki Ishi-5/+15
2018-03-24Fix build on non-Unix platformsTatsuyuki Ishi-0/+1
2018-03-20Refactor the stack addr aligning code into a functionTatsuyuki Ishi-16/+16
2018-03-19Address review commentsTatsuyuki Ishi-1/+19
2018-01-31Use a range to identify SIGSEGV in stack guardsJosh Stone-45/+70
Previously, the `guard::init()` and `guard::current()` functions were returning a `usize` address representing the top of the stack guard, respectively for the main thread and for spawned threads. The `SIGSEGV` handler on `unix` targets checked if a fault was within one page below that address, if so reporting it as a stack overflow. Now `unix` targets report a `Range<usize>` representing the guard memory, so it can cover arbitrary guard sizes. Non-`unix` targets which always return `None` for guards now do so with `Option<!>`, so they don't pay any overhead. For `linux-gnu` in particular, the previous guard upper-bound was `stackaddr + guardsize`, as the protected memory was *inside* the stack. This was a glibc bug, and starting from 2.27 they are moving the guard *past* the end of the stack. However, there's no simple way for us to know where the guard page actually lies, so now we declare it as the whole range of `stackaddr ± guardsize`, and any fault therein will be called a stack overflow. This fixes #47863.
2018-01-18in which the unused-parens lint comes to cover function and method argsZack M. Davis-2/+2
Resolves #46137.
2017-12-09Use Try syntax for Option in place of macros or matchMatt Brubeck-4/+1
2017-11-09std: Avoid use of `libc` in portable modulesAlex Crichton-1/+1
This commit removes usage of the `libc` crate in "portable" modules like those at the top level and `sys_common`. Instead common types like `*mut u8` or `u32` are used instead of `*mut c_void` or `c_int` as well as switching to platform-specific functions like `sys::strlen` instead of `libc::strlen`.
2017-10-20Fix some tests for linux gnux32Marco A L Barbosa-1/+1
2017-09-13Move default stack min size to thread implementationsTobias Schaffner-0/+5
The default min stack size value is smaller on l4re and therefore this value has to be different depending on the platform.
2017-09-08Move the stack size value for L4Re to the min_stack_size functionSebastian Humenda-4/+0
2017-09-08Add modifications needed for L4re in libstdTobias Schaffner-2/+8
This commit adds the needed modifications to compile the std crate for the L4 Runtime environment (L4Re). A target for the L4Re was introduced in commit: c151220a84e40b65e45308cc0f3bbea4466d3acf In many aspects implementations for linux also apply for the L4Re microkernel. Two uncommon characteristics had to be resolved: * L4Re has no network funktionality * L4Re has a maximum stacksize of 1Mb for threads Co-authored-by: Sebastian Humenda <sebastian.humenda@tu-dresden.de>
2017-08-26std: Handle OS errors when joining threadsAlex Crichton-1/+2
Also add to the documentation that the `join` method can panic. cc #34971 cc #43539
2017-07-07Skip the main thread's manual stack guard on LinuxJosh Stone-15/+29
Linux doesn't allocate the whole stack right away, and the kernel has its own stack-guard mechanism to fault when growing too close to an existing mapping. If we map our own guard, then the kernel starts enforcing a rather large gap above that, rendering much of the possible stack space useless. Instead, we'll just note where we expect rlimit to start faulting, so our handler can report "stack overflow", and trust that the kernel's own stack guard will work. Fixes #43052.
2016-10-22Fix tidy warningRaph Levien-1/+1
Prefer FIXME to TODO
2016-10-22Add Fuchsia supportRaph Levien-0/+4
Adds support for the x86_64-unknown-fuchsia target, which covers the Fuchsia operating system.
2016-10-08Use less `size_t` casts in libstd since it's now defined as `usize`Tobias Bucher-17/+12
2016-09-30Call emcc with ERROR_ON_UNDEFINED_SYMBOLSBrian Anderson-2/+16
2016-09-26Haiku: Use common thread set_name stubAlexander von Gluck IV-7/+5
2016-09-25Add support for the Haiku operating system on x86 and x86_64 machinesNiels Sascha Reedijk-0/+5
* Hand rebased from Niels original work on 1.9.0
2016-08-24Use `#[prelude_import]` in `libstd`.Jeffrey Seyfried-4/+0
2016-08-10[emscripten] Disable code paths that don't work on emscriptenJan-Erik Rediger-4/+3
2016-07-11std: Fix `Thread::set_name()` for newlib and solarisJosh Stone-1/+0
The `use ffi::CStr` in `unix/thread.rs` was previously guarded, but now all platforms need it for `Thread::set_name()`. Newlib and Solaris do nothing here, as they have no way to set a thread name, but they still define the same method signature.
2016-06-21Fix overflow error in thread::sleepGuillaume Gomez-6/+15
2016-04-06Remove accidental commentAlan Somers-1/+0
2016-04-05Reduce code duplication in thread.rsAlan Somers-42/+18
2016-04-04Fix stack overflow detection on FreeBSDAlan Somers-1/+44
src/libstd/sys/unix/thread.rs Implement several stack-related functions on FreeBSD src/libstd/sys/unix/stack_overflow.rs Fix a comment
2016-03-25Fix unsound behaviour with null characters in thread names (issue #32475)David Henningsson-16/+11
Previously, the thread name (&str) was converted to a CString in the new thread, but outside unwind::try, causing a panic to continue into FFI. This patch changes that behaviour, so that the panic instead happens in the parent thread (where panic infrastructure is properly set up), not the new thread. This could potentially be a breaking change for architectures who don't support thread names. Signed-off-by: David Henningsson <diwic@ubuntu.com>
2016-02-06Auto merge of #30629 - brson:emscripten-upstream, r=alexcrichtonbors-3/+5
Here's another go at adding emscripten support. This needs to wait again on new [libc definitions](https://github.com/rust-lang-nursery/libc/pull/122) landing. To get the libc definitions right I had to add support for i686-unknown-linux-musl, which are very similar to emscripten's, which are derived from arm/musl. This branch additionally removes the makefile dependency on the `EMSCRIPTEN` environment variable by not building the unused compiler-rt. Again, this is not sufficient for actually compiling to asmjs since it needs additional LLVM patches. r? @alexcrichton
2016-02-06Add support for i686-unknown-linux-muslBrian Anderson-2/+2
2016-02-06Add the asmjs-unknown-emscripten triple. Add cfgs to libs.Brian Anderson-1/+3
Backtraces, and the compilation of libbacktrace for asmjs, are disabled. This port doesn't use jemalloc so, like pnacl, it disables jemalloc *for all targets* in the configure file. It disables stack protection.
2016-02-05std: Add a helper for symbols that may not existAlex Crichton-27/+2
Right now we only attempt to call one symbol which my not exist everywhere, __pthread_get_minstack, but this pattern will come up more often as we start to bind newer functionality of systems like Linux. Take a similar strategy as the Windows implementation where we use `dlopen` to lookup whether a symbol exists or not.
2016-01-31Fix unresolved name in libstd/sys/unix/threadNikita Baksalyar-1/+1
2016-01-31Rename sunos to solarisNikita Baksalyar-6/+6
2016-01-31Add Illumos supportNikita Baksalyar-7/+17
2016-01-28std: Fix rumprun buildAlex Crichton-4/+9
Looks like the rumprun build has bitrotted over time, so this includes some libc fixes and some various libstd fixes which gets it back to bootstrapping.
2016-01-26Fix warnings during testsAlex Crichton-11/+8
The deny(warnings) attribute is now enabled for tests so we need to weed out these warnings as well.
2015-12-04Add JoinHandleExt to get the pthread_t on unix platformsPeter Atashian-0/+8
Signed-off-by: Peter Atashian <retep998@gmail.com>