LinuxQuestions.org
Help answer threads with 0 replies.
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
 
LinkBack Search this Thread
Old 12-22-2003, 05:05 AM   #1
hfawzy
Member
 
Registered: Aug 2002
Location: Egypt
Distribution: Debian Sarge, Slackware 10.0
Posts: 163

Rep: Reputation: 30
get info about a specific process


Hello,
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 :

Code:
./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 ?

Regards,
hfawzy
 
Old 12-22-2003, 11:08 AM   #2
jim mcnamara
Member
 
Registered: May 2002
Posts: 964

Rep: Reputation: 34
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, 02:42 AM   #3
imsandy_007
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, 03:28 AM   #4
culin
Member
 
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, 01:11 PM   #5
imsandy_007
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.
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are 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 04:31 PM
pass locale info to a specific application? Peff Linux - Software 2 06-24-2005 04:40 AM
Want to limit Memory to a specific Process tstaples Linux - General 3 01-26-2005 01:59 PM
How do you assign a process to a specific processor? ter_roshak Linux - General 1 12-19-2003 12:38 AM
request for VL specific security info aus9 VectorLinux 1 12-11-2003 05:43 PM


All times are GMT -5. The time now is 06:57 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration