<div dir="ltr"><div><div>O_NONBLOCK<br>If possible, the file will be opened in nonblocking mode. Neither the open() call,<br>nor any other operation will cause the process to block (sleep) on the I/O. This<br>behaviour may be defined only for FIFOs.<br>
<br>Sometimes, programmers do not want a call to read() to block when there is no data<br>available. Instead, they prefer that the call return immediately, indicating that no data<br>is available. This is called nonblocking I/O; it allows applications to perform I/O, potentially<br>
on multiple files, without ever blocking, and thus missing data available in<br>another file.<br><br>Consequently, an additional errno value is worth checking: EAGAIN.<br><br>- from - Linux system programming second edition R Love.</div>
<div>so yes.<br><br></div><br><br></div>HTH<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Feb 21, 2014 at 9:52 AM, Rahul Bedarkar <span dir="ltr"><<a href="mailto:rpal143@gmail.com" target="_blank">rpal143@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Thu, Feb 20, 2014 at 9:06 PM, <<a href="mailto:Valdis.Kletnieks@vt.edu">Valdis.Kletnieks@vt.edu</a>> wrote:<br>
> On Thu, 20 Feb 2014 20:36:44 +0530, Rahul Bedarkar said:<br>
><br>
>> "Often the open(2) call has unwanted side effects, that can be avoided<br>
>> under Linux by giving it the O_NONBLOCK flag."<br>
>><br>
>> I have seen open man page but can't find what are side effects of open.<br>
><br>
> Well, for starters, the open() call can block while trying to open a hardware<br>
> device that isnt ready, thus hanging the entire process. For added joy,<br>
> remember that signals are delivered when a process inside a syscall finally<br>
> returns to userspace - which means that your hung process may be unkillable<br>
> even by 'kill -9'.<br>
><br>
<br>
</div></div>Thanks, Does this mean that if I open a device file with O_NONBLOCK flag<br>
and if device is not ready by that time open system call will return<br>
immediately and fail?<br>
<div class=""><br>
> Most people would call that an unwanted side effect. :)<br>
<br>
</div>_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
<a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>easy is right<br>begin right and you're easy<br>continue easy and you're right<br>the right way to go easy is to forget the right way<br>and forget that the going is easy....<br>
</div>