setrlimit always fails
Corinna Vinschen
corinna-cygwin@cygwin.com
Mon Feb 15 09:14:19 GMT 2021
On Feb 12 10:11, Patrick Chkoreff wrote:
> Ken Brown via Cygwin wrote on 2/11/21 9:06 PM:
>
> > 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
> [...]
> I will say that my first attempt at compiling the Linux code under
> Cygwin went very well. The only compiler error was in some code that
> calls strptime. To fix that, I had to use some macros in a sequence
> like this:
>
> #ifdef __CYGWIN__
> /* Ensure that strptime is accessible. */
> #define _XOPEN_SOURCE
> #endif
>
> #include <stdint.h>
> ...
> #ifndef __CYGWIN__
> /* Ensure that strptime is accessible. */
> #define __USE_XOPEN
> #endif
>
> #include <time.h>
>
>
> That seems to be the simplest I can make that.
That looks wrong. The __USE_<standard> flags are internal flags from
GLibc and not supposed to be used by application code. Check the Linux
man page for strptime, the usage of _XOPEN_SOURCE or another flag
including _XOPEN_SOURCE (e. g. _GNU_SOURCE) is required. So this:
#define _XOPEN_SOURCE
#include <time.h>
should be sufficient.
Corinna
More information about the Cygwin
mailing list