@@ -157,43 +157,26 @@ cfg_if! {
157
157
* get_tib_address( ) . offset( 2 )
158
158
}
159
159
} else if #[ cfg( target_os = "linux" ) ] {
160
- use libc:: { pthread_attr_t, c_int, size_t, c_void, pthread_t} ;
161
160
use std:: mem;
162
161
163
162
unsafe fn guess_os_morestack_stack_limit( ) -> usize {
164
163
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 ) ;
167
167
let mut stackaddr = 0 as * mut _;
168
168
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 ) ;
172
172
stackaddr as usize
173
173
}
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
- }
185
174
} else if #[ cfg( target_os = "macos" ) ] {
186
175
use libc:: { c_void, pthread_t, size_t} ;
187
176
188
177
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
197
180
}
198
181
} else {
199
182
unsafe fn guess_os_morestack_stack_limit( ) -> usize {
0 commit comments