Commit 209f0abb authored by Andi Kleen's avatar Andi Kleen Committed by Linus Torvalds

[PATCH] Deprecate numerical sysctl

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)
parent ed08e6df
...@@ -6,16 +6,10 @@ ...@@ -6,16 +6,10 @@
**************************************************************** ****************************************************************
**************************************************************** ****************************************************************
** **
** WARNING:
** The values in this file are exported to user space via ** The values in this file are exported to user space via
** the sysctl() binary interface. Do *NOT* change the ** the sysctl() binary interface. However this interface
** numbering of any existing values here, and do not change ** is unstable and deprecated and will be removed in the future.
** any numbers within any one set of values. If you have ** For a stable interface use /proc/sys.
** 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
** **
**************************************************************** ****************************************************************
**************************************************************** ****************************************************************
......
...@@ -853,6 +853,15 @@ asmlinkage long sys_sysctl(struct __sysctl_args __user *args) ...@@ -853,6 +853,15 @@ asmlinkage long sys_sysctl(struct __sysctl_args __user *args)
if (copy_from_user(&tmp, args, sizeof(tmp))) if (copy_from_user(&tmp, args, sizeof(tmp)))
return -EFAULT; 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(); lock_kernel();
error = do_sysctl(tmp.name, tmp.nlen, tmp.oldval, tmp.oldlenp, error = do_sysctl(tmp.name, tmp.nlen, tmp.oldval, tmp.oldlenp,
tmp.newval, tmp.newlen); tmp.newval, tmp.newlen);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment