* ext/socket/ancdata.c (bsock_sendmsg_internal): Always set
controls_num to raise NotImplementedError appropriately. (bsock_recvmsg_internal): Raise NotImplementedError if :scm_rights=>true is given on platforms which don't have 4.4BSD style control message. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40624 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a5e6d48dfb
commit
adb575e21e
@ -1,3 +1,11 @@
|
|||||||
|
Thu May 9 20:43:41 2013 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
|
* ext/socket/ancdata.c (bsock_sendmsg_internal): Always set
|
||||||
|
controls_num to raise NotImplementedError appropriately.
|
||||||
|
(bsock_recvmsg_internal): Raise NotImplementedError if
|
||||||
|
:scm_rights=>true is given on platforms which don't have
|
||||||
|
4.4BSD style control message.
|
||||||
|
|
||||||
Thu May 9 12:06:07 2013 Tanaka Akira <akr@fsij.org>
|
Thu May 9 12:06:07 2013 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* ext/socket/rubysocket.h, ext/socket/unixsocket.c,
|
* ext/socket/rubysocket.h, ext/socket/unixsocket.c,
|
||||||
|
@ -1147,15 +1147,15 @@ bsock_sendmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
data = vflags = dest_sockaddr = Qnil;
|
data = vflags = dest_sockaddr = Qnil;
|
||||||
controls_num = 0;
|
|
||||||
|
|
||||||
if (argc == 0)
|
if (argc == 0)
|
||||||
rb_raise(rb_eArgError, "mesg argument required");
|
rb_raise(rb_eArgError, "mesg argument required");
|
||||||
data = argv[0];
|
data = argv[0];
|
||||||
if (1 < argc) vflags = argv[1];
|
if (1 < argc) vflags = argv[1];
|
||||||
if (2 < argc) dest_sockaddr = argv[2];
|
if (2 < argc) dest_sockaddr = argv[2];
|
||||||
|
controls_num = argc - 3;
|
||||||
#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
|
#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
|
||||||
if (3 < argc) { controls_ptr = &argv[3]; controls_num = argc - 3; }
|
if (3 < argc) { controls_ptr = &argv[3]; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
StringValue(data);
|
StringValue(data);
|
||||||
@ -1490,8 +1490,8 @@ bsock_recvmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
|
|||||||
VALUE dat_str = Qnil;
|
VALUE dat_str = Qnil;
|
||||||
VALUE ret;
|
VALUE ret;
|
||||||
ssize_t ss;
|
ssize_t ss;
|
||||||
#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
|
|
||||||
int request_scm_rights;
|
int request_scm_rights;
|
||||||
|
#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
|
||||||
struct cmsghdr *cmh;
|
struct cmsghdr *cmh;
|
||||||
size_t maxctllen;
|
size_t maxctllen;
|
||||||
union {
|
union {
|
||||||
@ -1524,10 +1524,12 @@ bsock_recvmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
|
|||||||
|
|
||||||
grow_buffer = NIL_P(vmaxdatlen) || NIL_P(vmaxctllen);
|
grow_buffer = NIL_P(vmaxdatlen) || NIL_P(vmaxctllen);
|
||||||
|
|
||||||
#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
|
|
||||||
request_scm_rights = 0;
|
request_scm_rights = 0;
|
||||||
if (!NIL_P(vopts) && RTEST(rb_hash_aref(vopts, ID2SYM(rb_intern("scm_rights")))))
|
if (!NIL_P(vopts) && RTEST(rb_hash_aref(vopts, ID2SYM(rb_intern("scm_rights")))))
|
||||||
request_scm_rights = 1;
|
request_scm_rights = 1;
|
||||||
|
#if !defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
|
||||||
|
if (request_scm_rights)
|
||||||
|
rb_raise(rb_eNotImpError, "control message for recvmsg is unimplemented");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
GetOpenFile(sock, fptr);
|
GetOpenFile(sock, fptr);
|
||||||
|
@ -221,7 +221,7 @@ class TestSocketNonblock < Test::Unit::TestCase
|
|||||||
s1.sendmsg_nonblock("a" * 100000)
|
s1.sendmsg_nonblock("a" * 100000)
|
||||||
}
|
}
|
||||||
rescue NotImplementedError, Errno::ENOSYS
|
rescue NotImplementedError, Errno::ENOSYS
|
||||||
skip "sendmsg not implemented on this platform."
|
skip "sendmsg not implemented on this platform: #{$!}"
|
||||||
rescue Errno::EMSGSIZE
|
rescue Errno::EMSGSIZE
|
||||||
# UDP has 64K limit (if no Jumbograms). No problem.
|
# UDP has 64K limit (if no Jumbograms). No problem.
|
||||||
rescue Errno::EWOULDBLOCK
|
rescue Errno::EWOULDBLOCK
|
||||||
|
@ -410,7 +410,7 @@ class TestSocket < Test::Unit::TestCase
|
|||||||
}
|
}
|
||||||
rescue NotImplementedError, Errno::ENOSYS
|
rescue NotImplementedError, Errno::ENOSYS
|
||||||
skipped = true
|
skipped = true
|
||||||
skip "need sendmsg and recvmsg"
|
skip "need sendmsg and recvmsg: #{$!}"
|
||||||
ensure
|
ensure
|
||||||
if th
|
if th
|
||||||
if skipped
|
if skipped
|
||||||
|
Loading…
x
Reference in New Issue
Block a user