From owner-svn-src-all@FreeBSD.ORG Wed Oct 30 13:32:31 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id AB2D993D; Wed, 30 Oct 2013 13:32:31 +0000 (UTC) (envelope-from BM-2cXppXU4T67w7j6NCir9T1WdzBHmFgBnLj@bitmessage.ch) Received: from mail.bitmessage.ch (unknown [IPv6:2002:92e4:70fc::92e4:70fc]) by mx1.freebsd.org (Postfix) with SMTP id 95856217D; Wed, 30 Oct 2013 13:32:30 +0000 (UTC) dkim-signature: v=1; a=rsa-sha256; d=bitmessage.ch; s=mail; c=relaxed/relaxed; q=dns/txt; h=From:Subject:Date:Message-ID:To:CC:MIME-Version:Content-Type:In-Reply-To:References; bh=dbKkp6aLWn66aqWBuMzx2wE1wYq/cNEK2ZB8+esQxk0=; b=O+3v8ao77kxkwfVz4eo4yQKbOcIRKgZFGInl332OERk7EhnJcODM1x+Ji+Z2A3hyFxSlhRxheUH7wd04Mfo5zgIBb/yzr5XGS2t9tA6syTb2e5+oRJgtqD3oCeWFFaDf7w3aJo2iCX4Txt8TrT4xQRURwBNY5mJj1C+F90kGXeY= Received: from nil ([127.0.0.1]) by mail.bitmessage.ch ; Wed, 30 Oct 2013 14:31:31 +0100 From: Stefan Neudorf To: Konstantin Belousov Subject: Re: svn commit: r256850 - in head: bin/sh etc lib/libc/sys lib/libutil usr.bin/limits usr.bin/procstat In-Reply-To: <201310211646.r9LGkDl5012906@svn.freebsd.org> (Konstantin Belousov's message of "Mon, 21 Oct 2013 16:46:13 +0000 (UTC)") Date: Wed, 30 Oct 2013 14:01:57 +0100 Message-ID: <20131030.86fvriud2y@bitmessage.ch> References: <201310211646.r9LGkDl5012906@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Oct 2013 13:32:31 -0000 Konstantin Belousov 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?