# include <linux/kmod.h>
# include <linux/notifier.h>
# include <linux/fs.h>
-# include <asm/segment.h>
# include <linux/miscdevice.h>
# include <linux/vmalloc.h>
# include <linux/time.h>
#else /* !__KERNEL__ */
# include <stdio.h>
# include <stdlib.h>
-#ifdef CRAY_XT3
-# include <ioctl.h>
-#elif defined(__CYGWIN__)
+#if defined(__CYGWIN__)
# include <cygwin-ioctl.h>
#else
# include <stdint.h>
# include <limits.h>
# include <errno.h>
# include <sys/ioctl.h> /* for _IOWR */
+#ifndef _IOWR
+#include "ioctl.h"
+#endif
# define CFS_MODULE_PARM(name, t, type, perm, desc)
#define PORTAL_SYMBOL_GET(x) inter_module_get(#x)
#define _LWORDSIZE __WORDSIZE
#endif
-#if (defined(__x86_64__) && (defined(__KERNEL__) || defined(CRAY_XT3)))
+#if (defined(__x86_64__) && (defined(__KERNEL__) || defined(CRAY_XT3))) || defined(HAVE_U64_LONG_LONG)
/* x86_64 defines __u64 as "long" in userspace, but "long long" in the kernel */
# define LPU64 "%Lu"
# define LPD64 "%Ld"