X-Recipient: archive-cygwin@delorie.com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 21196388C000
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
	s=default; t=1613380467;
	bh=MugDLNDSOV2jUsGfA1O3D4B2ck56w3rlJCApNai4cUQ=;
	h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe:
	 List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:
	 From;
	b=Iizt7BBiaT//4rQZvXz4pMhpJQIeqazEy+oALKr+uxZoRTEcyl1VQ8Vad2UIwB95f
	 sGZDfQhtsAgXZw2tCL4LsxDHBmuehwlU5u5/gRP8lIyv+4tI099fQiwanwjgDlfvwq
	 2Va2pnVhrjWFscTHjifJ6ntnOTqx87VXdhKOeB10=
X-Original-To: cygwin@cygwin.com
Delivered-To: cygwin@cygwin.com
DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 77FF63836C52
Date: Mon, 15 Feb 2021 10:14:19 +0100
To: Patrick Chkoreff <pc@fexl.com>
Subject: Re: setrlimit always fails
Message-ID: <20210215091419.GJ4251@calimero.vinschen.de>
Mail-Followup-To: Patrick Chkoreff <pc@fexl.com>, cygwin@cygwin.com
References: <b0924bcb-56d0-a026-84b5-71750537facb@fexl.com>
 <1c233bc7-401b-568f-36d5-48c4f1d4dcea@cornell.edu>
 <efc6c8da-7c22-4c8a-a334-c9803efb0e10@fexl.com>
MIME-Version: 1.0
Content-Disposition: inline
In-Reply-To: <efc6c8da-7c22-4c8a-a334-c9803efb0e10@fexl.com>
X-Provags-ID: V03:K1:YpdAOit3QsYgi0x0MqugZDxuk7TXZzN2BcXccRRFVFlKFm7haB6
 o+0AtR/77LwDhM0qd0bNHGnVphwwjDhiojow6LGrAZL4OHVVmbGR71zahBtCCQQj5iMeHcQ
 gugXPYzWOjsu7i1t56wzs+F4cRQ774bA/gsL81Aqu5JbecZE8z6sn7b3uQfDatYWD+eBg4n
 rah5zxnckaGT5p8etpZcQ==
X-UI-Out-Filterresults: notjunk:1;V03:K0:GU0O1MzJKPw=:8JzsaZVQhQPHu2Lcn/2cYW
 rABaoA3ZPtIL7uwh6B3kHz055l1vzTrZvi2S/X/MYugSrI/YGMmN+R0iG4dp4sWXNwz/uqALf
 aJbDNmMxfCiD+um65XN1hqd2kL4kpyClpD3+LORd6kyL+jtaFKWQQn0sfPKevO2RP1qyAuYzm
 hUXXbJ9tNJiAp9QYABHl35CbsNjkq+f8hT0stlECMpBQA+fHRpBNsARbqJjdPTcpPtVItxuop
 YC82wJ9ZF8RS0URMjGSojzeiidEZz5rK+24AIhTfXzMj170+jcMTb+haFIFsM5GLg5rk4xUqK
 HddT5TLMwKAynSZa+Rh5mXPWLb1+cPrQMhpF4O9/tFaJW6NcYvO7pY5uqZkSou2xcqdR36TDg
 rceZlG8FZAhthqR3dctwDCENIIgz4hsG3mBaqB6ECQR+gTKI/WxmwYjCtNayiBsmZ1OyadvNW
 1xufw6HXug==
X-Spam-Status: No, score=-101.3 required=5.0 tests=BAYES_00,
 GOOD_FROM_CORINNA_CYGWIN, KAM_DMARC_NONE, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE,
 RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NEUTRAL,
 TXREP autolearn=ham autolearn_force=no version=3.4.2
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on
 server2.sourceware.org
X-BeenThere: cygwin@cygwin.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-request@cygwin.com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=subscribe>
From: Corinna Vinschen via Cygwin <cygwin@cygwin.com>
Reply-To: cygwin@cygwin.com
Cc: Corinna Vinschen <corinna-cygwin@cygwin.com>, cygwin@cygwin.com
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cygwin-bounces@cygwin.com
Sender: "Cygwin" <cygwin-bounces@cygwin.com>

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
--
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple
