lttng-dev.lists.lttng.org archive mirror
 help / color / mirror / Atom feed
From: Alistair Francis via lttng-dev <lttng-dev@lists.lttng.org>
To: lttng-dev@lists.lttng.org
Cc: alistair23@gmail.com
Subject: [lttng-dev] [PATCH lttng-tools 2/2] Tests: select_poll_epoll: Add support for _time64
Date: Fri,  7 Oct 2022 10:39:18 +1000	[thread overview]
Message-ID: <20221007003918.344922-2-alistair.francis@opensource.wdc.com> (raw)
In-Reply-To: <20221007003918.344922-1-alistair.francis@opensource.wdc.com>

From: Alistair Francis <alistair.francis@wdc.com>

Add support for the  64-bit time_t syscalls SYS_ppoll_time64
and SYS_pselect6_time64.

These are the syscalls that exist 32-bit platforms since the 5.1 kernel.
32-bit platforms with a 64-bit time_t only have these and don't have the
original syscalls (such as 32-bit RISC-V).

Fixes: https://github.com/lttng/lttng-tools/pull/162
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
---
 tests/regression/kernel/select_poll_epoll.cpp | 53 +++++++++++++++++++
 1 file changed, 53 insertions(+)

diff --git a/tests/regression/kernel/select_poll_epoll.cpp b/tests/regression/kernel/select_poll_epoll.cpp
index c0b688217..4a6d394f4 100644
--- a/tests/regression/kernel/select_poll_epoll.cpp
+++ b/tests/regression/kernel/select_poll_epoll.cpp
@@ -5,6 +5,7 @@
  *
  */
 
+#include <errno.h>
 #include <fcntl.h>
 #include <limits.h>
 #include <poll.h>
@@ -456,8 +457,22 @@ void ppoll_fds_buffer_overflow(
 	ufds[0].fd = wait_fd;
 	ufds[0].events = POLLIN|POLLPRI;
 
+#ifdef SYS_ppoll_time64
+	/*
+	 * As there is no timeout value, we don't convert to/from
+	 * 64/32-bit time_t.
+	 */
+	ret = syscall(SYS_ppoll_time64, ufds, 100, NULL, NULL);
+	if (ret == 0 || errno != ENOSYS) {
+		goto ppoll_fds_buffer_overflow_done;
+	}
+#endif
+
+#ifdef SYS_ppoll
 	ret = syscall(SYS_ppoll, ufds, 100, NULL, NULL);
+#endif
 
+ppoll_fds_buffer_overflow_done:
 	if (ret < 0) {
 		PERROR("ppoll");
 	} else if (ret > 0) {
@@ -483,7 +498,22 @@ void ppoll_fds_ulong_max(FILE *validation_output_file __attribute__((unused)))
 	ufds[0].fd = wait_fd;
 	ufds[0].events = POLLIN|POLLPRI;
 
+#ifdef SYS_ppoll_time64
+	/*
+	 * As there is no timeout value, we don't convert to/from
+	 * 64/32-bit time_t.
+	 */
+	ret = syscall(SYS_ppoll_time64, ufds, ULONG_MAX, NULL, NULL);
+	if (ret == 0 || errno != ENOSYS) {
+		goto ppoll_fds_ulong_max_done;
+	}
+#endif
+
+#ifdef SYS_ppoll
 	ret = syscall(SYS_ppoll, ufds, ULONG_MAX, NULL, NULL);
+#endif
+
+ppoll_fds_ulong_max_done:
 	if (ret < 0) {
 		/* Expected error. */
 	} else if (ret > 0) {
@@ -524,7 +554,18 @@ void pselect_invalid_fd(FILE *validation_output_file __attribute__((unused)))
 	FD_ZERO(&rfds);
 	FD_SET(fd, &rfds);
 
+#ifdef SYS_pselect6_time64
+	ret = syscall(SYS_pselect6_time64, fd + 1, &rfds, NULL, NULL, NULL, NULL);
+	if (ret == 0 || errno != ENOSYS) {
+		goto pselect_invalid_fd_done;
+	}
+#endif
+
+#ifdef SYS_pselect6
 	ret = syscall(SYS_pselect6, fd + 1, &rfds, NULL, NULL, NULL, NULL);
+#endif
+
+pselect_invalid_fd_done:
 	if (ret == -1) {
 		/* Expected error. */
 	} else if (ret) {
@@ -553,8 +594,20 @@ void pselect_invalid_pointer(
 	FD_ZERO(&rfds);
 	FD_SET(wait_fd, &rfds);
 
+#ifdef SYS_pselect6_time64
+	ret = syscall(SYS_pselect6_time64, 1, &rfds, (fd_set *) invalid, NULL, NULL,
+			NULL);
+	if (ret == 0 || errno != ENOSYS) {
+		goto pselect_invalid_pointer_done;
+	}
+#endif
+
+#ifdef SYS_pselect6
 	ret = syscall(SYS_pselect6, 1, &rfds, (fd_set *) invalid, NULL, NULL,
 			NULL);
+#endif
+
+pselect_invalid_pointer_done:
 	if (ret == -1) {
 		/* Expected error. */
 	} else if (ret) {
-- 
2.37.3

_______________________________________________
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

  reply	other threads:[~2022-10-07  6:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-07  0:39 [lttng-dev] [PATCH lttng-tools 1/2] README: Update the Userspace RCU requirements Alistair Francis via lttng-dev
2022-10-07  0:39 ` Alistair Francis via lttng-dev [this message]
2022-10-12 13:19   ` [lttng-dev] [PATCH lttng-tools 2/2] Tests: select_poll_epoll: Add support for _time64 Jérémie Galarneau via lttng-dev
2022-10-13  0:12     ` Alistair Francis via lttng-dev
2022-10-13  7:08       ` Jérémie Galarneau via lttng-dev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221007003918.344922-2-alistair.francis@opensource.wdc.com \
    --to=lttng-dev@lists.lttng.org \
    --cc=alistair.francis@opensource.wdc.com \
    --cc=alistair23@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).