Reputation: 137
I'm using ioctl() to check if the read-end of a pipe would block. I set ioctl(the_pipe[0], FIONBIO, ...)
(I'm not sure what the 3rd parameter is supposed to be, can I set it to NULL?).
As I understand, read(the_pipe[0], buf, buf_len);
is supposed to set an error code for EWOULDBLOCK (EAGAIN), but where is that error code set, how do I get it?
Thanks
Upvotes: 0
Views: 1296
Reputation: 2883
Note also that errno is set by system calls, but is not cleared. That is, if you aren't checking for errors after each system call or explicitly clearing errno prior to the call in question, you won't be sure which system call set errno.
Upvotes: 0