| Floyd L. Davidson 2005-08-01, 8:30 am |
| "Simon Elliott" <Simon at ctsn.co.uk> wrote:
>On 01/08/2005, Villy Kruse wrote:
>
>
>Thanks, this is useful info. Would the same be true for O_NONBLOCK?
Yes, and in that particular way they are always identical.
However, O_NONBLOCK is defined by POSIX and will be the same on
all platforms while O_NDELAY has slight variations between some
platforms. Hence O_NONBLOCK is preferred for portability.
>
>I was under the impression that I could only set CLOCAL via termios(2).
>Can I achieve the same thing with open(2)?
In a C program the way to set or clear the CLOCAL flag is with
termios. However, you cannot guarantee the state of the serial
port before you open it; therefore the *only* correct way to do
so is with the O_NONBLOCK flag set in open(). After it is open
the CLOCAL flag can be set as desired, and blocking can be set
as desired with fcntl().
--
Floyd L. Davidson <http://www.apaflo.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska) floyd@apaflo.com
|