X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7E657386180C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1613422092; bh=nCpEE7FcTJvko1A2ei29rleqQC6mhYYU+AXtTf8r3oU=; 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=BrNjQNp/Po0g+VFcktl/mwf+ybqJTgw4ADB3LkR8+cQ3YNYXtsL0n+Hk8wKD0/nFC NIiaZ30CY8YzZ1teRrcUgiR/lYKfMnkng5g/u7cPPjI7n4z0j3H2gm+3aukp1BwcJs ONaQh/TL0FzdGHSRgiffzvYSgYd35+oG8pbSz69Y= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org A2BC73857C7B Date: Mon, 15 Feb 2021 21:48:04 +0100 To: Patrick Chkoreff Subject: Re: setrlimit always fails Message-ID: Mail-Followup-To: Patrick Chkoreff , cygwin AT cygwin DOT com References: <1c233bc7-401b-568f-36d5-48c4f1d4dcea AT cornell DOT edu> <20210215091419 DOT GJ4251 AT calimero DOT vinschen DOT de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Provags-ID: V03:K1:DQ7NShXEoF/DQSkFNTfzqNg46PAmR9JR4bq9MrCHaCdk5AxmLop h7FWz0IJ5EZ+Tpo0on2W9/AIlgnqb28HTC4RBwqbcAKo2lm60X1TW9LKKS9CbfuG1CaCe9R ghZEYxOfykWNPIpmcuzPf67c3PLLevsjro9R4fV7k5mFhL25NitooRUzULMlUHSl9Py0mFV VZ/NV8WgtNbBGFTu4pIMg== X-UI-Out-Filterresults: notjunk:1;V03:K0:c6rX0X4Qk+Y=:eIUZhiEZsSggZuX6DNO55p GIb/XlhsBUSC4XkDpZNDTc8XnBtj+YLD6vSztvGHdRms3YJlv3hehFBLoXmvGZbF7gjmgZrlf AFfwVFa4OJmxu4hfIOKFCAwloogJnnkAsrjMuNvP2wGT7UhMtIVzZLmtNTcsCo50YqTrr7y5l 7g/x95tWe00goG/ztw7lX+ScAG+6PYscXpZuU5qscD4H52oxSAookmU5rXrqw+9uh7StrLB7W cY8b1chM/4Ra0C63fw+zQ2WGfL94XD/I6FIjN0l9Zma1AtZeU+xvBNbDIpDskkqh7jrt+WEfB o05ofrFgw4HVA12DIu7+HNctj9U40R3Pl2hmEn5BmChfrw1Oq1+T1MQD8VCsizwiv8QkxU+Z9 rb6jjsF2mT8dxdmhoJrAOq6ROG+vnxfayvEnlgg5cfux2AR3T9i1a5I8U1DM48KLy2b0w0z+o W2jeI6qNag== X-Spam-Status: No, score=-101.4 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 AT cygwin DOT com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Corinna Vinschen via Cygwin Reply-To: cygwin AT cygwin DOT com Cc: Corinna Vinschen , cygwin AT cygwin DOT com Content-Type: text/plain; charset="utf-8" Errors-To: cygwin-bounces AT cygwin DOT com Sender: "Cygwin" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 11FKmFUC029337 On Feb 15 14:54, Patrick Chkoreff wrote: > Corinna Vinschen wrote on 2/15/21 4:14 AM: > > > That looks wrong. The __USE_ 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 > > One would think so, but I tried it on two different Linux machines and > it failed with: > > error: ‘strptime’ undeclared > > To fix that, I must define _USE_XOPEN You really, really must not use this macro. > #else > > #include > #include > #define __USE_XOPEN > #include > > #endif > > void stuff(void) > { > uint64_t n; > time_t t; > struct timeval tv; > (void)n; > (void)t; > (void)tv; > (void)time; > (void)gettimeofday; > (void)timegm; > (void)timelocal; > (void)gmtime; > (void)localtime; > (void)strftime; > (void)strptime; > } 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. This works: #define _XOPEN_SOURCE #define _DEFAULT_SOURCE #include #include #include void stuff(void) [...] This works, too: #define _GNU_SOURCE #include #include #include void stuff(void) [...] 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