• Amerigo Wang's avatar
    sysctl: refactor integer handling proc code · 00b7c339
    Amerigo Wang authored
    (Based on Octavian's work, and I modified a lot.)
    
    As we are about to add another integer handling proc function a little
    bit of cleanup is in order: add a few helper functions to improve code
    readability and decrease code duplication.
    
    In the process a bug is also fixed: if the user specifies a number
    with more then 20 digits it will be interpreted as two integers
    (e.g. 10000...13 will be interpreted as 100.... and 13).
    
    Behavior for EFAULT handling was changed as well. Previous to this
    patch, when an EFAULT error occurred in the middle of a write
    operation, although some of the elements were set, that was not
    acknowledged to the user (by shorting the write and returning the
    number of bytes accepted). EFAULT is now treated just like any other
    errors by acknowledging the amount of bytes accepted.
    Signed-off-by: default avatarOctavian Purdila <opurdila@ixiacom.com>
    Signed-off-by: default avatarWANG Cong <amwang@redhat.com>
    Cc: Eric W. Biederman <ebiederm@xmission.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    00b7c339
sysctl.c 63.8 KB