From: Michael Jeanson Date: Tue, 13 Oct 2020 22:44:19 +0000 (-0400) Subject: port: no eventfd support on FreeBSD X-Git-Tag: v2.13.0-rc1~447 X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=commitdiff_plain;h=7b0027b3e2a8b3120980f43a58f132ee58b69f54;ds=sidebyside port: no eventfd support on FreeBSD It's only used in the tests to create dummy fds, use fcntl to duplicate the stdout fd instead. Signed-off-by: Michael Jeanson Signed-off-by: Jérémie Galarneau Change-Id: I401f2bfe6a2375a9bf4d895956071f74e5684783 --- diff --git a/src/bin/lttng-sessiond/notification-thread.c b/src/bin/lttng-sessiond/notification-thread.c index 3ae8741d6..ba308bc83 100644 --- a/src/bin/lttng-sessiond/notification-thread.c +++ b/src/bin/lttng-sessiond/notification-thread.c @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include diff --git a/src/bin/lttng-sessiond/rotate.c b/src/bin/lttng-sessiond/rotate.c index 30ec24124..813a1a0dc 100644 --- a/src/bin/lttng-sessiond/rotate.c +++ b/src/bin/lttng-sessiond/rotate.c @@ -18,7 +18,6 @@ #include #include #include -#include #include #include #include diff --git a/src/bin/lttng-sessiond/rotation-thread.c b/src/bin/lttng-sessiond/rotation-thread.c index 036296a3f..5fc029693 100644 --- a/src/bin/lttng-sessiond/rotation-thread.c +++ b/src/bin/lttng-sessiond/rotation-thread.c @@ -16,7 +16,6 @@ #include #include #include -#include #include #include #include diff --git a/tests/unit/test_payload.c b/tests/unit/test_payload.c index be97d4990..e232cde66 100644 --- a/tests/unit/test_payload.c +++ b/tests/unit/test_payload.c @@ -5,10 +5,12 @@ * */ +#include + +#include #include #include #include -#include 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) { diff --git a/tests/unit/test_unix_socket.c b/tests/unit/test_unix_socket.c index ca49e1b32..b32a5174a 100644 --- a/tests/unit/test_unix_socket.c +++ b/tests/unit/test_unix_socket.c @@ -5,6 +5,7 @@ * */ +#include #include #include #include @@ -12,7 +13,6 @@ #include #include #include -#include #include #include #include @@ -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; } }