Improve core dump setting

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/ec/trunk@36362 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2013-03-15 11:02:32 +00:00
parent ca48656dc6
commit 80bd3b6a7b
3 changed files with 40 additions and 23 deletions

View file

@ -1,3 +1,9 @@
2013-03-15 Richard Frith-Macdonald <rfm@gnu.org>
* EcProcess.h: Document EcCoreSize
* EcProcess.m: Change so that if no value is set, we don't use any
limit, and so that if a negative value is set we use 1GB
2013-03-13 Richard Frith-Macdonald <rfm@gnu.org>
* GNUmakefile: 1.0.2 release

View file

@ -50,6 +50,13 @@
<subsect>
<heading>startup settings</heading>
<deflist>
<term>EcCoreSize</term>
<desc>
Specifies the maximum size (in bytes) for any core-dump of the
process.
If this is negative, the default size of 1GB is used.<br />
If this is zero (or no value is set) then no limit is set.
</desc>
<term>EcDebug-</term>
<desc>
Any key of the form EcDebug-xxx turns on the xxx debug level

View file

@ -3109,32 +3109,36 @@ NSLog(@"Ignored attempt to set timer interval to %g ... using 10.0", interval);
}
}
i = [cmdDefs integerForKey: @"CoreSize"];
if (i <= 0)
if (i < 0)
{
i = 250000000;
}
if (getrlimit(RLIMIT_CORE, &rlim) < 0)
{
NSLog(@"Unable to get core file size limit: %d", errno);
}
else
{
if (rlim.rlim_max < i)
{
NSLog(@"Hard limit for core file size (%lu) less than desired",
rlim.rlim_max);
}
else
{
rlim.rlim_cur = i;
if (setrlimit(RLIMIT_CORE, &rlim) < 0)
{
NSLog(@"Unable to set core file size limit: %d", errno);
}
}
i = 1024 * 1024 * 1024; // 1 GB default
}
if (i > 0)
{
if (getrlimit(RLIMIT_CORE, &rlim) < 0)
{
NSLog(@"Unable to get core file size limit: %d", errno);
}
else
{
if (rlim.rlim_max < i)
{
NSLog(@"Hard limit for core file size (%"PRIuPTR
@") less than requested (%"PRIdPTR,
(NSUInteger)rlim.rlim_max, i);
}
else
{
rlim.rlim_cur = i;
if (setrlimit(RLIMIT_CORE, &rlim) < 0)
{
NSLog(@"Unable to set core file size limit to %"PRIdPTR
@", errno: %d", i, errno);
}
}
}
}
if (nil == noNetConfig)
{