From owner-freebsd-hackers Sat Dec 4 15:41:46 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from foo.sics.se (assail.s3.kth.se [130.237.43.29]) by hub.freebsd.org (Postfix) with ESMTP id E09FF154D1 for ; Sat, 4 Dec 1999 15:41:27 -0800 (PST) (envelope-from assar@foo.sics.se) Received: (from assar@localhost) by foo.sics.se (8.9.3/8.9.3) id AAA40156; Sun, 5 Dec 1999 00:40:16 +0100 (CET) (envelope-from assar) To: Randell Jesup Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: Portable way to compare struct stat's? References: <3845712D.F4D51A70@softweyr.com> <5lwvqu7as2.fsf@foo.sics.se> From: Assar Westerlund Date: 05 Dec 1999 00:40:14 +0100 In-Reply-To: Randell Jesup's message of "04 Dec 1999 15:49:59 -0500" Message-ID: <5laenqz34x.fsf@foo.sics.se> Lines: 39 User-Agent: Gnus/5.070098 (Pterodactyl Gnus v0.98) Emacs/20.4 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Randell Jesup writes: > Sounds like what we'd want to build it upon. If the FS doesn't > support it, use st_dev/st_ino. Actually, since it's in the kernel, the default implementation of the vnode operation might be: int vop_default_cmp (struct vnode *v1, struct vnode *v2) { return v1 == v2; } Or did you mean a fallback in the library function for when the kernel doesn't provide the fdcmp (or whatever) system call? That could be something like: /* * 1 if fd1 and fd2 point to the same file. * 0 if they are not * -1 if we can't compare them */ int fdcmp (int fd1, int fd2) { struct stat sb1, sb2; if(fstat(fd1, &sb1) < 0 || fstat(fd2, &sb2) < 0) return -1; return sb1.st_dev == sb2.st_dev && sb1.st_ino == sb2.st_ino; } > The real problem is getting people to switch. You mean application programs? Sure, but the only thing we can do about that is implementing support for it, right? /assar To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message