Patch to make sysctl support optional

Christopher Horn (chorn@warwick.net)
Fri, 10 Jan 1997 11:41:59 -0500


This is a multi-part message in MIME format.

--------------636C2E1E38A8649B3BAFD218
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Attached is a patch against 2.1.20 that builds on top of one I posted a
couple days ago. It now includes a compile time option to make the
sysctl interface optional via a CONFIG_SYSCTL define. I've had no
problems with it, if anyone else tries this out and does please let me
know. Otherwise I'll probably submit it to Linus in a couple of days.

Cheers,
Chris

--------------636C2E1E38A8649B3BAFD218
Content-Type: text/plain; charset=us-ascii; name="sysctl-patch2-2.1.20"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="sysctl-patch2-2.1.20"

diff -uNr linux-2.1.20-virgin/Documentation/Configure.help linux/Documentation/Configure.help
--- linux-2.1.20-virgin/Documentation/Configure.help Thu Jan 2 19:24:07 1997
+++ linux/Documentation/Configure.help Thu Jan 9 19:56:25 1997
@@ -661,6 +661,14 @@
or with the program info ("man info"). Enabling this option enlarges
your kernel by about 7kB. Just say Y.

+Sysctl interface support
+CONFIG_SYSCTL
+ The sysctl interface provides a means of dynamically changing certain
+ kernel parameters and variables on the fly without requiring a
+ recompile of the kernel or reboot of the system. It is generally
+ a good thing, you probably want to say Y here unless building a
+ kernel for install or rescue disks.
+
Kernel support for ELF binaries
CONFIG_BINFMT_ELF
ELF (Executable and Linkable Format) is a format for libraries and
diff -uNr linux-2.1.20-virgin/arch/alpha/config.in linux/arch/alpha/config.in
--- linux-2.1.20-virgin/arch/alpha/config.in Sun Aug 4 06:38:59 1996
+++ linux/arch/alpha/config.in Thu Jan 9 19:38:25 1997
@@ -92,6 +92,7 @@
fi
bool 'Networking support' CONFIG_NET
bool 'System V IPC' CONFIG_SYSVIPC
+bool 'Sysctl support' CONFIG_SYSCTL
tristate 'Kernel support for a.out (ECOFF) binaries' CONFIG_BINFMT_AOUT
tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
endmenu
diff -uNr linux-2.1.20-virgin/arch/alpha/defconfig linux/arch/alpha/defconfig
--- linux-2.1.20-virgin/arch/alpha/defconfig Sun Dec 29 19:45:10 1996
+++ linux/arch/alpha/defconfig Thu Jan 9 19:38:47 1997
@@ -40,6 +40,7 @@
CONFIG_TGA_CONSOLE=y
CONFIG_NET=y
CONFIG_SYSVIPC=y
+CONFIG_SYSCTL=y
CONFIG_BINFMT_AOUT=y
CONFIG_BINFMT_ELF=y

diff -uNr linux-2.1.20-virgin/arch/i386/config.in linux/arch/i386/config.in
--- linux-2.1.20-virgin/arch/i386/config.in Thu Dec 12 21:26:01 1996
+++ linux/arch/i386/config.in Thu Jan 9 19:37:38 1997
@@ -32,6 +32,7 @@
fi
bool 'MCA support' CONFIG_MCA
bool 'System V IPC' CONFIG_SYSVIPC
+bool 'Sysctl support' CONFIG_SYSCTL
tristate 'Kernel support for a.out binaries' CONFIG_BINFMT_AOUT
tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
diff -uNr linux-2.1.20-virgin/arch/i386/defconfig linux/arch/i386/defconfig
--- linux-2.1.20-virgin/arch/i386/defconfig Thu Jan 2 19:24:07 1997
+++ linux/arch/i386/defconfig Thu Jan 9 19:37:53 1997
@@ -23,6 +23,7 @@
CONFIG_PCI=y
# CONFIG_MCA is not set
CONFIG_SYSVIPC=y
+CONFIG_SYSCTL=y
CONFIG_BINFMT_AOUT=y
CONFIG_BINFMT_ELF=y
# CONFIG_M386 is not set
diff -uNr linux-2.1.20-virgin/arch/m68k/config.in linux/arch/m68k/config.in
--- linux-2.1.20-virgin/arch/m68k/config.in Tue Dec 17 16:07:29 1996
+++ linux/arch/m68k/config.in Thu Jan 9 19:39:13 1997
@@ -49,6 +49,7 @@

