#include "token.h"
-#if defined(LINUX_KEYRING_SUPPORT) && defined(HAVE_SESSION_TO_PARENT)
+#if defined(AFS_LINUX26_ENV)
#include <sys/syscall.h>
+#if defined(SYS_keyctl)
+/* Open code this value to avoid a dependency on keyutils */
#define KEYCTL_SESSION_TO_PARENT 18
#endif
+#endif
/* For malloc() */
#include <stdlib.h>
}
#else /* NO_AFS_CLIENT */
code = PIOCTL(0, VIOCSETTOK, &iob, 0);
-#if defined(LINUX_KEYRING_SUPPORT) && defined(HAVE_SESSION_TO_PARENT)
- /*
- * If we're using keyring based PAGs and the SESSION_TO_PARENT keyctl
- * is available, use it to copy the session keyring to the parent process
- */
- if (flags & AFS_SETTOK_SETPAG)
- syscall(SYS_keyctl, KEYCTL_SESSION_TO_PARENT);
-#endif
#endif /* NO_AFS_CLIENT */
if (code)
return KTC_PIOCTLFAIL;
if (code)
return KTC_PIOCTLFAIL;
+#if defined(AFS_LINUX26_ENV) && defined(SYS_keyctl)
+ else
+ /*
+ * If we're using keyring based PAGs and the SESSION_TO_PARENT keyctl
+ * is available, use it to copy the session keyring to the parent process
+ */
+ if (token->flags & AFS_SETTOK_SETPAG)
+ syscall(SYS_keyctl, KEYCTL_SESSION_TO_PARENT);
+#endif
return 0;
}