1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

update doc.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30330 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2010-12-23 23:52:42 +00:00
parent a041f129af
commit a048436461

View file

@ -237,15 +237,16 @@ ancillary_s_unix_rights(int argc, VALUE *argv, VALUE klass)
* # recvmsg needs :scm_rights=>true for unix_rights
* s1, s2 = UNIXSocket.pair
* p s1 #=> #<UNIXSocket:fd 3>
* s1.sendmsg "stdin and a socket", 0, nil, [:SOCKET, :RIGHTS, [0,s1.fileno].pack("ii")]
* s1.sendmsg "stdin and a socket", 0, nil, Socket::AncillaryData.unix_rights(STDIN, s1)
* _, _, _, ctl = s2.recvmsg(:scm_rights=>true)
* p ctl #=> #<Socket::AncillaryData: UNIX SOCKET RIGHTS 6 7>
* p ctl.unix_rights #=> [#<IO:fd 6>, #<Socket:fd 7>]
* p File.identical?(STDIN, ctl.unix_rights[0]) #=> true
* p File.identical?(s1, ctl.unix_rights[1]) #=> true
*
* # If :scm_rights=>true is not given, unix_rights returns nil
* s1, s2 = UNIXSocket.pair
* s1.sendmsg "stdin and a socket", 0, nil, [:SOCKET, :RIGHTS, [0,s1.fileno].pack("ii")]
* s1.sendmsg "stdin and a socket", 0, nil, Socket::AncillaryData.unix_rights(STDIN, s1)
* _, _, _, ctl = s2.recvmsg
* p ctl #=> #<Socket::AncillaryData: UNIX SOCKET RIGHTS 6 7>
* p ctl.unix_rights #=> nil