All of lore.kernel.org
 help / color / mirror / Atom feed
From: D Scott Phillips <d.scott.phillips@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t 18/29] runner: Add support for non-Linux operating systems
Date: Tue, 10 Dec 2019 16:52:24 -0800	[thread overview]
Message-ID: <20191211005235.67897-19-d.scott.phillips@intel.com> (raw)
In-Reply-To: <20191211005235.67897-1-d.scott.phillips@intel.com>

The runner depends on Linux specific functionality like signalfd
and the watchdog interface. Provide stub functionality for other
platforms so that the runner can continue with reduced
functionality.

Signed-off-by: D Scott Phillips <d.scott.phillips@intel.com>
---
 runner/executor.c | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/runner/executor.c b/runner/executor.c
index f36bfd3d..095451c4 100644
--- a/runner/executor.c
+++ b/runner/executor.c
@@ -1,7 +1,9 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <glib.h>
+#if defined(__linux__)
 #include <linux/watchdog.h>
+#endif
 #if HAVE_OPING
 #include <oping.h>
 #endif
@@ -13,7 +15,9 @@
 #include <sys/ioctl.h>
 #include <sys/select.h>
 #include <sys/poll.h>
+#if defined(__linux__)
 #include <sys/signalfd.h>
+#endif
 #include <sys/stat.h>
 #include <sys/time.h>
 #include <sys/types.h>
@@ -27,6 +31,12 @@
 #include "executor.h"
 #include "output_strings.h"
 
+#if !defined(__linux__)
+#define CLOCK_BOOTTIME CLOCK_REALTIME
+#define WDIOC_SETTIMEOUT 0
+#define WDIOC_KEEPALIVE 0
+#endif
+
 static struct {
 	int *fds;
 	size_t num_dogs;
@@ -674,7 +684,14 @@ static int monitor_output(pid_t child,
 	char *outbuf = NULL;
 	size_t outbufsize = 0;
 	char current_subtest[256] = {};
+#if defined(__linux__)
 	struct signalfd_siginfo siginfo;
+#else
+	struct signalfd_siginfo {
+		pid_t ssi_pid;
+		int ssi_signo;
+	} siginfo;
+#endif
 	ssize_t s;
 	int n, status;
 	int nfds = outfd;
@@ -1455,7 +1472,14 @@ static void oom_immortal(void)
 
 static bool should_die_because_signal(int sigfd)
 {
+#if defined(__linux__)
 	struct signalfd_siginfo siginfo;
+#else
+	struct signalfd_siginfo {
+		pid_t ssi_pid;
+		int ssi_signo;
+	} siginfo;
+#endif
 	int ret;
 	struct pollfd sigpoll = { .fd = sigfd, .events = POLLIN | POLLRDBAND };
 
@@ -1494,7 +1518,7 @@ bool execute(struct execute_state *state,
 	struct utsname unamebuf;
 	int resdirfd, testdirfd, unamefd, timefd;
 	sigset_t sigmask;
-	int sigfd;
+	int sigfd = -1;
 	double time_spent = 0.0;
 	bool status = true;
 
@@ -1543,7 +1567,9 @@ bool execute(struct execute_state *state,
 	sigaddset(&sigmask, SIGTERM);
 	sigaddset(&sigmask, SIGQUIT);
 	sigaddset(&sigmask, SIGHUP);
+#if defined(__linux__)
 	sigfd = signalfd(-1, &sigmask, O_CLOEXEC);
+#endif
 	sigprocmask(SIG_BLOCK, &sigmask, NULL);
 
 	if (sigfd < 0) {
-- 
2.23.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  parent reply	other threads:[~2019-12-11  0:59 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-11  0:52 [igt-dev] [PATCH i-g-t 00/30] Add FreeBSD Support D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 01/29] Remove unused includes D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 02/29] lib/igt_chipset: Add missing libdrm dependency D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 03/29] lib/igt_core: update longjmp buffers to type sigjmp_buf D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 04/29] Include <sys/wait.h>, <limits.h>, and <signal.h> where appropriate D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 05/29] Use /bin/sh for shell scripts D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 06/29] tools/intel_gpu_top: Use POSIX signal handler type definition D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 07/29] kms_atomic: change `PAGE_SIZE` to `page_size` D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 08/29] lib: remove open-coded card index fetching D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 09/29] igt: replace mmap64() with mmap() D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 10/29] drm-uapi: patch sync_file.h to depend on drm.h D Scott Phillips
2019-12-12 11:01   ` Jani Nikula
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 11/29] i915/pm_backlight: use POSIX basename D Scott Phillips
2019-12-16 13:31   ` Petri Latvala
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 12/29] Include Linux specific headers only on Linux D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 13/29] lib/igt_core: skip oom_adjustments on non-Linux platforms D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 14/29] i915/gem: Omit Linux-specific madvise, mmap, and sched flags on non-Linux D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 15/29] lib/igt_aux: add null implementation D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 16/29] lib/igt_kmod: " D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 17/29] lib/igt_perf: " D Scott Phillips
2019-12-11  0:52 ` D Scott Phillips [this message]
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 19/29] Use ETIMEDOUT in place of ETIME on FreeBSD D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 20/29] ilog2: Use libc provided fls() " D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 21/29] lib: undefine FreeBSD libc's ALIGN macro D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 22/29] lib: Add FreeBSD-specific pthread logic D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 23/29] lib/igt_kms: Add FreeBSD support D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 24/29] lib/ioctl_wrappers: Support FreeBSD in igt_require_gem D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 25/29] lib/intel_os: Implement get_avail_ram and get_total_swap for FreeBSD D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 26/29] lib/igt_device: Implement get_card_index " D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 27/29] lib/igt_debugfs: Implement mount() " D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 28/29] build: Add support for building on non-Linux D Scott Phillips
2019-12-11  0:52 ` [igt-dev] [PATCH i-g-t 29/29] lib/igt_device_scan: add null implementation D Scott Phillips
2019-12-11  8:11 ` [igt-dev] ✗ GitLab.Pipeline: warning for Add FreeBSD Support Patchwork
2019-12-12 11:14 ` [igt-dev] [PATCH i-g-t 00/30] " Jani Nikula
2019-12-12 18:20   ` D Scott Phillips
2019-12-16 13:55     ` Petri Latvala
2019-12-27  9:38       ` Arkadiusz Hiler

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=20191211005235.67897-19-d.scott.phillips@intel.com \
    --to=d.scott.phillips@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.