Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

accessing data in /proc using an linux API

Posted on 2003-03-31
4
Medium Priority
?
197 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
3 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

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

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 demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

571 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