[igt-dev] [PATCH] tests/drm_read: Don't use deprecated siginterrupt

Arkadiusz Hiler arek at hiler.eu
Mon Mar 22 18:45:39 UTC 2021


Since we are using sigaction() we can also register the signal handler
in one go.

Fixes: "warning: ‘siginterrupt’ is deprecated: Use sigaction with SA_RESTART instead"
Signed-off-by: Arkadiusz Hiler <arek at hiler.eu>
---
 tests/drm_read.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/tests/drm_read.c b/tests/drm_read.c
index cfb1c04d..ccf9d822 100644
--- a/tests/drm_read.c
+++ b/tests/drm_read.c
@@ -48,7 +48,7 @@
 
 IGT_TEST_DESCRIPTION("Call read(drm) and see if it behaves.");
 
-static void sighandler(int sig)
+static void sighandler(int sig, siginfo_t * info, void *context)
 {
 }
 
@@ -257,12 +257,15 @@ igt_main
 	struct igt_fb fb;
 	enum pipe pipe;
 
-	signal(SIGALRM, sighandler);
-	siginterrupt(SIGALRM, 1);
-
 	igt_fixture {
+		struct sigaction alarm_action = {};
 		igt_output_t *output;
 
+		igt_assert_neq(sigaction(SIGALRM, NULL, &alarm_action), -1);
+		alarm_action.sa_flags &= ~SA_RESTART;
+		alarm_action.sa_sigaction = sighandler;
+		igt_assert_neq(sigaction(SIGALRM, &alarm_action, NULL), -1);
+
 		fd = drm_open_driver_master(DRIVER_ANY);
 		kmstest_set_vt_graphics_mode();
 
-- 
2.31.0



More information about the igt-dev mailing list