[comp.sys.next] Testing for power at modem port.

dgc@euphemia.math.ucla.edu (David G. Cantor) (04/09/90)

I have a battery-powered backup emergency power supply for my NeXT.  I
want my NeXT to automatically initiate a shutdown sequence if the main
power goes off.

My problem is how to test if power is on.  I can set my modem to always
assert DCD (and of course power the modem from the main power).  Then I
can have a process running which opens /dev/ttyda when I boot.  If DCD
drops, the process will receive a sighup and initate the shutdown.

The problem with this is (it appears) that this will be the only use I
can make of this port, because of the @#$%!! NON-STANDARD, NON-UNIX
interlocks on /dev/ttya, /dev/cua, and /dev/ttyda.  These interlocks
prevent two programs from simultaneously opening this port (under any
combination of names).  I can't have my (dial-out) modem software
running on /dev/ttyda and also do the power checking because I don't
have the source.  All this applies to the other port, also.

Since the NeXT has only two ports, I don't want to tie one up
unnecessarily.  Is there any reasonable way I can use one port for both
a dial-out modem and for determining if power is on?

Is there any hope that, in some future revision of its OS, the NeXT tty
ports, under one of their aliases, will obey the usual Unix semantics?

dgc

David G. Cantor
Department of Mathematics
University of California at Los Angeles
Internet:  dgc@math.ucla.edu

eps@toaster.SFSU.EDU (Eric P. Scott) (04/09/90)

In article <2518@sunset.MATH.UCLA.EDU> dgc@euphemia.math.ucla.edu
	(David G. Cantor) writes:
>The problem with this is (it appears) that this will be the only use I
>can make of this port, because of the @#$%!! NON-STANDARD, NON-UNIX
>interlocks on /dev/ttya, /dev/cua, and /dev/ttyda.  These interlocks
>prevent two programs from simultaneously opening this port (under any
>combination of names).

>Is there any hope that, in some future revision of its OS, the NeXT tty
>ports, under one of their aliases, will obey the usual Unix semantics?

"Render unto me a f---ing break."  You don't know how much grief
the `usual' UNIX semantics caused me until I got my hands on a
System V implementation that had intrinsicly interlocking tty
devices, and I'm really sick of BSD claiming to be so "advanced"
when it's still forcing me into 7th edition's limitations.

My commendations to SunOS and NeXT Mach; they're the only BSD-
derived systems I've used that don't have their heads in the sand
on this.  (Now if Mach would only adopt termio...)

I share your concerns (and I've criticized NeXT's handling of
power outages more than once in this forum).  I would like to see
a clean solution, not a kludge, and certainly not at the expense
of essential functionality.

					-=EPS=-