setrlimit always fails

Patrick Chkoreff pc@fexl.com
Tue Feb 16 14:53:11 GMT 2021


Corinna Vinschen wrote on 2/15/21 3:48 PM:

> On Feb 15 14:54, Patrick Chkoreff wrote:
>> Corinna Vinschen wrote on 2/15/21 4:14 AM:
>> To fix that, I must define _USE_XOPEN
> 
> You really, really must not use this macro.

I'm glad to hear something definitive about that.  I don't even remember
how I arrived at that hack.


...
> The problem here is that you mix functions only defined under
> _XOPEN_SOURCE with stuff only defined with _DEFAULT_SOURCE from the same
> header.  Either define both feature test macros, or define _GNU_SOURCE.

Thank you for the sensible explanation.


> This works:
> 
> #define _XOPEN_SOURCE
> #define _DEFAULT_SOURCE
> #include <stdint.h>
> #include <sys/time.h>
> #include <time.h>
> void stuff(void)
> [...]

Yes, that does work on both Cygwin and Linux.


> This works, too:
> 
> #define _GNU_SOURCE
> #include <stdint.h>
> #include <sys/time.h>
> #include <time.h>
> void stuff(void)
> [...]

Yes, that also works on both Cygwin and Linux.

Thank you!


-- Patrick


More information about the Cygwin mailing list