git: kernel - Add per-user file descriptor limit

Matthew Dillon dillon at crater.dragonflybsd.org
Tue Aug 10 16:35:58 PDT 2010


commit d37c8f7fecbdf4f76bd481048935533b58b88baa
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Tue Aug 10 16:27:27 2010 -0700

    kernel - Add per-user file descriptor limit
    
    * Add kern.maxfilesperuser and kern.minfilesperproc to complement the
      kern.maxfilesperproc which already exists.  Print a warning on the
      console if a user hits the limit (rate limited).
    
    * Track per-user files via the uidinfo structure.  Each file pointer counts
      as one file.  dup()'d and fork()'d file descriptors do not count.
    
    * Adjust the default user limits to approximately 1/4 the system maximums
      instead of 9/10 the system maximums.  This reduces the maximum descriptors
      per process and the maximum processes per uid.  They can be raised again
      via sysctl.
    
    * Set minfilesperproc to 8 by default.  This is a safety which guarantees
      that a process can always have at least that many open descriptors
      without tripping over kern.maxfilesperuser.
    
    Reported-by: swildner

Summary of changes:
 sys/kern/kern_descrip.c  |  116 +++++++++++++++++++++++++++++++++++++++------
 sys/kern/kern_resource.c |    8 ++--
 sys/kern/subr_param.c    |   35 +++++++++++++-
 sys/sys/file.h           |    2 +
 sys/sys/resourcevar.h    |    2 +
 5 files changed, 140 insertions(+), 23 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/d37c8f7fecbdf4f76bd481048935533b58b88baa


-- 
DragonFly BSD source repository





More information about the Commits mailing list