X-Recipient: archive-cygwin AT delorie DOT com X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org B54E53850404 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=fexl.com Authentication-Results: sourceware.org; spf=none smtp.mailfrom=pc AT fexl DOT com X_CMAE_Category: , , X-CNFS-Analysis: v=2.4 cv=H9wef8Ui c=1 sm=1 tr=0 ts=60254bd7 cx=a_idp_x a=PDGaJ8dF8zRAWf39Bu4Cgw==:117 a=PDGaJ8dF8zRAWf39Bu4Cgw==:17 a=KGjhK52YXX0A:10 a=IkcTkHD0fZMA:10 a=qa6Q16uM49sA:10 a=Ehmfxr484HgA:10 a=VL9kFEmlWuCujlkdr38A: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 AT windstream DOT net; auth=pass (LOGIN) To: The Cygwin Mailing List From: Patrick Chkoreff Subject: setrlimit always fails Autocrypt: addr=pc AT fexl DOT com; keydata= mQINBFVTu9wBEAD3HrqNmAU5TPesso2t7QG+bq/Y9Brz0X/9JIqPHT4eSiRCQmm228QFJfm8 eRo4yw0gG/Jb535P8MrFfkRconzW6ttsftlQkzzjskpvyUCcJ6ReRNFBzPKRSSEIm9keqG0v JQ28ffa0dvH7DIWZpdVveaHtwH/Jy5wrmErpcXjAOWAus9KjRtiISWOllHV5CiA3QhgRrTeb htQLkDDvnPYF4q20lbX1tiyLKHJmZ+Xq/F3feokTdKwvyfI/jPkPGpfHUWzS1ELmzDweaaeN RBuAEo5+EmBf7sCXMAL4Jq11n+qdwFmxbC6xR4gROf6QbkAlZKmQhXptUz8dbP4VJKACwVNK Y9OraoMiDpiM4X+fpAogpvSNdP9nX2NNfvmzkaeIB8aSo4Y4v5zdtqgh4xEFbdzWqT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43phaVkgP3YBR9Pv5dEYgr teBB0XtJ6DO08vmtMjvziXS6lcdj0cS+znoyyN8DLT8Na4LcEWeQaM6kZG3QoO4ZA17KPq1V hE2QPKNmfGcsTSZnz+I/RLyel0A75JzbcTXRKAnKGppZL5Mapgmk9MWyHdV+/LFDpvoNUkN4 mBpJ7CSeR59pJ8u7v8bHPnBR1w0TYySONrpN/46JdZj4IuKP9h+6K3j0dKFycKobhCT0Mdel 9Xj7W/jmScEA9+Vbg7quRy5ay5nRWh18STdLp1AHwyZZ+5XscdCHgtqu/jYecPxjB37ILfl7 mcDR+8yj4yHZEyFW+n8ai3+Lijea+KdjE0/7nWwYIJNs9TWwL2cOPURznPHdFWTg5qFUIils L55yRVFSzndW7wiYONMHRIWTF5kGLDeMTP357EDVsKRxAg0G2w2fQVKC5HD9L8N3 Message-ID: Date: Thu, 11 Feb 2021 10:23:02 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 Content-Language: en-US X-Vade-Verditct: clean X-Vade-Analysis: gggruggvucftvghtrhhoucdtuddrgeduledrheelgdejgecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfujgfpteevqfftpdghkffpfffuvfftgfetofdpqfgfvfenuceurghilhhouhhtmecufedtudenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhepvffhuffkffgfgggtgfesthejredttdefjeenucfhrhhomheprfgrthhrihgtkhcuvehhkhhorhgvfhhfuceophgtsehfvgiglhdrtghomheqnecuggftrfgrthhtvghrnhepfedvtddtvdetkeetuedtueetffevgeeitddtuddugfehhffhgeekgfetgeevgeehnecukfhppeegtddrudefkedrudejfedrkeegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepgedtrddufeekrddujeefrdekgeenpdhmrghilhhfrhhomhepphgtsehfvgiglhdrtghomhenpdhrtghpthhtoheptgihghifihhnsegthihgfihinhdrtghomhen X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, 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 AT cygwin DOT com X-Mailman-Version: 2.1.29 List-Id: General Cygwin discussions and problem reports List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Cygwin" I'm trying to use setrlimit to impose limits on various resources such as CPU time and memory. The call to setrlimit always fails. I've distilled this into the following example test.c: #include #include #include int main(void) { struct rlimit rlim; rlim.rlim_cur = 1; rlim.rlim_max = 1; if (setrlimit(RLIMIT_CPU,&rlim) < 0) { perror("setrlimit"); exit(1); } printf("HEY\n"); while (1) { } printf("BYE\n"); return 0; } $ gcc test.c $ ./a.exe setrlimit: Invalid argument I have found that the only way to make the setrlimit call succeed is to use RLIM_INFINITY: rlim.rlim_cur = RLIM_INFINITY; rlim.rlim_max = RLIM_INFINITY; But then of course it does not achieve the desired result of timing out after 1 second. Any ideas? -- Patrick -- 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