/* Set a file descriptor to non-blocking */
bool
-set_nonblock_action(int fd)
+set_nonblock_action(socket_descriptor_t fd)
{
#ifdef _WIN32
u_long arg = 1;
/* Set a file descriptor to not be passed across execs */
bool
-set_cloexec_action(int fd)
+set_cloexec_action(socket_descriptor_t fd)
{
#ifndef _WIN32
if (fcntl(fd, F_SETFD, FD_CLOEXEC) < 0)
/* Set a file descriptor to non-blocking */
void
-set_nonblock(int fd)
+set_nonblock(socket_descriptor_t fd)
{
if (!set_nonblock_action(fd))
{
/* Set a file descriptor to not be passed across execs */
void
-set_cloexec(int fd)
+set_cloexec(socket_descriptor_t fd)
{
if (!set_cloexec_action(fd))
{
#include "error.h"
#include "syshead.h"
-bool set_nonblock_action(int fd);
+bool set_nonblock_action(socket_descriptor_t fd);
-bool set_cloexec_action(int fd);
+bool set_cloexec_action(socket_descriptor_t fd);
-void set_nonblock(int fd);
+void set_nonblock(socket_descriptor_t fd);
-void set_cloexec(int fd);
+void set_cloexec(socket_descriptor_t fd);
static inline void
-openvpn_fd_set(int fd, fd_set *setp)
+openvpn_fd_set(socket_descriptor_t fd, fd_set *setp)
{
#ifndef _WIN32 /* The Windows FD_SET() implementation does not overflow */
ASSERT(fd >= 0 && fd < FD_SETSIZE);
}
static int
-socket_get_sndbuf(int sd)
+socket_get_sndbuf(socket_descriptor_t sd)
{
#if defined(HAVE_GETSOCKOPT) && defined(SOL_SOCKET) && defined(SO_SNDBUF)
int val;
}
static void
-socket_set_sndbuf(int sd, int size)
+socket_set_sndbuf(socket_descriptor_t sd, int size)
{
#if defined(HAVE_SETSOCKOPT) && defined(SOL_SOCKET) && defined(SO_SNDBUF)
if (setsockopt(sd, SOL_SOCKET, SO_SNDBUF, (void *) &size, sizeof(size)) != 0)
}
static int
-socket_get_rcvbuf(int sd)
+socket_get_rcvbuf(socket_descriptor_t sd)
{
#if defined(HAVE_GETSOCKOPT) && defined(SOL_SOCKET) && defined(SO_RCVBUF)
int val;
}
static bool
-socket_set_rcvbuf(int sd, int size)
+socket_set_rcvbuf(socket_descriptor_t sd, int size)
{
#if defined(HAVE_SETSOCKOPT) && defined(SOL_SOCKET) && defined(SO_RCVBUF)
if (setsockopt(sd, SOL_SOCKET, SO_RCVBUF, (void *) &size, sizeof(size)) != 0)
}
static void
-socket_set_buffers(int fd, const struct socket_buffer_size *sbs)
+socket_set_buffers(socket_descriptor_t fd, const struct socket_buffer_size *sbs)
{
if (sbs)
{
*/
static bool
-socket_set_tcp_nodelay(int sd, int state)
+socket_set_tcp_nodelay(socket_descriptor_t sd, int state)
{
#if defined(_WIN32) || (defined(HAVE_SETSOCKOPT) && defined(IPPROTO_TCP) && defined(TCP_NODELAY))
if (setsockopt(sd, IPPROTO_TCP, TCP_NODELAY, (void *) &state, sizeof(state)) != 0)
}
static inline void
-socket_set_mark(int sd, int mark)
+socket_set_mark(socket_descriptor_t sd, int mark)
{
#if defined(TARGET_LINUX) && HAVE_DECL_SO_MARK
if (mark && setsockopt(sd, SOL_SOCKET, SO_MARK, (void *) &mark, sizeof(mark)) != 0)
}
static bool
-socket_set_flags(int sd, unsigned int sockflags)
+socket_set_flags(socket_descriptor_t sd, unsigned int sockflags)
{
if (sockflags & SF_TCP_NODELAY)
{