bool 'Networking support' CONFIG_NET
bool 'System V IPC' CONFIG_SYSVIPC
+bool 'Sysctl support' CONFIG_SYSCTL
tristate 'Kernel support for a.out binaries' CONFIG_BINFMT_AOUT
tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
if [ "$CONFIG_AMIGA" = "y" ]; then
diff -uNr linux-2.1.20-virgin/arch/m68k/defconfig linux/arch/m68k/defconfig
--- linux-2.1.20-virgin/arch/m68k/defconfig Tue Dec 17 16:07:29 1996
+++ linux/arch/m68k/defconfig Thu Jan 9 19:39:30 1997
@@ -38,6 +38,7 @@
#
CONFIG_NET=y
CONFIG_SYSVIPC=y
+CONFIG_SYSCTL=y
CONFIG_BINFMT_AOUT=y
CONFIG_BINFMT_ELF=y
CONFIG_ZORRO=y
diff -uNr linux-2.1.20-virgin/arch/mips/config.in linux/arch/mips/config.in
--- linux-2.1.20-virgin/arch/mips/config.in Sun May 5 02:05:58 1996
+++ linux/arch/mips/config.in Thu Jan 9 19:39:59 1997
@@ -50,6 +50,7 @@
# fi
#fi
bool 'System V IPC' CONFIG_SYSVIPC
+bool 'Sysctl support' CONFIG_SYSCTL
endmenu

mainmenu_option next_comment
diff -uNr linux-2.1.20-virgin/arch/mips/defconfig linux/arch/mips/defconfig
--- linux-2.1.20-virgin/arch/mips/defconfig Wed Feb 7 22:41:50 1996
+++ linux/arch/mips/defconfig Thu Jan 9 19:40:35 1997
@@ -26,6 +26,7 @@
CONFIG_CPU_LITTLE_ENDIAN=y
# CONFIG_NET is not set
# CONFIG_SYSVIPC is not set
+CONFIG_SYSCTL=y

#
# Loadable module support
diff -uNr linux-2.1.20-virgin/arch/ppc/config.in linux/arch/ppc/config.in
--- linux-2.1.20-virgin/arch/ppc/config.in Mon May 27 05:00:57 1996
+++ linux/arch/ppc/config.in Thu Jan 9 19:40:59 1997
@@ -31,6 +31,7 @@
fi
fi
bool 'System V IPC' CONFIG_SYSVIPC
+bool 'Sysctl support' CONFIG_SYSCTL
tristate 'Kernel support for a.out binaries' CONFIG_BINFMT_AOUT
tristate 'Kernel support for JAVA binaries' CONFIG_BINFMT_JAVA
tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
diff -uNr linux-2.1.20-virgin/arch/sparc/config.in linux/arch/sparc/config.in
--- linux-2.1.20-virgin/arch/sparc/config.in Tue Dec 17 16:07:31 1996
+++ linux/arch/sparc/config.in Thu Jan 9 19:41:30 1997
@@ -46,6 +46,7 @@
tristate 'Openprom tree appears in /proc/openprom (EXPERIMENTAL)' CONFIG_SUN_OPENPROMFS
bool 'Networking support' CONFIG_NET
bool 'System V IPC' CONFIG_SYSVIPC
+bool 'Sysctl support' CONFIG_SYSCTL
tristate 'Kernel support for a.out binaries' CONFIG_BINFMT_AOUT
tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
diff -uNr linux-2.1.20-virgin/arch/sparc/defconfig linux/arch/sparc/defconfig
--- linux-2.1.20-virgin/arch/sparc/defconfig Tue Dec 31 22:14:55 1996
+++ linux/arch/sparc/defconfig Thu Jan 9 19:41:52 1997
@@ -53,6 +53,7 @@
CONFIG_SUN_OPENPROMFS=m
CONFIG_NET=y
CONFIG_SYSVIPC=y
+CONFIG_SYSCTL=y
CONFIG_BINFMT_AOUT=y
CONFIG_BINFMT_ELF=y
CONFIG_BINFMT_JAVA=m
diff -uNr linux-2.1.20-virgin/arch/sparc64/config.in linux/arch/sparc64/config.in
--- linux-2.1.20-virgin/arch/sparc64/config.in Tue Dec 31 22:14:57 1996
+++ linux/arch/sparc64/config.in Thu Jan 9 19:42:19 1997
@@ -46,6 +46,7 @@
tristate 'Openprom tree appears in /proc/openprom (EXPERIMENTAL)' CONFIG_SUN_OPENPROMFS
bool 'Networking support' CONFIG_NET
bool 'System V IPC' CONFIG_SYSVIPC
+bool 'Sysctl support' CONFIG_SYSCTL
tristate 'Kernel support for a.out binaries' CONFIG_BINFMT_AOUT
tristate 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF
if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
diff -uNr linux-2.1.20-virgin/arch/sparc64/defconfig linux/arch/sparc64/defconfig
--- linux-2.1.20-virgin/arch/sparc64/defconfig Tue Dec 31 22:14:57 1996
+++ linux/arch/sparc64/defconfig Thu Jan 9 19:42:34 1997
@@ -51,6 +51,7 @@
CONFIG_SUN_OPENPROMFS=y
CONFIG_NET=y
CONFIG_SYSVIPC=y
+CONFIG_SYSCTL=y
CONFIG_BINFMT_AOUT=y
CONFIG_BINFMT_ELF=y
CONFIG_BINFMT_JAVA=y
diff -uNr linux-2.1.20-virgin/fs/proc/root.c linux/fs/proc/root.c
--- linux-2.1.20-virgin/fs/proc/root.c Tue Dec 17 16:07:48 1996
+++ linux/fs/proc/root.c Thu Jan 9 22:51:19 1997
@@ -152,6 +152,7 @@
};
#endif

