[PATCH:intel-gpu-tools 7/7] Skip MADV_DOFORK & MADV_DONTFORK calls on OS'es that don't support them
Alan Coopersmith
alan.coopersmith at oracle.com
Tue Dec 23 19:07:14 PST 2014
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
tests/gem_userptr_blits.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/tests/gem_userptr_blits.c b/tests/gem_userptr_blits.c
index d641c12..be2fdf9 100644
--- a/tests/gem_userptr_blits.c
+++ b/tests/gem_userptr_blits.c
@@ -594,14 +594,18 @@ static void test_forked_access(int fd)
int ret;
ret = posix_memalign(&ptr1, PAGE_SIZE, sizeof(linear));
+#ifdef MADV_DONTFORK
ret |= madvise(ptr1, sizeof(linear), MADV_DONTFORK);
+#endif
ret |= gem_userptr(fd, ptr1, sizeof(linear), 0, &handle1);
igt_assert(ret == 0);
igt_assert(ptr1);
igt_assert(handle1);
ret = posix_memalign(&ptr2, PAGE_SIZE, sizeof(linear));
+#ifdef MADV_DONTFORK
ret |= madvise(ptr2, sizeof(linear), MADV_DONTFORK);
+#endif
ret |= gem_userptr(fd, ptr2, sizeof(linear), 0, &handle2);
igt_assert(ret == 0);
igt_assert(ptr2);
@@ -623,12 +627,16 @@ static void test_forked_access(int fd)
igt_assert(memcmp(ptr1, ptr2, sizeof(linear)) == 0);
+#ifdef MADV_DOFORK
ret = madvise(ptr1, sizeof(linear), MADV_DOFORK);
igt_assert(ret == 0);
+#endif
free(ptr1);
+#ifdef MADV_DOFORK
ret = madvise(ptr2, sizeof(linear), MADV_DOFORK);
igt_assert(ret == 0);
+#endif
free(ptr2);
}
--
1.7.9.2
More information about the xorg-devel
mailing list