Re: File Descriptors

Chris Wedgwood (chris@f00f.org)
Wed, 31 Dec 1997 10:03:33 +1300


Date: Tue, 30 Dec 1997 14:52:43 +0100 (CET)
From: Andrea Arcangeli <arcangeli@mbox.queen.it>
X-Sender: andrea@localhost
To: Chris Wedgwood <chris@f00f.org>
cc: linux-kernel@vger.rutgers.edu, ryoo@cymitar.net
SERVER-LINUX@NETSPACE.ORG
Subject: Re: File Descriptors
In-Reply-To: <199712020831.VAA10317@f00f.org>
Message-ID: <Pine.LNX.3.96.971230145150.649E-100000@localhost>
Status: R

On Tue, 2 Dec 1997, Chris Wedgwood wrote:

>The current version of fuser doesn't work with the new VFS. I've sent a
>patch to Werner to fix this (Werner, if your reading this can you
>please ACK you received it? - it was some time back now...). If you
>want me to mail you this let me know.

Where I can found that patch or a working fuser for 2.1.76?

Andrea[s] Arcangeli

[cc'd to linux-kernel as I've been asked about this a few times]

OK. Here is a patch that I sent out earlier.

If noone objects I might release and 'unofficial psmisc17' in Werner's absence
with this small fix in it, and anything else anyone wants to send me.

-Chris

diff -Nur psmisc16/fuser.c psmisc17/fuser.c
--- psmisc16/fuser.c Tue Jun 17 01:59:02 1997
+++ psmisc17/fuser.c Fri Oct 24 13:20:51 1997
@@ -224,8 +224,25 @@

if ((length = readlink(path,buffer,PATH_MAX)) < 0) return;
buffer[length] = 0;
- if (sscanf(buffer,"[%lx]:%ld",&device,&inode) == 2)
- add_file(path,device,inode,pid,type);
+
+ /* the new VFS code shows links differently -cw */
+ if(buffer[0] != '['){
+ /* new VFS code */
+ struct stat st;
+
+ if(stat(buffer,&st))
+ return;
+
+ device = st.st_dev;
+ inode = st.st_ino;
+
+ add_file(path,device,inode,pid,type);
+
+ }else{
+ /* old VFS code */
+ if (sscanf(buffer,"[%lx]:%ld",&device,&inode) == 2)
+ add_file(path,device,inode,pid,type);
+ }
}


[5~~h