+#ifdef CONFIG_SYSCTL
struct proc_dir_entry proc_sys_root = {
PROC_SYS, 3, "sys", /* inode, name */
S_IFDIR | S_IRUGO | S_IXUGO, 2, 0, 0, /* mode, nlink, uid, gid */
@@ -160,6 +161,7 @@
NULL, /* next */
NULL, NULL /* parent, subdir */
};
+#endif

#if defined(CONFIG_SUN_OPENPROMFS) || defined(CONFIG_SUN_OPENPROMFS_MODULE)

@@ -538,7 +540,9 @@
proc_register(&proc_root, &proc_root_self);
proc_register(&proc_root, &proc_net);
proc_register(&proc_root, &proc_scsi);
+#ifdef CONFIG_SYSCTL
proc_register(&proc_root, &proc_sys_root);
+#endif
#ifdef CONFIG_MCA
proc_register(&proc_root, &proc_mca);
#endif
diff -uNr linux-2.1.20-virgin/include/linux/sysctl.h linux/include/linux/sysctl.h
--- linux-2.1.20-virgin/include/linux/sysctl.h Fri Dec 13 21:05:34 1996
+++ linux/include/linux/sysctl.h Fri Jan 10 09:22:48 1997
@@ -62,13 +62,19 @@
#define KERN_JAVA_INTERPRETER 19 /* path to Java(tm) interpreter */
#define KERN_JAVA_APPLETVIEWER 20 /* path to Java(tm) appletviewer */
#define KERN_SPARC_REBOOT 21 /* reboot command on Sparc */
+#define KERN_CONLOGLVL 22 /* int: console log level */
+#define KERN_MINCONLOG 23 /* int: minimum console log level */
+#define KERN_DEFCONLOG 24 /* int: default console log level */
+#define KERN_DEFMSGLOG 25 /* int: default message log level */
+#define KERN_CTLALTDEL 26 /* int: allow ctrl-alt-del to reboot */

/* CTL_VM names: */
#define VM_SWAPCTL 1 /* struct: Set vm swapping control */
#define VM_KSWAPD 2 /* struct: control background pageout */
#define VM_FREEPG 3 /* struct: Set free page thresholds */
#define VM_BDFLUSH 4 /* struct: Control buffer cache flushing */
-#define VM_MAXID 5
+#define VM_SWAPOUT 5 /* int: Pageout scan interval */
+#define VM_MAXID 6

/* CTL_NET names: */
#define NET_CORE 1
@@ -176,7 +182,7 @@
#ifdef __KERNEL__

extern asmlinkage int sys_sysctl(struct __sysctl_args *);
-extern void init_sysctl(void);
+extern void sysctl_init(void);

typedef struct ctl_table ctl_table;

diff -uNr linux-2.1.20-virgin/init/main.c linux/init/main.c
--- linux-2.1.20-virgin/init/main.c Thu Jan 2 19:24:19 1997
+++ linux/init/main.c Thu Jan 9 23:19:13 1997
@@ -898,7 +898,9 @@
#ifdef __SMP__
smp_init();
#endif
+#ifdef CONFIG_SYSCTL
sysctl_init();
+#endif
/*
* We count on the initial thread going ok
* Like idlers init is an unlocked kernel thread, which will
diff -uNr linux-2.1.20-virgin/kernel/printk.c linux/kernel/printk.c
--- linux-2.1.20-virgin/kernel/printk.c Tue Dec 17 16:07:52 1996
+++ linux/kernel/printk.c Wed Jan 8 20:43:12 1997
@@ -9,6 +9,7 @@
* to the console. Added hook for sending the console messages
* elsewhere, in preparation for a serial line console (someday).
* Ted Ts'o, 2/11/93.
+ * Added sysctl support, 1/8/97, Chris Horn.
*/

#include <stdarg.h>
@@ -41,6 +42,12 @@
struct wait_queue * log_wait = NULL;
int console_loglevel = DEFAULT_CONSOLE_LOGLEVEL;

