Subject: RE: Blocked I/O on serial ports
To: Ken Hornstein <kenh@cmf.nrl.navy.mil>
From: Ruschmeyer, John <jruschme@att.com>
List: port-sparc
Date: 08/10/1998 09:17:37
FYI, this is the approach I ended up taking (i.e., opening O_NONBLOCK,
setting CLOCAL, and turning off O_NONBLOCK) because I have to agree on the
portability concern.

I am still slightly confused by the different behaviors of the same code
under Linux and NetBSD. I think I would have expected them to work more
closely alike since both presumably support the same relevant sections of
the POSIX specs. As it was, though, I felt thrown back to the old days when
you had to deal with the issues of porting between System V and BSD 4.2 and,
no matter which you were running, the code you wanted to run was written for
the other. :-)

One other question to the lists, it was pointed out to me in an e-mail
response that POSIX requires open(2) to support both the 2- and 3-argument
syntax; yet it appears that the NetBSD man page only documents the
3-argument version. Should I send-PR this?

I do want to take a second and thank everyone for their overwhelming
response and to let you all know that I now have heyu running. A set of
patches has been sent to the author which he tells me he will try to
incorporate into the next release.

<<<John>>>

"One World, One Web, One Program" - Microsoft Promotional Ad
"Ein Volk, Ein Reich, Ein Fuhrer" - Adolf Hitler

> ----------
> From: 	Ken Hornstein[SMTP:kenh@cmf.nrl.navy.mil]
> Sent: 	Friday, August 07, 1998 2:30 PM
> To: 	Ruschmeyer, John
> Cc: 	port-sparc@netbsd.org; tech-kern@netbsd.org
> Subject: 	Re: Blocked I/O on serial ports 
> 
> >Now, however, I hit the next problem- open() won't complete unless I use
> the
> >O_NONBLOCK option. I assume that this is because the CM11A is not
> asserting
> >the modem control lines.
> 
> Others have suggested setting local in /etc/ttys; this works, but I think
> if you wanted to be _truely_ portable, you should open with O_NONBLOCK
> and use fcntl() to turn off the NONBLOCK flag on that file descriptor.
> Something like:
> 
> 	flags = fcntl(fd, F_GETFL);
> 	fcntl(fd, F_SETFL, flags & ~O_NONBLOCK);
> 
> --Ken
>