DESC strategies-fix0 EDESC --- work-dave/include/linux/ipc.h | 5 ++++ work-dave/ipc/Makefile | 2 - work-dave/ipc/sysctl.c | 48 ++++++++++++++++++++++++++++++++++++++++++ work-dave/ipc/util.c | 1 work-dave/kernel/sysctl.c | 8 +++++++ 5 files changed, 63 insertions(+), 1 deletion(-) diff -puN kernel/sysctl.c~sysv-do-sysctl-strategies1 kernel/sysctl.c --- work/kernel/sysctl.c~sysv-do-sysctl-strategies1 2006-04-18 17:16:10.000000000 -0700 +++ work-dave/kernel/sysctl.c 2006-04-18 17:16:10.000000000 -0700 @@ -47,6 +47,7 @@ #include #include #include +#include #include #include @@ -442,6 +443,7 @@ static ctl_table kern_table[] = { .maxlen = sizeof (size_t), .mode = 0644, .proc_handler = &proc_doulongvec_minmax, + .strategy = &sysctl_ipc_strategy, }, { .ctl_name = KERN_SHMALL, @@ -450,6 +452,7 @@ static ctl_table kern_table[] = { .maxlen = sizeof (size_t), .mode = 0644, .proc_handler = &proc_doulongvec_minmax, + .strategy = &sysctl_ipc_strategy, }, { .ctl_name = KERN_SHMMNI, @@ -458,6 +461,7 @@ static ctl_table kern_table[] = { .maxlen = sizeof (int), .mode = 0644, .proc_handler = &proc_dointvec, + .strategy = &sysctl_ipc_strategy, }, { .ctl_name = KERN_MSGMAX, @@ -466,6 +470,7 @@ static ctl_table kern_table[] = { .maxlen = sizeof (int), .mode = 0644, .proc_handler = &proc_dointvec, + .strategy = &sysctl_ipc_strategy, }, { .ctl_name = KERN_MSGMNI, @@ -474,6 +479,7 @@ static ctl_table kern_table[] = { .maxlen = sizeof (int), .mode = 0644, .proc_handler = &proc_dointvec, + .strategy = &sysctl_ipc_strategy, }, { .ctl_name = KERN_MSGMNB, @@ -482,6 +488,7 @@ static ctl_table kern_table[] = { .maxlen = sizeof (int), .mode = 0644, .proc_handler = &proc_dointvec, + .strategy = &sysctl_ipc_strategy, }, { .ctl_name = KERN_SEM, @@ -490,6 +497,7 @@ static ctl_table kern_table[] = { .maxlen = 4*sizeof (int), .mode = 0644, .proc_handler = &proc_dointvec, + .strategy = &sysctl_ipc_strategy, }, #endif #ifdef CONFIG_MAGIC_SYSRQ diff -puN include/linux/ipc.h~sysv-do-sysctl-strategies1 include/linux/ipc.h --- work/include/linux/ipc.h~sysv-do-sysctl-strategies1 2006-04-18 17:16:10.000000000 -0700 +++ work-dave/include/linux/ipc.h 2006-04-18 17:18:03.000000000 -0700 @@ -2,6 +2,7 @@ #define _LINUX_IPC_H #include +#include #define IPC_PRIVATE ((__kernel_key_t) 0) @@ -53,6 +54,10 @@ struct ipc_perm #define IPCMNI 32768 /* <= MAX_INT limit for ipc arrays (including sysctl changes) */ +int sysctl_ipc_strategy (/*ctl_table *table,*/ int __user *name, int nlen, + void __user *oldval, size_t __user *oldlenp, + void __user *newval, size_t newlen, void **context); + /* used by in-kernel data structures */ struct kern_ipc_perm { diff -puN ipc/util.c~sysv-do-sysctl-strategies1 ipc/util.c --- work/ipc/util.c~sysv-do-sysctl-strategies1 2006-04-18 17:16:10.000000000 -0700 +++ work-dave/ipc/util.c 2006-04-19 09:01:53.000000000 -0700 @@ -27,6 +27,7 @@ #include #include #include +#include #include diff -puN /dev/null ipc/sysctl.c --- /dev/null 2005-03-30 22:36:15.000000000 -0800 +++ work-dave/ipc/sysctl.c 2006-04-19 09:04:23.000000000 -0700 @@ -0,0 +1,48 @@ +#include +#include + +extern size_t shm_ctlmax; +extern size_t shm_ctlall; +extern int shm_ctlmni; +extern int msg_ctlmax; +extern int msg_ctlmnb; +extern int msg_ctlmni; +extern int sem_ctls[]; + +int sysctl_ipc_strategy (ctl_table *table, int __user *name, int nlen, + void __user *oldval, size_t __user *oldlenp, + void __user *newval, size_t newlen, void **context) +{ + void *data = NULL; + switch (table->ctl_name) { + case KERN_SHMMAX: + data = &shm_ctlmax; + break; + case KERN_SHMALL: + data = &shm_ctlall; + break; + case KERN_SHMMNI: + data = &shm_ctlmni; + break; + case KERN_MSGMAX: + data = &msg_ctlmax; + break; + case KERN_MSGMNI: + data = &msg_ctlmni; + break; + case KERN_MSGMNB: + data = &msg_ctlmnb; + break; + case KERN_SEM: + data = &sem_ctls; + break; + default: + WARN_ON(1); + } + /* an excellent check to make sure everything is going as expected */ + WARN_ON(data != table->data); + return default_sysctl_strategy(table, data, oldval, oldlenp, + newval, newlen); +} + + diff -puN ipc/Makefile~sysv-do-sysctl-strategies1 ipc/Makefile --- work/ipc/Makefile~sysv-do-sysctl-strategies1 2006-04-19 09:02:50.000000000 -0700 +++ work-dave/ipc/Makefile 2006-04-19 09:02:58.000000000 -0700 @@ -3,7 +3,7 @@ # obj-$(CONFIG_SYSVIPC_COMPAT) += compat.o -obj-$(CONFIG_SYSVIPC) += util.o msgutil.o msg.o sem.o shm.o +obj-$(CONFIG_SYSVIPC) += util.o msgutil.o msg.o sem.o shm.o sysctl.c obj_mq-$(CONFIG_COMPAT) += compat_mq.o obj-$(CONFIG_POSIX_MQUEUE) += mqueue.o msgutil.o $(obj_mq-y) _