X-Recipient: archive-cygwin@delorie.com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:mime-version:references:in-reply-to:from:date
	:message-id:subject:to:content-type; q=dns; s=default; b=e9mn8HB
	484SY9YbeB6OszL6ILxMhImcxQr+YP+4UAcvX8xyoi1ppYtpy8zVmqrbpnM6HLea
	/A0v2rg2nj9fgBWdgNc4oNcChu5Wgh8FT9ESgzlb7l4JaN29tc0tb3MVuIARStk5
	jE/W31+g7JsZpK+VPGCPodVvMGn8SrC4fVJg=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:mime-version:references:in-reply-to:from:date
	:message-id:subject:to:content-type; s=default; bh=3lUTrwolEkPIu
	GfnQoG5ycRhYlI=; b=qnd/0s8+VK/hehDo8NQ9RvWr2GWiVh/U1hWpMimZEwDQE
	xa4TTgxDCHPSLiDkwzhZn4CHIRtyzwfR9Gmc+ObpzN3wTD7n7ZtHgXw0WfQ4Vz2F
	pNIijMNJ8IXdvJq+NYeBTHVjDsjJXRS0qWS3EMmUhI6JeVEqz92CONB8EgftPw=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy=Hx-spam-relays-external:ESMTPA
X-HELO: bird.maple.relay.mailchannels.net
X-Sender-Id: dreamhost|x-authsender|dropbox@opencoder.net
X-Sender-Id: dreamhost|x-authsender|dropbox@opencoder.net
X-MC-Relay: Neutral
X-MailChannels-SenderId: dreamhost|x-authsender|dropbox@opencoder.net
X-MailChannels-Auth-Id: dreamhost
X-Abaft-Imminent: 59ee3ac36116fec8_1544996183589_3431043853
X-MC-Loop-Signature: 1544996183589:2133734616
X-MC-Ingress-Time: 1544996183589
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=opencoder.net; h=	mime-version:references:in-reply-to:from:date:message-id:subject	:to:content-type; s=opencoder.net; bh=tOn4MwbGY7sxxdGrEOnkwas0rA	k=; b=IQ0wLsE/R/0ScmFnR6+Vk5vCG9XL+NEckgVC127uR2LJ8HAYT7qln68Jmc	XgmhJ6bWo20zPwlIuSVCb3daOYFMtO5f3iV5ZQ/ahkoilZ/sE723/pYWYwKZq6ul	PeqKfHyYQAXZYym0MbpPXA1cdSTwB7zcSOhzPmGLQA2LKfaEM=
MIME-Version: 1.0
References: <0f030e809f063f5a5e64ff7a7a0c3227@xs4all.nl> <20181216202847.GK28727@calimero.vinschen.de>
In-Reply-To: <20181216202847.GK28727@calimero.vinschen.de>
X-DH-BACKEND: pdx1-sub0-mail-a27
From: Wayne Davison <wayne@opencoder.net>
Date: Sun, 16 Dec 2018 13:36:10 -0800
Message-ID: <CAHSx_SvqFgi5stKvYSNCPwyyu98miPHyYcDKJL1-=KP8NE9+JQ@mail.gmail.com>
Subject: Re: /dev/fd/N not synonymous with file descriptor N; it is on Linux
To: cygwin <cygwin@cygwin.com>
Content-Type: text/plain; charset="UTF-8"
X-VR-OUT-STATUS: OK
X-VR-OUT-SCORE: 0
X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedtkedrudehledgudehvdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucggtfgfnhhsuhgsshgtrhhisggvpdfftffgtefojffquffvnecuuegrihhlohhuthemuceftddtnecunecujfgurhepgghfjgfhfffkuffvtgesthdtredttddtjeenucfhrhhomhephggrhihnvgcuffgrvhhishhonhcuoeifrgihnhgvsehophgvnhgtohguvghrrdhnvghtqeenucfkphepvddtledrkeehrddvuddtrdehudenucfrrghrrghmpehmohguvgepshhmthhppdhhvghlohepmhgrihhlqdhothduqdhfhedurdhgohhoghhlvgdrtghomhdpihhnvghtpedvtdelrdekhedrvddutddrhedupdhrvghtuhhrnhdqphgrthhhpeghrgihnhgvucffrghvihhsohhnuceofigrhihnvgesohhpvghntghouggvrhdrnhgvtheqpdhmrghilhhfrhhomhepfigrhihnvgesohhpvghntghouggvrhdrnhgvthdpnhhrtghpthhtoheptgihghifihhnsegthihgfihinhdrtghomhenucevlhhushhtvghrufhiiigvpedt
X-IsSubscribed: yes

On Sun, Dec 16, 2018 at 12:29 PM Corinna Vinschen wrote:
> In contrast to Linux the symlinks are not just faked symlinks with the underlying OS having direct access to the file descriptors.

Yeah, Linux is more like a fuse where the open filehandles are used
directly on open, and the stat calls return pretend symlinks with the
lsof info.

> The way it's implemented in Cygwin uses the actual file path resolution and then either works or fails as above.

If Cygwin can't be changed into a fuse idiom, perhaps a hard-link
idiom could be used? For instance, when the /proc/$PID/fd/0 symlink is
being created, the code could try to hard-link the file to
/proc/$PID/.fd/0 first (note the dot-fd) before creating the normal
fd/0 symlink. Then, when a request came in to read /proc/$PID/fd/0, it
could check if the associated hard-link exists and read from that
instead.  Or perhaps the "symlink" info could be stored elsewhere and
the fd/0 file could be the hard-link, requiring the stat code to be
tweaked to look up the pretend-symlink info?

..wayne..

--
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

