Konstantin Belousov <k...@freebsd.org> writes:

> Author: kib
> Date: Mon Oct 21 16:46:12 2013
> New Revision: 256850
> URL: http://svnweb.freebsd.org/changeset/base/256850
>
> Log:
>   Add a resource limit for the total number of kqueues available to the
>   user.  Kqueue now saves the ucred of the allocating thread, to
>   correctly decrement the counter on close.
>   
>   Under some specific and not real-world use scenario for kqueue, it is
>   possible for the kqueues to consume memory proportional to the square
>   of the number of the filedescriptors available to the process.  Limit
>   allows administrator to prevent the abuse.
>   
>   This is kernel-mode side of the change, with the user-mode enabling
>   commit following.
>   
>   Reported and tested by:     pho
>   Discussed with:     jmg
>   Sponsored by:       The FreeBSD Foundation
>   MFC after:  2 weeks
>
> Modified:
>   head/bin/sh/miscbltin.c
>   head/etc/login.conf
>   head/lib/libc/sys/getrlimit.2
>   head/lib/libutil/login_class.3
>   head/lib/libutil/login_class.c
>   head/usr.bin/limits/limits.c
>   head/usr.bin/procstat/procstat_rlimit.c

kqueues limit isn't documented in sh(1) and limits(1) manpages.

>
> Modified: head/bin/sh/miscbltin.c
> ==============================================================================
> --- head/bin/sh/miscbltin.c   Mon Oct 21 16:44:53 2013        (r256849)
> +++ head/bin/sh/miscbltin.c   Mon Oct 21 16:46:12 2013        (r256850)
> @@ -405,6 +405,9 @@ static const struct limits limits[] = {
>  #ifdef RLIMIT_NPTS
>       { "pseudo-terminals",   (char *)0,      RLIMIT_NPTS,       1, 'p' },
>  #endif
> +#ifdef RLIMIT_KQUEUES
> +     { "kqueues",            (char *)0,      RLIMIT_KQUEUES,    1, 'k' },
> +#endif
>       { (char *) 0,           (char *)0,      0,                 0, '\0' }
>  };
>  

I've submitted a patch to add ulimit -k (kqueue) to zsh but the reviewer
asked me to rename -k to -K to avoid conflict with ulimit -k (posixlocks)
from DragonFly. Do you anticipate FreeBSD never adds RLIMIT_POSIXLOCKS
support or would use incompatible option switch?

http://www.zsh.org/mla/workers/2013/msg00984.html
http://gitweb.dragonflybsd.org/dragonfly.git?a=search&h=HEAD&st=commit&s=posixlocks

> Modified: head/usr.bin/limits/limits.c
> ==============================================================================
> --- head/usr.bin/limits/limits.c      Mon Oct 21 16:44:53 2013        
> (r256849)
> +++ head/usr.bin/limits/limits.c      Mon Oct 21 16:46:12 2013        
> (r256850)

This adds limits -e support only for sh, csh, tcsh. What about other
shells that already support sbsize and swapuse extensions?

_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to