Use libc errno
This commit is contained in:
parent
a52da95ced
commit
fe791d7886
1 changed files with 8 additions and 1 deletions
|
|
@ -33,9 +33,16 @@ use vec;
|
|||
const TMPBUF_SZ: usize = 128;
|
||||
static ENV_LOCK: Mutex = Mutex::new();
|
||||
|
||||
extern {
|
||||
#[link_name = "__errno_location"]
|
||||
fn errno_location() -> *mut i32;
|
||||
}
|
||||
|
||||
/// Returns the platform-specific value of errno
|
||||
pub fn errno() -> i32 {
|
||||
0
|
||||
unsafe {
|
||||
(*errno_location())
|
||||
}
|
||||
}
|
||||
|
||||
/// Gets a detailed string description for the given error number.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue