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

Herb Weiner herbw at wiskit.rain.com
Sun May 5 04:07:39 AEST 1991


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.

Note that this is NOT the same thing as the SLIP link going down.  If
the system at the other end of the SLIP link gets rebooted, the route
is temporarily marked dead, but is automatically reactivated when the
remote system comes back up.  The line is not dropped in this case.

Note that my daemon must NOT do reads or writes to the serial line,
since the line is being used by SLIP.  I need to be able to detect
the loss of carrier detect in a passive fashion.

If it would help, my daemon could fork and exec slattconf, so that it
is a child of the daemon, but I don't think this solves the problem.

I've checked out termio(7) and ioctl(2), specifically TCGETSTAT to see
if input or output is currently blocked, but this appears to always
return 0 regardless of the state of the line.

Any hints would be appreciated.  Note that I intend to make this daemon
available to the net if and when I get it working.

Herb



More information about the Comp.unix.aux mailing list