2007-06-04 23:01:14 +08:00
|
|
|
/*
|
2009-08-02 04:55:14 +08:00
|
|
|
Copyright (C) 2007-2008 Quantum ESPRESSO group
|
2007-06-04 23:01:14 +08:00
|
|
|
This file is distributed under the terms of the
|
|
|
|
GNU General Public License. See the file `License'
|
|
|
|
in the root directory of the present distribution,
|
|
|
|
or http://www.gnu.org/copyleft/gpl.txt .
|
|
|
|
*/
|
|
|
|
|
2009-03-25 23:11:41 +08:00
|
|
|
#include "c_defs.h"
|
2007-06-04 23:01:14 +08:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
2009-03-25 23:11:41 +08:00
|
|
|
|
2015-11-14 04:33:05 +08:00
|
|
|
#if !defined(__WIN32)
|
2007-06-04 23:01:14 +08:00
|
|
|
#include <sys/resource.h>
|
|
|
|
|
2015-09-24 21:10:28 +08:00
|
|
|
void remove_stack_limit_(void) {
|
2007-06-04 23:01:14 +08:00
|
|
|
|
|
|
|
struct rlimit rlim = { RLIM_INFINITY, RLIM_INFINITY };
|
|
|
|
|
2008-07-07 04:11:10 +08:00
|
|
|
/* Modified according to Cesar Da Silva suggestions */
|
2007-06-04 23:01:14 +08:00
|
|
|
if ( setrlimit(RLIMIT_STACK, &rlim) == -1 ) {
|
2008-07-07 04:11:10 +08:00
|
|
|
if ( getrlimit(RLIMIT_STACK, &rlim) == 0 ) {
|
|
|
|
rlim.rlim_cur = rlim.rlim_max;
|
|
|
|
if ( setrlimit(RLIMIT_STACK, &rlim) == 0 ) {
|
|
|
|
getrlimit(RLIMIT_STACK, &rlim);
|
|
|
|
} else {
|
|
|
|
perror(" Cannot set stack size to new value");
|
|
|
|
}
|
|
|
|
}
|
2007-06-04 23:01:14 +08:00
|
|
|
}
|
|
|
|
}
|
2015-11-14 04:33:05 +08:00
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
void remove_stack_limit_(void) {;}
|
|
|
|
|
|
|
|
#endif
|