linux26-rlim-20050114
authorMatthew Miller <mattdm@mattdm.org>
Fri, 14 Jan 2005 17:36:39 +0000 (17:36 +0000)
committerDerrick Brashear <shadow@dementia.org>
Fri, 14 Jan 2005 17:36:39 +0000 (17:36 +0000)
detect rlim stuff for linux 2.6

acinclude.m4
src/afs/LINUX/osi_machdep.h
src/afs/LINUX/osi_misc.c
src/cf/linux-test4.m4

index 692f208..d837ef4 100644 (file)
@@ -583,6 +583,8 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
                 LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_SIG
                 LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_SIGHAND
                 LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_SIGMASK_LOCK
+                LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_RLIM
+                LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_SIGNAL_RLIM
                 LINUX_WHICH_MODULES
                  if test "x$ac_cv_linux_config_modversions" = "xno" -o $AFS_SYSKVERS -ge 26; then
                    AC_MSG_WARN([Cannot determine sys_call_table status. assuming it isn't exported])
@@ -714,6 +716,12 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
                 if test "x$ac_cv_linux_sched_struct_task_struct_has_sig" = "xyes"; then 
                  AC_DEFINE(STRUCT_TASK_STRUCT_HAS_SIG, 1, [define if your struct task_struct has sig])
                 fi
+                if test "x$ac_cv_linux_sched_struct_task_struct_has_rlim" = "xyes"; then 
+                 AC_DEFINE(STRUCT_TASK_STRUCT_HAS_RLIM, 1, [define if your struct task_struct has rlim])
+                fi
+                if test "x$ac_cv_linux_sched_struct_task_struct_has_signal_rlim" = "xyes"; then 
+                 AC_DEFINE(STRUCT_TASK_STRUCT_HAS_SIGNAL_RLIM, 1, [define if your struct task_struct has signal->rlim])
+                fi
                 :
                fi
 esac
index 278e56a..83f6b1a 100644 (file)
 #define SIG_UNLOCK(X) spin_unlock_irq(&X->sig->siglock)
 #endif
 
+#if defined (STRUCT_TASK_STRUCT_HAS_RLIM)
+#define TASK_STRUCT_RLIM rlim
+#elif defined (STRUCT_TASK_STRUCT_HAS_SIGNAL_RLIM)
+#define TASK_STRUCT_RLIM signal->rlim
+#else
+#error Not sure what to do about rlim (should be in the Linux task struct somewhere....)
+#endif
+
 
 #define afs_hz HZ
 #include "h/sched.h"
index 5775e60..51755ad 100644 (file)
@@ -138,8 +138,8 @@ osi_rdwr(int rw, struct osi_file *file, caddr_t addrp, size_t asize,
     } else
        filp->f_pos = offset;
 
-    savelim = current->rlim[RLIMIT_FSIZE].rlim_cur;
-    current->rlim[RLIMIT_FSIZE].rlim_cur = RLIM_INFINITY;
+    savelim = current->TASK_STRUCT_RLIM[RLIMIT_FSIZE].rlim_cur;
+    current->TASK_STRUCT_RLIM[RLIMIT_FSIZE].rlim_cur = RLIM_INFINITY;
 
     /* Read/Write the data. */
     TO_USER_SPACE();
@@ -151,7 +151,7 @@ osi_rdwr(int rw, struct osi_file *file, caddr_t addrp, size_t asize,
        code = asize;
     TO_KERNEL_SPACE();
 
-    current->rlim[RLIMIT_FSIZE].rlim_cur = savelim;
+    current->TASK_STRUCT_RLIM[RLIMIT_FSIZE].rlim_cur = savelim;
 
     if (code >= 0) {
        *resid = asize - code;
@@ -173,8 +173,8 @@ osi_file_uio_rdwr(struct osi_file *osifile, uio_t * uiop, int rw)
     int count;
     unsigned long savelim;
 
-    savelim = current->rlim[RLIMIT_FSIZE].rlim_cur;
-    current->rlim[RLIMIT_FSIZE].rlim_cur = RLIM_INFINITY;
+    savelim = current->TASK_STRUCT_RLIM[RLIMIT_FSIZE].rlim_cur;
+    current->TASK_STRUCT_RLIM[RLIMIT_FSIZE].rlim_cur = RLIM_INFINITY;
 
     if (uiop->uio_seg == AFS_UIOSYS)
        TO_USER_SPACE();
@@ -217,7 +217,7 @@ osi_file_uio_rdwr(struct osi_file *osifile, uio_t * uiop, int rw)
     if (uiop->uio_seg == AFS_UIOSYS)
        TO_KERNEL_SPACE();
 
-    current->rlim[RLIMIT_FSIZE].rlim_cur = savelim;
+    current->TASK_STRUCT_RLIM[RLIMIT_FSIZE].rlim_cur = savelim;
 
     return code;
 }
index 08e0c97..30578b1 100644 (file)
@@ -392,3 +392,33 @@ ac_cv_linux_sched_struct_task_struct_has_sighand=yes,
 ac_cv_linux_sched_struct_task_struct_has_sighand=no)])
 AC_MSG_RESULT($ac_cv_linux_sched_struct_task_struct_has_sighand)
 CPPFLAGS="$save_CPPFLAGS"])
+
+AC_DEFUN([LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_RLIM], [
+AC_MSG_CHECKING(for rlim in struct task_struct)
+save_CPPFLAGS="$CPPFLAGS"
+CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS"
+AC_CACHE_VAL(ac_cv_linux_sched_struct_task_struct_has_rlim,
+[
+AC_TRY_COMPILE(
+[#include <linux/sched.h>],
+[struct task_struct _tsk;
+printf("%d\n", _tsk.rlim);],
+ac_cv_linux_sched_struct_task_struct_has_rlim=yes,
+ac_cv_linux_sched_struct_task_struct_has_rlim=no)])
+AC_MSG_RESULT($ac_cv_linux_sched_struct_task_struct_has_rlim)
+CPPFLAGS="$save_CPPFLAGS"])
+
+AC_DEFUN([LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_SIGNAL_RLIM], [
+AC_MSG_CHECKING(for signal->rlim in struct task_struct)
+save_CPPFLAGS="$CPPFLAGS"
+CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -I${LINUX_KERNEL_PATH}/include/asm/mach-${SUBARCH} -D__KERNEL__ $CPPFLAGS"
+AC_CACHE_VAL(ac_cv_linux_sched_struct_task_struct_has_signal_rlim,
+[
+AC_TRY_COMPILE(
+[#include <linux/sched.h>],
+[struct task_struct _tsk;
+printf("%d\n", _tsk.signal->rlim);],
+ac_cv_linux_sched_struct_task_struct_has_signal_rlim=yes,
+ac_cv_linux_sched_struct_task_struct_has_signal_rlim=no)])
+AC_MSG_RESULT($ac_cv_linux_sched_struct_task_struct_has_signal_rlim)
+CPPFLAGS="$save_CPPFLAGS"])