Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com From: "Paul Swartz" To: cygwin AT cygwin DOT com Date: Thu, 20 Feb 2003 18:47:39 -0500 MIME-Version: 1.0 Subject: Re: stat/fstat incompatibility w/ unix sockets Message-ID: <3E5522CB.17200.1661ACE@localhost> In-reply-to: <20030220214055.GA2388@cygbert.vinschen.de> Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body 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/