+/* For sysctl support... */
+int default_message_loglevel = DEFAULT_MESSAGE_LOGLEVEL;
+int minimum_console_loglevel = MINIMUM_CONSOLE_LOGLEVEL;
+int default_console_loglevel = DEFAULT_CONSOLE_LOGLEVEL;
+
+
static void (*console_print_proc)(const char *) = 0;
static char log_buf[LOG_BUF_LEN];
static unsigned long log_start = 0;
@@ -131,16 +138,16 @@
logged_chars = 0;
return 0;
case 6: /* Disable logging to console */
- console_loglevel = MINIMUM_CONSOLE_LOGLEVEL;
+ console_loglevel = minimum_console_loglevel;
return 0;
case 7: /* Enable logging to console */
- console_loglevel = DEFAULT_CONSOLE_LOGLEVEL;
+ console_loglevel = default_console_loglevel;
return 0;
case 8:
if (len < 1 || len > 8)
return -EINVAL;
- if (len < MINIMUM_CONSOLE_LOGLEVEL)
- len = MINIMUM_CONSOLE_LOGLEVEL;
+ if (len < minimum_console_loglevel)
+ len = minimum_console_loglevel;
console_loglevel = len;
return 0;
}
@@ -173,7 +180,7 @@
) {
p -= 3;
p[0] = '<';
- p[1] = DEFAULT_MESSAGE_LOGLEVEL + '0';
+ p[1] = default_message_loglevel + '0';
p[2] = '>';
} else
msg += 3;
diff -uNr linux-2.1.20-virgin/kernel/sysctl.c linux/kernel/sysctl.c
--- linux-2.1.20-virgin/kernel/sysctl.c Fri Dec 13 21:05:35 1996
+++ linux/kernel/sysctl.c Fri Jan 10 09:22:24 1997
@@ -7,6 +7,8 @@
* Added hooks for /proc/sys/net (minor, minor patch), 96/4/1, Mike Shaver.
* Added kernel/java-{interpreter,appletviewer}, 96/5/10, Mike Shaver.
* Dynamic registration fixes, Stephen Tweedie.
+ * Added swapout-interval, ctrl-alt-del, printk logging stuff, 1/8/97, Chris Horn.
+ * Made sysctl support optional via CONFIG_SYSCTL, 1/10/97, Chris Horn.
*/

#include <linux/config.h>
@@ -24,24 +26,40 @@
#include <asm/bitops.h>
#include <asm/uaccess.h>

+#ifdef CONFIG_ROOT_NFS
+#include <linux/nfs_fs.h>
+#endif
+
+#ifdef CONFIG_SYSCTL
+
/* External variables not in a header file. */
extern int panic_timeout;
+extern int console_loglevel, default_message_loglevel;
+extern int minimum_console_loglevel, default_console_loglevel;
+extern int C_A_D, swapout_interval;
+extern int bdf_prm[], bdflush_min[], bdflush_max[];
+extern char binfmt_java_interpreter[], binfmt_java_appletviewer[];

-
-#ifdef CONFIG_ROOT_NFS
-#include <linux/nfs_fs.h>
+#ifdef __sparc__
+extern char reboot_command [];
#endif

-static ctl_table root_table[];
-static struct ctl_table_header root_table_header =
- {root_table, DNODE_SINGLE(&root_table_header)};

static int parse_table(int *, int, void *, size_t *, void *, size_t,
ctl_table *, void **);
+static int do_securelevel_strategy (ctl_table *, int *, int, void *, size_t *,
+ void *, size_t, void **);
+
+
+static ctl_table root_table[];
+static struct ctl_table_header root_table_header =
+ {root_table, DNODE_SINGLE(&root_table_header)};

static ctl_table kern_table[];
static ctl_table vm_table[];
extern ctl_table net_table[];
+static ctl_table dev_table[];
+

/* /proc declarations: */

@@ -94,16 +112,6 @@
static void unregister_proc_table(ctl_table *, struct proc_dir_entry *);
#endif

-extern int bdf_prm[], bdflush_min[], bdflush_max[];
-
-static int do_securelevel_strategy (ctl_table *, int *, int, void *, size_t *,
- void *, size_t, void **);
-
-extern char binfmt_java_interpreter[], binfmt_java_appletviewer[];
-
-#ifdef __sparc__
-extern char reboot_command [];
-#endif

/* The default sysctl tables: */

@@ -111,6 +119,7 @@
{CTL_KERN, "kernel", NULL, 0, 0555, kern_table},
{CTL_VM, "vm", NULL, 0, 0555, vm_table},
{CTL_NET, "net", NULL, 0, 0555, net_table},
+ {CTL_DEV, "dev", NULL, 0, 0555, dev_table},
{0}
};

@@ -157,6 +166,16 @@
{KERN_SPARC_REBOOT, "reboot-cmd", reboot_command,
256, 0644, NULL, &proc_dostring, &sysctl_string },
#endif
+ {KERN_DEFMSGLOG, "def-message-level", &default_message_loglevel, sizeof(int),
+ 0644, NULL, &proc_dointvec},
+ {KERN_MINCONLOG, "min-console-level", &minimum_console_loglevel, sizeof(int),
+ 0644, NULL, &proc_dointvec},
+ {KERN_DEFCONLOG, "def-console-level", &default_console_loglevel, sizeof(int),
+ 0644, NULL, &proc_dointvec},
+ {KERN_CONLOGLVL, "console-level", &console_loglevel, sizeof(int),
+ 0644, NULL, &proc_dointvec},
+ {KERN_CTLALTDEL, "ctrl-alt-del", &C_A_D, sizeof(int),
+ 0644, NULL, &proc_dointvec},
{0}
};

