summaryrefslogtreecommitdiffstats
path: root/vendor/errno
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/errno')
-rw-r--r--vendor/errno/.cargo-checksum.json2
-rw-r--r--vendor/errno/CHANGELOG.md23
-rw-r--r--vendor/errno/Cargo.toml26
-rw-r--r--vendor/errno/README.md28
-rw-r--r--vendor/errno/clippy.toml1
-rw-r--r--vendor/errno/src/hermit.rs10
-rw-r--r--vendor/errno/src/lib.rs45
-rw-r--r--vendor/errno/src/unix.rs82
-rw-r--r--vendor/errno/src/wasi.rs57
-rw-r--r--vendor/errno/src/windows.rs75
10 files changed, 213 insertions, 136 deletions
diff --git a/vendor/errno/.cargo-checksum.json b/vendor/errno/.cargo-checksum.json
index e902c4f19..40940cedb 100644
--- a/vendor/errno/.cargo-checksum.json
+++ b/vendor/errno/.cargo-checksum.json
@@ -1 +1 @@
-{"files":{"CHANGELOG.md":"4117e53ffe976635cceec0945cb500f5da2d7a5d54e360477d625e8382b585df","Cargo.toml":"8a810e953a0ae35ef3813fa470bb02d6315dee5020a81ba50319c23ce276c6c5","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"8764a597675778ddfd4e25f81b08a05dbcf089ac05662df7613fe67f150e3aa2","README.md":"057f18de8b228ec7980ad3c30782158022b429013a849ae9faf641187a7c9722","src/hermit.rs":"79bf2148c39260b9f8c4859a5dc805905bf1f6e56cb1cf3c1954e38563fe5091","src/lib.rs":"8aac3a13cf7a85d5b6bc0945a0614a2413abac92e66e289531dca5288a3e6fdd","src/unix.rs":"09cd79b198b5cdb1fe6db9be4a0ef5f7cb8ee217ec4a1aa4fdcb20fc3bfb8d6c","src/wasi.rs":"0443c1e5c0552140458c31cdf8d0647a4c164f0206a25f1d002bd4abbebe9c02","src/windows.rs":"c32c74e663b9b81f1df9ee3c4776269f4210bce0b49ed3237b9ae10db259170b"},"package":"f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1"} \ No newline at end of file
+{"files":{"CHANGELOG.md":"80348d2f4e4e309a65c6e1db88234e596fe7aef1be04b33079b3f580fa1ba7bb","Cargo.toml":"9c2bdda2209a38b52cba3f9fb9286a109d765f3301fae47b6427c134be7bb0de","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"8764a597675778ddfd4e25f81b08a05dbcf089ac05662df7613fe67f150e3aa2","README.md":"96a40903ea0fe68cf512d176a230f4a37df76de262f047f01a46f31de75402bd","clippy.toml":"2c27890fbf0454bb2405bdb013b1daeb78d57c5844b964bcac9afcc125fa46e4","src/hermit.rs":"a0d6839cbef77e2e93acafc629c76805b858311982f19b99c3389e43cfbebfbf","src/lib.rs":"318f864b8cb9296c85f70f9dfb855c552303630b3a9390f147bb4b581b8d8b5c","src/unix.rs":"fa6f6f615136ff2cad78d11f0b8396705a03dc9991af8a0389ab95b14537c44d","src/wasi.rs":"c606886ebda52b5dc7682c0f3aaf51e146692455acd5e303812cf0d634589d05","src/windows.rs":"7cbcdb8e74582f357fa945bb1c44c4d19c1a10bec958da1223305bf68ec35baf"},"package":"50d6a0976c999d473fe89ad888d5a284e55366d9dc9038b1ba2aa15128c4afa0"} \ No newline at end of file
diff --git a/vendor/errno/CHANGELOG.md b/vendor/errno/CHANGELOG.md
index 68fddd2d4..5f593190c 100644
--- a/vendor/errno/CHANGELOG.md
+++ b/vendor/errno/CHANGELOG.md
@@ -1,9 +1,30 @@
# [Unreleased]
+# [0.3.0] - 2023-02-12
+
+- Add haiku support
+ [#42](https://github.com/lambda-fairy/rust-errno/pull/42)
+
+- Add AIX support
+ [#54](https://github.com/lambda-fairy/rust-errno/pull/54)
+
+- Add formatting with `#![no_std]`
+ [#44](https://github.com/lambda-fairy/rust-errno/pull/44)
+
+- Switch from `winapi` to `windows-sys` [#55](https://github.com/lambda-fairy/rust-errno/pull/55)
+
+- Update minimum Rust version to 1.48
+ [#48](https://github.com/lambda-fairy/rust-errno/pull/48) [#55](https://github.com/lambda-fairy/rust-errno/pull/55)
+
+- Upgrade to Rust 2018 edition [#59](https://github.com/lambda-fairy/rust-errno/pull/59)
+
+- wasm32-wasi: Use `__errno_location` instead of `feature(thread_local)`. [#66](https://github.com/lambda-fairy/rust-errno/pull/66)
+
# [0.2.8] - 2021-10-27
- Optionally support no_std
[#31](https://github.com/lambda-fairy/rust-errno/pull/31)
-[Unreleased]: https://github.com/lambda-fairy/rust-errno/compare/v0.2.8...HEAD
+[Unreleased]: https://github.com/lambda-fairy/rust-errno/compare/v0.3.0...HEAD
+[0.3.0]: https://github.com/lambda-fairy/rust-errno/compare/v0.2.8...v0.3.0
[0.2.8]: https://github.com/lambda-fairy/rust-errno/compare/v0.2.7...v0.2.8
diff --git a/vendor/errno/Cargo.toml b/vendor/errno/Cargo.toml
index 2349617b0..98668cb9b 100644
--- a/vendor/errno/Cargo.toml
+++ b/vendor/errno/Cargo.toml
@@ -10,26 +10,40 @@
# See Cargo.toml.orig for the original contents.
[package]
+edition = "2018"
+rust-version = "1.48"
name = "errno"
-version = "0.2.8"
+version = "0.3.0"
authors = ["Chris Wong <lambda.fairy@gmail.com>"]
description = "Cross-platform interface to the `errno` variable."
documentation = "https://docs.rs/errno"
-categories = ["os"]
-license = "MIT/Apache-2.0"
+readme = "README.md"
+categories = [
+ "no-std",
+ "os",
+]
+license = "MIT OR Apache-2.0"
repository = "https://github.com/lambda-fairy/rust-errno"
[features]
default = ["std"]
std = []
+
[target."cfg(target_os=\"dragonfly\")".dependencies.errno-dragonfly]
version = "0.1.1"
+
[target."cfg(target_os=\"hermit\")".dependencies.libc]
version = "0.2"
+
[target."cfg(target_os=\"wasi\")".dependencies.libc]
version = "0.2"
+
[target."cfg(unix)".dependencies.libc]
version = "0.2"
-[target."cfg(windows)".dependencies.winapi]
-version = "0.3"
-features = ["errhandlingapi", "minwindef", "ntdef", "winbase"]
+
+[target."cfg(windows)".dependencies.windows-sys]
+version = "0.45"
+features = [
+ "Win32_Foundation",
+ "Win32_System_Diagnostics_Debug",
+]
diff --git a/vendor/errno/README.md b/vendor/errno/README.md
index a4762a7d0..48def1052 100644
--- a/vendor/errno/README.md
+++ b/vendor/errno/README.md
@@ -1,6 +1,6 @@
# errno [![CI](https://github.com/lambda-fairy/rust-errno/actions/workflows/main.yml/badge.svg)](https://github.com/lambda-fairy/rust-errno/actions/workflows/main.yml) [![Cargo](https://img.shields.io/crates/v/errno.svg)](https://crates.io/crates/errno)
-Cross-platform interface to the [`errno`][errno] variable. Works on Rust 1.13 or newer.
+Cross-platform interface to the [`errno`][errno] variable. Works on Rust 1.48 or newer.
Documentation is available at <https://docs.rs/errno>.
@@ -14,10 +14,22 @@ Add to your `Cargo.toml`:
```toml
[dependencies]
errno = "*"
-libc = "*"
```
+## Comparison with `std::io::Error`
+
+The standard library provides [`Error::last_os_error`][last_os_error] which fetches `errno` in the same way.
+
+This crate provides these extra features:
+
+- No heap allocations
+- Optional `#![no_std]` support
+- A `set_errno` function
+
+[last_os_error]: https://doc.rust-lang.org/std/io/struct.Error.html#method.last_os_error
+
+
## Examples
```rust
@@ -36,3 +48,15 @@ let code = e.0;
// Display a human-friendly error message
println!("Error {}: {}", code, e);
```
+
+
+## `#![no_std]`
+
+Enable `#![no_std]` support by disabling the default `std` feature:
+
+```toml
+[dependencies]
+errno = { version = "*", default-features = false }
+```
+
+The `Error` impl will be unavailable.
diff --git a/vendor/errno/clippy.toml b/vendor/errno/clippy.toml
new file mode 100644
index 000000000..f691ea3d2
--- /dev/null
+++ b/vendor/errno/clippy.toml
@@ -0,0 +1 @@
+msrv = "1.48"
diff --git a/vendor/errno/src/hermit.rs b/vendor/errno/src/hermit.rs
index d14a6c88f..99d4c3286 100644
--- a/vendor/errno/src/hermit.rs
+++ b/vendor/errno/src/hermit.rs
@@ -16,17 +16,17 @@
use Errno;
-pub fn with_description<F, T>(_err: Errno, callback: F) -> T where
- F: FnOnce(Result<&str, Errno>) -> T
+pub fn with_description<F, T>(_err: Errno, callback: F) -> T
+where
+ F: FnOnce(Result<&str, Errno>) -> T,
{
callback(Ok("unknown error"))
}
-pub const STRERROR_NAME: &'static str = "strerror_r";
+pub const STRERROR_NAME: &str = "strerror_r";
pub fn errno() -> Errno {
Errno(0)
}
-pub fn set_errno(_: Errno) {
-}
+pub fn set_errno(_: Errno) {}
diff --git a/vendor/errno/src/lib.rs b/vendor/errno/src/lib.rs
index b3a1dcb1a..20875b5c3 100644
--- a/vendor/errno/src/lib.rs
+++ b/vendor/errno/src/lib.rs
@@ -17,27 +17,19 @@
//! println!("Error {}: {}", code, e);
//! ```
-#![cfg_attr(target_os = "wasi", feature(thread_local))]
#![cfg_attr(not(feature = "std"), no_std)]
-#[cfg(unix)] extern crate libc;
-#[cfg(windows)] extern crate winapi;
-#[cfg(target_os = "dragonfly")] extern crate errno_dragonfly;
-#[cfg(target_os = "wasi")] extern crate libc;
-#[cfg(target_os = "hermit")] extern crate libc;
-
#[cfg_attr(unix, path = "unix.rs")]
#[cfg_attr(windows, path = "windows.rs")]
#[cfg_attr(target_os = "wasi", path = "wasi.rs")]
#[cfg_attr(target_os = "hermit", path = "hermit.rs")]
mod sys;
+use core::fmt;
#[cfg(feature = "std")]
-use std::fmt;
+use std::error::Error;
#[cfg(feature = "std")]
use std::io;
-#[cfg(feature = "std")]
-use std::error::Error;
/// Wraps a platform-specific error code.
///
@@ -50,7 +42,6 @@ use std::error::Error;
#[derive(Copy, Clone, Eq, Ord, PartialEq, PartialOrd, Hash)]
pub struct Errno(pub i32);
-#[cfg(feature = "std")]
impl fmt::Debug for Errno {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
sys::with_description(*self, |desc| {
@@ -62,21 +53,24 @@ impl fmt::Debug for Errno {
}
}
-#[cfg(feature = "std")]
impl fmt::Display for Errno {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
sys::with_description(*self, |desc| match desc {
- Ok(desc) => fmt.write_str(&desc),
+ Ok(desc) => fmt.write_str(desc),
Err(fm_err) => write!(
- fmt, "OS error {} ({} returned error {})",
- self.0, sys::STRERROR_NAME, fm_err.0),
+ fmt,
+ "OS error {} ({} returned error {})",
+ self.0,
+ sys::STRERROR_NAME,
+ fm_err.0
+ ),
})
}
}
-impl Into<i32> for Errno {
- fn into(self) -> i32 {
- self.0
+impl From<Errno> for i32 {
+ fn from(e: Errno) -> Self {
+ e.0
}
}
@@ -128,16 +122,27 @@ fn check_description() {
"Not owner"
} else if cfg!(target_os = "wasi") {
"Argument list too long"
+ } else if cfg!(target_os = "haiku") {
+ "Operation not allowed"
} else {
"Operation not permitted"
};
- set_errno(Errno(1));
+ let errno_code = if cfg!(target_os = "haiku") {
+ -2147483633
+ } else {
+ 1
+ };
+ set_errno(Errno(errno_code));
assert_eq!(errno().to_string(), expect);
assert_eq!(
format!("{:?}", errno()),
- format!("Errno {{ code: 1, description: Some({:?}) }}", expect));
+ format!(
+ "Errno {{ code: {}, description: Some({:?}) }}",
+ errno_code, expect
+ )
+ );
}
#[cfg(feature = "std")]
diff --git a/vendor/errno/src/unix.rs b/vendor/errno/src/unix.rs
index 820d89748..c22c587c2 100644
--- a/vendor/errno/src/unix.rs
+++ b/vendor/errno/src/unix.rs
@@ -12,40 +12,42 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#[cfg(feature = "std")]
-use std::ffi::CStr;
-use libc::c_int;
-#[cfg(feature = "std")]
-use libc::{self, c_char};
+use core::str;
#[cfg(target_os = "dragonfly")]
use errno_dragonfly::errno_location;
+use libc::{self, c_char, c_int, size_t, strlen};
-use Errno;
+use crate::Errno;
-#[cfg(feature = "std")]
-pub fn with_description<F, T>(err: Errno, callback: F) -> T where
- F: FnOnce(Result<&str, Errno>) -> T
+fn from_utf8_lossy(input: &[u8]) -> &str {
+ match str::from_utf8(input) {
+ Ok(valid) => valid,
+ Err(error) => unsafe { str::from_utf8_unchecked(&input[..error.valid_up_to()]) },
+ }
+}
+
+pub fn with_description<F, T>(err: Errno, callback: F) -> T
+where
+ F: FnOnce(Result<&str, Errno>) -> T,
{
- let mut buf = [0 as c_char; 1024];
- unsafe {
- if strerror_r(err.0, buf.as_mut_ptr(), buf.len() as libc::size_t) < 0 {
+ let mut buf = [0u8; 1024];
+ let c_str = unsafe {
+ if strerror_r(err.0, buf.as_mut_ptr() as *mut _, buf.len() as size_t) < 0 {
let fm_err = errno();
if fm_err != Errno(libc::ERANGE) {
return callback(Err(fm_err));
}
}
- }
- let c_str = unsafe { CStr::from_ptr(buf.as_ptr()) };
- callback(Ok(&String::from_utf8_lossy(c_str.to_bytes())))
+ let c_str_len = strlen(buf.as_ptr() as *const _);
+ &buf[..c_str_len]
+ };
+ callback(Ok(from_utf8_lossy(c_str)))
}
-#[cfg(feature = "std")]
-pub const STRERROR_NAME: &'static str = "strerror_r";
+pub const STRERROR_NAME: &str = "strerror_r";
pub fn errno() -> Errno {
- unsafe {
- Errno(*errno_location())
- }
+ unsafe { Errno(*errno_location()) }
}
pub fn set_errno(Errno(errno): Errno) {
@@ -54,26 +56,30 @@ pub fn set_errno(Errno(errno): Errno) {
}
}
-extern {
+extern "C" {
#[cfg(not(target_os = "dragonfly"))]
- #[cfg_attr(any(target_os = "macos",
- target_os = "ios",
- target_os = "freebsd"),
- link_name = "__error")]
- #[cfg_attr(any(target_os = "openbsd",
- target_os = "netbsd",
- target_os = "bitrig",
- target_os = "android"),
- link_name = "__errno")]
- #[cfg_attr(any(target_os = "solaris",
- target_os = "illumos"),
- link_name = "___errno")]
- #[cfg_attr(target_os = "linux",
- link_name = "__errno_location")]
+ #[cfg_attr(
+ any(target_os = "macos", target_os = "ios", target_os = "freebsd"),
+ link_name = "__error"
+ )]
+ #[cfg_attr(
+ any(
+ target_os = "openbsd",
+ target_os = "netbsd",
+ target_os = "bitrig",
+ target_os = "android"
+ ),
+ link_name = "__errno"
+ )]
+ #[cfg_attr(
+ any(target_os = "solaris", target_os = "illumos"),
+ link_name = "___errno"
+ )]
+ #[cfg_attr(target_os = "haiku", link_name = "_errnop")]
+ #[cfg_attr(target_os = "linux", link_name = "__errno_location")]
+ #[cfg_attr(target_os = "aix", link_name = "_Errno")]
fn errno_location() -> *mut c_int;
- #[cfg(feature = "std")]
#[cfg_attr(target_os = "linux", link_name = "__xpg_strerror_r")]
- fn strerror_r(errnum: c_int, buf: *mut c_char,
- buflen: libc::size_t) -> c_int;
+ fn strerror_r(errnum: c_int, buf: *mut c_char, buflen: size_t) -> c_int;
}
diff --git a/vendor/errno/src/wasi.rs b/vendor/errno/src/wasi.rs
index 28e3d9f11..b18fa9b2c 100644
--- a/vendor/errno/src/wasi.rs
+++ b/vendor/errno/src/wasi.rs
@@ -12,54 +12,49 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#[cfg(feature = "std")]
-use std::ffi::CStr;
-use libc::c_int;
-#[cfg(feature = "std")]
-use libc::{self, c_char};
+use core::str;
+use libc::{self, c_char, c_int, size_t, strlen};
-use Errno;
+use crate::Errno;
-#[cfg(feature = "std")]
-pub fn with_description<F, T>(err: Errno, callback: F) -> T where
- F: FnOnce(Result<&str, Errno>) -> T
+fn from_utf8_lossy(input: &[u8]) -> &str {
+ match str::from_utf8(input) {
+ Ok(valid) => valid,
+ Err(error) => unsafe { str::from_utf8_unchecked(&input[..error.valid_up_to()]) },
+ }
+}
+
+pub fn with_description<F, T>(err: Errno, callback: F) -> T
+where
+ F: FnOnce(Result<&str, Errno>) -> T,
{
- let mut buf = [0 as c_char; 1024];
- unsafe {
- if strerror_r(err.0, buf.as_mut_ptr(), buf.len() as libc::size_t) < 0 {
+ let mut buf = [0u8; 1024];
+ let c_str = unsafe {
+ if strerror_r(err.0, buf.as_mut_ptr() as *mut _, buf.len() as size_t) < 0 {
let fm_err = errno();
if fm_err != Errno(libc::ERANGE) {
return callback(Err(fm_err));
}
}
- }
- let c_str = unsafe { CStr::from_ptr(buf.as_ptr()) };
- callback(Ok(&String::from_utf8_lossy(c_str.to_bytes())))
+ let c_str_len = strlen(buf.as_ptr() as *const _);
+ &buf[..c_str_len]
+ };
+ callback(Ok(from_utf8_lossy(c_str)))
}
-#[cfg(feature = "std")]
-pub const STRERROR_NAME: &'static str = "strerror_r";
+pub const STRERROR_NAME: &str = "strerror_r";
pub fn errno() -> Errno {
- // libc_errno is thread-local, so simply read its value.
- unsafe {
- Errno(libc_errno)
- }
+ unsafe { Errno(*__errno_location()) }
}
pub fn set_errno(Errno(new_errno): Errno) {
- // libc_errno is thread-local, so simply assign to it.
unsafe {
- libc_errno = new_errno;
+ *__errno_location() = new_errno;
}
}
-extern {
- #[thread_local]
- #[link_name = "errno"]
- static mut libc_errno: c_int;
-
- #[cfg(feature = "std")]
- fn strerror_r(errnum: c_int, buf: *mut c_char,
- buflen: libc::size_t) -> c_int;
+extern "C" {
+ fn __errno_location() -> *mut c_int;
+ fn strerror_r(errnum: c_int, buf: *mut c_char, buflen: size_t) -> c_int;
}
diff --git a/vendor/errno/src/windows.rs b/vendor/errno/src/windows.rs
index 94e736210..9c7c0e400 100644
--- a/vendor/errno/src/windows.rs
+++ b/vendor/errno/src/windows.rs
@@ -12,59 +12,70 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#[cfg(feature = "std")]
-use std::ptr;
-use winapi::shared::minwindef::DWORD;
-#[cfg(feature = "std")]
-use winapi::shared::ntdef::WCHAR;
-#[cfg(feature = "std")]
-use winapi::um::winbase::{FORMAT_MESSAGE_FROM_SYSTEM, FORMAT_MESSAGE_IGNORE_INSERTS};
+use core::char::{self, REPLACEMENT_CHARACTER};
+use core::ptr;
+use core::str;
+use windows_sys::Win32::Foundation::{GetLastError, SetLastError, WIN32_ERROR};
+use windows_sys::Win32::System::Diagnostics::Debug::{
+ FormatMessageW, FORMAT_MESSAGE_FROM_SYSTEM, FORMAT_MESSAGE_IGNORE_INSERTS,
+};
-use Errno;
+use crate::Errno;
-#[cfg(feature = "std")]
-pub fn with_description<F, T>(err: Errno, callback: F) -> T where
- F: FnOnce(Result<&str, Errno>) -> T
+fn from_utf16_lossy<'a>(input: &[u16], output: &'a mut [u8]) -> &'a str {
+ let mut output_len = 0;
+ for c in char::decode_utf16(input.iter().copied().take_while(|&x| x != 0))
+ .map(|x| x.unwrap_or(REPLACEMENT_CHARACTER))
+ {
+ let c_len = c.len_utf8();
+ if c_len > output.len() - output_len {
+ break;
+ }
+ c.encode_utf8(&mut output[output_len..]);
+ output_len += c_len;
+ }
+ unsafe { str::from_utf8_unchecked(&output[..output_len]) }
+}
+
+pub fn with_description<F, T>(err: Errno, callback: F) -> T
+where
+ F: FnOnce(Result<&str, Errno>) -> T,
{
// This value is calculated from the macro
// MAKELANGID(LANG_SYSTEM_DEFAULT, SUBLANG_SYS_DEFAULT)
- let lang_id = 0x0800 as DWORD;
+ let lang_id = 0x0800_u32;
- let mut buf = [0 as WCHAR; 2048];
+ let mut buf = [0u16; 2048];
unsafe {
- let res = ::winapi::um::winbase::FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- ptr::null_mut(),
- err.0 as DWORD,
- lang_id,
- buf.as_mut_ptr(),
- buf.len() as DWORD,
- ptr::null_mut());
+ let res = FormatMessageW(
+ FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
+ ptr::null_mut(),
+ err.0 as u32,
+ lang_id,
+ buf.as_mut_ptr(),
+ buf.len() as u32,
+ ptr::null_mut(),
+ );
if res == 0 {
// Sometimes FormatMessageW can fail e.g. system doesn't like lang_id
let fm_err = errno();
return callback(Err(fm_err));
}
- let msg = String::from_utf16_lossy(&buf[..res as usize]);
+ let mut msg = [0u8; 2048];
+ let msg = from_utf16_lossy(&buf[..res as usize], &mut msg[..]);
// Trim trailing CRLF inserted by FormatMessageW
- #[allow(deprecated)] // TODO: remove when MSRV >= 1.30
- callback(Ok(msg.trim_right()))
+ callback(Ok(msg.trim_end()))
}
}
-#[cfg(feature = "std")]
-pub const STRERROR_NAME: &'static str = "FormatMessageW";
+pub const STRERROR_NAME: &str = "FormatMessageW";
pub fn errno() -> Errno {
- unsafe {
- Errno(::winapi::um::errhandlingapi::GetLastError() as i32)
- }
+ unsafe { Errno(GetLastError() as i32) }
}
pub fn set_errno(Errno(errno): Errno) {
- unsafe {
- ::winapi::um::errhandlingapi::SetLastError(errno as DWORD)
- }
+ unsafe { SetLastError(errno as WIN32_ERROR) }
}