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

Petri Latvala petri.latvala at intel.com
Wed Mar 24 08:56:43 UTC 2021


On Mon, Mar 22, 2021 at 08:45:39PM +0200, Arkadiusz Hiler wrote:
> 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>

Reviewed-by: Petri Latvala <petri.latvala at intel.com>

> ---
>  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
> 
> _______________________________________________
> igt-dev mailing list
> igt-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev


More information about the igt-dev mailing list