Loading...
Searching...
No Matches
rlimit.h File Reference

Go to the source code of this file.

## Functions

int | raise_rlimit_nproc (void)

## Function Documentation

## raise_rlimit_nproc()

int raise_rlimit_nproc | ( | void |  | ) |

Definition at line 18 of file rlimit.c.

{
#ifdef RLIMIT_NPROC
struct rlimit nproc;
getrlimit(RLIMIT_NPROC, &nproc);
if (nproc.rlim_cur == RLIM_INFINITY
|| (nproc.rlim_max != RLIM_INFINITY && nproc.rlim_cur >= nproc.rlim_max))
{
return(-1);
}
if (nproc.rlim_cur < 512)
{
nproc.rlim_cur = 512;
}
if ((nproc.rlim_max == RLIM_INFINITY || 2*nproc.rlim_cur <= nproc.rlim_max)
&& nproc.rlim_cur < 65536)
{
nproc.rlim_cur = 2*nproc.rlim_cur;
}
else
{
nproc.rlim_cur = nproc.rlim_max;
}
int res = setrlimit(RLIMIT_NPROC, &nproc);
return(res);
#else
return(-1);
#endif
}
res
CanonicalForm res
Definition facAbsFact.cc:60