From bed429445169865659af13d0f491f4b7060cf7e6 Mon Sep 17 00:00:00 2001 From: akr Date: Thu, 19 Feb 2009 12:13:38 +0000 Subject: * ext/socket/ancdata.c (ancillary_unix_rights): method renamed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22452 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 4 ++++ ext/socket/ancdata.c | 26 +++++++++++++------------- test/socket/test_unix.rb | 4 ++-- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1486ba1c65..a95487b29e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Thu Feb 19 21:13:03 2009 Tanaka Akira + + * ext/socket/ancdata.c (ancillary_unix_rights): method renamed. + Thu Feb 19 15:47:11 2009 Nobuyoshi Nakada * template/fake.rb.in: extracted from Makefile.in. diff --git a/ext/socket/ancdata.c b/ext/socket/ancdata.c index 442300abb4..f7c1935618 100644 --- a/ext/socket/ancdata.c +++ b/ext/socket/ancdata.c @@ -176,25 +176,25 @@ ancillary_data(VALUE self) /* * call-seq: - * ancillarydata.rights => array-of-IOs + * ancillarydata.unix_rights => array-of-IOs * - * returns the array of IOs which is sent by SCM_RIGHTS control message. + * returns the array of IOs which is sent by SCM_RIGHTS control message in UNIX domain socket. * * The class of an IO in the array is IO or Socket. * * s1, s2 = UNIXSocket.pair - * p s1 #=> # + * p s1 #=> # * s1.sendmsg "standard IOs", 0, nil, [:SOCKET, :RIGHTS, [0,s1.fileno].pack("ii")] * _, _, _, ctl = s2.recvmsg - * p ctl.rights #=> [#, #] - * p File.identical?(STDIN, ctl.rights[0]) #=> true - * p File.identical?(s1, ctl.rights[1]) #=> true + * p ctl.unix_rights #=> [#, #] + * p File.identical?(STDIN, ctl.unix_rights[0]) #=> true + * p File.identical?(s1, ctl.unix_rights[1]) #=> true * */ static VALUE -ancillary_rights(VALUE self) +ancillary_unix_rights(VALUE self) { - VALUE v = rb_attr_get(self, rb_intern("rights")); + VALUE v = rb_attr_get(self, rb_intern("unix_rights")); return v; } @@ -1146,7 +1146,7 @@ discard_cmsg_resource(struct msghdr *mh) #if defined(HAVE_ST_MSG_CONTROL) static void -make_io_for_rights(VALUE ctl, struct cmsghdr *cmh) +make_io_for_unix_rights(VALUE ctl, struct cmsghdr *cmh) { if (cmh->cmsg_level == SOL_SOCKET && cmh->cmsg_type == SCM_RIGHTS) { int *fdp = (int *)CMSG_DATA(cmh); @@ -1161,10 +1161,10 @@ make_io_for_rights(VALUE ctl, struct cmsghdr *cmh) io = init_sock(rb_obj_alloc(rb_cSocket), fd); else io = rb_io_fdopen(fd, O_RDWR, NULL); - ary = rb_attr_get(ctl, rb_intern("rights")); + ary = rb_attr_get(ctl, rb_intern("unix_rights")); if (NIL_P(ary)) { ary = rb_ary_new(); - rb_ivar_set(ctl, rb_intern("rights"), ary); + rb_ivar_set(ctl, rb_intern("unix_rights"), ary); } rb_ary_push(ary, io); fdp++; @@ -1351,7 +1351,7 @@ bsock_recvmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock) } clen = (char*)cmh + cmh->cmsg_len - (char*)CMSG_DATA(cmh); ctl = ancdata_new(family, cmh->cmsg_level, cmh->cmsg_type, rb_tainted_str_new((char*)CMSG_DATA(cmh), clen)); - make_io_for_rights(ctl, cmh); + make_io_for_unix_rights(ctl, cmh); rb_ary_push(ret, ctl); } } @@ -1451,7 +1451,7 @@ Init_ancdata(void) rb_define_method(rb_cAncillaryData, "level", ancillary_level_m, 0); rb_define_method(rb_cAncillaryData, "type", ancillary_type_m, 0); rb_define_method(rb_cAncillaryData, "data", ancillary_data, 0); - rb_define_method(rb_cAncillaryData, "rights", ancillary_rights, 0); + rb_define_method(rb_cAncillaryData, "unix_rights", ancillary_unix_rights, 0); rb_define_method(rb_cAncillaryData, "cmsg_is?", ancillary_cmsg_is_p, 2); rb_define_singleton_method(rb_cAncillaryData, "int", ancillary_s_int, 4); rb_define_method(rb_cAncillaryData, "int", ancillary_int, 0); diff --git a/test/socket/test_unix.rb b/test/socket/test_unix.rb index e4c86f2912..b5f9f969bf 100644 --- a/test/socket/test_unix.rb +++ b/test/socket/test_unix.rb @@ -53,7 +53,7 @@ class TestSocket_UNIXSocket < Test::Unit::TestCase recv_io_ary = [] ctls.each {|ctl| next if ctl.level != Socket::SOL_SOCKET || ctl.type != Socket::SCM_RIGHTS - recv_io_ary.concat ctl.rights + recv_io_ary.concat ctl.unix_rights } assert_equal(send_io_ary.length, recv_io_ary.length) send_io_ary.length.times {|i| @@ -131,7 +131,7 @@ class TestSocket_UNIXSocket < Test::Unit::TestCase assert_equal(Socket::SOL_SOCKET, ctl.level) assert_equal(Socket::SCM_RIGHTS, ctl.type) assert_instance_of(String, ctl.data) - ios = ctl.rights + ios = ctl.unix_rights assert_equal(1, ios.length) r2 = ios[0] begin -- cgit v1.2.3