Skip to content

Commit 2d1485f

Browse files
committed
Bump dep on libc
1 parent aeb0924 commit 2d1485f

File tree

2 files changed

+9
-26
lines changed

2 files changed

+9
-26
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ test = false
2020

2121
[dependencies]
2222
cfg-if = "0.1"
23-
libc = "0.1"
23+
libc = { git = "https://github.com/rust-lang/libc" }
2424

2525
[build-dependencies]
2626
gcc = "0.3.10"

src/lib.rs

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -157,43 +157,26 @@ cfg_if! {
157157
*get_tib_address().offset(2)
158158
}
159159
} else if #[cfg(target_os = "linux")] {
160-
use libc::{pthread_attr_t, c_int, size_t, c_void, pthread_t};
161160
use std::mem;
162161

163162
unsafe fn guess_os_morestack_stack_limit() -> usize {
164163
let mut attr: libc::pthread_attr_t = mem::zeroed();
165-
assert_eq!(pthread_attr_init(&mut attr), 0);
166-
assert_eq!(pthread_getattr_np(pthread_self(), &mut attr), 0);
164+
assert_eq!(libc::pthread_attr_init(&mut attr), 0);
165+
assert_eq!(libc::pthread_getattr_np(libc::pthread_self(),
166+
&mut attr), 0);
167167
let mut stackaddr = 0 as *mut _;
168168
let mut stacksize = 0;
169-
assert_eq!(pthread_attr_getstack(&attr, &mut stackaddr,
170-
&mut stacksize), 0);
171-
assert_eq!(pthread_attr_destroy(&mut attr), 0);
169+
assert_eq!(libc::pthread_attr_getstack(&attr, &mut stackaddr,
170+
&mut stacksize), 0);
171+
assert_eq!(libc::pthread_attr_destroy(&mut attr), 0);
172172
stackaddr as usize
173173
}
174-
175-
extern {
176-
fn pthread_self() -> pthread_t;
177-
fn pthread_attr_init(attr: *mut pthread_attr_t) -> c_int;
178-
fn pthread_attr_destroy(attr: *mut pthread_attr_t) -> c_int;
179-
fn pthread_attr_getstack(attr: *const pthread_attr_t,
180-
stackaddr: *mut *mut c_void,
181-
stacksize: *mut size_t) -> c_int;
182-
fn pthread_getattr_np(native: pthread_t,
183-
attr: *mut pthread_attr_t) -> c_int;
184-
}
185174
} else if #[cfg(target_os = "macos")] {
186175
use libc::{c_void, pthread_t, size_t};
187176

188177
unsafe fn guess_os_morestack_stack_limit() -> usize {
189-
pthread_get_stackaddr_np(pthread_self()) as usize -
190-
pthread_get_stacksize_np(pthread_self()) as usize
191-
}
192-
193-
extern {
194-
fn pthread_self() -> pthread_t;
195-
fn pthread_get_stackaddr_np(thread: pthread_t) -> *mut c_void;
196-
fn pthread_get_stacksize_np(thread: pthread_t) -> size_t;
178+
libc::pthread_get_stackaddr_np(libc::pthread_self()) as usize -
179+
libc::pthread_get_stacksize_np(libc::pthread_self()) as usize
197180
}
198181
} else {
199182
unsafe fn guess_os_morestack_stack_limit() -> usize {

0 commit comments

Comments
 (0)