From 42dae6e5709151ced54b09a072dba683cf5112aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20S=C3=B6ntgen?= Date: Mon, 2 Sep 2024 15:36:08 +0200 Subject: [PATCH] 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. --- repos/dde_linux/lib/symbols/wifi | 1 + repos/dde_linux/src/lib/wifi/socket_call.cc | 6 ++---- repos/dde_linux/src/lib/wifi/symbol.map | 1 + 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/repos/dde_linux/lib/symbols/wifi b/repos/dde_linux/lib/symbols/wifi index 9f72cd9260..f76556ecbb 100644 --- a/repos/dde_linux/lib/symbols/wifi +++ b/repos/dde_linux/lib/symbols/wifi @@ -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 diff --git a/repos/dde_linux/src/lib/wifi/socket_call.cc b/repos/dde_linux/src/lib/wifi/socket_call.cc index a21ca8582d..a646e724f9 100644 --- a/repos/dde_linux/src/lib/wifi/socket_call.cc +++ b/repos/dde_linux/src/lib/wifi/socket_call.cc @@ -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; diff --git a/repos/dde_linux/src/lib/wifi/symbol.map b/repos/dde_linux/src/lib/wifi/symbol.map index b2f8892648..9d6e7cb346 100644 --- a/repos/dde_linux/src/lib/wifi/symbol.map +++ b/repos/dde_linux/src/lib/wifi/symbol.map @@ -18,6 +18,7 @@ /* interface for libnl/wpa_driver_nl82011 */ wifi_if*; + convert_errno_from_linux; local: