mirror of
https://github.com/gnustep/libs-ec.git
synced 2025-05-31 01:10:55 +00:00
Change core size setting to use MB and fix to update dynamically
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/ec/trunk@36588 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
23100989c4
commit
07bf4d6b99
2 changed files with 44 additions and 34 deletions
|
@ -52,8 +52,8 @@
|
||||||
<deflist>
|
<deflist>
|
||||||
<term>EcCoreSize</term>
|
<term>EcCoreSize</term>
|
||||||
<desc>
|
<desc>
|
||||||
Specifies the maximum size (in bytes) for any core-dump of the
|
Specifies the maximum size (in MB) for any core-dump of the
|
||||||
process.
|
process.<br />
|
||||||
If this is negative, the default size of 1GB is used.<br />
|
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.
|
If this is zero (or no value is set) then no limit is set.
|
||||||
</desc>
|
</desc>
|
||||||
|
|
74
EcProcess.m
74
EcProcess.m
|
@ -448,6 +448,8 @@ static NSMutableArray *noNetConfig = nil;
|
||||||
|
|
||||||
static NSMutableDictionary *servers = nil;
|
static NSMutableDictionary *servers = nil;
|
||||||
|
|
||||||
|
static int coreSize = 0;
|
||||||
|
|
||||||
static NSString *hostName = nil;
|
static NSString *hostName = nil;
|
||||||
static NSString *
|
static NSString *
|
||||||
ecHostName()
|
ecHostName()
|
||||||
|
@ -1050,6 +1052,7 @@ static NSString *noFiles = @"No log files to archive";
|
||||||
NSDictionary *dict;
|
NSDictionary *dict;
|
||||||
NSString *mode;
|
NSString *mode;
|
||||||
NSString *str;
|
NSString *str;
|
||||||
|
int i;
|
||||||
|
|
||||||
enumerator = [cmdDebugKnown keyEnumerator];
|
enumerator = [cmdDebugKnown keyEnumerator];
|
||||||
while (nil != (mode = [enumerator nextObject]))
|
while (nil != (mode = [enumerator nextObject]))
|
||||||
|
@ -1094,6 +1097,45 @@ static NSString *noFiles = @"No log files to archive";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
i = (int)[cmdDefs integerForKey: @"CoreSize"];
|
||||||
|
if (i < 0)
|
||||||
|
{
|
||||||
|
i = 1024; // 1 GB default
|
||||||
|
}
|
||||||
|
if (i != coreSize)
|
||||||
|
{
|
||||||
|
struct rlimit rlim;
|
||||||
|
rlim_t want;
|
||||||
|
|
||||||
|
coreSize = i;
|
||||||
|
want = i * 1024 * 1024;
|
||||||
|
if (i > 0)
|
||||||
|
{
|
||||||
|
if (getrlimit(RLIMIT_CORE, &rlim) < 0)
|
||||||
|
{
|
||||||
|
NSLog(@"Unable to get core file size limit: %d", errno);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (rlim.rlim_max < want)
|
||||||
|
{
|
||||||
|
NSLog(@"Hard limit for core file size (%dMB)"
|
||||||
|
@" less than requested (%dMB)",
|
||||||
|
(int)(rlim.rlim_max/(1024*1024)), coreSize);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rlim.rlim_cur = want;
|
||||||
|
if (setrlimit(RLIMIT_CORE, &rlim) < 0)
|
||||||
|
{
|
||||||
|
NSLog(@"Unable to set core file size limit to %uMB"
|
||||||
|
@", errno: %d", coreSize, errno);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (servers != nil)
|
if (servers != nil)
|
||||||
{
|
{
|
||||||
NSEnumerator *e;
|
NSEnumerator *e;
|
||||||
|
@ -3040,7 +3082,6 @@ NSLog(@"Ignored attempt to set timer interval to %g ... using 10.0", interval);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
struct rlimit rlim;
|
|
||||||
NSProcessInfo *pinfo;
|
NSProcessInfo *pinfo;
|
||||||
NSFileManager *mgr;
|
NSFileManager *mgr;
|
||||||
NSEnumerator *enumerator;
|
NSEnumerator *enumerator;
|
||||||
|
@ -3178,37 +3219,6 @@ NSLog(@"Ignored attempt to set timer interval to %g ... using 10.0", interval);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
i = [cmdDefs integerForKey: @"CoreSize"];
|
|
||||||
if (i < 0)
|
|
||||||
{
|
|
||||||
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)
|
if (nil == noNetConfig)
|
||||||
{
|
{
|
||||||
noNetConfig = [[NSMutableArray alloc] initWithCapacity: 4];
|
noNetConfig = [[NSMutableArray alloc] initWithCapacity: 4];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue