
NAME
	LockSerial	- SERIAL PORT ACCESS CONTROL FOR NON-UUCP PROGRAMS

SYNOPSIS
	LockSerial [-D device] [-U unit] [-A] "command"

DESCRIPTION
	LockSerial is used to run programs (e.g. terminal programs)
	after ensuring that a given serial port and unit is free.  It
	locks the port, runs the program, then unlocks the port.  The
	"command" argument should NOT run things in the background,
	since the port will be unlocked too early.  You can RUN the
	lockserial command itself, if you wish.

	Getty need not be running, but if it is it will maintain a
	port lock.  When getty sees the lock request it will close
	the device and relinquish control to the requesting program.

	UUCico runs LockSerialPort()/UnLockSerialPort() internally,
	DO NOT RUN UUCICO WITH THIS COMMAND.

	This change was made because the hacks in Getty to track individual
	units within a serial device were broken and had to be removed.
	This also allows getty to close its reference on the device before
	another program opens it, thereby avoiding some well known bugs
	in the A2232 serial device.


TECH NOTES
	There are two AmigaUUCP locks (LockFile() and UnLockFile() type)
	associated with obtaining a serial port.  Here is an example for
	the serial.device, unit 0:

	    P.serial.device.0
	    R.serial.device.0

	LockSerial first obtains the R. lock, then the P. lock.  After
	obtaining the P. lock it immediately releases the R. lock, then
	runs the program in question.  When the program is through,
	it releases the P. lock.

	Getty monitors the R. lock to determine if another program (UUCico
	or LockSerial) wishes to gain the serial port.	When this returns
	true Getty will release the P. lock and loop until the R. lock is
	released, then attempt to get the P. lock again.

WARNING
	You cannot run auto-detach programs with LockSerial.  Such programs
	will detach from the CLI and appear to have exited, causing
	LockSerial to give Getty the serial port back.

	LockSerial utilizes the OwnDevUnit.Library.  Programs that directly
	support this library do not need to be run with the LockSerial
	program.

OPTIONS
	-D device	The serial device, default serial.device

	-U unit 	The unit number, default 0

	-A		Do not lock up waiting for access if someone else
			has currently got the device locked.

	Command 	The command to run (if the command takes args,
			the entire thing should be in quotes)

EXAMPLE
	1> LockSerial -U2 "XBBS UNIT 2"

REFERENCES
	Getty

