Serial Patch

Richard B. Johnson (
Fri, 13 Dec 1996 12:18:37 -0500 (EST)


I installed the latest tty patch. The call to open a non-existant
terminal device no longer crashes. However, it now returns a valid
handle even if the device does not exist. In this example, there
are only TWO RS-232C ports on this machine! An attempt to open
/dev/cua3 should return with -1 and the error set to something appropriate.

Interesting that it returns -1 with /dev/cua4, however. I checked to
see if there was, perhaps, a "motherboard UART" that I didn't know about.

UARTs exist at 0x2f8 and 0x3f8 only on this machine.


#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <sys/fcntl.h>

int fd;

fd = open("/dev/cua3", O_RDWR|O_NONBLOCK, 0);
fprintf(stdout, "Open() returned %d, (%s)\n", fd, strerror(errno));
return 0;

Dick Johnson
Richard B. Johnson
Project Engineer
Analogic Corporation
Voice : (508) 977-3000 ext. 3754
Fax : (508) 532-6097
Modem : (508) 977-6870
Ftp :
Email :,
Penguin : Linux version 2.1.15 on an i586 machine.
Warning : It's hard to remain at the trailing edge of technology.