@@ -170,9 +189,17 @@
{VM_BDFLUSH, "bdflush", &bdf_prm, 9*sizeof(int), 0600, NULL,
&proc_dointvec_minmax, &sysctl_intvec, NULL,
&bdflush_min, &bdflush_max},
+ {VM_SWAPOUT, "swapout-interval",
+ &swapout_interval, sizeof(int), 0600, NULL, &proc_dointvec},
+ {0}
+};
+
+static ctl_table dev_table[] = {
{0}
};

+
+
void sysctl_init(void)
{
#ifdef CONFIG_PROC_FS
@@ -927,4 +954,59 @@
copy_from_user(data, newval, len);
return 0;
}
+
+
+#else /* CONFIG_SYSCTL */
+
+
+extern asmlinkage int sys_sysctl(struct __sysctl_args *args)
+{
+ return -ENOSYS;
+}
+
+int sysctl_string(ctl_table *table, int *name, int nlen,
+ void *oldval, size_t *oldlenp,
+ void *newval, size_t newlen, void **context)
+{
+ return -ENOSYS;
+}
+
+int sysctl_intvec(ctl_table *table, int *name, int nlen,
+ void *oldval, size_t *oldlenp,
+ void *newval, size_t newlen, void **context)
+{
+ return -ENOSYS;
+}
+
+int proc_dostring(ctl_table *table, int write, struct file *filp,
+ void *buffer, size_t *lenp)
+{
+ return -ENOSYS;
+}
+
+int proc_dointvec(ctl_table *table, int write, struct file *filp,
+ void *buffer, size_t *lenp)
+{
+ return -ENOSYS;
+}
+
+int proc_dointvec_minmax(ctl_table *table, int write, struct file *filp,
+ void *buffer, size_t *lenp)
+{
+ return -ENOSYS;
+}
+
+struct ctl_table_header * register_sysctl_table(ctl_table * table,
+ int insert_at_head)
+{
+ return 0;
+}
+
+void unregister_sysctl_table(struct ctl_table_header * table)
+{
+}
+
+#endif /* CONFIG_SYSCTL */
+
+

diff -uNr linux-2.1.20-virgin/net/802/Makefile linux/net/802/Makefile
--- linux-2.1.20-virgin/net/802/Makefile Thu Dec 12 21:26:18 1996
+++ linux/net/802/Makefile Thu Jan 9 23:37:29 1997
@@ -8,13 +8,15 @@
# Note 2! The CFLAGS definition is now in the main makefile...

O_TARGET := 802.o
-O_OBJS = p8023.o sysctl_net_802.o
+O_OBJS = p8023.o

ifeq ($(CONFIG_LLC),y)
SUB_DIRS += transit
O_OBJS += llc_macinit.o llc_sendpdu.o llc_utility.o cl2llc.o
+endif

-
+ifeq ($(CONFIG_SYSCTL),y)
+O_OBJS += sysctl_net_802.o
endif

ifdef CONFIG_TR
diff -uNr linux-2.1.20-virgin/net/Makefile linux/net/Makefile
--- linux-2.1.20-virgin/net/Makefile Thu Jan 2 19:24:20 1997
+++ linux/net/Makefile Thu Jan 9 23:34:49 1997
@@ -90,11 +90,15 @@
endif

L_TARGET := network.a
-L_OBJS := socket.o protocols.o sysctl_net.o $(join $(SUB_DIRS),$(SUB_DIRS:%=/%.o))
+L_OBJS := socket.o protocols.o $(join $(SUB_DIRS),$(SUB_DIRS:%=/%.o))
ifeq ($(CONFIG_NET),y)
ifeq ($(CONFIG_MODULES),y)
LX_OBJS = netsyms.o
endif
+endif
+
+ifeq ($(CONFIG_SYSCTL),y)
+L_OBJS += sysctl_net.o
endif

M_OBJS :=
diff -uNr linux-2.1.20-virgin/net/appletalk/Makefile linux/net/appletalk/Makefile
--- linux-2.1.20-virgin/net/appletalk/Makefile Tue Apr 2 00:43:08 1996
+++ linux/net/appletalk/Makefile Thu Jan 9 23:38:26 1997
@@ -8,8 +8,12 @@
# Note 2! The CFLAGS definition is now in the main makefile...

O_TARGET := appletalk.o
-O_OBJS := aarp.o ddp.o sysctl_net_atalk.o
+O_OBJS := aarp.o ddp.o
M_OBJS := $(O_TARGET)
+
+ifeq ($(CONFIG_SYSCTL),y)
+O_OBJS += sysctl_net_atalk.o
+endif

include $(TOPDIR)/Rules.make

