Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Bug in ulimit ?
- X-seq: zsh-workers 23290
- From: Stephane Chazelas <Stephane_Chazelas@xxxxxxxx>
- To: Micah Cowan <micah@xxxxxxxxxx>, zsh-workers@xxxxxxxxxx
- Subject: Re: Bug in ulimit ?
- Date: Tue, 17 Apr 2007 14:24:46 +0100
- In-reply-to: <20070417130316.GD4955@xxxxxxxxxxxxxxx>
- Mail-followup-to: Micah Cowan <micah@xxxxxxxxxx>, zsh-workers@xxxxxxxxxx
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <46248CC2.4010901@xxxxxxxxxxxxx> <462493C0.20700@xxxxxxxxxx> <20070417094244.GA4955@xxxxxxxxxxxxxxx> <46249BC7.8070200@xxxxxxxxxx> <20070417104303.GB4955@xxxxxxxxxxxxxxx> <4624A79F.1020107@xxxxxxxxxx> <20070417125355.GC4955@xxxxxxxxxxxxxxx> <20070417130316.GD4955@xxxxxxxxxxxxxxx>
On Tue, Apr 17, 2007 at 02:03:16PM +0100, Stephane Chazelas wrote:
[...]
> So it would seem that the limit is inherited but not applied in
> the child (and I couldn't see any signal being blocked or
> ignored). So that's probably not a libc issue, rather a Linux
> issue.
[...]
The Linux code for setrlimit gives a hint:
if (it_prof_secs == 0 || new_rlim.rlim_cur <= it_prof_secs) {
unsigned long rlim_cur = new_rlim.rlim_cur;
cputime_t cputime;
if (rlim_cur == 0) {
/*
* The caller is asking for an immediate RLIMIT_CPU
* expiry. But we use the zero value to mean "it was
* never set". So let's cheat and make it one second
* instead
*/
rlim_cur = 1;
}
It's stored as being "0" and armed with a 1 second delay. And on a fork,
obviously, for the new process, there's no way to distinguish
between a 0 that means "not set" and a 0 that means exit
immediately.
And one can verify that it_prof_expires will be set to 0 in
copy_signal during the fork and that 0 means not armed in
check_process_timers.
But what's the point of setting a cputime of 0 anyway?
--
Stéphane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author