* src/lib/evil_fcntl.c:

* src/lib/evil_fcntl.h:
	* src/lib/evil_unistd.c:
	make pipe() blocking by default and allow fcntl()
	to set a socket to be non-blocking
	* src/lib/evil_stdlib.c:
	fix warning



SVN revision: 45698
This commit is contained in:
Vincent Torri 2010-01-29 09:34:26 +00:00
parent 0aec2b4dcd
commit 29db27970c
5 changed files with 33 additions and 8 deletions

View File

@ -1,3 +1,14 @@
2010-01-29 Vincent Torri <doursse at users dot sf dot net>
* src/lib/evil_fcntl.c:
* src/lib/evil_fcntl.h:
* src/lib/evil_unistd.c:
make pipe() blocking by default and allow fcntl()
to set a socket to be non-blocking
* src/lib/evil_stdlib.c:
fix warning
2010-01-19 Vincent Torri <doursse at users dot sf dot net>
* src/lib/dlfcn/dlfcn.c:

View File

@ -1,4 +1,8 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif /* HAVE_CONFIG_H */
#include <stdio.h>
#ifdef _MSC_VER
@ -9,9 +13,7 @@
# include <sys/locking.h>
#endif /* __CEGCC__ */
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif /* HAVE_CONFIG_H */
#include <winsock2.h> /* for ioctlsocket */
#include "Evil.h"
@ -64,6 +66,12 @@ int fcntl(int fd, int cmd, ...)
res = 0;
#endif /* __CEGCC__ || __MINGW32CE__ */
}
if (flag == O_NONBLOCK)
{
u_long arg = 1;
if (ioctlsocket((SOCKET)fd, FIONBIO, &arg) == SOCKET_ERROR)
res = 0;
}
}
#if ! ( defined(__CEGCC__) || defined(__MINGW32CE__) )
else if ((cmd == F_SETLK) || (cmd == F_SETLKW))

View File

@ -13,6 +13,12 @@
*/
# define FD_CLOEXEC 1
/**
* @def O_NONBLOCK
* Specifies that the socket is in non-blocking mode.
*/
# define O_NONBLOCK 04000
/**
* @def F_SETFD
* Specifies that fcntl() should set the file descriptor flags

View File

@ -322,7 +322,7 @@ mkstemp(char *__template)
#if ! ( defined(__CEGCC__) || defined(__MINGW32CE__) )
fd = _open(__template, _O_RDWR | _O_BINARY | _O_CREAT | _O_EXCL, _S_IREAD | _S_IWRITE);
#else /* __CEGCC__ || __MINGW32CE__ */
#else /* _WIN32_WCE */
{
FILE *f;
wchar_t *wtemplate;
@ -339,9 +339,9 @@ mkstemp(char *__template)
#endif /* HAVE_ERRNO_H */
return -1;
}
fd = _fileno(f);
fd = (int)_fileno(f);
}
#endif /* __CEGCC__ || __MINGW32CE__ */
#endif /* _WIN32_WCE */
if (fd >= 0)
return fd;

View File

@ -382,11 +382,11 @@ evil_pipe(int *fds)
if (!FD_ISSET (socket1, &write_set))
goto out2;
arg = 1;
arg = 0;
if (ioctlsocket (socket1, FIONBIO, &arg) == SOCKET_ERROR)
goto out2;
arg = 1;
arg = 0;
if (ioctlsocket (socket2, FIONBIO, &arg) == SOCKET_ERROR)
goto out2;