delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2024/03/04/01:59:25

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A674E385841E
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1709535564;
bh=uc0+isK2eP8lNC0FjH6WCIH34mYhDSJ5RAFwAq9LCE8=;
h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:
From;
b=daBhtblgViHjqiRDY9/BAbO/LKTIhlHvqvtcWaDtZGWYAf68ZKASFMSI0BMxjPUds
+8HdFnWYff48tC4W4HqCPEl96XV0C6ZZsSANlQEQwKMzZ9TVjMtxsP1KMqfOaXhh5Y
ktbzp69cqLggP8bMGrKXh/U/RuGuTKsG/SiliSJo=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F41983858D37
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org F41983858D37
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709535543; cv=none;
b=OtRfReWbiqe1ZTpUFHeOo0U8MtdzxVt0ZLWlllnwwt+InCzwae1c59DcgnHFr/8jtmFYTWjBvJUzqSw9pqqgyTh8wioTXAcFQMsHTpDQl1cjAF82yxSfFjSA8HLDzQ3a3CzVLvh7JyVm7j4eDXtBmXP6QJLraq6+VzcXfrzK0iA=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1709535543; c=relaxed/simple;
bh=YYqFNiPp7GIsbtwxGTaS2nrj7fecej2XCX19yagwpe8=;
h=Message-ID:Date:MIME-Version:Subject:To:From;
b=w+4dXJzSbtaaZPRCIxq8uFXVt5gzSCiLHZ5SaL7Q+DcWRTQHmi2PD5WENZC2ehcPZasLaw29xIwvuRF2zKa2/NS/jlBxL3lHnQEso2lskVTk95QtqZnPxDNPde977+zjJDQL7SPX74Zx9ULui+RXqjn5gOBfdAdhLY3J/Ib9AtI=
ARC-Authentication-Results: i=1; server2.sourceware.org
Message-ID: <9a74d651-0de6-4ec9-a49f-f1b31309c5a3@maxrnd.com>
Date: Sun, 3 Mar 2024 22:59:00 -0800
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: Convert a file descriptor from Cygwin openat() to Win32 file
HANDLE?
To: cygwin AT cygwin DOT com
References: <CALXu0Udk+gw6T9kYHX9XViigfvkS+bw0f4KGi3n7MiQA-3zVVg AT mail DOT gmail DOT com>
In-Reply-To: <CALXu0Udk+gw6T9kYHX9XViigfvkS+bw0f4KGi3n7MiQA-3zVVg@mail.gmail.com>
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS,
SPF_HELO_NONE, SPF_PASS, TXREP,
T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
server2.sourceware.org
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.30
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Mark Geisert via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Mark Geisert <mark AT maxrnd DOT com>
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT 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

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

- Raw text -


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