LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   About /proc/mounts (https://www.linuxquestions.org/questions/programming-9/about-proc-mounts-259428/)

A-Liang 11-26-2004 02: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"
Result:
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.

Thanks

Hko 11-26-2004 04:27 AM

Quote:

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

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

yes, don't show all mounts.

mount information is truncated.

foo_bar_foo 11-27-2004 09:52 PM

hmmmmmmmmm
that's odd
try
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
getmntent()
lets see
Code:

#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 05:03 PM.