summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-05-09 03:08:58 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-05-09 03:08:58 +0000
commita5e6d48dfbd13f245eaa063c794e83c91aa5606a (patch)
tree4bd195d7cf59a98e51c074938088fa0a41bc6745 /ext
parent029ad63b0b1f1a4d41678d1e42540ccef6affcb4 (diff)
* ext/socket/rubysocket.h, ext/socket/unixsocket.c,
ext/socket/ancdata.c: Use HAVE_STRUCT_MSGHDR_MSG_CONTROL instead of HAVE_ST_MSG_CONTROL. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40623 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/socket/ancdata.c40
-rw-r--r--ext/socket/rubysocket.h2
-rw-r--r--ext/socket/unixsocket.c2
3 files changed, 22 insertions, 22 deletions
diff --git a/ext/socket/ancdata.c b/ext/socket/ancdata.c
index eb36402720e..8759d3390d4 100644
--- a/ext/socket/ancdata.c
+++ b/ext/socket/ancdata.c
@@ -2,7 +2,7 @@
#include <time.h>
-#if defined(HAVE_ST_MSG_CONTROL)
+#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
static VALUE rb_cAncillaryData;
static VALUE
@@ -1132,7 +1132,7 @@ bsock_sendmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
int controls_num;
struct msghdr mh;
struct iovec iov;
-#if defined(HAVE_ST_MSG_CONTROL)
+#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
volatile VALUE controls_str = 0;
VALUE *controls_ptr = NULL;
int family;
@@ -1142,7 +1142,7 @@ bsock_sendmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
rb_secure(4);
GetOpenFile(sock, fptr);
-#if defined(HAVE_ST_MSG_CONTROL)
+#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
family = rsock_getfamily(fptr->fd);
#endif
@@ -1154,14 +1154,14 @@ bsock_sendmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
data = argv[0];
if (1 < argc) vflags = argv[1];
if (2 < argc) dest_sockaddr = argv[2];
-#if defined(HAVE_ST_MSG_CONTROL)
+#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
if (3 < argc) { controls_ptr = &argv[3]; controls_num = argc - 3; }
#endif
StringValue(data);
if (controls_num) {
-#if defined(HAVE_ST_MSG_CONTROL)
+#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
int i;
size_t last_pad = 0;
#if defined(__NetBSD__)
@@ -1264,7 +1264,7 @@ bsock_sendmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
mh.msg_iov = &iov;
iov.iov_base = RSTRING_PTR(data);
iov.iov_len = RSTRING_LEN(data);
-#if defined(HAVE_ST_MSG_CONTROL)
+#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
if (controls_str) {
mh.msg_control = RSTRING_PTR(controls_str);
mh.msg_controllen = RSTRING_SOCKLEN(controls_str);
@@ -1396,7 +1396,7 @@ rb_recvmsg(int fd, struct msghdr *msg, int flags)
return (ssize_t)rb_thread_call_without_gvl(nogvl_recvmsg_func, &args, RUBY_UBF_IO, 0);
}
-#if defined(HAVE_ST_MSG_CONTROL)
+#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
static void
discard_cmsg(struct cmsghdr *cmh, char *msg_end, int msg_peek_p)
{
@@ -1428,7 +1428,7 @@ discard_cmsg(struct cmsghdr *cmh, char *msg_end, int msg_peek_p)
void
rsock_discard_cmsg_resource(struct msghdr *mh, int msg_peek_p)
{
-#if defined(HAVE_ST_MSG_CONTROL)
+#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
struct cmsghdr *cmh;
char *msg_end;
@@ -1443,7 +1443,7 @@ rsock_discard_cmsg_resource(struct msghdr *mh, int msg_peek_p)
#endif
}
-#if defined(HAVE_ST_MSG_CONTROL)
+#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
static void
make_io_for_unix_rights(VALUE ctl, struct cmsghdr *cmh, char *msg_end)
{
@@ -1490,7 +1490,7 @@ bsock_recvmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
VALUE dat_str = Qnil;
VALUE ret;
ssize_t ss;
-#if defined(HAVE_ST_MSG_CONTROL)
+#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
int request_scm_rights;
struct cmsghdr *cmh;
size_t maxctllen;
@@ -1509,7 +1509,7 @@ bsock_recvmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
rb_scan_args(argc, argv, "03:", &vmaxdatlen, &vflags, &vmaxctllen, &vopts);
maxdatlen = NIL_P(vmaxdatlen) ? sizeof(datbuf0) : NUM2SIZET(vmaxdatlen);
-#if defined(HAVE_ST_MSG_CONTROL)
+#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
maxctllen = NIL_P(vmaxctllen) ? sizeof(ctlbuf0) : NUM2SIZET(vmaxctllen);
#else
if (!NIL_P(vmaxctllen))
@@ -1524,7 +1524,7 @@ bsock_recvmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
grow_buffer = NIL_P(vmaxdatlen) || NIL_P(vmaxctllen);
-#if defined(HAVE_ST_MSG_CONTROL)
+#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
request_scm_rights = 0;
if (!NIL_P(vopts) && RTEST(rb_hash_aref(vopts, ID2SYM(rb_intern("scm_rights")))))
request_scm_rights = 1;
@@ -1535,7 +1535,7 @@ bsock_recvmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
rb_raise(rb_eIOError, "recvmsg for buffered IO");
}
-#if !defined(HAVE_ST_MSG_CONTROL)
+#if !defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
if (grow_buffer) {
int socktype;
socklen_t optlen = (socklen_t)sizeof(socktype);
@@ -1558,7 +1558,7 @@ bsock_recvmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
datbuf = RSTRING_PTR(dat_str);
}
-#if defined(HAVE_ST_MSG_CONTROL)
+#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
if (maxctllen <= sizeof(ctlbuf0))
ctlbuf = ctlbuf0.bytes;
else {
@@ -1581,7 +1581,7 @@ bsock_recvmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
iov.iov_base = datbuf;
iov.iov_len = maxdatlen;
-#if defined(HAVE_ST_MSG_CONTROL)
+#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
mh.msg_control = ctlbuf;
mh.msg_controllen = (socklen_t)maxctllen;
#endif
@@ -1603,7 +1603,7 @@ bsock_recvmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
if (ss == -1) {
if (nonblock && (errno == EWOULDBLOCK || errno == EAGAIN))
rb_readwrite_sys_fail(RB_IO_WAIT_READABLE, "recvmsg(2) would block");
-#if defined(HAVE_ST_MSG_CONTROL)
+#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
if (!gc_done && (errno == EMFILE || errno == EMSGSIZE)) {
/*
* When SCM_RIGHTS hit the file descriptors limit:
@@ -1622,7 +1622,7 @@ bsock_recvmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
if (grow_buffer) {
int grown = 0;
-#if defined(HAVE_ST_MSG_CONTROL)
+#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
if (NIL_P(vmaxdatlen) && (mh.msg_flags & MSG_TRUNC)) {
if (SIZE_MAX/2 < maxdatlen)
rb_raise(rb_eArgError, "max data length too big");
@@ -1680,14 +1680,14 @@ bsock_recvmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
ret = rb_ary_new3(3, dat_str,
rsock_io_socket_addrinfo(sock, mh.msg_name, mh.msg_namelen),
-#if defined(HAVE_ST_MSG_CONTROL)
+#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
INT2NUM(mh.msg_flags)
#else
Qnil
#endif
);
-#if defined(HAVE_ST_MSG_CONTROL)
+#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
family = rsock_getfamily(fptr->fd);
if (mh.msg_controllen) {
char *msg_end = (char *)mh.msg_control + mh.msg_controllen;
@@ -1797,7 +1797,7 @@ rsock_bsock_recvmsg_nonblock(int argc, VALUE *argv, VALUE sock)
void
rsock_init_ancdata(void)
{
-#if defined(HAVE_ST_MSG_CONTROL)
+#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
/*
* Document-class: Socket::AncillaryData
*
diff --git a/ext/socket/rubysocket.h b/ext/socket/rubysocket.h
index 68f27342415..81448720070 100644
--- a/ext/socket/rubysocket.h
+++ b/ext/socket/rubysocket.h
@@ -328,7 +328,7 @@ ssize_t rsock_recvmsg(int socket, struct msghdr *message, int flags);
#define rsock_bsock_recvmsg_nonblock rb_f_notimplement
#endif
-#ifdef HAVE_ST_MSG_CONTROL
+#ifdef HAVE_STRUCT_MSGHDR_MSG_CONTROL
void rsock_discard_cmsg_resource(struct msghdr *mh, int msg_peek_p);
#endif
diff --git a/ext/socket/unixsocket.c b/ext/socket/unixsocket.c
index 6aaf2f9c173..c30dbb7956c 100644
--- a/ext/socket/unixsocket.c
+++ b/ext/socket/unixsocket.c
@@ -157,7 +157,7 @@ unix_recvfrom(int argc, VALUE *argv, VALUE sock)
return rsock_s_recvfrom(sock, argc, argv, RECV_UNIX);
}
-#if defined(HAVE_ST_MSG_CONTROL) && defined(SCM_RIGHTS)
+#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL) && defined(SCM_RIGHTS)
#define FD_PASSING_BY_MSG_CONTROL 1
#else
#define FD_PASSING_BY_MSG_CONTROL 0