Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint

5.9. Nonblocking I/O

Specifying the O_NONBLOCK flag when opening a file serves two purposes:

  • If the file can’t be opened immediately, then open() returns an error instead of blocking. One case where open() can block is with FIFOs (Section 44.7).

  • After a successful open(), subsequent I/O operations are also nonblocking. If an I/O system call can’t complete immediately, then either a partial data transfer is performed or the system call fails with one of the errors EAGAIN or EWOULDBLOCK. Which error is returned depends on the system call. On Linux, as on many UNIX implementations, these two error constants are synonymous.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial