Move to kernel style SPDX license identifiers
[babeltrace.git] / src / compat / socket.h
index b1fe15978a763a2bdbccca238cb19f971ed09c8f..f5c59b4bb1e53133ff4757e0c32a8721067ce3d7 100644 (file)
@@ -1,29 +1,15 @@
-#ifndef _BABELTRACE_COMPAT_SOCKET_H
-#define _BABELTRACE_COMPAT_SOCKET_H
-
 /*
- * Copyright (C) 2015-2017  Michael Jeanson <mjeanson@efficios.com>
- *               2015  Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * SPDX-License-Identifier: MIT
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * Copyright (C) 2015-2017 Michael Jeanson <mjeanson@efficios.com>
+ * Copyright (C) 2015 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
  */
 
+#ifndef _BABELTRACE_COMPAT_SOCKET_H
+#define _BABELTRACE_COMPAT_SOCKET_H
+
+#include <stdbool.h>
+
 #ifdef __MINGW32__
 
 #include <winsock2.h>
@@ -33,7 +19,7 @@
 #define BT_SOCKET SOCKET
 
 static inline
-int bt_socket_init(void)
+int bt_socket_init(int log_level)
 {
        WORD verreq;
        WSADATA wsa;
@@ -44,15 +30,17 @@ int bt_socket_init(void)
 
        ret = WSAStartup(verreq, &wsa);
        if (ret != 0) {
-#ifdef BT_LOGE
-               BT_LOGE("Winsock init failed with error: %d", ret);
+#ifdef BT_LOG_WRITE_CUR_LVL
+               BT_LOG_WRITE_CUR_LVL(BT_LOG_ERROR, log_level, BT_LOG_TAG,
+                               "Winsock init failed with error: %d", ret);
 #endif
                goto end;
        }
 
        if (LOBYTE(wsa.wVersion) != 2 || HIBYTE(wsa.wVersion) != 2) {
-#ifdef BT_LOGE_STR
-               BT_LOGE_STR("Could not init winsock 2.2 support");
+#ifdef BT_LOG_WRITE_CUR_LVL
+               BT_LOG_WRITE_CUR_LVL(BT_LOG_ERROR, log_level, BT_LOG_TAG,
+                               "Could not init winsock 2.2 support");
 #endif
                WSACleanup();
                ret = -1;
@@ -272,17 +260,20 @@ const char *bt_socket_errormsg(void)
 
 #else /* __MINGW32__ */
 
-#include <unistd.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
+#include <errno.h>
 #include <netdb.h>
+#include <netinet/in.h>
+#include <sys/socket.h>
+#include <unistd.h>
+
+#include <glib.h>
 
 #define BT_INVALID_SOCKET -1
 #define BT_SOCKET_ERROR -1
 #define BT_SOCKET int
 
 static inline
-int bt_socket_init(void)
+int bt_socket_init(int log_level)
 {
        return 0;
 }
This page took 0.023473 seconds and 4 git commands to generate.