delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/05/30/14:48:34

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,TW_FD,UNPARSEABLE_RELAY
X-Spam-Check-By: sourceware.org
X-Yahoo-SMTP: jenXL62swBAWhMTL3wnej93oaS0ClBQOAKs8jbEbx_o-
Date: Mon, 30 May 2011 14:48:08 -0400
From: Christopher Faylor <cgf-use-the-mailinglist-please AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Problem with Cygwin's fdopen and Windows handles
Message-ID: <20110530184808.GA25192@ednor.casa.cgf.cx>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <loom DOT 20110529T133128-564 AT post DOT gmane DOT org> <20110529233841 DOT GC5283 AT ednor DOT casa DOT cgf DOT cx> <loom DOT 20110530T093057-556 AT post DOT gmane DOT org> <20110530174649 DOT GB14225 AT ednor DOT casa DOT cgf DOT cx> <4DE3E451 DOT 8040209 AT gmail DOT com>
MIME-Version: 1.0
In-Reply-To: <4DE3E451.8040209@gmail.com>
User-Agent: Mutt/1.5.20 (2009-06-14)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On Mon, May 30, 2011 at 11:39:13AM -0700, Daniel Colascione wrote:
>On 5/30/11 10:46 AM, Christopher Faylor wrote:
>> On Mon, May 30, 2011 at 07:34:27AM +0000, Juanjo wrote:
>>> Christopher Faylor writes:
>>>> Unfortunately, cygwin_attach_handle_to_fd doesn't really work.  Cygwin
>>>> needs to know the type of handle it is attaching in order to set up the
>>>> correct type of file handler.  Since it doesn't do that the handle is
>>>> of limited utility.
>>>
>>> If this was true, the function should have then been removed from the
>>> manual or marked as not working.  But I believe this is not right, for
>>> read() and file handlers work perfectly and the problem only arises
>>> with fread() !!!
>> 
>> Please calm down.
>> 
>> I guess I shouldn't have said the "doesn't really work" and stuck with
>> "of limited utility".  fds attached with cygwin_attach_handle_to_fd are
>> not fully functional.
>
>If cygwin_attach_handle_to_fd is ever deprecated or replaced entirely,
>could we replace it with opening /proc/self/fd/handle:XXXX, where XXXX
>is the decimal encoding of the handle value?  It'd eliminate a Cygwin
>API call and allow easier interaction with handles inherited from
>non-Cygwin programs, and if the code exists to automatically detect the
>proper fhandler type for a given HANDLE, the loss in API richness
>shouldn't matter.

Getting rid of cygwin_attach_handle_to_fd would break backwards
compatibility.  It's not going anywhere.

Your scheme sounds like a whole lot of extra work that SHTDI.

cgf

--
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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019