Welcome to the most active Linux Forum on the web.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 12-22-2003, 06:05 AM   #1
Registered: Aug 2002
Location: Egypt
Distribution: Debian Sarge, Slackware 10.0
Posts: 163

Rep: Reputation: 30
get info about a specific process

I want to get information about a specific process automatically. I can get these infos from the /proc/PID/status file. But my problem is that the process that I want to get its info could take no time to execute . If I have a program named foo, when I want to get its info, I use this command :

./foo | cat /proc/`/sbin/pidof foo`/status
BUT the program foo takes no time to execute. Consequently, when I try to search for its info, the directory /proc/`/sbin/pidof foo` is already removed.
So my question is : How can I pause the program foo, until I can get its info, then kill foo ?

Old 12-22-2003, 12:08 PM   #2
jim mcnamara
Registered: May 2002
Posts: 964

Rep: Reputation: 36
There is another file, wtmp, that is written if accounting is enabled.
It records process creation, deletion times, etc. Has the same format as utmp. The information is not lost.

See the man pages for getutent or utmp.
Old 01-30-2007, 03:42 AM   #3
LQ Newbie
Registered: Nov 2006
Distribution: SuSe 10.1 , Knoppix
Posts: 15

Rep: Reputation: 0
get info of a process

i want a simple c code for pausing the process which doesnot use the kill command because i want to do some process programming but there is not much help available..
please help.
Old 01-30-2007, 04:28 AM   #4
Registered: Sep 2006
Distribution: Fedora Core 10
Posts: 254

Rep: Reputation: 32
for pausing u can use sleep() command ... sleep(1) sleeps for a second...and similarly for slee(2) and so on... bud don know it is recommanded to ur situation or not....
Old 01-31-2007, 02:11 PM   #5
LQ Newbie
Registered: Nov 2006
Distribution: SuSe 10.1 , Knoppix
Posts: 15

Rep: Reputation: 0
well using the sleep() command is also a solution to the problem..

but i wanted to have a better approach in terms of programming, like for example using the process link list and using the task_struct to access the task and then setting the status field to pause..

i know the theory but i am unable to do the programming.

please 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
How do I get PID info about a specific script? Stepaj47 Linux - Newbie 2 11-14-2005 05:31 PM
pass locale info to a specific application? Peff Linux - Software 2 06-24-2005 05:40 AM
Want to limit Memory to a specific Process tstaples Linux - General 3 01-26-2005 02:59 PM
How do you assign a process to a specific processor? ter_roshak Linux - General 1 12-19-2003 01:38 AM
request for VL specific security info aus9 VectorLinux 1 12-11-2003 06:43 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:42 AM.

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