diff -uNr linux-2.1.20-virgin/net/ax25/Makefile linux/net/ax25/Makefile
--- linux-2.1.20-virgin/net/ax25/Makefile Sun Nov 10 12:12:57 1996
+++ linux/net/ax25/Makefile Thu Jan 9 23:39:37 1997
@@ -9,8 +9,12 @@


O_TARGET := ax25.o
-O_OBJS := sysctl_net_ax25.o ax25_in.o ax25_out.o ax25_route.o ax25_subr.o ax25_timer.o
+O_OBJS := ax25_in.o ax25_out.o ax25_route.o ax25_subr.o ax25_timer.o
M_OBJS := $(O_TARGET)
+
+ifeq ($(CONFIG_SYSCTL),y)
+O_OBJS += sysctl_net_ax25.o
+endif

OX_OBJS += af_ax25.o

diff -uNr linux-2.1.20-virgin/net/ax25/af_ax25.c linux/net/ax25/af_ax25.c
--- linux-2.1.20-virgin/net/ax25/af_ax25.c Thu Jan 2 19:24:20 1997
+++ linux/net/ax25/af_ax25.c Thu Jan 9 23:42:21 1997
@@ -2428,7 +2428,9 @@
ax25_packet_type.type = htons(ETH_P_AX25);
dev_add_pack(&ax25_packet_type);
register_netdevice_notifier(&ax25_dev_notifier);
+#ifdef CONFIG_SYSCTL
ax25_register_sysctl();
+#endif

#ifdef CONFIG_PROC_FS
proc_net_register(&proc_ax25_route);
@@ -2603,8 +2605,9 @@
#endif
ax25_rt_free();

+#ifdef CONFIG_SYSCTL
ax25_unregister_sysctl();
-
+#endif
unregister_netdevice_notifier(&ax25_dev_notifier);

ax25_packet_type.type = htons(ETH_P_AX25);
diff -uNr linux-2.1.20-virgin/net/ax25/ax25_route.c linux/net/ax25/ax25_route.c
--- linux-2.1.20-virgin/net/ax25/ax25_route.c Thu Jan 2 19:24:20 1997
+++ linux/net/ax25/ax25_route.c Thu Jan 9 23:43:46 1997
@@ -543,8 +543,9 @@
return;
}

+#ifdef CONFIG_SYSCTL
ax25_unregister_sysctl();
-
+#endif
sprintf(ax25_dev->name, "%s.parms", dev->name);

ax25_dev->dev = dev;
@@ -565,20 +566,26 @@
ax25_dev->values[AX25_VALUES_PACLEN] = AX25_DEF_PACLEN;
ax25_dev->values[AX25_VALUES_MAXQUEUE] = AX25_DEF_MAXQUEUE;

+#ifdef CONFIG_SYSCTL
ax25_register_sysctl();
+#endif
}

void ax25_dev_device_down(struct device *dev)
{
int i;

+#ifdef CONFIG_SYSCTL
ax25_unregister_sysctl();
+#endif

for (i = 0; i < AX25_MAX_DEVICES; i++)
if (ax25_device[i].dev != NULL && ax25_device[i].dev == dev)
ax25_device[i].dev = NULL;

+#ifdef CONFIG_SYSCTL
ax25_register_sysctl();
+#endif
}

#ifdef MODULE
diff -uNr linux-2.1.20-virgin/net/bridge/Makefile linux/net/bridge/Makefile
--- linux-2.1.20-virgin/net/bridge/Makefile Mon Jun 3 05:42:41 1996
+++ linux/net/bridge/Makefile Thu Jan 9 23:44:53 1997
@@ -8,8 +8,12 @@
# Note 2! The CFLAGS definition is now in the main makefile...

O_TARGET := bridge.o
-O_OBJS := br.o br_tree.o sysctl_net_bridge.o
+O_OBJS := br.o br_tree.o
M_OBJS := $(O_TARGET)
+
+ifeq ($(CONFIG_SYSCTL),y)
+O_OBJS += sysctl_net_bridge.o
+endif

include $(TOPDIR)/Rules.make

diff -uNr linux-2.1.20-virgin/net/core/Makefile linux/net/core/Makefile
--- linux-2.1.20-virgin/net/core/Makefile Thu Dec 12 21:26:21 1996
+++ linux/net/core/Makefile Thu Jan 9 23:46:04 1997
@@ -9,8 +9,12 @@

O_TARGET := core.o

-O_OBJS := sock.o skbuff.o iovec.o datagram.o sysctl_net_core.o dst.o scm.o \
+O_OBJS := sock.o skbuff.o iovec.o datagram.o dst.o scm.o \
neighbour.o
+
+ifeq ($(CONFIG_SYSCTL),y)
+O_OBJS += sysctl_net_core.o
+endif

ifdef CONFIG_NET

diff -uNr linux-2.1.20-virgin/net/ethernet/Makefile linux/net/ethernet/Makefile
--- linux-2.1.20-virgin/net/ethernet/Makefile Tue Apr 2 00:43:08 1996
+++ linux/net/ethernet/Makefile Thu Jan 9 23:47:01 1997
@@ -9,7 +9,11 @@

O_TARGET := ethernet.o

-OBJS := eth.o sysctl_net_ether.o
+OBJS := eth.o
+
+ifeq ($(CONFIG_SYSCTL),y)
+OBJS += sysctl_net_ether.o
+endif

ifdef CONFIG_IPX
OBJ2 := pe2.o
diff -uNr linux-2.1.20-virgin/net/ipv4/sysctl_net_ipv4.c linux/net/ipv4/sysctl_net_ipv4.c
--- linux-2.1.20-virgin/net/ipv4/sysctl_net_ipv4.c Thu Dec 12 21:26:25 1996
+++ linux/net/ipv4/sysctl_net_ipv4.c Fri Jan 10 11:02:14 1997
@@ -39,6 +39,9 @@
void *buffer, size_t *lenp);

struct ipv4_config ipv4_config = { 1, 1, 1, 1, };
+
+/* Should move ipv4_config out of here so this can be skipped altogether... */
+#ifdef CONFIG_SYSCTL
struct ipv4_config ipv4_def_router_config = { 0, 1, 1, 1, 1, 1, 1, };
struct ipv4_config ipv4_def_host_config = { 1, 1, 1, 1, };

@@ -121,3 +124,5 @@
&proc_dointvec},
{0}
};
+
+#endif /* CONFIG_SYSCTL */
diff -uNr linux-2.1.20-virgin/net/ipv6/Makefile linux/net/ipv6/Makefile
--- linux-2.1.20-virgin/net/ipv6/Makefile Thu Dec 12 21:24:44 1996
+++ linux/net/ipv6/Makefile Thu Jan 9 23:50:18 1997
@@ -11,9 +11,13 @@
O_OBJS := af_inet6.o ipv6_output.o ipv6_input.o addrconf.o sit.o \
ipv6_route.o ipv6_sockglue.o ndisc.o udp.o raw.o \
protocol.o icmp.o mcast.o reassembly.o tcp_ipv6.o \
- exthdrs.o sysctl_net_ipv6.o datagram.o
+ exthdrs.o datagram.o

MOD_LIST_NAME := IPV6_MODULES
M_OBJS := $(O_TARGET)
+
+ifeq ($(CONFIG_SYSCTL),y)
+O_OBJS += sysctl_net_ipv6.o
+endif

include $(TOPDIR)/Rules.make
diff -uNr linux-2.1.20-virgin/net/ipv6/ipv6_sockglue.c linux/net/ipv6/ipv6_sockglue.c
--- linux-2.1.20-virgin/net/ipv6/ipv6_sockglue.c Thu Dec 12 21:26:26 1996
+++ linux/net/ipv6/ipv6_sockglue.c Thu Jan 9 23:52:48 1997
@@ -252,7 +252,7 @@
return 0;
}

-#ifdef MODULE
+#if defined(MODULE) && defined(CONFIG_SYSCTL)

