[PATCH i-g-t] tests/kms_atomic: fix musl compilation

Kamil Konieczny kamil.konieczny at linux.intel.com
Mon Mar 4 16:43:54 UTC 2024


On musl there is already defined PAGE_SIZE and it is casing
compilation error:

../tests/kms_atomic.c: In function 'crtc_invalid_params_fence'
../tests/kms_atomic.c:893:25: error: expected identifier or '(' before numeric constant
  893 |         const ptrdiff_t PAGE_SIZE = sysconf(_SC_PAGE_SIZE);

Change this variable name in order to fix it.

Link: https://gitlab.freedesktop.org/drm/igt-gpu-tools/-/issues/138
Signed-off-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>
---
 tests/kms_atomic.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/tests/kms_atomic.c b/tests/kms_atomic.c
index 96cd58571..489b0d709 100644
--- a/tests/kms_atomic.c
+++ b/tests/kms_atomic.c
@@ -890,7 +890,7 @@ static void crtc_invalid_params_fence(data_t *data, igt_output_t *output)
 {
 	int timeline, fence_fd;
 	void *map;
-	const ptrdiff_t PAGE_SIZE = sysconf(_SC_PAGE_SIZE);
+	const ptrdiff_t page_size = sysconf(_SC_PAGE_SIZE);
 	uint64_t old_mode_id = data->pipe->values[IGT_CRTC_MODE_ID];
 
 	igt_require_sw_sync();
@@ -898,28 +898,28 @@ static void crtc_invalid_params_fence(data_t *data, igt_output_t *output)
 	timeline = sw_sync_timeline_create();
 
 	/* invalid out_fence_ptr */
-	map = mmap(NULL, PAGE_SIZE, PROT_READ, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
+	map = mmap(NULL, page_size, PROT_READ, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
 	igt_assert(map != MAP_FAILED);
 
 	igt_pipe_obj_set_prop_value(data->pipe, IGT_CRTC_OUT_FENCE_PTR, (ptrdiff_t)map);
 	crtc_commit_atomic_err(data->pipe, data->primary, ATOMIC_RELAX_NONE, EFAULT);
-	munmap(map, PAGE_SIZE);
+	munmap(map, page_size);
 
 	/* invalid out_fence_ptr */
-	map = mmap(NULL, PAGE_SIZE, PROT_EXEC, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
+	map = mmap(NULL, page_size, PROT_EXEC, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
 	igt_assert(map != MAP_FAILED);
 
 	igt_pipe_obj_set_prop_value(data->pipe, IGT_CRTC_OUT_FENCE_PTR, (ptrdiff_t)map);
 	crtc_commit_atomic_err(data->pipe, data->primary, ATOMIC_RELAX_NONE, EFAULT);
-	munmap(map, PAGE_SIZE);
+	munmap(map, page_size);
 
 	/* invalid out_fence_ptr */
-	map = mmap(NULL, PAGE_SIZE, PROT_NONE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
+	map = mmap(NULL, page_size, PROT_NONE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
 	igt_assert(map != MAP_FAILED);
 
 	igt_pipe_obj_set_prop_value(data->pipe, IGT_CRTC_OUT_FENCE_PTR, (ptrdiff_t)map);
 	crtc_commit_atomic_err(data->pipe, data->primary, ATOMIC_RELAX_NONE, EFAULT);
-	munmap(map, PAGE_SIZE);
+	munmap(map, page_size);
 
 	/* valid in fence but not allowed prop on crtc */
 	fence_fd = sw_sync_timeline_create_fence(timeline, 1);
-- 
2.42.0



More information about the igt-dev mailing list