public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Mark Geisert <mark@maxrnd.com>
To: cygwin@cygwin.com
Subject: Re: Convert a file descriptor from Cygwin openat() to Win32 file HANDLE?
Date: Sun, 3 Mar 2024 22:59:00 -0800	[thread overview]
Message-ID: <9a74d651-0de6-4ec9-a49f-f1b31309c5a3@maxrnd.com> (raw)
In-Reply-To: <CALXu0Udk+gw6T9kYHX9XViigfvkS+bw0f4KGi3n7MiQA-3zVVg@mail.gmail.com>

On 3/3/2024 10:16 PM, Cedric Blancher via Cygwin wrote:
> 
> How can I convert a file descriptor from Cygwin openat() to Win32 file HANDLE?

In general, this can be done with:
     hFile = (HANDLE) _get_osfhandle (int fd);

That works for simple cases such as disk file descriptors. I've learned 
one can't always depend on it because Cygwin can use several handles for 
a specific file or other object in certain situations, which I'm not 
going to list here because I don't know them all.

Try that and see if it works for your case.

..mark

  reply	other threads:[~2024-03-04  6:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-04  6:16 Cedric Blancher
2024-03-04  6:59 ` Mark Geisert [this message]
2024-03-04  8:21 ` Andrey Repin
2024-03-05  8:45   ` Cedric Blancher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9a74d651-0de6-4ec9-a49f-f1b31309c5a3@maxrnd.com \
    --to=mark@maxrnd.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).