From b2788cf3abf20f404c16c57314e126a2b1b5800f Mon Sep 17 00:00:00 2001 From: Derrick Brashear Date: Tue, 25 Jun 2002 16:25:43 +0000 Subject: [PATCH] linux-gcpags-support-20020625 might even work --- src/afs/LINUX/osi_machdep.h | 1 + src/afs/LINUX/osi_sysctl.c | 3 +++ src/afs/afs_osi.c | 41 +++++++++++++++++++++++++++++++ src/config/param.alpha_linux_22.h | 2 +- src/config/param.alpha_linux_24.h | 2 +- src/config/param.i386_linux22.h | 3 ++- src/config/param.i386_linux24.h | 2 +- src/config/param.ia64_linux24.h | 2 +- src/config/param.parisc_linux24.h | 3 +-- src/config/param.ppc_linux22.h | 3 +-- src/config/param.ppc_linux24.h | 3 +-- src/config/param.s390_linux22.h | 2 +- src/config/param.s390_linux24.h | 2 +- src/config/param.sparc_linux22.h | 2 +- src/config/param.sparc_linux24.h | 2 +- 15 files changed, 58 insertions(+), 15 deletions(-) diff --git a/src/afs/LINUX/osi_machdep.h b/src/afs/LINUX/osi_machdep.h index 91c32293d..b378a2354 100644 --- a/src/afs/LINUX/osi_machdep.h +++ b/src/afs/LINUX/osi_machdep.h @@ -108,6 +108,7 @@ typedef struct cred { /* maps to task field: */ int cr_ngroups; } cred_t; #define AFS_UCRED cred +#define AFS_PROC struct task_struct #define crhold(c) (c)->cr_ref++ /* UIO manipulation */ diff --git a/src/afs/LINUX/osi_sysctl.c b/src/afs/LINUX/osi_sysctl.c index e75603b20..1479ca1a4 100644 --- a/src/afs/LINUX/osi_sysctl.c +++ b/src/afs/LINUX/osi_sysctl.c @@ -34,6 +34,9 @@ static ctl_table afs_sysctl_table[] = { {3, "hm_retry_int", &hm_retry_int, sizeof(afs_int32), 0644, NULL, &proc_dointvec}, + {4, "GCPAGs", + &afs_gcpags, sizeof(afs_int32), 0644, NULL, + &proc_dointvec}, {0} }; diff --git a/src/afs/afs_osi.c b/src/afs/afs_osi.c index d536f20af..51f3659f0 100644 --- a/src/afs/afs_osi.c +++ b/src/afs/afs_osi.c @@ -799,6 +799,22 @@ void afs_osi_TraverseProcTable() } #endif +#if defined(AFS_LINUX22_ENV) +void afs_osi_TraverseProcTable() +{ + struct task_struct *p; + for_each_task(p) if (p->pid) { + if (p->state & TASK_ZOMBIE) + continue; +#if 0 + if (p->flags & ) + continue; +#endif + afs_GCPAGs_perproc_func(p); + } +} +#endif + /* return a pointer (sometimes a static copy ) to the cred for a * given AFS_PROC. * subsequent calls may overwrite the previously returned value. @@ -980,6 +996,31 @@ const struct AFS_UCRED *afs_osi_proc2cred(AFS_PROC *pr) return rv; } +#elif defined(AFS_LINUX22_ENV) +const struct AFS_UCRED *afs_osi_proc2cred(AFS_PROC *pr) +{ + struct AFS_UCRED *rv=NULL; + static struct AFS_UCRED cr; + + if(pr == NULL) { + return NULL; + } + + if ((pr->state == TASK_RUNNING) || + (pr->state == TASK_INTERRUPTIBLE) || + (pr->state == TASK_UNINTERRUPTIBLE) || + (pr->state == TASK_STOPPED)) { + read_lock(&tasklist_lock); + cr.cr_ref=1; + cr.cr_uid=pr->uid; + cr.cr_ngroups=pr->ngroups; + memcpy(cr.cr_groups, pr->groups, NGROUPS * sizeof(gid_t)); + read_unlock(&tasklist_lock); + rv = &cr; + } + + return rv; +} #else const struct AFS_UCRED *afs_osi_proc2cred(AFS_PROC *pr) { diff --git a/src/config/param.alpha_linux_22.h b/src/config/param.alpha_linux_22.h index f9b0accfe..252d68fb9 100644 --- a/src/config/param.alpha_linux_22.h +++ b/src/config/param.alpha_linux_22.h @@ -51,7 +51,7 @@ #define AFS_USERSPACE_IP_ADDR 1 #define RXK_LISTENER_ENV 1 -#define AFS_GCPAGS 0 /* if nonzero, garbage collect PAGs */ +#define AFS_GCPAGS 2 /* Set to Userdisabled, allow sysctl to override */ /* Machine / Operating system information */ #define SYS_NAME "alpha_linux_22" diff --git a/src/config/param.alpha_linux_24.h b/src/config/param.alpha_linux_24.h index 5c64253d3..2bf32a9a1 100644 --- a/src/config/param.alpha_linux_24.h +++ b/src/config/param.alpha_linux_24.h @@ -53,7 +53,7 @@ #define AFS_USERSPACE_IP_ADDR 1 #define RXK_LISTENER_ENV 1 -#define AFS_GCPAGS 0 /* if nonzero, garbage collect PAGs */ +#define AFS_GCPAGS 2 /* Set to Userdisabled, allow sysctl to override */ /* Machine / Operating system information */ #define SYS_NAME "alpha_linux_24" diff --git a/src/config/param.i386_linux22.h b/src/config/param.i386_linux22.h index 4a7130491..0a845bcf2 100644 --- a/src/config/param.i386_linux22.h +++ b/src/config/param.i386_linux22.h @@ -58,7 +58,8 @@ #define AFS_USERSPACE_IP_ADDR 1 #define RXK_LISTENER_ENV 1 -#define AFS_GCPAGS 0 /* if nonzero, garbage collect PAGs */ +#define AFS_GCPAGS 2 /* Set to Userdisabled, allow sysctl to override */ + /* Machine / Operating system information */ #define SYS_NAME "i386_linux22" diff --git a/src/config/param.i386_linux24.h b/src/config/param.i386_linux24.h index 9a2d87202..2d4ab16e0 100644 --- a/src/config/param.i386_linux24.h +++ b/src/config/param.i386_linux24.h @@ -52,7 +52,7 @@ #include #define AFS_USERSPACE_IP_ADDR 1 #define RXK_LISTENER_ENV 1 -#define AFS_GCPAGS 0 /* if nonzero, garbage collect PAGs */ +#define AFS_GCPAGS 2 /* Set to Userdisabled, allow sysctl to override */ #define AFSLITTLE_ENDIAN 1 #define AFS_HAVE_FFS 1 /* Use system's ffs. */ diff --git a/src/config/param.ia64_linux24.h b/src/config/param.ia64_linux24.h index 5918766f9..63e5f45a8 100644 --- a/src/config/param.ia64_linux24.h +++ b/src/config/param.ia64_linux24.h @@ -56,7 +56,7 @@ #define AFS_USERSPACE_IP_ADDR 1 #define RXK_LISTENER_ENV 1 -#define AFS_GCPAGS 0 /* if nonzero, garbage collect PAGs */ +#define AFS_GCPAGS 2 /* Set to Userdisabled, allow sysctl to override */ /* Machine / Operating system information */ #define SYS_NAME "ia64_linux24" diff --git a/src/config/param.parisc_linux24.h b/src/config/param.parisc_linux24.h index 1ff56bf83..1c181bff6 100644 --- a/src/config/param.parisc_linux24.h +++ b/src/config/param.parisc_linux24.h @@ -45,8 +45,7 @@ #define AFS_USERSPACE_IP_ADDR 1 #define RXK_LISTENER_ENV 1 -#define AFS_GCPAGS 0 /* if nonzero, garbage collect PAGs */ - +#define AFS_GCPAGS 2 /* Set to Userdisabled, allow sysctl to override */ /* Machine / Operating system information */ #define SYS_NAME "parisc_linux24" diff --git a/src/config/param.ppc_linux22.h b/src/config/param.ppc_linux22.h index f68aacd27..e1a48cc78 100644 --- a/src/config/param.ppc_linux22.h +++ b/src/config/param.ppc_linux22.h @@ -46,8 +46,7 @@ #define AFS_USERSPACE_IP_ADDR 1 #define RXK_LISTENER_ENV 1 -#define AFS_GCPAGS 0 /* if nonzero, garbage collect PAGs */ - +#define AFS_GCPAGS 2 /* Set to Userdisabled, allow sysctl to override */ /* Machine / Operating system information */ #define SYS_NAME "ppc_linux22" diff --git a/src/config/param.ppc_linux24.h b/src/config/param.ppc_linux24.h index 8d3991b8e..c5161af29 100644 --- a/src/config/param.ppc_linux24.h +++ b/src/config/param.ppc_linux24.h @@ -47,8 +47,7 @@ #define AFS_USERSPACE_IP_ADDR 1 #define RXK_LISTENER_ENV 1 -#define AFS_GCPAGS 0 /* if nonzero, garbage collect PAGs */ - +#define AFS_GCPAGS 2 /* Set to Userdisabled, allow sysctl to override */ /* Machine / Operating system information */ #define SYS_NAME "ppc_linux24" diff --git a/src/config/param.s390_linux22.h b/src/config/param.s390_linux22.h index 5cb40fd79..1dcb8fed4 100644 --- a/src/config/param.s390_linux22.h +++ b/src/config/param.s390_linux22.h @@ -52,7 +52,7 @@ #define AFS_USERSPACE_IP_ADDR 1 #define RXK_LISTENER_ENV 1 -#define AFS_GCPAGS 0 /* if nonzero, garbage collect PAGs */ +#define AFS_GCPAGS 2 /* Set to Userdisabled, allow sysctl to override */ /* Machine / Operating system information */ #define SYS_NAME "s390_linux22" diff --git a/src/config/param.s390_linux24.h b/src/config/param.s390_linux24.h index c71fed920..c80aebb64 100644 --- a/src/config/param.s390_linux24.h +++ b/src/config/param.s390_linux24.h @@ -52,7 +52,7 @@ #define AFS_USERSPACE_IP_ADDR 1 #define RXK_LISTENER_ENV 1 -#define AFS_GCPAGS 0 /* if nonzero, garbage collect PAGs */ +#define AFS_GCPAGS 2 /* Set to Userdisabled, allow sysctl to override */ /* Machine / Operating system information */ #define SYS_NAME "s390_linux24" diff --git a/src/config/param.sparc_linux22.h b/src/config/param.sparc_linux22.h index 2e916be7c..56cf4b5e5 100644 --- a/src/config/param.sparc_linux22.h +++ b/src/config/param.sparc_linux22.h @@ -48,7 +48,7 @@ #define AFS_USERSPACE_IP_ADDR 1 #define RXK_LISTENER_ENV 1 -#define AFS_GCPAGS 0 /* if nonzero, garbage collect PAGs */ +#define AFS_GCPAGS 2 /* Set to Userdisabled, allow sysctl to override */ /* Machine / Operating system information */ #define SYS_NAME "sparc_linux22" diff --git a/src/config/param.sparc_linux24.h b/src/config/param.sparc_linux24.h index 37a046e75..3dcdc5362 100644 --- a/src/config/param.sparc_linux24.h +++ b/src/config/param.sparc_linux24.h @@ -50,7 +50,7 @@ #define AFS_USERSPACE_IP_ADDR 1 #define RXK_LISTENER_ENV 1 -#define AFS_GCPAGS 0 /* if nonzero, garbage collect PAGs */ +#define AFS_GCPAGS 2 /* Set to Userdisabled, allow sysctl to override */ /* Machine / Operating system information */ #define SYS_NAME "sparc_linux24" -- 2.39.5