From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mailsrv.cs.umass.edu (mailsrv.cs.umass.edu [128.119.240.136]) by sourceware.org (Postfix) with ESMTPS id B7E0D3951C08 for ; Thu, 13 Jan 2022 13:40:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B7E0D3951C08 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=cs.umass.edu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=cs.umass.edu Received: from [192.168.50.148] (c-24-62-201-179.hsd1.ma.comcast.net [24.62.201.179]) by mailsrv.cs.umass.edu (Postfix) with ESMTPSA id DFC9740F2643; Thu, 13 Jan 2022 08:40:19 -0500 (EST) Reply-To: moss@cs.umass.edu Subject: Re: ExitProcess does not work in Cygwin? To: Jay K , "cygwin@sourceware.org" References: From: Eliot Moss Message-ID: <1f98eb84-e3d7-bf0d-875c-3d4818e41aef@cs.umass.edu> Date: Thu, 13 Jan 2022 08:40:19 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, NICE_REPLY_A, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Thu, 13 Jan 2022 13:40:27 -0000 On 1/13/2022 1:39 AM, Jay K wrote: > ExitProcess does not work in Cygwin? > > $ rm *.exe > > # u is for Unix > # w is for Windows > > $ cat u.c > #include > int main() > { > exit(1); > } > > $ gcc u.c > $ ./a.exe > > $ echo $? > 1 > > => as expected > > $ cat w.c > #include > > int main() > { > ExitProcess(1); > } > > $ gcc w.c > $ ./a.exe > > $ echo $? > 0 > > => not expected > > $ uname -a > CYGWIN_NT-10.0 jayk-tp4 3.3.3(0.341/5/3) 2021-12-03 16:35 x86_64 Cygwin > > works in debugger: > > $ /cygdrive/c/bin/amd64/windbg.exe .\\a.exe > > $ echo $? > 1 > > ? > > - Jay ExitProcess does not appear to be a POSIX function. Cygwin strives to provide a POSIX-like interface, not a Windows-like one. However, if ExitProcess is a Windows function, there is probably a library you can use to obtain it in Cygwin (maybe the winsup (Windows support) library). Eliot Moss