How can a program (daemon) detect loss of carrier detect?

John Michael Sovereign jms at apple.com
Wed May 8 07:10:04 AEST 1991


In article <> herbw at wiskit.rain.com (Herb Weiner) writes:
> My mac is connected to a Portland area SLIP network over dial-up phone
> lines.  Occasionally, the line gets dropped.  What I'd like to do is
> write a daemon that detects the loss of carrier detect, and automatically
> redials the line and restarts SLIP.

If modem control is enabled (stty modem) and CLOCAL is  disabled in
c_cflag in the termio structure, the process group will receive the
SIGHUP signal when carrier detect is lost.  If you arrange for your 
daemon and slattconf to be in the same process group, your daemon
can catch the SIGHUP and respawn slattconf.

Of course, slattconf sets its pgrp to its pid so that the device will be
its controlling terminal.  Your daemon will need to do a setpgrp to
the child pid returned by fork.

John Sovereign
jms at apple.com

#include <std/disclaimer.h>



More information about the Comp.unix.aux mailing list