delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/09/23/21:05:31

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
From: "Ronald Landheer" <info AT rlsystems DOT net>
To: "Charles Wilson" <cwilson AT ece DOT gatech DOT edu>
Cc: "Robert Collins" <robert DOT collins AT itdomain DOT com DOT au>, <cygwin AT cygwin DOT com>
Subject: RE: [PATCH] ls & "magic" cygdrive dir (was: RE: cygdrive stuff)
Date: Mon, 24 Sep 2001 03:04:32 +0200
Message-ID: <NFBBLOMHALONCDMPGBLFEEDDCCAA.info@rlsystems.net>
MIME-Version: 1.0
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
In-reply-to: <3BAE774A.4000806@ece.gatech.edu>
Importance: Normal
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id VAA27619

Hi Chuck,

> None of these are correct.  You should be looking in 
> /cygwin/winsup/cygwin/*.cc, not /newlib/*.  You probably want to take 
> a look at syscalls.cc or fhandler_*.cc or path.cc.
Found stat_worker() in syscalls.cc (which is called by _stat()).
opendir() and readdir() are both in dir.cc

I'll have a good look tomorow. What I'm thinking of doing for stat() is 
this: I let the stat() call run until the end (there's a done flag there 
that it jumps to, and there's only one other return, which is 
succesful). If it's not successful, I take a look whether the stat()-ed 
path is actually a magic dir, and if so, I report it as a dir. Like 
that, I don't do anything if stat() would figure it out by himself, and 
I can only report a magic dir as a directory.
There's some details I have to figure out before I actually do anything 
(like what the MALLOC_CHECK macro does, for example) but I think this 
should work.

As for opendir() and readdir(), I don't know what the problem is yet - 
opendir() calls stat() to see if it's a directory, so after fixing 
stat() it should think it's looking at a directory. As it's not real, it 
will fail when it starts requesting information to win32, and/or tries 
to open it with open(), so I'll probably have to hook in after that's 
failed (so I know it would fail), fill in the dirent structure. It looks 
like the cookie field (__d_cookie) is a nice place to hide that we're 
looking at the magic dir, but I'd have to make sure it's not used by 
anyone else first. As is, readdir() expects it to be __DIRENT_COOKIE and 
nothing else, but I'll be working on readdir() anyway. I don't expect 
anything else to use this field, but I have all the sources anyway, so 
I'll do a grep search to make sure. (If that's the case, I can make a 
__DIRENT_COOKIE and a __DIRENT_MAGICDIR_COOKIE, and have readdir() 
handle it accordingly.

Now it's three AM. I have a call to put in to Canada (where it's 9 PM) 
and a nap to take (tomorow, it'll be 7 AM again..)

If you have any thoughts about the above, feel free to share them :)

Greetz!

Ronald


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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