My Project
Loading...
Searching...
No Matches
Functions
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.

19{
20#ifdef RLIMIT_NPROC
21 struct rlimit nproc;
22 getrlimit(RLIMIT_NPROC, &nproc);
23 if (nproc.rlim_cur == RLIM_INFINITY
24 || (nproc.rlim_max != RLIM_INFINITY && nproc.rlim_cur >= nproc.rlim_max))
25 {
26 return(-1);
27 }
28 if (nproc.rlim_cur < 512)
29 {
30 nproc.rlim_cur = 512;
31 }
32 if ((nproc.rlim_max == RLIM_INFINITY || 2*nproc.rlim_cur <= nproc.rlim_max)
33 && nproc.rlim_cur < 65536)
34 {
35 nproc.rlim_cur = 2*nproc.rlim_cur;
36 }
37 else
38 {
39 nproc.rlim_cur = nproc.rlim_max;
40 }
41 int res = setrlimit(RLIMIT_NPROC, &nproc);
42 return(res);
43#else
44 return(-1);
45#endif
46}
CanonicalForm res
Definition: facAbsFact.cc:60