This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: stat/fstat incompatibility w/ unix sockets


On 20 Feb 2003 at 22:40, Corinna Vinschen wrote:

> I created a testcase which allows me to reproduce your observation.
> First of all let me say that thanks to your report I could find the
> problem in Cygwin which explains the differences between stat() and
> fstat().  However, I'm not quite sure if that will help you.  I've
> created a AF_UNIX socket called "pipe.101" and this is the output of
> my testcase:

(result snipped)

Could you attach this test case?  Also, are you just creating the socket and 
then checking it, or listening on the socket too?

> Note that except for st_ino all other fields are identical.  But other
> than that, I don't see *any* field which you could use to identify the
> results being the same file.  I've checked the same testcase on Linux
> and I'm getting the following results:

(more results snipped)
 
> As you can see, there's also nothing which would help you in using the
> result to identify the sockets as being the same.  Even the timestamps
> aren't identical.

No one field can say it's the same file.  All of them together, or a 
sufficiently large number of them, does.
 
> Bottom line:  Trying to use the result of fstat/stat to identify a
> socket is definitely non-portable and will give you more headaches
> than useful results.

Even if it isn't completely portable, at the very least, things like the 
uid/gid definatly shouldn't change.  The ctime/mtime probably shouldn't 
either, I'm less sure about atime.  I don't have a copy of POSIX, does that 
say anything about the stat/fstat semantics?

-p
-- 
     Paul Swartz
(o_  http://twistedmatrix.com/users/z3p.twistd/
//\  z3p at twistedmatrix dot com
V_/_ AIM: Z3Penguin


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]