Project Home
Project Home
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - PID for spawned pppd process: (2 Items)
   
PID for spawned pppd process  
I'm currently programming an application where I use pppd.

I use the following command to spawn pppd:
pid = spawnlp ( P_NOWAIT, "pppd", "pppd", "passive", NULL);

This PID is not the PID for the spawned process, but the deamon's. I guess the case is that you can have several pppd 
instances running at the same time, all started by the deamon.

Is there a way for me to get the PID for the spawned process? I would like to handle this without seaching all running 
processes. I must be sure to get the right PID.

I would also like to do some IPC with this process for status purposes like if it is connected or not, preferably using 
the same PID. Is this possible?

My first post here, and I hope someone could assist me on this :)

Regards,
Mikael
RE: PID for spawned pppd process  
By default, pppd would fork()/exec() a child to detach the screen. You
can add "nodetach" option to pppd,
(spawnlp(P_NOWAIT, "pppd", "pppd", "passive", "nodetach", NULL) that
way, you should be able to get the
pid for the running pppd.

pppd should also leave it's pid in /var/run/pppX.pid, the "X" is the
pppd interface id (ppp0, ppp1, ...), so that's
another place you can find the pid.

-xtang 

> -----Original Message-----
> From: Mikael Eriksen [mailto:community-noreply@qnx.com] 
> Sent: Monday, December 15, 2008 9:24 AM
> To: drivers-networking
> Subject: PID for spawned pppd process
> 
> I'm currently programming an application where I use pppd.
> 
> I use the following command to spawn pppd:
> pid = spawnlp ( P_NOWAIT, "pppd", "pppd", "passive", NULL);
> 
> This PID is not the PID for the spawned process, but the 
> deamon's. I guess the case is that you can have several pppd 
> instances running at the same time, all started by the deamon.
> 
> Is there a way for me to get the PID for the spawned process? 
> I would like to handle this without seaching all running 
> processes. I must be sure to get the right PID.
> 
> I would also like to do some IPC with this process for status 
> purposes like if it is connected or not, preferably using the 
> same PID. Is this possible?
> 
> My first post here, and I hope someone could assist me on this :)
> 
> Regards,
> Mikael
> 
> _______________________________________________
> Networking Drivers
> http://community.qnx.com/sf/go/post18598
> 
>