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 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: <20110529233841 DOT GC5283 AT ednor DOT casa DOT cgf DOT cx> <20110530174649 DOT GB14225 AT ednor DOT casa DOT cgf DOT cx> <4DE3E451 DOT 8040209 AT gmail DOT com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 Precedence: bulk List-Id: List-Unsubscribe: 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 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