Re: program calls system() gettind PID - slightly off topic

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Thu, Oct 18, 2007 at 08:07:46PM -0400, Jerry Geis alleged:
> I have a C program on centos. When I call system("some_program &");
> how do I get the PID of the some_program?
> 
> I cant just list processes as there might be more than one some_program 
> active.
> I need to know the one that I just started.

You don't.  At least not by using system().

Use fork() and exec() and you will have the child pid.

Attachment: pgp2hpLk4jc9C.pgp
Description: PGP signature

_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux