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 Date: Fri, 21 Feb 2003 09:42:13 +0100 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: stat/fstat incompatibility w/ unix sockets Message-ID: <20030221084213.GK1403@cygbert.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <20030220214055 DOT GA2388 AT cygbert DOT vinschen DOT de> <3E5522CB DOT 17200 DOT 1661ACE AT localhost> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Kj7319i9nmIyA2yE" Content-Disposition: inline In-Reply-To: <3E5522CB.17200.1661ACE@localhost> User-Agent: Mutt/1.4i --Kj7319i9nmIyA2yE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, Feb 20, 2003 at 06:47:39PM -0500, Paul Swartz wrote: > On 20 Feb 2003 at 22:40, Corinna Vinschen wrote: > > 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. Nope. How should they? The really interesting fields are not identical as e. g. st_dev, st_ino, st_mode, st_ctime. Anyway, that's not a Cygwin issue anymore. > 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? SUSv3: http://www.opengroup.org/ Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Developer mailto:cygwin AT cygwin DOT com Red Hat, Inc. --Kj7319i9nmIyA2yE Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="sock-stat.c" #include #include #include #include #include #include #include #include int main (int argc, char **argv) { int fd; struct sockaddr_un addr; socklen_t addrlen; char buf[100]; struct stat st; /* creating test unix domain socket pipe */ fd = socket(AF_UNIX, SOCK_DGRAM, 0); /* SOCK_DGRAM require this to bind */ bzero((char *)&addr, sizeof(addr)); /* fill in addr structire */ addr.sun_family = AF_UNIX; strcpy(addr.sun_path, "pipe.101"); addrlen = sizeof(addr.sun_family) + strlen(addr.sun_path) + 1; /* unlink old socket file */ unlink(addr.sun_path); /* bind socket to special file named pipe.100 in current directory */ bind(fd, (struct sockaddr *)&addr, addrlen); printf ("STAT : \"%s\"\n", addr.sun_path); if (!stat (addr.sun_path, &st)) { printf ("st_dev : 0x%x\n", st.st_dev); printf ("st_ino : %lu\n", st.st_ino); printf ("st_mode : 0%o\n", st.st_mode); printf ("st_nlink : %d\n", st.st_nlink); printf ("st_uid : %d\n", st.st_uid); printf ("st_gid : %d\n", st.st_gid); printf ("st_rdev : 0x%x\n", st.st_rdev); printf ("st_size : %ld\n", st.st_size); printf ("st_blksize: %ld\n", st.st_blksize); printf ("st_blocks : %ld\n", st.st_blocks); printf ("st_ctime : %ld\n", st.st_ctime); printf ("st_mtime : %ld\n", st.st_mtime); printf ("st_atime : %ld\n", st.st_atime); } printf ("FSTAT : \"%s\"\n", addr.sun_path); if (!fstat (fd, &st)) { printf ("st_dev : 0x%x\n", st.st_dev); printf ("st_ino : %lu\n", st.st_ino); printf ("st_mode : 0%o\n", st.st_mode); printf ("st_nlink : %d\n", st.st_nlink); printf ("st_uid : %d\n", st.st_uid); printf ("st_gid : %d\n", st.st_gid); printf ("st_rdev : 0x%x\n", st.st_rdev); printf ("st_size : %ld\n", st.st_size); printf ("st_blksize: %ld\n", st.st_blksize); printf ("st_blocks : %ld\n", st.st_blocks); printf ("st_ctime : %ld\n", st.st_ctime); printf ("st_mtime : %ld\n", st.st_mtime); printf ("st_atime : %ld\n", st.st_atime); } return 0; } --Kj7319i9nmIyA2yE Content-Type: text/plain; charset=us-ascii -- 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/ --Kj7319i9nmIyA2yE--