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

Re: [OT OBSD Programming] kill cu processes



On Wed, Sep 01, 2004 at 09:57:41AM +0200, Christian Schäfer wrote:
> hi all!
> 
> in a project I am involved in we connect to a serial device using cu.
> we fork() and execvp() the cu programm keeping two pipes. one for 
> reading one for writing. this runs very smoothly. ;-)
> 
> but on openbsd cu seems to for itself a second time. having two 
> processes listed. I guess this is to do asynchronous io, since pthreads 
> are implemented in userland on obsd..
> 
> this is no problem until we want to exit.
> how can our programm, that has done the fork() of cu, kill _both_ cu 
> processes. right now the self-forked cu process remains as a zombie. we 
> don't want this of course..

The child cu process is in the same process group as his parent.
Kill the process group id instead. It works here when I start cu
from the shell.

ps  -o "pid,ppid,pgid,command"
  PID  PPID  PGID COMMAND
 5990 29691  5990 -/bin/ksh
22571  5990 22571 /usr/bin/cu -l cua00 -s 9600
 7927 22571 22571 /usr/bin/cu -l cua00 -s 9600

kill -TERM -22571

> 
> 
> any hint?

I don't understand why you need cu. If you don't run cu on a terminal
you might as well open the serial port directly.

> 
> 
> regards
> /christian

-- 
Hugo Villeneuve <hugo@EINTR.net>
http://EINTR.net/