1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

[osdep] Restored changes.

This commit is contained in:
Witold Filipczyk 2022-05-01 15:07:51 +02:00
parent dcfcd26d08
commit 154479e849

View File

@ -77,6 +77,13 @@
int int
set_nonblocking_fd(int fd) set_nonblocking_fd(int fd)
{ {
#ifdef WIN32
/* on current mingw (202204)
* this is correct usage of winsock
* when compiling for win32 */
u_long mode = 1; // set non-blocking socket
return ioctlsocket(fd, FIONBIO, &mode);
# else
#if defined(O_NONBLOCK) || defined(O_NDELAY) #if defined(O_NONBLOCK) || defined(O_NDELAY)
int flags = fcntl(fd, F_GETFL, 0); int flags = fcntl(fd, F_GETFL, 0);
@ -94,6 +101,8 @@ set_nonblocking_fd(int fd)
#else #else
return 0; return 0;
#endif #endif
#endif
} }
/* Set a file descriptor to blocking mode. It returns a non-zero value on /* Set a file descriptor to blocking mode. It returns a non-zero value on
@ -101,6 +110,13 @@ set_nonblocking_fd(int fd)
int int
set_blocking_fd(int fd) set_blocking_fd(int fd)
{ {
#ifdef WIN32
/* on current mingw (202204)
* this is correct usage of winsock
* when compiling for win32 */
u_long mode = 0; // set blocking socket
return ioctlsocket(fd, FIONBIO, &mode);
# else
#if defined(O_NONBLOCK) || defined(O_NDELAY) #if defined(O_NONBLOCK) || defined(O_NDELAY)
int flags = fcntl(fd, F_GETFL, 0); int flags = fcntl(fd, F_GETFL, 0);
@ -118,6 +134,7 @@ set_blocking_fd(int fd)
#else #else
return 0; return 0;
#endif #endif
#endif
} }
void void