libwutsocket: Add __wut_socket_init_devoptab() and __wut_socket_fini_devoptab()

This commit is contained in:
Maschell 2021-04-28 22:12:07 +02:00
parent 912a373b12
commit f4cd99f1b1

View File

@ -4,9 +4,6 @@
int h_errno; int h_errno;
static uint32_t
__wut_socket_refcount = 0;
static devoptab_t static devoptab_t
__wut_socket_devoptab = __wut_socket_devoptab =
{ {
@ -76,43 +73,52 @@ __wut_nsysnet_error_code_map[] =
}; };
void void
__wut_socket_init_devoptab()
{
AddDevice(&__wut_socket_devoptab);
}
void
__wut_socket_fini_devoptab()
{
RemoveDevice("soc:");
}
__attribute__ ((deprecated))
static inline void
WHBInitializeSocketLibrary() {}
__attribute__ ((deprecated))
static inline void
WHBDeinitializeSocketLibrary() {}
inline void
socket_lib_init() socket_lib_init()
{ {
if (0 == __wut_socket_refcount++) { RPLWRAP(socket_lib_init)();
RPLWRAP(socket_lib_init)();
AddDevice(&__wut_socket_devoptab);
}
} }
void inline void
socket_lib_finish() socket_lib_finish()
{ {
if (0 == --__wut_socket_refcount) { RPLWRAP(socket_lib_finish)();
RemoveDevice("soc:");
RPLWRAP(socket_lib_finish)();
}
} }
void
WHBInitializeSocketLibrary() __attribute__((alias("socket_lib_init")));
void
WHBDeinitializeSocketLibrary() __attribute__((alias("socket_lib_finish")));
void __attribute__((weak)) void __attribute__((weak))
__init_wut_socket() __init_wut_socket()
{ {
socket_lib_init(); RPLWRAP(socket_lib_init)();
__wut_socket_init_devoptab();
ACInitialize(); ACInitialize();
ACConnectAsync(); ACConnectAsync();
} }
void __attribute__((weak)) void __attribute__((weak))
__fini_wut_socket() __fini_wut_socket() {
{
ACClose(); ACClose();
ACFinalize(); ACFinalize();
socket_lib_finish(); __wut_socket_fini_devoptab();
RPLWRAP(socket_lib_finish)();
} }
int int