-   Programming (
-   -   About /proc/mounts (

A-Liang 11-26-2004 03:58 AM

About /proc/mounts
Now I am using Red Hat Enterprise Linux As 2.1.
I mounted some file systems. but "cat /proc/mounts"
value of /proc/mounts: /dev/root / ext3 rw 0 0
/proc /proc proc rw 0 0
usbdevfs /proc/bus/usb usbdevfs rw 0 0
none /dev/pts devpts rw 0 0
none /dev/shm tmpfs rw 0 0
/dev/sda /home/mnt01 ext2 rw 0 0
/dev/sdb /home/mnt02 ext2 rw 0 0
/dev/sdc /home/mnt03 ext2 rw 0 0
/dev/sdd /home/mnt04 ext2 rw 0 0
# truncated.

How to get all contents from /proc/mounts.


Hko 11-26-2004 05:27 AM


How to get all contents from /proc/mounts.
What do you mean? Does it not show all mounts?

A-Liang 11-26-2004 07:35 AM

yes, don't show all mounts.

mount information is truncated.

foo_bar_foo 11-27-2004 10:52 PM

that's odd
cat /etc/mtab
that is sort of the same thing
that must be a cat problem but it is hard to imagine what it is.
you could try reading /proc/mounts or /etc/mtab programmatically with
lets see

#include <mntent.h>
struct mntent *fs;
FILE *fp = setmntent("/etc/mtab","r");
while ((fs == getmntent(fp))  !=  NULL)
          printf ("%s %s %s %d %d\n", fs->mnt_fsname, fs->mnt_dir, fs->mnt_type, fs->mnt_opts, fs->mnt_freq,  fs->mnt_passno);

All times are GMT -5. The time now is 04:56 PM.