Made async fds nonblocking.

This commit is contained in:
Ove Kaaven 1999-07-31 12:59:29 +00:00 committed by Alexandre Julliard
parent 402dc20e1f
commit 43a2b6a2a5
1 changed files with 6 additions and 4 deletions

View File

@ -96,12 +96,14 @@ HANDLER_DEF(ASYNC_sigio) {
* Makes the passed filedescriptor async (or not) depending on flag. * Makes the passed filedescriptor async (or not) depending on flag.
*/ */
static BOOL ASYNC_MakeFDAsync(int unixfd,int async) { static BOOL ASYNC_MakeFDAsync(int unixfd,int async) {
int flags;
#if !defined(FASYNC) && defined(FIOASYNC) #if !defined(FASYNC) && defined(FIOASYNC)
#define FASYNC FIOASYNC #define FASYNC FIOASYNC
#endif #endif
#ifdef FASYNC
int flags;
#endif
#ifdef F_SETOWN #ifdef F_SETOWN
if (-1==fcntl(unixfd,F_SETOWN,getpid())) if (-1==fcntl(unixfd,F_SETOWN,getpid()))
perror("fcntl F_SETOWN <pid>"); perror("fcntl F_SETOWN <pid>");
@ -112,9 +114,9 @@ static BOOL ASYNC_MakeFDAsync(int unixfd,int async) {
return FALSE; return FALSE;
} }
if (async) if (async)
flags|=FASYNC; flags|=FASYNC | O_NONBLOCK;
else else
flags&=~FASYNC; flags&=~(FASYNC | O_NONBLOCK);
if (-1==fcntl(unixfd,F_SETFL,&flags)) { if (-1==fcntl(unixfd,F_SETFL,&flags)) {
perror("fcntl F_SETFL FASYNC"); perror("fcntl F_SETFL FASYNC");
return FALSE; return FALSE;