ruby-changes:28571
From: akr <ko1@a...>
Date: Thu, 9 May 2013 12:09:09 +0900 (JST)
Subject: [ruby-changes:28571] akr:r40623 (trunk): * ext/socket/rubysocket.h, ext/socket/unixsocket.c,
akr 2013-05-09 12:08:58 +0900 (Thu, 09 May 2013) New Revision: 40623 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=40623 Log: * ext/socket/rubysocket.h, ext/socket/unixsocket.c, ext/socket/ancdata.c: Use HAVE_STRUCT_MSGHDR_MSG_CONTROL instead of HAVE_ST_MSG_CONTROL. Modified files: trunk/ChangeLog trunk/ext/socket/ancdata.c trunk/ext/socket/rubysocket.h trunk/ext/socket/unixsocket.c Index: ChangeLog =================================================================== --- ChangeLog (revision 40622) +++ ChangeLog (revision 40623) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Thu May 9 12:06:07 2013 Tanaka Akira <akr@f...> + + * ext/socket/rubysocket.h, ext/socket/unixsocket.c, + ext/socket/ancdata.c: Use HAVE_STRUCT_MSGHDR_MSG_CONTROL instead + of HAVE_ST_MSG_CONTROL. + Thu May 9 11:30:02 2013 Zachary Scott <zachary@z...> * string.c: Add call-seq alias for String#=== [Bug #8381] Index: ext/socket/rubysocket.h =================================================================== --- ext/socket/rubysocket.h (revision 40622) +++ ext/socket/rubysocket.h (revision 40623) @@ -328,7 +328,7 @@ ssize_t rsock_recvmsg(int socket, struct https://github.com/ruby/ruby/blob/trunk/ext/socket/rubysocket.h#L328 #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 Index: ext/socket/ancdata.c =================================================================== --- ext/socket/ancdata.c (revision 40622) +++ ext/socket/ancdata.c (revision 40623) @@ -2,7 +2,7 @@ https://github.com/ruby/ruby/blob/trunk/ext/socket/ancdata.c#L2 #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 * https://github.com/ruby/ruby/blob/trunk/ext/socket/ancdata.c#L1132 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 * https://github.com/ruby/ruby/blob/trunk/ext/socket/ancdata.c#L1142 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 * https://github.com/ruby/ruby/blob/trunk/ext/socket/ancdata.c#L1154 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 * https://github.com/ruby/ruby/blob/trunk/ext/socket/ancdata.c#L1264 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, i https://github.com/ruby/ruby/blob/trunk/ext/socket/ancdata.c#L1396 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 * https://github.com/ruby/ruby/blob/trunk/ext/socket/ancdata.c#L1428 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 msghd https://github.com/ruby/ruby/blob/trunk/ext/socket/ancdata.c#L1443 #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 * https://github.com/ruby/ruby/blob/trunk/ext/socket/ancdata.c#L1490 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 * https://github.com/ruby/ruby/blob/trunk/ext/socket/ancdata.c#L1509 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 * https://github.com/ruby/ruby/blob/trunk/ext/socket/ancdata.c#L1524 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 * https://github.com/ruby/ruby/blob/trunk/ext/socket/ancdata.c#L1535 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 * https://github.com/ruby/ruby/blob/trunk/ext/socket/ancdata.c#L1558 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 * https://github.com/ruby/ruby/blob/trunk/ext/socket/ancdata.c#L1581 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 * https://github.com/ruby/ruby/blob/trunk/ext/socket/ancdata.c#L1603 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 * https://github.com/ruby/ruby/blob/trunk/ext/socket/ancdata.c#L1622 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 * https://github.com/ruby/ruby/blob/trunk/ext/socket/ancdata.c#L1680 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, V https://github.com/ruby/ruby/blob/trunk/ext/socket/ancdata.c#L1797 void rsock_init_ancdata(void) { -#if defined(HAVE_ST_MSG_CONTROL) +#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL) /* * Document-class: Socket::AncillaryData * Index: ext/socket/unixsocket.c =================================================================== --- ext/socket/unixsocket.c (revision 40622) +++ ext/socket/unixsocket.c (revision 40623) @@ -157,7 +157,7 @@ unix_recvfrom(int argc, VALUE *argv, VAL https://github.com/ruby/ruby/blob/trunk/ext/socket/unixsocket.c#L157 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/