])
#
+# LIBCFS_HAVE_IS_COMPAT_TASK
+#
+# Added in 2.6.17, it wasn't until 2.6.29 that all
+# Linux architectures have is_compat_task()
+#
+AC_DEFUN([LIBCFS_HAVE_IS_COMPAT_TASK],
+[AC_MSG_CHECKING([if is_compat_task() is declared])
+LB_LINUX_TRY_COMPILE([
+ #include <linux/compat.h>
+],[
+ int i = is_compat_task();
+],[
+ AC_MSG_RESULT([yes])
+ AC_DEFINE(HAVE_IS_COMPAT_TASK, 1, [is_compat_task() is available])
+],[
+ AC_MSG_RESULT([no])
+])
+])
+
+#
# LIBCFS_PROG_LINUX
#
# LNet linux kernel checks
LIBCFS_TASK_RCU
# 2.6.18
LIBCFS_TASKLIST_LOCK
+LIBCFS_HAVE_IS_COMPAT_TASK
# 2.6.19
LIBCFS_NETLINK
LIBCFS_NLMSG_MULTICAST
#include <linux/sched.h>
#include <linux/fs_struct.h>
+#include <linux/compat.h>
+#include <linux/thread_info.h>
+
#define DEBUG_SUBSYSTEM S_LNET
#include <libcfs/libcfs.h>
return capable(cfs_cap_unpack(cap));
}
+/* Check if task is running in 32-bit API mode, for the purpose of
+ * userspace binary interfaces. On 32-bit Linux this is (unfortunately)
+ * always true, even if the application is using LARGEFILE64 and 64-bit
+ * APIs, because Linux provides no way for the filesystem to know if it
+ * is called via 32-bit or 64-bit APIs. Other clients may vary. On
+ * 64-bit systems, this will only be true if the binary is calling a
+ * 32-bit system call. */
+int cfs_curproc_is_32bit(void)
+{
+#ifdef HAVE_IS_COMPAT_TASK
+ return is_compat_task();
+#else
+ return (BITS_PER_LONG == 32);
+#endif
+}
+
EXPORT_SYMBOL(cfs_curproc_uid);
EXPORT_SYMBOL(cfs_curproc_pid);
EXPORT_SYMBOL(cfs_curproc_euid);
EXPORT_SYMBOL(cfs_curproc_cap_pack);
EXPORT_SYMBOL(cfs_curproc_cap_unpack);
EXPORT_SYMBOL(cfs_capable);
+EXPORT_SYMBOL(cfs_curproc_is_32bit);
/*
* Local variables: