summaryrefslogtreecommitdiffstats
path: root/Utilities/cmlibuv/src/uv-common.c
diff options
context:
space:
mode:
Diffstat (limited to 'Utilities/cmlibuv/src/uv-common.c')
-rw-r--r--Utilities/cmlibuv/src/uv-common.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/Utilities/cmlibuv/src/uv-common.c b/Utilities/cmlibuv/src/uv-common.c
index 49fc184..2fcbe3d 100644
--- a/Utilities/cmlibuv/src/uv-common.c
+++ b/Utilities/cmlibuv/src/uv-common.c
@@ -294,6 +294,36 @@ int uv_tcp_bind(uv_tcp_t* handle,
}
+int uv_udp_init_ex(uv_loop_t* loop, uv_udp_t* handle, unsigned flags) {
+ unsigned extra_flags;
+ int domain;
+ int rc;
+
+ /* Use the lower 8 bits for the domain. */
+ domain = flags & 0xFF;
+ if (domain != AF_INET && domain != AF_INET6 && domain != AF_UNSPEC)
+ return UV_EINVAL;
+
+ /* Use the higher bits for extra flags. */
+ extra_flags = flags & ~0xFF;
+ if (extra_flags & ~UV_UDP_RECVMMSG)
+ return UV_EINVAL;
+
+ rc = uv__udp_init_ex(loop, handle, flags, domain);
+
+ if (rc == 0)
+ if (extra_flags & UV_UDP_RECVMMSG)
+ handle->flags |= UV_HANDLE_UDP_RECVMMSG;
+
+ return rc;
+}
+
+
+int uv_udp_init(uv_loop_t* loop, uv_udp_t* handle) {
+ return uv_udp_init_ex(loop, handle, AF_UNSPEC);
+}
+
+
int uv_udp_bind(uv_udp_t* handle,
const struct sockaddr* addr,
unsigned int flags) {
@@ -823,3 +853,19 @@ void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count) {
uv__free(cpu_infos);
}
+
+
+#ifdef __GNUC__ /* Also covers __clang__ and __INTEL_COMPILER. */
+__attribute__((destructor))
+#endif
+void uv_library_shutdown(void) {
+ static int was_shutdown;
+
+ if (was_shutdown)
+ return;
+
+ uv__process_title_cleanup();
+ uv__signal_cleanup();
+ uv__threadpool_cleanup();
+ was_shutdown = 1;
+}