about summary refs log tree commit diff
path: root/src/libstd/sys/common
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-07-21 20:51:04 +0000
committerbors <bors@rust-lang.org>2015-07-21 20:51:04 +0000
commitee2d3bc8a20545aa6bb660ae0e30ff143f160d16 (patch)
tree11f8943dddf55f253b0247d09d8447826d083595 /src/libstd/sys/common
parent21dfd24c4b1f8c24abb78d573c42344b8d2ec809 (diff)
parentd68b152c3e2feb6ee18bdf2c992098376dbb528c (diff)
downloadrust-ee2d3bc8a20545aa6bb660ae0e30ff143f160d16.tar.gz
rust-ee2d3bc8a20545aa6bb660ae0e30ff143f160d16.zip
Auto merge of #27073 - alexcrichton:less-proc-fs, r=brson
This can fail on linux for various reasons, such as the /proc filesystem not
being mounted. There are already many cases where we can't set up stack guards,
so just don't worry about this case and communicate that no guard was enabled.

I've confirmed that this allows the compiler to run in a chroot without /proc
mounted.

Closes #22642
Diffstat (limited to 'src/libstd/sys/common')
-rw-r--r--src/libstd/sys/common/thread_info.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libstd/sys/common/thread_info.rs b/src/libstd/sys/common/thread_info.rs
index ae55bae37aa..bb47c946e49 100644
--- a/src/libstd/sys/common/thread_info.rs
+++ b/src/libstd/sys/common/thread_info.rs
@@ -18,7 +18,7 @@ use thread::Thread;
 use thread::LocalKeyState;
 
 struct ThreadInfo {
-    stack_guard: usize,
+    stack_guard: Option<usize>,
     thread: Thread,
 }
 
@@ -33,7 +33,7 @@ impl ThreadInfo {
         THREAD_INFO.with(move |c| {
             if c.borrow().is_none() {
                 *c.borrow_mut() = Some(ThreadInfo {
-                    stack_guard: 0,
+                    stack_guard: None,
                     thread: NewThread::new(None),
                 })
             }
@@ -47,10 +47,10 @@ pub fn current_thread() -> Option<Thread> {
 }
 
 pub fn stack_guard() -> Option<usize> {
-    ThreadInfo::with(|info| info.stack_guard)
+    ThreadInfo::with(|info| info.stack_guard).and_then(|o| o)
 }
 
-pub fn set(stack_guard: usize, thread: Thread) {
+pub fn set(stack_guard: Option<usize>, thread: Thread) {
     THREAD_INFO.with(|c| assert!(c.borrow().is_none()));
     THREAD_INFO.with(move |c| *c.borrow_mut() = Some(ThreadInfo{
         stack_guard: stack_guard,