public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* converse of cygwin_attach_handle_to_fd()?
@ 2006-06-04  2:41 Samuel Thibault
  2006-06-05 13:48 ` Dave Korn
  2006-06-05 14:54 ` Brian Ford
  0 siblings, 2 replies; 3+ messages in thread
From: Samuel Thibault @ 2006-06-04  2:41 UTC (permalink / raw)
  To: cygwin; +Cc: dave

Hi,

cygwin_attach_handle_to_fd() lets create a cygwin fd on top of a windows
handle. When calling close() on the fd, the windows handle is closed
too. Is there any way to close the fd without closing the underlying
handle? (i.e. the converse of cygwin_attach_handle_to_fd(), actually)

The same question applies to mingw's open_osfhandle() actually.

Samuel

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: converse of cygwin_attach_handle_to_fd()?
  2006-06-04  2:41 converse of cygwin_attach_handle_to_fd()? Samuel Thibault
@ 2006-06-05 13:48 ` Dave Korn
  2006-06-05 14:54 ` Brian Ford
  1 sibling, 0 replies; 3+ messages in thread
From: Dave Korn @ 2006-06-05 13:48 UTC (permalink / raw)
  To: cygwin

On 04 June 2006 00:10, Samuel Thibault wrote:

> Hi,
> 
> cygwin_attach_handle_to_fd() lets create a cygwin fd on top of a windows
> handle. When calling close() on the fd, the windows handle is closed
> too. Is there any way to close the fd without closing the underlying
> handle? (i.e. the converse of cygwin_attach_handle_to_fd(), actually)

  Well, the simple workaround would be to write a wrapper function for
cygwin_attach_handle_to_fd; the wrapper would call DuplicateHandle to get a
spare copy of the original handle and then pass that duplicated handle to
cygwin_attach_handle_to_fd instead of the original handle; that way, when you
close the fd, the duplicate of the handle is closed, entirely independently of
the original.

    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: converse of cygwin_attach_handle_to_fd()?
  2006-06-04  2:41 converse of cygwin_attach_handle_to_fd()? Samuel Thibault
  2006-06-05 13:48 ` Dave Korn
@ 2006-06-05 14:54 ` Brian Ford
  1 sibling, 0 replies; 3+ messages in thread
From: Brian Ford @ 2006-06-05 14:54 UTC (permalink / raw)
  To: cygwin

On Sun, 4 Jun 2006, Samuel Thibault wrote:

> (i.e. the converse of cygwin_attach_handle_to_fd(), actually)

get_osfhandle()?  I'm not sure of its close semantics, though.

-- 
Brian Ford
Lead Realtime Software Engineer
VITAL - Visual Simulation Systems
FlightSafety International
the best safety device in any aircraft is a well-trained pilot...

.


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-06-05 14:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-04  2:41 converse of cygwin_attach_handle_to_fd()? Samuel Thibault
2006-06-05 13:48 ` Dave Korn
2006-06-05 14:54 ` Brian Ford

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).