* equivalent of Solaris `fuser' command under DU ?
@ 1997-02-13 5:00 Hugues Talbot
1997-02-13 5:00 ` Paul Dwerryhouse
1997-02-14 5:00 ` Alex Nord
0 siblings, 2 replies; 3+ messages in thread
From: Hugues Talbot @ 1997-02-13 5:00 UTC (permalink / raw)
Hello all Dec Unix Guru,
I'm running DU 3.2c on an AlphaStation 200-4/233.
I'm looking for the equivalent of the Solaris command `fuser'
under Dec Unix.
This command lists all the user using a file or
a file structure. It is really useful to run when you want
to unmount a filesystem and you find out that it is busy.
I've looked on the Web and I've done a search on
Usenet, the best I could find was really old (1990) and
wouldn't compile under DU anyway.
I noticed that DU does have the fuser system call. Did
someone out there go to the trouble of making an application out of
it?
Thanks for any help/pointer.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: equivalent of Solaris `fuser' command under DU ?
1997-02-13 5:00 equivalent of Solaris `fuser' command under DU ? Hugues Talbot
@ 1997-02-13 5:00 ` Paul Dwerryhouse
1997-02-14 5:00 ` Alex Nord
1 sibling, 0 replies; 3+ messages in thread
From: Paul Dwerryhouse @ 1997-02-13 5:00 UTC (permalink / raw)
Hugues Talbot <talbot@fire.syd.dms.csiro.au> writes:
> I'm running DU 3.2c on an AlphaStation 200-4/233.
>I'm looking for the equivalent of the Solaris command `fuser'
>under Dec Unix.
> This command lists all the user using a file or
>a file structure. It is really useful to run when you want
>to unmount a filesystem and you find out that it is busy.
> I noticed that DU does have the fuser system call. Did
>someone out there go to the trouble of making an application out of
>it?
There's a program called 'lsof' that does the same thing - and more,
I believe, although I've never used it for anything more than standard
fuser functions.
It's available at: ftp://vic.cc.purdue.edu:pub/tools/unix/lsof/
Damned if I know why DEC never included an fuser command with Dec Unix,
though. Pretty silly thing to do...
Cheers,
Paul.
--
Paul Dwerryhouse paul@xenu.ee.mu.oz.au
"The growing use of e-mail, not to mention Web-page publishing, threatens to
reverse the trend towards illiteracy among the supposedly educated without at
the same time improving their spelling". -- Michael Swaine, Dr. Dobb's Journal
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: equivalent of Solaris `fuser' command under DU ?
1997-02-13 5:00 equivalent of Solaris `fuser' command under DU ? Hugues Talbot
1997-02-13 5:00 ` Paul Dwerryhouse
@ 1997-02-14 5:00 ` Alex Nord
1 sibling, 0 replies; 3+ messages in thread
From: Alex Nord @ 1997-02-14 5:00 UTC (permalink / raw)
To: Hugues Talbot
Hugues Talbot wrote:
>
> Hello all Dec Unix Guru,
>
> I'm running DU 3.2c on an AlphaStation 200-4/233.
> I'm looking for the equivalent of the Solaris command `fuser'
> under Dec Unix.
> I noticed that DU does have the fuser system call. Did
> someone out there go to the trouble of making an application out of
> it?
>
> Thanks for any help/pointer.
Here's some quick C code I threw together. Every now and then, it
gives me some 'unpredictable' output (read "None at all!"), but I
think I at least have all the core dumps worked out of it. :)
#include <stdio.h>
#include <sys/fuser.h>
#include <unistd.h>
#include <pwd.h>
#include <errno.h>
#include <malloc.h>
int main(argc, argv)
int argc;
char *argv[];
{
int x,y;
struct f_user * wowie;
struct f_user crap[1];
struct passwd person;
if (getuid() != 0)
{
fprintf (stderr,"You must be root to use %s!\n",argv[0]);
exit (-1);
}
if (argc != 2)
{
fprintf (stderr,"Usage : fuser <filename>\n");
exit (-1);
}
x=fuser(argv[1], 0L, crap, sizeof(struct f_user));
if (errno == 2)
{
fprintf (stderr,"'%s' - Not Found\n",argv[1]);
exit (-1);
}
if (x==0)
{
fprintf(stdout,"No processes are currently accessing %s\n",argv[1]);
exit (x);
}
wowie=(struct f_user *) malloc(x*(sizeof(struct f_user)));
x=fuser(argv[1], 0L, wowie, (long) (x * (sizeof (struct f_user))));
for (y=0;y<x;y++)
{
person=*getpwuid(wowie[y].fu_uid);
fprintf(stdout,"%s (%d) ",person.pw_name,wowie[y].fu_pid);
}
fprintf(stdout,"\n");
free(wowie);
return (x);
}
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1997-02-14 5:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1997-02-13 5:00 equivalent of Solaris `fuser' command under DU ? Hugues Talbot
1997-02-13 5:00 ` Paul Dwerryhouse
1997-02-14 5:00 ` Alex Nord
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox