[LTP] [PATCH 1/1] lapi/keyctl.h: Fix compilation on old kernel

Cyril Hrubis chrubis@suse.cz
Mon Sep 21 13:52:33 CEST 2026


Hi!
> diff --git a/include/lapi/keyctl.h b/include/lapi/keyctl.h
> index fdb68d1725..e1e46b7865 100644
> --- a/include/lapi/keyctl.h
> +++ b/include/lapi/keyctl.h
> @@ -69,6 +69,12 @@ struct keyctl_dh_params {
>  };
>  #endif
>  
> +/* Fix for kernel < v4.20 */
> +#if defined(HAVE_STRUCT_KEYCTL_DH_PARAMS) && \
> +	!defined(HAVE_STRUCT_KEYCTL_DH_PARAMS_PRIV)
> +# define priv private
> +#endif

I do not like this one, we may end up redefining wrong priv and break
everything.

Given that the private stil exists in the structure for C code:

(/usr/include/linux/keyctl.h)
/* keyctl structures */
struct keyctl_dh_params {
        union {
#ifndef __cplusplus
                __s32 private;
#endif
                __s32 priv;
        };
        __s32 prime;
        __s32 base;
};

We may as well use private in the tests consistently and update our
fallback with the union as well.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list