[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: non-blocking I/O
From: |
Bruno Haible |
Subject: |
Re: non-blocking I/O |
Date: |
Tue, 29 Mar 2011 13:08:32 +0100 |
User-agent: |
KMail/1.9.9 |
Hi Paolo, Eric,
> prefer to implement {g,s}et_nonblock_flag functions. ...
> This module can then be used to build a fcntl F_GETFL/F_SETFL
> implementation, but it is not very important to do so.
Nevertheless in gnulib we try to offer the POSIX APIs, if possible.
There are three APIs for non-blocking I/O on Unix:
1) fcntl F_SETFL O_NONBLOCK (POSIX, SysV)
2) fcntl F_SETFL O_NDELAY (older SysV)
3) ioctl FIONBIO (BSD 4.2)
According to the include files the support is the following:
- glibc, MacOS X, FreeBSD, NetBSD, OpenBSD, AIX, HP-UX, IRIX, OSF/1, Solaris,
Cygwin, Interix have all three APIs,
- mingw lacks F_GETFL, O_NONBLOCK, O_NDELAY
- BeOS lacks O_NDELAY, FIONBIO
- Haiku lacks O_NDELAY
So, barring bugs that we find during unit testing, we need
- a replacement for fcntl F_SETFL O_NONBLOCK that supports mingw,
- extend lib/open.c so that it handles O_NONBLOCK on mingw (presumably
by failing, because Win32 does not support non-blocking I/O on
regular files).
I agree that get/set_nonblocking functions are a good step towards this.
Bruno
--
In memoriam Rachel Levy <http://en.wikipedia.org/wiki/Rachel_Levy>