From eee57cfccd84e8ecb936cbab2fc2a5a8922b8e27 Mon Sep 17 00:00:00 2001 From: Akos Vandra Date: Sun, 11 Dec 2022 15:40:15 +0100 Subject: [PATCH] show errno on error --- src/poll.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/poll.rs b/src/poll.rs index b2da244..df5c758 100644 --- a/src/poll.rs +++ b/src/poll.rs @@ -108,12 +108,13 @@ impl Poller { { extern "C" { fn eventfd(initval: libc::c_uint, flags: libc::c_int) -> libc::c_int; + fn __errno() -> *mut libc::c_int; } let fd = unsafe { eventfd(0, 0) }; if fd == -1 { // TODO: Switch back to syscall! once eventfd is in libc for the ESP-IDF - return Err(std::io::ErrorKind::Other.into()); + return Err(std::io::Error::new(std::io::ErrorKind::Other, format!("eventfd(0,0) returned {}", unsafe { *__errno() }))); } notify_pipe[0] = fd;