summaryrefslogtreecommitdiff
path: root/lib/igt_aux.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2017-03-07 15:13:47 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2017-03-07 15:18:10 +0000
commit072bbf12707afa65cbe9c7d7ce81eb8ef5bd1d5b (patch)
tree5c48a85f98ac4e0b6a224b44e50b1cbf6d7fc7f6 /lib/igt_aux.c
parent75e032e18a70dd99fa5787a938ef2f51f515595d (diff)
lib: Break poll loop to check for a missed signal
If our parent dies, so should we. Our parent should kill us before it exits, but just in case we escape, wake up periodically to check upon our parent. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'lib/igt_aux.c')
-rw-r--r--lib/igt_aux.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/igt_aux.c b/lib/igt_aux.c
index 447e4f08..2eb71449 100644
--- a/lib/igt_aux.c
+++ b/lib/igt_aux.c
@@ -359,6 +359,7 @@ hang_detector_process(pid_t pid, dev_t rdev)
struct udev_monitor *mon =
udev_monitor_new_from_netlink(udev_new(), "kernel");
struct pollfd pfd;
+ int ret;
udev_monitor_filter_add_match_subsystem_devtype(mon, "drm", NULL);
udev_monitor_enable_receiving(mon);
@@ -366,14 +367,19 @@ hang_detector_process(pid_t pid, dev_t rdev)
pfd.fd = udev_monitor_get_fd(mon);
pfd.events = POLLIN;
- while (poll(&pfd, 1, -1) > 0) {
+ while ((ret = poll(&pfd, 1, 2000)) >= 0) {
struct udev_device *dev;
dev_t devnum;
- if (kill(pid, 0)) /* Parent has died, so must we. */
+ if (kill(pid, 0)) { /* Parent has died, so must we. */
+ igt_warn("Parent died without killing its children (%s)\n",
+ __func__);
break;
+ }
- dev = udev_monitor_receive_device(mon);
+ dev = NULL;
+ if (ret > 0)
+ dev = udev_monitor_receive_device(mon);
if (dev == NULL)
continue;