![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Linux RedHat, Ubuntu, SUSE, Fedora, Debian, Mandriva, Slackware, Gentoo linux, PCLinuxOS. All Linux questions here! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Call C Program From Shell Script | Chanakya.m | Shell Programming and Scripting | 1 | 05-22-2008 10:40 PM |
| Unix call to Oracle PL/SQL pkg/store.proc | csong2 | Shell Programming and Scripting | 7 | 01-07-2008 08:49 AM |
| how to call awk in a csh Program | bikas_jena | Shell Programming and Scripting | 5 | 11-25-2007 02:24 AM |
| how to call c executable inside c program?? | zedex | High Level Programming | 3 | 02-28-2007 10:34 AM |
| tcsh user failed to call library in ksh program | nir_s | Shell Programming and Scripting | 1 | 04-04-2006 05:29 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
How to call a proc file from *.c program?
Hi,
I am new to Linux programming. As part of learning, I need to create a *.c program where we call certain /proc files (i.e. such as meminfo, version, uptime, etc...) from our program. Can anyone point me to a simple program on how one would do this (i.e. can you directly call uptime() or ... straight from my program - I would be very surprised if one could)? Thanks, Pat// |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Since you are on a learning curve, read through this - The /proc File System
It has almost everything that you have asked for. |
|
#3
|
|||
|
|||
|
I'm pretty sure you just read() it.
One way to see how other programs does it. Run strace on a program which is known to access /proc. The system calls involved will be logged. Inside you will find calls to read from the proc filesystem. |
|
#4
|
|||
|
|||
|
Hi cbkihong,
You mention that I can run a program 'known' to access a file in the '/proc' subsystem. Is there a good example program you can recommend I run (and how do you run with strace?). Thanks, Patrick// |
|
#5
|
|||
|
|||
|
On Linux, a program which reads /proc I can currently think of is "lsmod".
If I run Code:
strace lsmod 2>&1 >/dev/null | vim - Quote:
If you know of a program which reads /proc in a similar fashion you can try to strace it to find out what is involved. |
|||
| Google The UNIX and Linux Forums |
| Tags |
| inappropriate ioctl for device |
| Thread Tools | |
| Display Modes | |
|
|