?
Solved

accessing data in /proc using an linux API

Posted on 2003-03-31
4
Medium Priority
?
196 Views
Last Modified: 2010-04-21
I want to write a C program which accesses process information(pid no,tty,etc) using an API. I know how to access the information directly from /proc using system calls(fread(),fopen(),etc). what I want to do is to access the /proc data structure using an API since it makes my program version independent. Also if possible tell me other ways to access /proc data structurs.
0
Comment
Question by:omdon
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 

Expert Comment

by:keramati_h
ID: 8244218
Hello,
See these man pages:
getpid
getppid
procinfo
proc

0
 
LVL 5

Accepted Solution

by:
bryanh earned 100 total points
ID: 8263181
Except for the few cross-platform standardized bits of information that you can get with things such as getpid(), fread() of proc files _is_ the API.  I know the contents of these files look too friendly to be an API, but they are definitely designed to be parsed by programs.  The file contents should change less than the kernel data structures underlying them as Linux evolves.  (But as with Linux interfaces in general, they will change).
0
 
LVL 20

Expert Comment

by:jmcg
ID: 10225255
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Accept: bryanh {http:#8263181}

Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jmcg
EE Cleanup Volunteer
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question