port: no eventfd support on FreeBSD
authorMichael Jeanson <mjeanson@efficios.com>
Tue, 13 Oct 2020 22:44:19 +0000 (18:44 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 28 Oct 2020 21:10:03 +0000 (17:10 -0400)
It's only used in the tests to create dummy fds, use fcntl to duplicate
the stdout fd instead.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I401f2bfe6a2375a9bf4d895956071f74e5684783

src/bin/lttng-sessiond/notification-thread.c
src/bin/lttng-sessiond/rotate.c
src/bin/lttng-sessiond/rotation-thread.c
tests/unit/test_payload.c
tests/unit/test_unix_socket.c

index 3ae8741d65b10a346bec2c965c1581873c8ea155..ba308bc831d7e26802f6995ae4fa433f89e1ced1 100644 (file)
@@ -17,7 +17,6 @@
 #include <common/utils.h>
 #include <common/align.h>
 #include <common/time.h>
-#include <sys/eventfd.h>
 #include <sys/stat.h>
 #include <time.h>
 #include <signal.h>
index 30ec241249e5a1020b88b63ee01845122fbb9b2a..813a1a0dc0847d699da2cf72251e8af0d4c88e45 100644 (file)
@@ -18,7 +18,6 @@
 #include <common/hashtable/utils.h>
 #include <common/kernel-ctl/kernel-ctl.h>
 #include <common/credentials.h>
-#include <sys/eventfd.h>
 #include <sys/stat.h>
 #include <time.h>
 #include <signal.h>
index 036296a3fe80bcc4a797311fcfa87d6e6f9078fc..5fc02969383c3820e239600a1966da92ba80fcd0 100644 (file)
@@ -16,7 +16,6 @@
 #include <common/align.h>
 #include <common/time.h>
 #include <common/hashtable/utils.h>
-#include <sys/eventfd.h>
 #include <sys/stat.h>
 #include <time.h>
 #include <signal.h>
index be97d49904481f6ae01819dec5ffe98993b8d760..e232cde66cfaba6f07f5d0cab56e55181e6228ad 100644 (file)
@@ -5,10 +5,12 @@
  *
  */
 
+#include <unistd.h>
+
+#include <common/compat/fcntl.h>
 #include <common/payload.h>
 #include <common/payload-view.h>
 #include <tap/tap.h>
-#include <sys/eventfd.h>
 
 static const int TEST_COUNT = 5;
 
@@ -27,7 +29,7 @@ static void test_fd_push_pop_order(void)
 
        diag("Validating fd push/pop order");
        for (i = 0; i < 3; i++) {
-               int fd = eventfd(0, 0);
+               int fd = fcntl(STDOUT_FILENO, F_DUPFD, 0);
                struct fd_handle *handle;
 
                assert(fd >= 0);
@@ -76,7 +78,7 @@ static void test_fd_push_pop_imbalance(void)
        diag("Validating fd pop imbalance");
        for (i = 0; i < 10; i++) {
                struct fd_handle *handle;
-               int fd = eventfd(0, 0);
+               int fd = fcntl(STDOUT_FILENO, F_DUPFD, 0);
 
                assert(fd >= 0);
 
@@ -119,14 +121,17 @@ fail:
 static void test_fd_pop_fd_root_views(void)
 {
        int ret, i;
-       const int fd = eventfd(0, 0);
-       struct fd_handle *handle = fd_handle_create(fd);
+       int fd = fcntl(STDOUT_FILENO, F_DUPFD, 0);
+       struct fd_handle *handle;
        struct lttng_payload payload;
        const char * const test_description = "Same file descriptor returned when popping from different top-level views";
 
-       lttng_payload_init(&payload);
+       assert(fd >= 0);
+       handle = fd_handle_create(fd);
        assert(handle);
 
+       lttng_payload_init(&payload);
+
        diag("Validating root view fd pop behaviour");
        ret = lttng_payload_push_fd_handle(&payload, handle);
        if (ret) {
index ca49e1b328ea61e07db86151225fe65085423fbc..b32a5174aa772e844e4a660d48a8626defcf7bf6 100644 (file)
@@ -5,6 +5,7 @@
  *
  */
 
+#include <common/compat/fcntl.h>
 #include <common/sessiond-comm/sessiond-comm.h>
 #include <common/payload.h>
 #include <common/payload-view.h>
@@ -12,7 +13,6 @@
 #include <common/utils.h>
 #include <common/defaults.h>
 #include <tap/tap.h>
-#include <sys/eventfd.h>
 #include <stdbool.h>
 #include <common/error.h>
 #include <lttng/constant.h>
@@ -65,17 +65,17 @@ static void test_high_fd_count(unsigned int fd_count)
 
        for (i = 0; i < fd_count; i++) {
                struct fd_handle *handle;
-               const int fd = eventfd(0, 0);
+               int fd = fcntl(STDOUT_FILENO, F_DUPFD, 0);
 
                if (fd < 0) {
-                       PERROR("Failed to create event fd while creating test payload");
+                       PERROR("Failed to create fd while creating test payload");
                        goto error;
                }
 
                handle = fd_handle_create(fd);
                if (!handle) {
                        if (close(fd)) {
-                               PERROR("Failed to close event fd while preparing test payload");
+                               PERROR("Failed to close fd while preparing test payload");
                                goto error;
                        }
                }
@@ -221,16 +221,16 @@ static void test_one_fd_per_message(unsigned int message_count)
                        goto error;
                }
 
-               fd = eventfd(0, 0);
+               fd = fcntl(STDOUT_FILENO, F_DUPFD, 0);
                if (fd < 0) {
-                       PERROR("Failed to create event fd while creating test payload");
+                       PERROR("Failed to create fd while creating test payload");
                        goto error;
                }
 
                handle = fd_handle_create(fd);
                if (!handle) {
                        if (close(fd)) {
-                               PERROR("Failed to close event fd while preparing test payload");
+                               PERROR("Failed to close fd while preparing test payload");
                                goto error;
                        }
                }
@@ -380,16 +380,16 @@ static void test_receive_in_chunks(
                goto error;
        }
 
-       fd = eventfd(0, 0);
+       fd = fcntl(STDOUT_FILENO, F_DUPFD, 0);
        if (fd < 0) {
-               PERROR("Failed to create event fd while creating test payload");
+               PERROR("Failed to create fd while creating test payload");
                goto error;
        }
 
        handle = fd_handle_create(fd);
        if (!handle) {
                if (close(fd)) {
-                       PERROR("Failed to close event fd while preparing test payload");
+                       PERROR("Failed to close fd while preparing test payload");
                        goto error;
                }
        }
This page took 0.029365 seconds and 4 git commands to generate.