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

Petr Vorel pvorel@suse.cz
Mon Sep 21 13:14:07 CEST 2026


priv member was added in kernel v4.20 (which we still support) in commit
2ecefa0a15fd0 ("keys: Fix the use of the C++ keyword "private" in
uapi/linux/keyctl.h")

Use macro definition to fix missing 'priv' in the old UAPI headers. This
fixes error:

    keyctl25.c:25:11: error: ‘struct keyctl_dh_params’ has no member named ‘priv’

Fixes: ee02118e9f ("lapi/keyctl.h: Add fallback definitions for extended ops")
Suggested-by: linuxtestproject.agent@gmail.com
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
Yet another pre-release fix, required for compilation on SLE12-SP5.

Kind regards,
Petr

 include/lapi/keyctl.h | 6 ++++++
 1 file changed, 6 insertions(+)

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
+
 #ifndef HAVE_STRUCT_KEYCTL_KDF_PARAMS
 struct keyctl_kdf_params {
 	char *hashname;
-- 
2.55.0



More information about the ltp mailing list