| 8 | using namespace ftg; |
| 9 | |
| 10 | void increaseStackSize() { |
| 11 | |
| 12 | const unsigned long long MAX = 100 * 1024 * 1024; |
| 13 | struct rlimit Limit; |
| 14 | |
| 15 | if (getrlimit(RLIMIT_STACK, &Limit) == 0) { |
| 16 | if (MAX < Limit.rlim_cur) { |
| 17 | llvm::outs() << "[I] Default stack size is enough.\n"; |
| 18 | return; |
| 19 | } |
| 20 | } |
| 21 | |
| 22 | Limit.rlim_cur = MAX; |
| 23 | Limit.rlim_max = MAX; |
| 24 | if (setrlimit(RLIMIT_STACK, &Limit) != 0) { |
| 25 | llvm::outs() << "[W] Unable to increase stack size.\n"; |
| 26 | return; |
| 27 | } |
| 28 | |
| 29 | if (getrlimit(RLIMIT_STACK, &Limit) == 0) { |
| 30 | llvm::outs() << "[I] Stack size increased to " |
| 31 | << Limit.rlim_cur / 1024 / 1024 << " MB.\n"; |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | int main(int argc, const char **argv) { |
| 36 | llvm::cl::ResetCommandLineParser(); |