diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2018-11-20 19:15:07 -0800 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2018-11-20 19:15:07 -0800 |
commit | 6f0d80885930140eac21d63cf7a7a1254d75b60a (patch) | |
tree | 38acc2e426e113ca4a3803f71f7d781e4519de6b /src/base/main | |
parent | f3c5bab518917315d0a1f35844f92ca659de29ae (diff) | |
download | abc-6f0d80885930140eac21d63cf7a7a1254d75b60a.tar.gz abc-6f0d80885930140eac21d63cf7a7a1254d75b60a.tar.bz2 abc-6f0d80885930140eac21d63cf7a7a1254d75b60a.zip |
Various usability changes (second round).
Diffstat (limited to 'src/base/main')
-rw-r--r-- | src/base/main/mainReal.c | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/src/base/main/mainReal.c b/src/base/main/mainReal.c index 31bfef75..f33c0125 100644 --- a/src/base/main/mainReal.c +++ b/src/base/main/mainReal.c @@ -44,6 +44,14 @@ SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. ***********************************************************************/ +#ifndef WIN32 +#include <sys/time.h> +#include <sys/times.h> +#include <sys/resource.h> +#include <unistd.h> +#include <signal.h> +#include <malloc.h> +#endif #include "base/abc/abc.h" #include "mainInt.h" @@ -62,6 +70,7 @@ static int TypeCheck( Abc_Frame_t * pAbc, const char * s); /// FUNCTION DEFINITIONS /// //////////////////////////////////////////////////////////////////////// +unsigned enable_dbg_outs = 1; /**Function************************************************************* @@ -115,8 +124,37 @@ int Abc_RealMain( int argc, char * argv[] ) sprintf( sWriteCmd, "write" ); Extra_UtilGetoptReset(); - while ((c = Extra_UtilGetopt(argc, argv, "c:q:C:Q:S:hf:F:o:st:T:xb")) != EOF) { + while ((c = Extra_UtilGetopt(argc, argv, "dm:l:c:q:C:Q:S:hf:F:o:st:T:xb")) != EOF) { switch(c) { + + case 'd': + enable_dbg_outs ^= 1; + break; + + case 'm': +#ifndef WIN32 + int maxMb = atoi(globalUtilOptarg); + printf("Limiting memory use to %d MB\n", maxMb); + struct rlimit limit = { + maxMb * (1llu << 20), /* soft limit */ + maxMb * (1llu << 20) /* hard limit */ + }; + setrlimit(RLIMIT_AS, &limit); +#endif + break; + + case 'l': +#ifndef WIN32 + int maxTime = atoi(globalUtilOptarg); + printf("Limiting time to %d seconds\n", maxTime); + struct rlimit limit = { + maxTime, /* soft limit */ + maxTime /* hard limit */ + }; + setrlimit(RLIMIT_CPU, &limit); +#endif + break; + case 'c': if( Vec_StrSize(sCommandUsr) > 0 ) { |