X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:to:from:subject:date:message-id:references :reply-to:mime-version:content-type:content-transfer-encoding :in-reply-to; q=dns; s=default; b=s5S4rs9OI3s8+wIHgFJj+BZ3vCfTnv EYfFO9GGhC+Ndk1vbd5Knm8ehOpU+dQHDk/FdEjYgH/0nj/yQvEGgWZ42ThPdykx ZJETkpbnTvTuWnvwZfWMI4ToCY0A6ukrmVwNir8V2cNdPIeoInH3lPww7H0cvWTD nwpfjMEUDUbsM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:to:from:subject:date:message-id:references :reply-to:mime-version:content-type:content-transfer-encoding :in-reply-to; s=default; bh=xjcJk3p2q9A3tBdF2jh2ztNOcKw=; b=XMcl np1VlYJit01sKMCM0a+6xi+k3rSoLSGmPRVGsM7Da0/q4Xl9PaSdU5hyfQ/eLMLf zDKQNYRR/wkPd4hElWRAZNjQivhL0RPJCs3Z632oXP6LYZHo7Uu68bTcbP7I7DR2 3zWD9rb0arrfQBCCoF1KyF5cmUWqogBPxEEybhs= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.4 required=5.0 tests=AWL,BAYES_20,FREEMAIL_FROM,FSL_HELO_BARE_IP_2,RCVD_IN_DNSWL_LOW,RCVD_NUMERIC_HELO,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=no version=3.3.2 spammy=Fork, ren, H*MI:sk:billzis, H*i:D38743FD.926E X-HELO: plane.gmane.org To: cygwin AT cygwin DOT com From: =?UTF-8?Q?Ren=c3=a9_Berber?= Subject: Re: Fork and Windows Heap Date: Wed, 15 Jun 2016 21:48:43 -0500 Lines: 46 Message-ID: References: Reply-To: Do not reply Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.19) Gecko/20081209 Lightning/0.9 Thunderbird/2.0.0.19 Mnenhy/0.7.6.0 In-Reply-To: X-IsSubscribed: yes On 6/15/2016 7:42 PM, Bill Zissimopoulos wrote: [snip] > WinFsp consists of an FSD (file system driver) and a DLL component. The > WinFsp DLL uses the Windows heap functions to manage memory > (HeapAlloc/HeapFree). It seems that the Windows heap is not properly > cloned after a fork, which leads to the crash I am experiencing. I have > the following questions: > > (1) Is my assumption that Windows heaps are not properly cloned after a > fork correct? A 2011 post [2] seems to suggest so. > (2) Is there any workaround that the WinFsp DLL can use to get around this > limitation and work properly after a fork? The obvious answer would be to > have the DLL use Cygwin's malloc/free and this is indeed possible within > the DLL's FUSE layer, but not workable elsewhere. Those are the wrong questions: you shouldn't be mixing Windows and Unix (SuSv4, Posix) APIs, and by your description you are trying a Windows port, mixing it with probably the base, and expecting it to work on Cygwin, that's a no-go from the start. Unix software usually requires no porting, or very little to account for libc implementations (glibc in Linux, newlib in Cygwin), and the Windows environment. I think you have 2 options: 1. Keep the Windows port and use the cross-compiler tools to create Windows native binaries. That means: forget about fork, start using the spawn family of functions, i.e. _wspawnvp. Of course the result will work independently of Cygwin, daemons are called services (and created differently). 2. Keep the base Unix version for everything. Fork/exec works fine, daemon works fine but you'll have to use cygrunsrv to install the daemon as service. You should read the documentation: https://cygwin.com/cygwin-ug-net/highlights.html#ov-hi-ansiclib Hope this helps. -- René Berber -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple