lib/wifi: make errno conversion function public

The 'convert_errno_from_linux' function was already used internally to
convert the Linux errno values to the matching FreeBSD libc ones when
calling socket functions.

It will now also be used to convert the error values included in
netlink messages as those, naturally, also correspond to the Linux
ones.

Issue #5341.
This commit is contained in:
Josef Söntgen 2024-09-02 15:36:08 +02:00 committed by Norman Feske
parent e5df8da1bd
commit 42dae6e570
3 changed files with 4 additions and 4 deletions

View File

@ -24,3 +24,4 @@ _ZN4Wifi26firmware_establish_handlerERNS_24Firmware_request_handlerE T
_ZN4Wifi10set_rfkillEb T
_ZN4Wifi14rfkill_blockedEv T
_ZN4Wifi24rfkill_establish_handlerERNS_27Rfkill_notification_handlerE T
convert_errno_from_linux T

View File

@ -54,7 +54,7 @@ enum : int {
};
static int convert_errno_from_linux(int linux_errno)
extern "C" int convert_errno_from_linux(int linux_errno)
{
if (linux_errno >= 0)
return linux_errno;
@ -100,9 +100,7 @@ static int convert_errno_from_linux(int linux_errno)
case ENODEV: return -(int)Libc::Errno::BSD_ENODEV;
case ENOENT: return -(int)Libc::Errno::BSD_ENOENT;
case ENOEXEC: return -(int)Libc::Errno::BSD_ENOEXEC;
case ENOLINK:
error("ENOLINK (", (int) ENOLINK, ") -> ", (int)Libc::Errno::BSD_ENOLINK);
return -(int)Libc::Errno::BSD_ENOLINK;
case ENOLINK: return -(int)Libc::Errno::BSD_ENOLINK;
case ENOMEM: return -(int)Libc::Errno::BSD_ENOMEM;
case ENOMSG: return -(int)Libc::Errno::BSD_ENOMSG;
case ENOPROTOOPT: return -(int)Libc::Errno::BSD_ENOPROTOOPT;

View File

@ -18,6 +18,7 @@
/* interface for libnl/wpa_driver_nl82011 */
wifi_if*;
convert_errno_from_linux;
local: