skip reforking with ulimit code on 64 bit

This commit is contained in:
Anthony Minessale 2013-04-22 13:42:12 -05:00
parent 658f128896
commit f038338e81
1 changed files with 10 additions and 2 deletions

View File

@ -373,7 +373,9 @@ static const char usage[] =
"\t-g [group] -- specify group to switch to\n" "\t-g [group] -- specify group to switch to\n"
#endif #endif
#ifdef HAVE_SETRLIMIT #ifdef HAVE_SETRLIMIT
#ifndef FS_64BIT
"\t-waste -- allow memory waste\n" "\t-waste -- allow memory waste\n"
#endif
"\t-core -- dump cores\n" "\t-core -- dump cores\n"
#endif #endif
"\t-help -- this message\n" "\t-help -- this message\n"
@ -459,7 +461,9 @@ int main(int argc, char *argv[])
switch_file_t *fd; switch_file_t *fd;
switch_memory_pool_t *pool = NULL; switch_memory_pool_t *pool = NULL;
#ifdef HAVE_SETRLIMIT #ifdef HAVE_SETRLIMIT
#ifndef FS_64BIT
switch_bool_t waste = SWITCH_FALSE; switch_bool_t waste = SWITCH_FALSE;
#endif
#endif #endif
for (x = 0; x < argc; x++) { for (x = 0; x < argc; x++) {
@ -623,13 +627,17 @@ int main(int argc, char *argv[])
} }
else if (!strcmp(local_argv[x], "-waste")) { else if (!strcmp(local_argv[x], "-waste")) {
#ifndef FS_64BIT
fprintf(stderr, "WARNING: Wasting up to 8 megs of memory per thread.\n"); fprintf(stderr, "WARNING: Wasting up to 8 megs of memory per thread.\n");
sleep(2); sleep(2);
waste = SWITCH_TRUE; waste = SWITCH_TRUE;
#endif
} }
else if (!strcmp(local_argv[x], "-no-auto-stack")) { else if (!strcmp(local_argv[x], "-no-auto-stack")) {
#ifndef FS_64BIT
waste = SWITCH_TRUE; waste = SWITCH_TRUE;
#endif
} }
#endif #endif
else if (!strcmp(local_argv[x], "-hp") || !strcmp(local_argv[x], "-rp")) { else if (!strcmp(local_argv[x], "-hp") || !strcmp(local_argv[x], "-rp")) {
@ -935,7 +943,7 @@ int main(int argc, char *argv[])
return 255; return 255;
} }
#ifndef FS_64BIT
#if defined(HAVE_SETRLIMIT) && !defined(__sun) #if defined(HAVE_SETRLIMIT) && !defined(__sun)
if (!waste && !(flags & SCF_VG)) { if (!waste && !(flags & SCF_VG)) {
struct rlimit rlp; struct rlimit rlp;
@ -963,7 +971,7 @@ int main(int argc, char *argv[])
} }
} }
#endif #endif
#endif
signal(SIGILL, handle_SIGILL); signal(SIGILL, handle_SIGILL);
signal(SIGTERM, handle_SIGILL); signal(SIGTERM, handle_SIGILL);
#ifndef WIN32 #ifndef WIN32