Installation guide
(void) ioctl(fd, TIOCSCTTY, 0);
• The manner for establishing and controlling modem connections is
different for DIGITAL UNIX and ULTRIX systems. The DIGITAL
UNIX system uses POSIX conventions for modem control. Information
about a serial line can be inspected and altered in the POSIX termios
structure, using the tcgetattr() and tcsetattr() library routines.
On ULTRIX systems, modem control was accomplished using the
TIOCCAR, TIOCNAR, and TIOCWONLINE requests to the ioctl()
system call. These requests are not supported on a DIGITAL UNIX
system. When porting source code, open a serial line in the following
manner:
fd = open(ttyname,O_RDWR | O_NONBLOCK);
The O_NONBLOCK flag enables you to complete a read request, in
case the CLOCAL flag is not set and you are monitoring the modem
status lines.
Get the current line attributes; set the CLOCAL flag, in case it is not
already set; and turn off the O_NONBLOCK flag in the following
manner:
tcgetattr(fd,&tty_termios); /* get current line attributes */
if ((tty_termios.c_cflag & CLOCAL) == 0) {
tty_termios.c_cflag |= CLOCAL;
tcsetattr(fd,TCSANOW,&tty_termios);
}
flags = fcntl(fd, F_GETFL)
fcntl(fd, F_SETFL, flags & ~O_NONBLOCK)
You can now use your implementation-defined process for dialing the
phone number and negotiating with the modem. After this, monitor the
modem signals by doing the following:
tty_termios.c_cflag &= ~CLOCAL;
tcsetattr(fd,&tty_termios); /* watch for modem signals now */
alarm(40); /* set a timer; do not wait forever */
read(fd,buffer,count); /* this read() blocks, pending the
appearance of modem signals */
alarm(0); /* turn off timer */
See Appendix D for a comparison of an ULTRIX application using
modem control and a DIGITAL UNIX application using modem control.
The comparison is for an outgoing call. In addition, Appendix D also
contains a sample application for an incoming call.
• The Transmission Control Protocol (TCP) and User Datagram Protocol
(UDP) transport providers are supported by both ULTRIX and
DIGITAL UNIX X/Open Transport Interface (XTI). However, when
creating a transport end point with the t_open call, ULTRIX does not
7–44 Migrating Your ULTRIX Application to a DIGITAL UNIX System