From: Matthew Miller Date: Fri, 14 Jan 2005 17:36:39 +0000 (+0000) Subject: linux26-rlim-20050114 X-Git-Tag: BP-disconnected~46 X-Git-Url: https://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=9e81a8e4c2e7830ab18de1f5dd23dfc916ef2bf0 linux26-rlim-20050114 detect rlim stuff for linux 2.6 --- diff --git a/acinclude.m4 b/acinclude.m4 index 692f208..d837ef4 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -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 diff --git a/src/afs/LINUX/osi_machdep.h b/src/afs/LINUX/osi_machdep.h index 278e56a..83f6b1a 100644 --- a/src/afs/LINUX/osi_machdep.h +++ b/src/afs/LINUX/osi_machdep.h @@ -47,6 +47,14 @@ #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" diff --git a/src/afs/LINUX/osi_misc.c b/src/afs/LINUX/osi_misc.c index 5775e60..51755ad 100644 --- a/src/afs/LINUX/osi_misc.c +++ b/src/afs/LINUX/osi_misc.c @@ -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; } diff --git a/src/cf/linux-test4.m4 b/src/cf/linux-test4.m4 index 08e0c97..30578b1 100644 --- a/src/cf/linux-test4.m4 +++ b/src/cf/linux-test4.m4 @@ -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 ], +[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 ], +[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"])