aboutsummaryrefslogtreecommitdiffstats
path: root/test/socket/test_unix.rb
Commit message (Collapse)AuthorAgeFilesLines
* Fix #6154 by introducing new EAGAIN/EWOULDBLOCK/EINPROGRESSheadius2013-04-081-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | subclasses that include WaitReadable or WaitWritable rather than extending them into the exception object each time. * error.c: Capture EGAIN, EWOULDBLOCK, EINPROGRESS exceptions and export them for use in WaitReadable/Writable exceptions. * io.c: Create versions of EAGAIN, EWOULDBLOCK, EINPROGRESS that include WaitReadable and WaitWritable. Add rb_readwrite_sys_fail for nonblocking failures using those exceptions. Use that function in io_getpartial and io_write_nonblock instead of rb_mod_sys_fail * ext/openssl/ossl_ssl.c: Add new SSLError subclasses that include WaitReadable and WaitWritable. Use those classes for write_would_block and read_would_block instead of rb_mod_sys_fail. * ext/socket/ancdata.c: Use rb_readwrite_sys_fail instead of rb_mod_sys_fail in bsock_sendmsg_internal and bsock_recvmsg_internal. * ext/socket/init.c: Use rb_readwrite_sys_fail instead of rb_mod_sys_fail in rsock_s_recvfrom_nonblock and rsock_s_connect_nonblock. * ext/socket/socket.c: Use rb_readwrite_sys_fail instead of rb_mod_sys_fail in sock_connect_nonblock. * include/ruby/ruby.h: Export rb_readwrite_sys_fail for use instead of rb_mod_sys_fail. Introduce new constants RB_IO_WAIT_READABLE and RB_IO_WAIT_WRITABLE for first arg to rb_readwrite_sys_fail. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/socket/raddrinfo.c (rsock_unix_sockaddr_len): returnshugo2013-01-311-2/+29
| | | | | | | | | | | | sizeof(sa_familiy_t) if path is empty. see "Autobind Feature" in unix(7) for details. * ext/socket/lib/socket.rb (unix_socket_abstract_name?): treat an empty path as an abstract name. * test/socket/test_unix.rb: related test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38994 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/socket/unixsocket.c (rsock_init_unixsock): use rb_inspect()shugo2013-01-301-0/+8
| | | | | | | | because rb_sys_fail_str() fails if its argument contains NUL. * test/socket/test_unix.rb: related test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/socket/socket.c (sock_s_pack_sockaddr_un): calculate theshugo2013-01-291-4/+6
| | | | | | | | correct address length of an abstract socket. * test/socket/test_unix.rb: related test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38963 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/socket/raddrinfo.c (rsock_unixpath_len, init_unix_addrinfo),shugo2013-01-251-0/+30
| | | | | | | | | | | | | | | | | ext/socket/unixsocket.c (unixsock_connect_internal, rsock_init_unixsock): calculate the correct address length of an abstract socket. Without this fix, sizeof(struct sockaddr_un) is specified as the length of an abstract socket for bind(2) or connect(2), so the address of the socket is filled with extra NUL characters. See unix(7) for details. * ext/socket/lib/socket.rb (unix_server_socket): don't access the file system if the platform is Linux and path starts with NUL, which means that the socket is an abstract socket. * test/socket/test_unix.rb: related test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38939 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/socket/raddrinfo.c (init_unix_addrinfo): support the longestakr2012-04-261-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | path in sockaddr_un. (inspect_sockaddr): ditto. (addrinfo_mdump): ditto. (addrinfo_mload): ditto. (rsock_unixpath_str): new function. (rsock_unixpath): removed. (rsock_unixaddr): use rsock_unixpath_str. * ext/socket/socket.c (sock_s_pack_sockaddr_un): support the longest path in sockaddr_un. (sock_s_unpack_sockaddr_un): ditto. (sock_s_gethostbyaddr): unused variable removed. * ext/socket/unixsocket.c (rsock_init_unixsock): support the longest path in sockaddr_un. * ext/socket/rubysocket.h (rsock_unixpath_str): declared. (rsock_unixpath): removed. * test/socket/test_unix.rb: comment out test_nul because abstract unix sockets may contain NULs. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35474 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/socket/test_unix.rb (bound_unix_socket): make temporaryakr2012-04-231-1/+1
| | | | | | | | | filename shorter for less possibility of Unix socket path over 107 bytes when TMPDIR has long path. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35436 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* add test for close-on-exec.akr2011-11-031-0/+23
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33617 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/socket/test_unix.rb: don't use Thread.abort_on_exception.akr2011-06-131-4/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32063 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/socket/unixsocket.c (unix_send_io): race condition fixed.akr2011-06-131-0/+37
| | | | | | | | | | (unix_recv_io): ditto. fixed by Eric Wong. [ruby-core:35574] * test/socket/test_unix.rb: test added for above problem. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32062 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/socket/test_unix.rb (TestSocket_UNIXSocket#test_recvmsg):nobu2010-04-281-0/+1
| | | | | | skip if AncillaryData is not available. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27531 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/matrix.rb: suppress warnings.akr2010-01-251-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26417 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * {ext,lib,test}/**/*.rb: removed trailing spaces.nobu2009-03-061-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/socket/ancdata.c (rsock_discard_cmsg_resource): definedakr2009-03-021-0/+1
| | | | | | | unconditionally. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22710 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/socket/ancdata.c (bsock_recvmsg_internal): close FDs passed byakr2009-02-271-3/+3
| | | | | | | | | SCM_RIGHTS unless :scm_rights=>true is given. (discard_cmsg): extracted from rsock_discard_cmsg_resource. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22667 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/socket/ancdata.c (ancillary_s_unix_rights): new method.akr2009-02-251-1/+58
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22631 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/socket/ancdata.c (ancillary_unix_rights): method renamed.akr2009-02-191-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22452 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/socket/ancdata.c (ancillary_rights): new method.akr2009-02-181-8/+9
| | | | | | | | | | (make_io_for_rights): new function to allocate IOs for FDs in SCM_RIGHTS message. (bsock_recvmsg_internal): use make_io_for_rights. So the FDs can be closed by GC. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22426 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/socket/lib/socket.rb (Socket.unix_server_socket): close theakr2009-02-111-0/+3
| | | | | | | | socket when the block exits. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/socket/lib/socket.rb (Socket.unix_server_socket): call the blockakr2009-02-111-0/+11
| | | | | | | | if given. remove the socket file when the block exits. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22233 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* rename tests classes.akr2009-02-111-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/socket/extconf.rb: check getpeereid.akr2009-02-111-0/+14
| | | | | | | | * ext/socket/basicsocket.c (bsock_getpeereid): new method. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22219 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/socket/ancdata.c (ancillary_initialize): add family argument.akr2009-02-091-1/+1
| | | | | | | | | | | | | (ancdata_new): ditto. (ancillary_s_int): ditto. (ancillary_family): new function. (ancillary_family_m): new method. (ancillary_s_ip_pktinfo): follow ancdata_new change. (ancillary_s_ipv6_pktinfo): ditto. (bsock_recvmsg_internal): examine the socket address family. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22175 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/socket/option.c (inspect_peercred): struct ucred containsakr2009-02-081-2/+2
| | | | | | | effective uid/gid. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22144 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* LOCAL_PEERCRED is also available on MacOS X.akr2009-02-081-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22140 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/socket/option.c (inspect_local_peercred): cr_uid is a effectiveakr2009-02-081-1/+1
| | | | | | | uid, not a real uid. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22138 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/socket/extconf.rb: check sys/param.h and sys/ucred.h.akr2009-02-081-0/+14
| | | | | | | | | | | | | * ext/socket/rubysocket.h: include sys/param.h and sys/ucred.h. * ext/socket/option.c (inspect_local_peercred): new function to show LOCAL_PEERCRED socket option on FreeBSD. (sockopt_inspect): show as LOCAL_* socket option if AF_UNIX and level is 0. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22137 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* remove debug print.akr2009-02-081-2/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22133 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/socket/option.c (inspect_peercred): new function to showakr2009-02-081-4/+20
| | | | | | | SO_PEERCRED socket option. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22131 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/socket/extconf.rb: check struct cmsgcred.akr2009-02-081-10/+35
| | | | | | | | | | * ext/socket/ancdata.c (anc_inspect_passcred_credentials): add "(ucred)". (anc_inspect_socket_creds): show struct cmsgcred too, for FreeBSD. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22129 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test renamed.akr2009-02-081-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22127 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/socket/extconf.rb: check struct sockcred.akr2009-02-081-4/+21
| | | | | | | | * ext/socket/ancdata.c (anc_inspect_socket_creds): new function to show SCM_CREDS on NetBSD. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22126 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* add a test.akr2009-02-081-0/+18
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22125 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/socket: AddrInfo is renamed to Addrinfo. [ruby-dev:37876]akr2009-02-051-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22077 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/socket/rubysocket.h (cmsg_type_arg): declared.akr2009-02-021-0/+112
| | | | | | | | | | | | | | | | | | | | | | (Init_ancdata): ditto. * ext/socket/init.c (Init_socket_init): call Init_ancdata. * ext/socket/constants.c (cmsg_type_arg): defined. * ext/socket/depend: add dependency for ancdata.o. * ext/socket/mkconstants.rb: generate scm_optname_to_int. more constants. * ext/socket/extconf.rb: add ancdata.o. * ext/socket/ancdata.c: new file. new method BasicSocket#{sendmsg,sendmsg_nonblock,recvmsg,recvmsg_nonblock} git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* don't get a name for anonymous Unix socket.akr2009-01-051-10/+14
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21346 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/socket/mkconstants.rb: generate family_to_int().akr2009-01-011-0/+14
| | | | | | | | * ext/socket/socket.c (setup_domain_and_type): use family_to_int. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21240 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/socket/socket.c (sock_s_socketpair): yield if a block is given.akr2008-12-311-0/+20
| | | | | | | | | | (io_call_close): defined. (io_close): defined. (pair_yield): defined. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21216 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* add an assertion.akr2008-06-301-0/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17746 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* add a test for [ruby-dev:34619].akr2008-06-301-0/+8
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17742 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* UNIXServer.new("a\0b") test removed becauseakr2007-09-281-1/+0
| | | | | | | UNIXServer.new accepts NUL as abstruct unix sockets. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/socket/test_unix.rb: disabled on cygwin.akr2006-07-231-1/+1
| | | | | | | reported by Kouhei Yanagita. [ruby-dev:29080] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10585 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/socket/test_unix.rb: test_seqpacket_pair removed.akr2006-06-281-18/+0
| | | | | | | [ruby-dev:28846] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10421 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/socket/socket.c (bsock_recv_nonblock): new methodakr2006-06-261-6/+6
| | | | | | | | | | | BasicSocket#recv_nonblock. (udp_recvfrom_nonblock): renamed from ip_recvfrom_nonblock. IPSocket#recvfrom_nonblock is moved to UDPSocket#recvfrom_nonblock. (unix_recvfrom_nonblock): removed. UNIXSocket#recvfrom_nonblock is removed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10403 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* getsockname returns "" on MacOS Xakr2006-06-071-4/+6
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10230 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix tests.akr2006-06-041-2/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10216 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/socket/socket.c: fix sockaddr_un handling.akr2006-06-041-1/+127
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10212 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/socket/socket.c (unix_send_io, unix_recv_io): support x86-64 andakr2005-07-021-12/+14
| | | | | | | IA64. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8702 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* add a test for file descriptor passing.akr2005-06-041-0/+28
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e