From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20366 invoked from network); 14 Jun 2004 15:23:51 -0000 Received: from thor.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.86) by ns1.primenet.com.au with SMTP; 14 Jun 2004 15:23:51 -0000 Received: (qmail 30861 invoked from network); 14 Jun 2004 15:23:15 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 14 Jun 2004 15:23:15 -0000 Received: (qmail 8837 invoked by alias); 14 Jun 2004 15:23:07 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 20041 Received: (qmail 8822 invoked from network); 14 Jun 2004 15:23:07 -0000 Received: from thor.dotsrc.org (HELO a.mx.sunsite.dk) (qmailr@130.225.247.86) by sunsite.dk with SMTP; 14 Jun 2004 15:23:04 -0000 Received: (qmail 29920 invoked from network); 14 Jun 2004 15:22:23 -0000 Received: from lhuumrelay3.lnd.ops.eu.uu.net (62.189.58.19) by a.mx.sunsite.dk with SMTP; 14 Jun 2004 15:22:21 -0000 Received: from MAILSWEEPER01.csr.com (mailhost1.csr.com [62.189.183.235]) by lhuumrelay3.lnd.ops.eu.uu.net (8.11.0/8.11.0) with ESMTP id i5EFLsv19934 for ; Mon, 14 Jun 2004 15:21:54 GMT Received: from EXCHANGE02.csr.com (unverified [192.168.137.45]) by MAILSWEEPER01.csr.com (Content Technologies SMTPRS 4.3.12) with ESMTP id for ; Mon, 14 Jun 2004 16:21:17 +0100 Received: from news01.csr.com ([192.168.143.38]) by EXCHANGE02.csr.com with Microsoft SMTPSVC(5.0.2195.6713); Mon, 14 Jun 2004 16:24:57 +0100 Received: from news01.csr.com (localhost.localdomain [127.0.0.1]) by news01.csr.com (8.12.11/8.12.11) with ESMTP id i5EFLolV019196 for ; Mon, 14 Jun 2004 16:21:50 +0100 Received: from csr.com (pws@localhost) by news01.csr.com (8.12.11/8.12.11/Submit) with ESMTP id i5EFLolC019193 for ; Mon, 14 Jun 2004 16:21:50 +0100 Message-Id: <200406141521.i5EFLolC019193@news01.csr.com> X-Authentication-Warning: news01.csr.com: pws owned process doing -bs To: Zsh workers Subject: Re: setting resource limits In-reply-to: "Peter Stephenson"'s message of "Mon, 14 Jun 2004 14:08:01 BST." <200406141308.i5ED81Kl015224@news01.csr.com> Date: Mon, 14 Jun 2004 16:21:49 +0100 From: Peter Stephenson X-OriginalArrivalTime: 14 Jun 2004 15:24:57.0117 (UTC) FILETIME=[BFF6C4D0:01C45223] X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, hits=0.0 required=6.0 tests=none autolearn=no version=2.63 X-Spam-Hits: 0.0 A much nicer way of doing it is with an explicit option to give the number of the limit. This is more consistent with normal ulimit behaviour. Index: Doc/Zsh/builtins.yo =================================================================== RCS file: /cvsroot/zsh/zsh/Doc/Zsh/builtins.yo,v retrieving revision 1.68 diff -u -r1.68 builtins.yo --- Doc/Zsh/builtins.yo 21 May 2004 20:04:59 -0000 1.68 +++ Doc/Zsh/builtins.yo 14 Jun 2004 15:19:24 -0000 @@ -1406,7 +1406,7 @@ findex(ulimit) cindex(resource limits) cindex(limits, resource) -item(tt(ulimit) [ tt(-SHacdflmnpstv) [ var(limit) ] ... ])( +item(tt(ulimit) [ tt(-SHacdflmnpstv) [ tt(-N) var(type) ] [ var(limit) ] ... ])( Set or display resource limits of the shell and the processes started by the shell. The value of var(limit) can be a number in the unit specified below or the value `tt(unlimited)'. By default, only soft limits are @@ -1432,6 +1432,11 @@ sitem(tt(-v))(K-bytes on the size of virtual memory. On some systems this refers to the limit called `address space'.) endsitem() + +Alternatively, the limit can be given by number using tt(-N) var(limit). +This can be used to set a limit known to the operating system, but +not to the shell. Limits are typically given in the file +tt(/usr/include/sys/resource.h), or a file included from there. ) findex(umask) cindex(umask) Index: Src/Builtins/rlimits.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Builtins/rlimits.c,v retrieving revision 1.11 diff -u -r1.11 rlimits.c --- Src/Builtins/rlimits.c 2 Jun 2004 22:14:47 -0000 1.11 +++ Src/Builtins/rlimits.c 14 Jun 2004 15:19:24 -0000 @@ -485,6 +485,23 @@ case 'S': soft = 1; continue; + case 'N': + if (options[1]) { + res = (int)zstrtol(options+1, NULL, 10); + argv++; + } else if (*argv) { + res = (int)zstrtol(*argv++, NULL, 10); + } else { + zwarnnam(name, "number required after -N", + NULL, 0); + return 1; + } + /* + * fake it so it looks like we just finished an option... + */ + while (options[1]) + options++; + break; case 'a': if (resmask) { zwarnnam(name, "no limits allowed with -a", -- Peter Stephenson Software Engineer CSR Ltd., Science Park, Milton Road, Cambridge, CB4 0WH, UK Tel: +44 (0)1223 692070 ********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. www.mimesweeper.com **********************************************************************