#include "c.h"#include <fcntl.h>
Go to the source code of this file.
Functions | |
| bool | pg_set_noblock (pgsocket sock) |
| bool | pg_set_block (pgsocket sock) |
Definition at line 35 of file noblock.c.
Referenced by pq_set_nonblocking().
{
#if !defined(WIN32)
int flags;
flags = fcntl(sock, F_GETFL);
if (flags < 0 || fcntl(sock, F_SETFL, (long) (flags & ~O_NONBLOCK)))
return false;
return true;
#else
unsigned long ioctlsocket_ret = 0;
/* Returns non-0 on failure, while fcntl() returns -1 on failure */
return (ioctlsocket(sock, FIONBIO, &ioctlsocket_ret) == 0);
#endif
}
Definition at line 21 of file noblock.c.
Referenced by pgstat_init(), pq_set_nonblocking(), PQconnectPoll(), and report_fork_failure_to_client().
{
#if !defined(WIN32)
return (fcntl(sock, F_SETFL, O_NONBLOCK) != -1);
#else
unsigned long ioctlsocket_ret = 1;
/* Returns non-0 on failure, while fcntl() returns -1 on failure */
return (ioctlsocket(sock, FIONBIO, &ioctlsocket_ret) == 0);
#endif
}
1.7.1