1
0
Fork 0
forked from wry/wry

all: simplify handling of Errno values

This commit is contained in:
Julian Orth 2026-04-02 18:34:12 +02:00
parent 9c605df692
commit 34914eccb0
58 changed files with 443 additions and 464 deletions

View file

@ -2,7 +2,11 @@ use {
crate::{
async_engine::{AsyncEngine, SpawnedFuture},
io_uring::IoUring,
utils::{buf::TypedBuf, errorfmt::ErrorFmt, oserror::OsError},
utils::{
buf::TypedBuf,
errorfmt::ErrorFmt,
oserror::{OsError, OsErrorExt2},
},
},
std::rc::Rc,
thiserror::Error,
@ -25,13 +29,10 @@ pub fn install(
uapi::sigaddset(&mut set, c::SIGINT).unwrap();
uapi::sigaddset(&mut set, c::SIGTERM).unwrap();
uapi::sigaddset(&mut set, c::SIGPIPE).unwrap();
if let Err(e) = uapi::pthread_sigmask(c::SIG_BLOCK, Some(&set), None) {
return Err(SighandError::BlockFailed(e.into()));
}
let fd = match uapi::signalfd_new(&set, c::SFD_CLOEXEC) {
Ok(fd) => Rc::new(fd),
Err(e) => return Err(SighandError::CreateFailed(e.into())),
};
uapi::pthread_sigmask(c::SIG_BLOCK, Some(&set), None).map_os_err(SighandError::BlockFailed)?;
let fd = uapi::signalfd_new(&set, c::SFD_CLOEXEC)
.map(Rc::new)
.map_os_err(SighandError::CreateFailed)?;
Ok(eng.spawn("signal handler", handle_signals(fd, ring.clone())))
}