[LTP] [PATCH 1/1] lapi/keyctl.h: Fix compilation on old kernel
Petr Vorel
pvorel@suse.cz
Mon Sep 21 15:36:13 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.
When I looked in the struct in UAPI I considered define better, but indeed
mirroring UAPI the same way is really better.
I'll retest it and send v2.
Kind regards,
Petr
More information about the ltp
mailing list