Add autoconf tests for keyctl01 required features.
Signed-off-by: Garrett Cooper <yanegomi@gmail.com>
diff --git a/configure.ac b/configure.ac
index ee5a9fd..c5f213b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -87,6 +87,7 @@
LTP_CHECK_SELINUX
LTP_CHECK_SIGNAL
LTP_CHECK_SYSCALL_EVENTFD
+LTP_CHECK_SYSCALL_KEYCTL
LTP_CHECK_SYSCALL_MODIFY_LDT
LTP_CHECK_SYSCALL_NUMA
LTP_CHECK_SYSCALL_QUOTACTL
diff --git a/m4/ltp-quota.m4 b/m4/ltp-quota.m4
index 8342027..efb9f67 100644
--- a/m4/ltp-quota.m4
+++ b/m4/ltp-quota.m4
@@ -25,21 +25,19 @@
#include <sys/types.h>
#include <sys/quota.h>
#include <unistd.h>],[
-int main(void) {
struct dqblk dq;
return quotactl(QCMD(Q_GETINFO, USRQUOTA), (const char *) "/dev/null",
geteuid(), (caddr_t) &dq);
-}],[has_quotav2="yes"],[dnl END quota v2 check
+],[has_quotav2="yes"],[dnl END quota v2 check
AC_TRY_COMPILE([
#define _LINUX_QUOTA_VERSION 1
#include <sys/types.h>
#include <sys/quota.h>
#include <unistd.h>],[
-int main(void) {
struct dqblk dq;
return quotactl(QCMD(Q_GETQUOTA, USRQUOTA), (const char *) "/dev/null",
geteuid(), (caddr_t) &dq);
-}],[has_quotav1="yes"],AC_MSG_WARN(Couldn't determine quota version (please submit config.log and manpage details for inspectionto ltp-list@lists.sourceforge.net))) dnl END quota v1 check
+],[has_quotav1="yes"],AC_MSG_WARN(Couldn't determine quota version (please submit config.log and manpage details for inspectionto ltp-list@lists.sourceforge.net))) dnl END quota v1 check
])
if test "x$has_quotav1" = "xyes"; then
AC_DEFINE(HAS_QUOTAV1,1,[Define to 1 if you have quota v1])
diff --git a/testcases/kernel/syscalls/keyctl/keyctl01.c b/testcases/kernel/syscalls/keyctl/keyctl01.c
index b05efe9..c7592ca 100644
--- a/testcases/kernel/syscalls/keyctl/keyctl01.c
+++ b/testcases/kernel/syscalls/keyctl/keyctl01.c
@@ -39,11 +39,16 @@
/******************************************************************************/
#include <sys/types.h>
+#if HAVE_KEYCTL_SYSCALL
#include <linux/keyctl.h>
+#endif
#include <errno.h>
+#if HAVE_KEYCTL_SYSCALL
#include <keyutils.h>
+#endif
#include <limits.h>
#include <stdio.h>
+#include "config.h"
/* Harness Specific Include Files. */
#include "test.h"
@@ -59,6 +64,7 @@
int testno;
int TST_TOTAL = 2; /* total number of tests in this file. */
+#if HAVE_KEYCTL_SYSCALL
/* Extern Global Functions */
/******************************************************************************/
/* */
@@ -175,3 +181,11 @@
/* NOTREACHED */
return (1);
}
+#else
+int
+main(void)
+{
+ tst_resm(TCONF, "keyctl syscall support not available on system");
+ tst_exit();
+}
+#endif