SUMMARY: CD umount failed

From: Javier Aida <jaida_at_gmd.com.pe>
Date: Mon, 25 Mar 1996 10:13:22 -0500

HI,
Many thnx to
fje_at_buckeye.cb.att.com
Jim Belonis
bouchard_l_at_decus.fr ( Ooops, just received a blank page from you)

Jim Belonis suggested me to use fuser, a program which allows to see which processes are accessing which devices, so i can kill any process allocating the CDROM.
fje_at_buckeye.cb.att.com suggested that i was using two shells, unfortunely, that's not the case. I'll try using fuser, and, if someone would like to use it, here is the code sent by Jim:

* --------------------------------<Cut Here>---------------------------------
 *
 */

/*************************************************************************
** Title : fuser **
** Format : fuser [-f | -c] <file_name|mount_point> **
** file : fuser.c **
** Function: Give the file name/mount poind, PID and user **
** name of the process which has the file opened **
**************************************************************************
*/
#include <stdio.h>
#include <sys/fuser.h>
#include <pwd.h>
#include <unistd.h>

#define File_Owner_Limit 10000
#define Args "fc"

f_user_t File_Owner[File_Owner_Limit];
struct passwd *Owner_Name;

main(int argc, char *argv[])
{
int i,x=0;
int c,errflg=0;
long Fuser_Type=F_FILE_ONLY;

optarg=NULL;

while ( !errflg && ( c = getopt(argc,argv,Args)) != -1 )
        switch (c) {
        case 'c' :
                Fuser_Type=F_CONTAINED;
                break;
        case 'f' :
                Fuser_Type=F_FILE_ONLY;
                break;
        case '?' :
                exit(1);
        default :
                errflg++;
        }

if ( (x=fuser(argv[optind],Fuser_Type,File_Owner,(long) sizeof (File_Owner))) > 0 )
   {
        for (i=0;i<x;i++) {
           Owner_Name=getpwuid(File_Owner[i].fu_uid);
           printf("FILE: %s\tPID: %d\tUSER: %s\n",argv[optind],File_Owner[i].fu_pid,Owner_Name->pw_name);
                }
   }
}
Received on Mon Mar 25 1996 - 17:10:33 NZST

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:46 NZDT