/*
* sysctl registration functions defined in sysctl_net_ipv6.c
@@ -268,7 +268,7 @@

dev_add_pack(&ipv6_packet_type);

-#ifdef MODULE
+#if defined(MODULE) && defined(CONFIG_SYSCTL)
ipv6_sysctl_register();
#endif

@@ -282,7 +282,9 @@
{
unregister_netdevice_notifier(&ipv6_dev_notf);
dev_remove_pack(&ipv6_packet_type);
+#ifdef CONFIG_SYSCTL
ipv6_sysctl_unregister();
+#endif
ipv6_route_cleanup();
ndisc_cleanup();
addrconf_cleanup();
diff -uNr linux-2.1.20-virgin/net/ipx/Makefile linux/net/ipx/Makefile
--- linux-2.1.20-virgin/net/ipx/Makefile Tue Apr 2 00:43:08 1996
+++ linux/net/ipx/Makefile Thu Jan 9 23:53:40 1997
@@ -8,8 +8,12 @@
# Note 2! The CFLAGS definition is now in the main makefile...

O_TARGET := ipx.o
-O_OBJS := af_ipx.o sysctl_net_ipx.o
+O_OBJS := af_ipx.o
M_OBJS := $(O_TARGET)
+
+ifeq ($(CONFIG_SYSCTL),y)
+O_OBJS += sysctl_net_ipx.o
+endif

include $(TOPDIR)/Rules.make

diff -uNr linux-2.1.20-virgin/net/netrom/Makefile linux/net/netrom/Makefile
--- linux-2.1.20-virgin/net/netrom/Makefile Sun Nov 10 12:12:58 1996
+++ linux/net/netrom/Makefile Fri Jan 10 00:00:43 1997
@@ -8,8 +8,12 @@
# Note 2! The CFLAGS definition is now in the main makefile...

O_TARGET := netrom.o
-O_OBJS := af_netrom.o sysctl_net_netrom.o nr_dev.o nr_in.o nr_out.o nr_route.o nr_subr.o nr_timer.o
+O_OBJS := af_netrom.o nr_dev.o nr_in.o nr_out.o nr_route.o nr_subr.o nr_timer.o
M_OBJS := $(O_TARGET)
+
+ifeq ($(CONFIG_SYSCTL),y)
+O_OBJS += sysctl_net_netrom.o
+endif

include $(TOPDIR)/Rules.make

diff -uNr linux-2.1.20-virgin/net/netrom/af_netrom.c linux/net/netrom/af_netrom.c
--- linux-2.1.20-virgin/net/netrom/af_netrom.c Thu Jan 2 19:24:25 1997
+++ linux/net/netrom/af_netrom.c Fri Jan 10 00:02:19 1997
@@ -1482,7 +1482,9 @@
for (i = 0; i < 4; i++)
register_netdev(&dev_nr[i]);

+#ifdef CONFIG_SYSCTL
nr_register_sysctl();
+#endif

#ifdef CONFIG_PROC_FS
proc_net_register(&proc_net_nr);
@@ -1517,8 +1519,9 @@

unregister_netdevice_notifier(&nr_dev_notifier);

+#ifdef CONFIG_SYSCTL
nr_unregister_sysctl();
-
+#endif
sock_unregister(AF_NETROM);

for (i = 0; i < 4; i++) {
diff -uNr linux-2.1.20-virgin/net/rose/Makefile linux/net/rose/Makefile
--- linux-2.1.20-virgin/net/rose/Makefile Sun Nov 10 12:12:58 1996
+++ linux/net/rose/Makefile Thu Jan 9 23:56:17 1997
@@ -8,8 +8,12 @@
# Note 2! The CFLAGS definition is now in the main makefile...

O_TARGET := rose.o
-O_OBJS := af_rose.o sysctl_net_rose.o rose_dev.o rose_in.o rose_link.o rose_out.o rose_route.o rose_subr.o rose_timer.o
+O_OBJS := af_rose.o rose_dev.o rose_in.o rose_link.o rose_out.o rose_route.o rose_subr.o rose_timer.o
M_OBJS := $(O_TARGET)
+
+ifeq ($(CONFIG_SYSCTL),y)
+O_OBJS += sysctl_net_rose.o
+endif

include $(TOPDIR)/Rules.make

diff -uNr linux-2.1.20-virgin/net/rose/af_rose.c linux/net/rose/af_rose.c
--- linux-2.1.20-virgin/net/rose/af_rose.c Thu Jan 2 19:24:25 1997
+++ linux/net/rose/af_rose.c Thu Jan 9 23:58:02 1997
@@ -1502,7 +1502,9 @@
for (i = 0; i < 6; i++)
register_netdev(&dev_rose[i]);

+#ifdef CONFIG_SYSCTL
rose_register_sysctl();
+#endif

#ifdef CONFIG_PROC_FS
proc_net_register(&proc_net_rose);
@@ -1537,8 +1539,9 @@
ax25_protocol_release(AX25_P_ROSE);
ax25_linkfail_release(rose_link_failed);

+#ifdef CONFIG_SYSCTL
rose_unregister_sysctl();
-
+#endif
unregister_netdevice_notifier(&rose_dev_notifier);

sock_unregister(AF_ROSE);
diff -uNr linux-2.1.20-virgin/net/unix/Makefile linux/net/unix/Makefile
--- linux-2.1.20-virgin/net/unix/Makefile Tue Apr 2 00:43:08 1996
+++ linux/net/unix/Makefile Thu Jan 9 23:58:56 1997
@@ -8,7 +8,11 @@
# Note 2! The CFLAGS definition is now in the main makefile...

O_TARGET := unix.o
-O_OBJS := af_unix.o garbage.o sysctl_net_unix.o
+O_OBJS := af_unix.o garbage.o
+
+ifeq ($(CONFIG_SYSCTL),y)
+O_OBJS += sysctl_net_unix.o
+endif

include $(TOPDIR)/Rules.make

diff -uNr linux-2.1.20-virgin/net/x25/Makefile linux/net/x25/Makefile
--- linux-2.1.20-virgin/net/x25/Makefile Fri Dec 13 21:05:39 1996
+++ linux/net/x25/Makefile Thu Jan 9 23:59:58 1997
@@ -8,8 +8,12 @@
# Note 2! The CFLAGS definition is now in the main makefile...

O_TARGET := x25.o
-O_OBJS := af_x25.o sysctl_net_x25.o x25_dev.o x25_in.o x25_link.o x25_out.o x25_route.o x25_subr.o x25_timer.o
+O_OBJS := af_x25.o x25_dev.o x25_in.o x25_link.o x25_out.o x25_route.o x25_subr.o x25_timer.o
M_OBJS := $(O_TARGET)
+
+ifeq ($(CONFIG_SYSCTL),y)
+O_OBJS += sysctl_net_x25.o
+endif

include $(TOPDIR)/Rules.make

--------------636C2E1E38A8649B3BAFD218--