You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello following our short conversation in #22 I'm creating a separate issue to expose errno.
Summary
Some syscall functions like setsockopt and simiar return -1 but set the errno to actual error.
Currently there's no way to access this errno value. ffi-napi exposes this via FFI.errno() function call.
Motivation
Since node v20.12.x broke ffi-napi and it seems like ffi-napi is not supported, I'm trying to migrate net-keepalive to ffi-rs one of the blockers is the lack of errno. Without it we can't provide clear enough error message on why setsockopt failed.
By default, ffi-rs will not output errno info, developers can get it by pass errno: true when call load method like
constfoo=load({library: 'libnative',funcName: 'setsockopt',retType: DataType.I32,paramsType: [DataType.I32,DataType.I32,DataType.I32,DataType.External,DataType.I32],paramsValue: [socket._handle.fd,level,option,pointer[0],4],errno: true// set errno as true})// The above code will return a object include three fields include errnoCode, errnoMessage, and the foreign function return value// { errnoCode: 22, errnoMessage: 'Invalid argument (os error 22)', value: -1 }
Hello following our short conversation in #22 I'm creating a separate issue to expose
errno
.Summary
Some syscall functions like
setsockopt
and simiar return-1
but set theerrno
to actual error.Currently there's no way to access this
errno
value.ffi-napi
exposes this viaFFI.errno()
function call.Motivation
Since node v20.12.x broke
ffi-napi
and it seems likeffi-napi
is not supported, I'm trying to migratenet-keepalive
toffi-rs
one of the blockers is the lack oferrno
. Without it we can't provide clear enough error message on whysetsockopt
failed.References:
The text was updated successfully, but these errors were encountered: