Getting device from home directory

Getting device from home directory

Post by John Hei » Fri, 27 Jun 2003 07:44:14



I want to check a user's quota on the filesystem their home directory
is on.  quotactl needs a char * for the block device name.

/*
 * Get the entry from the password file for user named in argv[1]
 * This gives us the name of their home directory
 */
pwd = getpwnam ((const char *)argv[1]);
printf ("Home: %s\n", pwd->pw_dir);

/*
 * Stat the home directory to get the filesystem number
 */
        stat ((const char *)pwd->pw_dir, &statb);
printf ("FS: %u\n", statb.st_dev);

        /*
* Now what? I have the device number, how do I get the name?
*/

ret = quotactl (QCMD(Q_V3_GETQUOTA, GRPQUOTA), dev, gid, &dqb3);

 
 
 

Getting device from home directory

Post by David Schwart » Fri, 27 Jun 2003 10:06:42


Quote:> * Now what? I have the device number, how do I get the name?

    Look in /proc/mounts

    DS