LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-26-2004, 02:58 AM   #1
A-Liang
LQ Newbie
 
Registered: Sep 2004
Location: China
Posts: 13

Rep: Reputation: 0
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
 
Old 11-26-2004, 04:27 AM   #2
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
Quote:
How to get all contents from /proc/mounts.
What do you mean? Does it not show all mounts?
 
Old 11-26-2004, 06:35 AM   #3
A-Liang
LQ Newbie
 
Registered: Sep 2004
Location: China
Posts: 13

Original Poster
Rep: Reputation: 0
yes, don't show all mounts.

mount information is truncated.
 
Old 11-27-2004, 09:52 PM   #4
foo_bar_foo
Senior Member
 
Registered: Jun 2004
Posts: 2,553

Rep: Reputation: 53
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);
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
/etc/mtab vs. /proc/self/mounts ciotog Slackware 1 10-10-2005 04:31 AM
/proc/mounts and /etc/mtab differs pradi_net Linux - Software 0 05-19-2004 09:47 AM
RH9 /proc/mounts boot failure!! calabash Linux - Newbie 6 02-17-2004 06:42 PM
Can't find file '/proc/mounts' TY2K4 Red Hat 1 01-10-2004 07:39 AM
Help! /proc/mounts not found during bootup artemis Linux - General 15 11-10-2003 03:31 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:53 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration