C Board  

Go Back   C Board > Platform Specific Boards > Linux Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 03-12-2003, 06:18 AM   #1
Registered User
 
Join Date: Mar 2003
Posts: 4
Returning PID from execve family of functions?

Hi all,

Just wondering if it's possible to programatically get the PID of an app that has just been executed
using one of the execve(2) family of functions?

For context, I'm writing an app that will execute an application specified on the command line,
retrieve it's process id, and monitor various parameters over time, producing a graph.

While I am writing this on Linux, it has to be portable so GNU/BSD extensions to ANSI C aren't
any use to me unfortunately.

Any ideas at all would be appreciated, I have the feeling I'm missing something simple :-/

TIA,

Ruairi
ruairi is offline   Reply With Quote
Old 03-12-2003, 06:24 AM   #2
Stewdent
Guest
 
Posts: n/a
are you using fork to spawn a child process which then uses one of the execve(2) family of functions?

If so upon successful completion, fork() and fork1() return 0 to
the child process and return the process ID of the child
process to the parent process.

Hope that helps
  Reply With Quote
Old 03-12-2003, 08:47 AM   #3
Registered User
 
Join Date: Mar 2003
Posts: 4
Thanks for the reply 'Twas just what I needed.
ruairi is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
returning arrays from functions Leeman_s C++ Programming 11 06-05-2002 10:00 PM
API "Clean Up" Functions & delete Pointers :: Winsock kuphryn Windows Programming 2 05-10-2002 06:53 PM
returning functions w/ sockets JagWire Windows Programming 4 03-11-2002 05:00 PM
Passing & Returning Strings from Functions nisaacs C Programming 1 01-30-2002 05:34 AM
Class accessor functions returning strings? Shadow12345 C++ Programming 6 12-31-2001 12:48 PM


All times are GMT -6. The time now is 06:43 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22