Re: Serial port: open vs fcntl
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > Re: Serial port: open vs fcntl




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Re: Serial port: open vs fcntl  
Pascal Bourguignon


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
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 ]



    Sponsored Links  




 





   All times are GMT. The time now is 10:54 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register