setrlimit always fails

Ken Brown kbrown@cornell.edu
Fri Feb 12 02:06:03 GMT 2021


On 2/11/2021 10:23 AM, Patrick Chkoreff wrote:
> I'm trying to use setrlimit to impose limits on various resources such
> as CPU time and memory.  The call to setrlimit always fails.  I've
> distilled this into the following example test.c:
[...]
>      if (setrlimit(RLIMIT_CPU,&rlim) < 0)
[...]
> setrlimit: Invalid argument

Cygwin's setrlimit only supports a few resources, as you can see in the source:

https://cygwin.com/git/?p=newlib-cygwin.git;a=blob;f=winsup/cygwin/resource.cc;h=97777e9d223466b7635b990d6c9e0bfb9e2e9a46;hb=HEAD#l201

Ken



More information about the Cygwin mailing list