Age | Commit message (Collapse) | Author |
|
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
This reduces GC overhead and makes the API more consistent
with IO#read and IO#read_nonblock.
* ext/socket/basicsocket.c (bsock_recv): document outbuf
* ext/socket/unixsocket.c (unix_recvfrom): ditto
* ext/socket/init.c (rsock_strbuf, recvfrom_locktmp): new functions
(rsock_s_recvfrom): support destination buffer as 3rd arg
(rsock_s_recvfrom_nonblock): ditto
* string.c (rb_str_locktmp_ensure): export for internal ext
* test/socket/test_nonblock.rb: test recv_nonblock
* test/socket/test_unix.rb: test recv
[ruby-core:69543] [Feature #11242]
Benchmark results:
user system total real
alloc 0.130000 0.280000 0.410000 ( 0.420656)
extbuf 0.100000 0.220000 0.320000 ( 0.318708)
-------------------8<--------------------
require 'socket'
require 'benchmark'
nr = 100000
msg = ' ' * 16384
size = msg.bytesize
buf = ' ' * size
UNIXSocket.pair(:DGRAM) do |a, b|
Benchmark.bmbm do |x|
x.report('alloc') do
nr.times do
b.send(msg, 0)
a.recv(size, 0)
end
end
x.report('extbuf') do
nr.times do
b.send(msg, 0)
a.recv(size, 0, buf)
end
end
end
end
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
properly, with a patch by @eval [Fixes GH-733]
https://github.com/ruby/ruby/pull/733
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47871 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
after path length check.
This fixes a fd leak by TestSocket_UNIXSocket#test_too_long_path.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46218 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
sockets.
Patch by Eric Wong. [ruby-core:59429] [Feature #9330]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44728 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
ext/openssl/ossl.h, ext/openssl/openssl_missing.c: Use
HAVE_AGGREGATE_MEMBER instead of HAVE_ST_MEMBER.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40625 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
ext/socket/ancdata.c: Use HAVE_STRUCT_MSGHDR_MSG_CONTROL instead
of HAVE_ST_MSG_CONTROL.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40623 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40619 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
(unix_recv_io): Ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40324 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
[ruby-core:45617] [Feature #6583] proposed Eric Hodel.
* ext/socket/rubysocket.h (rsock_sys_fail_host_port): Declared.
(rsock_sys_fail_path): Ditto.
(rsock_sys_fail_sockaddr): Ditto.
* ext/socket/udpsocket.c (udp_connect): Use rsock_sys_fail_host_port.
(udp_bind): Ditto.
(udp_send): Ditto.
* ext/socket/init.c (rsock_init_sock): Specify a string for rb_sys_fail
argument.
(make_fd_nonblock): Ditto.
(rsock_s_accept): Ditto.
* ext/socket/ipsocket.c (init_inetsock_internal): Use
rsock_sys_fail_host_port.
* ext/socket/socket.c (rsock_sys_fail_host_port): Defined.
(rsock_sys_fail_path): Ditto.
(rsock_sys_fail_sockaddr): Ditto.
(setup_domain_and_type): Use rsock_sys_fail_sockaddr.
(sock_connect_nonblock): Ditto.
(sock_bind): Ditto.
(sock_gethostname): Specify a string for rb_sys_fail argument.
(socket_s_ip_address_list): Ditto.
* ext/socket/basicsocket.c (bsock_shutdown): Specify a string for
rb_sys_fail argument.
(bsock_setsockopt): Use rsock_sys_fail_path.
(bsock_getsockopt): Ditto.
(bsock_getpeereid): Refine the argument for rb_sys_fail.
* ext/socket/unixsocket.c (rsock_init_unixsock): Use
rsock_sys_fail_path.
(unix_path): Ditto.
(unix_send_io): Ditto.
(unix_recv_io): Ditto.
(unix_addr): Ditto.
(unix_peeraddr): Ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40149 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
sun_len.
* ext/socket/sockport.h (INIT_SOCKADDR_UN): new macro defined.
* ext/socket/socket.c (sock_s_pack_sockaddr_un): use INIT_SOCKADDR_UN.
* ext/socket/unixsocket.c (rsock_init_unixsock): ditto.
* ext/socket/raddrinfo.c (init_unix_addrinfo): ditto.
(addrinfo_mload): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39260 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
part of socket address.
(bsock_getpeername): ditto.
(bsock_local_address): ditto.
(bsock_remote_address): ditto.
* ext/socket/unixsocket.c (unix_path): ditto.
(unix_addr): ditto.
(unix_peeraddr): ditto.
* ext/socket/init.c (cloexec_accept): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38993 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
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
|
|
rsock_unixpath_len, because it returns not the length of the path,
but the length of a socket address for the path.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
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
|
|
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37761 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
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
|
|
when it is too long for Unix socket.
* ext/socket/unixsocket.c (rsock_init_unixsock): ditto.
* ext/socket/socket.c (sock_s_pack_sockaddr_un): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35465 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
rb_sys_fail.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
* ext/socket/ancdata.c (rsock_recvmsg): extracted from
nogvl_recvmsg_func.
(nogvl_recvmsg_func): use rsock_recvmsg.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33646 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
available.
* ext/socket/unixsocket.c (recvmsg_blocking): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33594 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
rb_fd_set_cloexec.
* io.c: follow the above renaming.
* ext/pty/pty.c: ditto.
* ext/socket/init.c: ditto.
* ext/socket/socket.c: ditto.
* ext/socket/ancdata.c: ditto.
* ext/socket/unixsocket.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33585 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
* io.c (rb_fd_set_cloexec): new function.
(ruby_dup): call rb_fd_set_cloexec to set close-on-exec flag.
(rb_sysopen_internal): ditto.
(rb_pipe): ditto.
(io_reopen): ditto.
(io_cntl): ditto.
* process.c (rb_f_exec): change the default :close_others option to
true.
(rb_f_system): ditto.
(move_fds_to_avoid_crash): call rb_fd_set_cloexec to set
close-on-exec flag.
(ruby_setsid): ditto.
(rb_daemon): ditto.
* thread_pthread.c (rb_thread_create_timer_thread): call
rb_fd_set_cloexec to set close-on-exec flag.
* ruby.c (load_file_internal): ditto.
* file.c (rb_file_s_truncate): ditto.
(file_load_ok): ditto.
* random.c (fill_random_seed): ditto.
* ext/pty/pty.c (chfunc): ditto.
(get_device_once): ditto.
* ext/openssl/ossl_bio.c (ossl_obj2bio): ditto.
* ext/socket/init.c (rsock_socket): ditto.
(rsock_s_accept_nonblock): ditto.
(rsock_s_accept): ditto.
* ext/socket/socket.c (rsock_sock_s_socketpair): ditto.
* ext/socket/ancdata.c (discard_cmsg): ditto.
(make_io_for_unix_rights): ditto.
* ext/socket/unixsocket.c (unix_recv_io): ditto.
* ext/io/console/console.c (console_dev): ditto.
[ruby-core:38140] [Feature #5041]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33507 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
Socket, TCPServer, SOCKSSocket. Patch by Sylvain Daubert.
[Ruby 1.9 - Feature #5182]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
listen backlog.
* ext/socket/unixsocket.c (rsock_init_unixsock): ditto.
* ext/socket/lib/socket.rb (Addrinfo#listen): ditto.
(Socket.tcp_server_sockets_port0): ditto.
* ext/socket/mkconstants.rb: define SOMAXCONN as 5 if not available.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32939 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
* ext/socket/rubysocket.h (rsock_discard_cmsg_resource): add
msg_peek_p argument for the declaration.
* ext/socket/ancdata.c (discard_cmsg): add msg_peek_p argument.
assume FreeBSD, NetBSD and MacOS X doesn't generate passed fd
when MSG_PEEK.
(rsock_discard_cmsg_resource): add msg_peek_p argument.
(bsock_recvmsg_internal): call rsock_discard_cmsg_resource with
msg_peek_p argument.
* ext/socket/unixsocket.c (unix_recv_io): call
rsock_discard_cmsg_resource with msg_peek_p argument.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32638 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
internal.h.
* file.c: ditto.
* io.c: call rb_update_max_fd for each new fds.
* process.c: ditto.
* random.c: ditto.
* ruby.c: ditto.
* ext/io/console/console.c: ditto.
* ext/openssl/ossl_bio.c: ditto.
* ext/pty/pty.c: ditto.
* ext/socket/init.c: ditto.
* ext/socket/socket.c: ditto.
* ext/socket/ancdata.c: ditto.
* ext/socket/unixsocket.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32587 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
(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
|
|
blocking region with GIL released, for fd.
* thread.c (rb_thread_fd_close): implement. [ruby-core:35203]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30852 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29745 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27944 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27529 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
define only when used.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27527 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27437 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
ext/socket/unixsocket.c (rsock_init_unixsock): check the result of
listen(2). based on a patch from Mike Pomraning. [ruby-core:23698]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27272 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27018 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27012 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26998 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
implemented.
* ext/openssl/ossl_engine.c: ditto.
* ext/openssl/ossl_config.c: ditto.
* ext/openssl/ossl_cipher.c: ditto.
* ext/openssl/ossl_pkcs5.c: ditto.
* ext/openssl/ossl_x509ext.c: ditto.
* ext/socket/socket.c: ditto.
* ext/socket/basicsocket.c: ditto.
* ext/socket/ancdata.c: ditto.
* ext/socket/unixsocket.c: ditto.
* ext/iconv/iconv.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23204 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
* ext/socket/socket.c: ditto.
* ext/socket/unixsocket.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22698 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
(rsock_addrinfo): renamed from sock_addrinfo.
(rsock_getaddrinfo): renamed from sock_getaddrinfo.
(rsock_socket): renamed from ruby_socket.
(rsock_sock_s_socketpair): renamed from sock_s_socketpair.
(rsock_connect): renamed from ruby_connect.
* ext/socket/socket.c (sock_listen): make it static.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22686 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22684 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
gcc version 4.4.0 20090219 (Red Hat 4.4.0-0.21) on Fedora 11 Alpha.
* ext/socket/socket.c: ditto.
* ext/socket/unixsocket.c: ditto.
* ext/socket/sockport.h (SS_LEN): defined.
(SET_SS_LEN): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22668 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
sent on LP64 platform.
* ext/socket/rubysocket.h (rsock_discard_cmsg_resource): declared.
* ext/socket/ancdata.c (rsock_discard_cmsg_resource): renamed from
discard_cmsg_resource. export it.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22630 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22077 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
* ext/socket/unixsocket.c (unix_s_socketpair): follow the above
change.
* ext/socket/rubysocket.h (sock_s_socketpair): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22047 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21646 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
* ext/socket/rubysocket.h: common header.
* ext/socket/basicsocket.c: new file for BasicSocket.
* ext/socket/ipsocket.c: new file for IPSocket.
* ext/socket/tcpsocket.c: new file for TCPSocket.
* ext/socket/tcpserver.c: new file for TCPServer.
* ext/socket/sockssocket.c: new file for SOCKSSocket.
* ext/socket/udpsocket.c: new file for UDPSocket.
* ext/socket/unixsocket.c: new file for UNIXSocket.
* ext/socket/unixserver.c: new file for UNIXServer.
* ext/socket/socket.c: now for Socket.
* ext/socket/raddrinfo.c: new file for AddrInfo and name resolution.
* ext/socket/constants.c: new file for constants.
* ext/socket/init.c: new file for utilities.
* ext/socket/mkconstants.rb: export *_to_int.
* ext/socket/extconf.rb: add new object files.
* ext/socket/depend: add dependencies for new files.
* ext/.document: add new files.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21619 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|