07-30-05 12:48 PM
"Simon Elliott" <Simon at ctsn.co.uk> writes:
> In a lot of serial port code examples, there are calls to both open and
> fcntl to set/clear flags, for example:
>
> fd = open(devicename, O_RDWR | O_NOCTTY | O_NDELAY);
> fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NDELAY));
>
> If you want nonblocking I/O with the O_NDELAY option, is it necessary
> to specify it twice, once in the open() call and once in the fcntl()
> call?
I'd guess not, but I suspect it's done for portability reasons.
Perhaps there are some OS where O_NDELAY is not taken into account
when passed to open(2).
--
"Specifications are for the weak and timid!"
[ Post a follow-up to this message ]
|