summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/socket/ancdata.c16
-rw-r--r--ext/socket/rubysocket.h1
-rw-r--r--ext/socket/unixsocket.c6
3 files changed, 13 insertions, 10 deletions
diff --git a/ext/socket/ancdata.c b/ext/socket/ancdata.c
index f222f84..8cbe53c 100644
--- a/ext/socket/ancdata.c
+++ b/ext/socket/ancdata.c
@@ -1358,16 +1358,22 @@ struct recvmsg_args_struct {
int flags;
};
-static VALUE
-nogvl_recvmsg_func(void *ptr)
+ssize_t
+rsock_recvmsg(int socket, struct msghdr *message, int flags)
{
- struct recvmsg_args_struct *args = ptr;
- int flags = args->flags;
#ifdef MSG_CMSG_CLOEXEC
/* MSG_CMSG_CLOEXEC is available since Linux 2.6.23. Linux 2.6.18 silently ignore it. */
flags |= MSG_CMSG_CLOEXEC;
#endif
- return recvmsg(args->fd, args->msg, flags);
+ return recvmsg(socket, message, flags);
+}
+
+static VALUE
+nogvl_recvmsg_func(void *ptr)
+{
+ struct recvmsg_args_struct *args = ptr;
+ int flags = args->flags;
+ return rsock_recvmsg(args->fd, args->msg, flags);
}
static ssize_t
diff --git a/ext/socket/rubysocket.h b/ext/socket/rubysocket.h
index 4c0efdb..3e2f6c9 100644
--- a/ext/socket/rubysocket.h
+++ b/ext/socket/rubysocket.h
@@ -282,6 +282,7 @@ VALUE rsock_bsock_sendmsg_nonblock(int argc, VALUE *argv, VALUE sock);
#if defined(HAVE_RECVMSG)
VALUE rsock_bsock_recvmsg(int argc, VALUE *argv, VALUE sock);
VALUE rsock_bsock_recvmsg_nonblock(int argc, VALUE *argv, VALUE sock);
+ssize_t rsock_recvmsg(int socket, struct msghdr *message, int flags);
#else
#define rsock_bsock_recvmsg rb_f_notimplement
#define rsock_bsock_recvmsg_nonblock rb_f_notimplement
diff --git a/ext/socket/unixsocket.c b/ext/socket/unixsocket.c
index e5ef44c..2954cef 100644
--- a/ext/socket/unixsocket.c
+++ b/ext/socket/unixsocket.c
@@ -265,11 +265,7 @@ recvmsg_blocking(void *data)
{
struct iomsg_arg *arg = data;
int flags = 0;
-#ifdef MSG_CMSG_CLOEXEC
- /* MSG_CMSG_CLOEXEC is available since Linux 2.6.23. Linux 2.6.18 silently ignore it. */
- flags |= MSG_CMSG_CLOEXEC;
-#endif
- return recvmsg(arg->fd, &arg->msg, flags);
+ return rsock_recvmsg(arg->fd, &arg->msg, flags);
}
/*