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.
signature.asc
Description: OpenPGP digital signature