From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.windstream.net (mail.windstream.syn-alias.com [69.168.106.36]) by sourceware.org (Postfix) with ESMTPS id DABAC3857C7A for ; Mon, 15 Feb 2021 19:54:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org DABAC3857C7A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=fexl.com Authentication-Results: sourceware.org; spf=none smtp.mailfrom=pc@fexl.com X_CMAE_Category: , , X-CNFS-Analysis: v=2.4 cv=S+wcfKgP c=1 sm=1 tr=0 ts=602ad173 cx=a_idp_x a=PDGaJ8dF8zRAWf39Bu4Cgw==:117 a=PDGaJ8dF8zRAWf39Bu4Cgw==:17 a=KGjhK52YXX0A:10 a=IkcTkHD0fZMA:10 a=qa6Q16uM49sA:10 a=Ehmfxr484HgA:10 a=BteEbYCXQihtarNRQQcA:9 a=QEXdDO2ut3YA:10 X-CM-Score: 0 X-Scanned-by: Cloudmark Authority Engine X-Authed-Username: Y2hrb3JlZmZAd2luZHN0cmVhbS5uZXQ= Authentication-Results: smtp02.aqua.bos.sync.lan smtp.user=chkoreff@windstream.net; auth=pass (LOGIN) Received: from [40.138.173.84] ([40.138.173.84:56022] helo=[192.168.7.23]) by mail.windstream.net (envelope-from ) (ecelerity 3.6.25.56547 r(Core:3.6.25.0)) with ESMTPSA (cipher=AES128-SHA) id 97/D8-07383-371DA206; Mon, 15 Feb 2021 14:54:27 -0500 Subject: Re: setrlimit always fails To: cygwin@cygwin.com References: <1c233bc7-401b-568f-36d5-48c4f1d4dcea@cornell.edu> <20210215091419.GJ4251@calimero.vinschen.de> From: Patrick Chkoreff Autocrypt: addr=pc@fexl.com; keydata= mQINBFVTu9wBEAD3HrqNmAU5TPesso2t7QG+bq/Y9Brz0X/9JIqPHT4eSiRCQmm228QFJfm8 eRo4yw0gG/Jb535P8MrFfkRconzW6ttsftlQkzzjskpvyUCcJ6ReRNFBzPKRSSEIm9keqG0v JQ28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GmqVZtBQJeugTn BQkPCeOLAAoJEI/YYoGmqVZtABsP/25z6bTxB5szwFOqdkSTpGlVeCqHxInsH60BeliBzr1p qAX6urpdMwNzCpRa9DroU7wwtOJ2z7FtCCdoDtnCaWRLqw2lqsZp7KeGOrCCHbSbpr/KXj2s wrN5AH69tSUN6yQlL3NdaD4go3VbjVNY2fFZkzi+ohlrVqaBZGPv/YaZhVnW29Z+bss2Emsp 3+x49RmOSXvSRHE4CsBbayIRIPwt4WvtbEzwquHn8Z3e7/4yBO43phaVkgP3YBR9Pv5dEYgr teBB0XtJ6DO08vmtMjvziXS6lcdj0cS+znoyyN8DLT8Na4LcEWeQaM6kZG3QoO4ZA17KPq1V hE2QPKNmfGcsTSZnz+I/RLyel0A75JzbcTXRKAnKGppZL5Mapgmk9MWyHdV+/LFDpvoNUkN4 mBpJ7CSeR59pJ8u7v8bHPnBR1w0TYySONrpN/46JdZj4IuKP9h+6K3j0dKFycKobhCT0Mdel 9Xj7W/jmScEA9+Vbg7quRy5ay5nRWh18STdLp1AHwyZZ+5XscdCHgtqu/jYecPxjB37ILfl7 mcDR+8yj4yHZEyFW+n8ai3+Lijea+KdjE0/7nWwYIJNs9TWwL2cOPURznPHdFWTg5qFUIils L55yRVFSzndW7wiYONMHRIWTF5kGLDeMTP357EDVsKRxAg0G2w2fQVKC5HD9L8N3 Message-ID: Date: Mon, 15 Feb 2021 14:54:26 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20210215091419.GJ4251@calimero.vinschen.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Vade-Verditct: clean X-Vade-Analysis: gggruggvucftvghtrhhoucdtuddrgeduledrieekgdduvdeiucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuufgjpfetvefqtfdphgfkpfffuffvtffgtefopdfqfgfvnecuuegrihhlohhuthemuceftddunecunecujfgurhepuffvfhfhkffffgggjggtgfesthekredttdefjeenucfhrhhomheprfgrthhrihgtkhcuvehhkhhorhgvfhhfuceophgtsehfvgiglhdrtghomheqnecuggftrfgrthhtvghrnhepgffhvdelgeekueffgeevgefgkeehgfeguedvveffgfehgfdvteejgefhkedtiefgnecukfhppeegtddrudefkedrudejfedrkeegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepgedtrddufeekrddujeefrdekgeenpdhmrghilhhfrhhomhepphgtsehfvgiglhdrtghomhenpdhrtghpthhtoheptgihghifihhnsegthihgfihinhdrtghomhen X-Vade-Client: WINDSTREAM X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=no 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Feb 2021 19:54:29 -0000 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. I have stripped down my requirements as far as possible. I created a file "test_stuff.c" as follows, with the most minimal preambles that actually work on each platform (Cygwin or Linux): ~~ #ifdef __CYGWIN__ #define _XOPEN_SOURCE #include #include #include #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; } ~~ That compiles successfully on both Cygwin and Linux, using the simple command "gcc -c test_stuff.c". Note that in the case of Linux, the define __USE_XOPEN is absolutely essential, and define _XOPEN_SOURCE makes no difference. This is an experimental fact on the two Linux machines I tested. Note also that on Cygwin, I must define _XOPEN_SOURCE before including stdint.h. There are all kinds of weird interactions and different ordering requirements between the Linux and Cygwin code. So let's look at some options, and show how they work on both Linux and Cygwin. OPTION 1: #define _XOPEN_SOURCE #include #include #include Result on Cygwin: SUCCESS Result on Linux: error: ‘timegm’ undeclared error: ‘timelocal’ undeclared OPTION 2: #include #include #define _XOPEN_SOURCE #include Result on Cygwin: error: 'strptime' undeclared Result on Linux: error: 'strptime' undeclared OPTION 3: #include #include #define __USE_XOPEN #define _XOPEN_SOURCE #include Result on Cygwin: error: 'strptime' undeclared Result on Linux: SUCCESS Consequently I see nothing simpler than the test_stuff.c code at the top of this email. By all means correct me if I am wrong. Propose a preamble on this list, and I'll jam it into my test code and see if it compiles on both Cygwin and Linux. I can literally compile the exact same code file on both Cygwin and Linux, due to how I've got sharing set up. -- Patrick