]> git.hungrycats.org Git - linux/commitdiff
[PATCH] Deprecate numerical sysctl
authorAndi Kleen <ak@muc.de>
Sat, 12 Jul 2003 02:45:55 +0000 (19:45 -0700)
committerLinus Torvalds <torvalds@home.osdl.org>
Sat, 12 Jul 2003 02:45:55 +0000 (19:45 -0700)
Deprecate the numerical sysctl name space. People can use /proc/sys
instead.

The numeric name space was never well maintained and especially
in distribution kernels is not very consistent (everybody has their
own extensions, conflicting with others). It's also a great
source of rejects when merging patches.  The name-based /proc/sys
is a much better interface for this, which people should use instead.

Discussion of this on l-k found no advocate for it, so it seems to not
be very popular anyways.

This patch deprecates numerical name space accesses to make it possible
to remove them in the future. The only exception is kernel.version,
which is used by glibc (this one has to be maintained forever)

include/linux/sysctl.h
kernel/sysctl.c

index c7bd946843b44894aabe7eb419444bdddb537e21..57ad81aac1614fd07ab5575489077fd1e5aca666 100644 (file)
@@ -6,16 +6,10 @@
  ****************************************************************
  ****************************************************************
  **
- **  WARNING:  
  **  The values in this file are exported to user space via 
- **  the sysctl() binary interface.  Do *NOT* change the 
- **  numbering of any existing values here, and do not change
- **  any numbers within any one set of values.  If you have
- **  to redefine an existing interface, use a new number for it.
- **  The kernel will then return ENOTDIR to any application using
- **  the old binary interface.
- **
- **  --sct
+ **  the sysctl() binary interface.  However this interface
+ **  is unstable and deprecated and will be removed in the future. 
+ **  For a stable interface use /proc/sys.
  **
  ****************************************************************
  ****************************************************************
index d190b98f996a3e09ac380c6fcfca4f8f45f95f2a..6863399cb1dc5f0563213ec444d59b4963228cf2 100644 (file)
@@ -852,7 +852,16 @@ asmlinkage long sys_sysctl(struct __sysctl_args __user *args)
 
        if (copy_from_user(&tmp, args, sizeof(tmp)))
                return -EFAULT;
-               
+       
+       if (tmp.nlen != 2 || tmp.name[0] != CTL_KERN ||
+           tmp.name[1] != KERN_VERSION) { 
+               int i;
+               printk(KERN_INFO "%s: numerical sysctl ", current->comm); 
+               for (i = 0; i < tmp.nlen; i++) 
+                       printk("%d ", tmp.name[i]); 
+               printk("is obsolete.\n");
+       } 
+
        lock_kernel();
        error = do_sysctl(tmp.name, tmp.nlen, tmp.oldval, tmp.oldlenp,
                          tmp.newval, tmp.newlen);