Interfacing with uugetty on Unix System V R3.1 & HDB uucp.
Mike Wescott
wescott at sauron.Columbia.NCR.COM
Wed Feb 10 09:02:40 AEST 1988
In article <348 at asi.UUCP> metro at asi.UUCP (Metro T. Sauper) writes:
> Could somebody please tell me what magic I have to do to open
> a serial port for an outgoing connection similar to what cu does?
> My system is an AT&T 3B2 running Unix System V, R3.1 with HDB uucp.
Have you tried dial(3C). It might work.
> I have tried creating a lock file in /usr/spool/locks and this only seems
> to work for a short time. soon afterwards, uugetty seems to remove the
> lock file, and start competing for characters coming in the port.
Opening the port does not seem to be your problem, the locking
does. The lock file should contain 11 characters
fprintf(lockfp, "%10d\n", getpid());
The filename is /usr/spool/locks/LCK..<portname> e.g.
/usr/spool/locks/LCK..tty12
No lock is considered to exist if either:
there is no lockfile present,
the file exists, but has the wrong format,
or
the pid is not in use (checked with kill(pid,0); see man page
for kill())
> Could some one please itemize the steps which "cu' goes through to set up
> the port for communications?
cu, uucp, and uugetty all the same code for checking and making
lockfiles.
1. check for an existing (and valid) lockfile
2. set the lockfile
a. create a temporary file in the locks directory
b. write in the pid
c. chmod to 0444
d. chown to uucp
e. link to LCK..<portname>
f. unlink temp file
3. open the port
4. set advisory file lock (F_WRLCK)
5. use the port
6. remove the lockfile
--
-Mike Wescott
wescott at ncrcae.Columbia.NCR.COM
More information about the Comp.unix.wizards
mailing list