Граф коммитов

105 Коммитов

Автор SHA1 Сообщение Дата
normal f1de2e0070 ext/socket/raddrinfo.c (addrinfo_mark): avoid needless branch
gc.c (gc_mark_children, case T_DATA) does not use
the dmark function pointer if DATA_PTR is NULL

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57821 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-09 03:49:47 +00:00
rhe 2f551849c4 Use PRIuSIZE format specifier for size_t values
Use PRIuSIZE instead of PRIdSIZE. This fixes the exception message shown
on too large xmalloc2. This commit also fixes other incorrect use of
PRIdSIZE in other functions; though most of them are debug print.

* gc.c (heap_extend_pages, get_envparam_size, ruby_malloc_size_overflow,
  gc_profile_dump_on): Use PRIuSIZE instead of PRIdSIZE as the passed
  value is size_t, not ssize_t.

* iseq.c (get_line_info, rb_iseq_disasm_insn): Ditto.

* sprintf.c (rb_str_format): Ditto.

* thread_win32.c (native_thread_create): Ditto.

* vm.c (get_param): Ditto.

* ext/objspace/objspace_dump.c (dump_append_string_content,
  dump_object): Ditto.

* ext/socket/raddrinfo.c (host_str, port_str): Ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-13 12:33:13 +00:00
usa 3912e4fa3b * ext/socket/raddrinfo.c (host_str, port_str): Use StringValueCStr
instead of (Safe)StringValue, to detect NUL byte in the string.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55222 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-30 15:33:06 +00:00
nobu 79fd02cd51 raddrinfo.c: fix modifier
* ext/socket/raddrinfo.c (host_str, port_str): fix length modifier
  to size_t.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55220 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-30 14:05:36 +00:00
nobu 94a91b1d60 raddrinfo.c: fix for SHARABLE_MIDDLE_SUBSTRING
* ext/socket/raddrinfo.c (host_str, port_str): use RSTRING_LEN
  instead of strlen, since RSTRING_PTR StringValueCStr may not be
  NUL-terminated when SHARABLE_MIDDLE_SUBSTRING=1.  reported by
  @tmtms, http://twitter.com/tmtms/status/736910516229005312

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55213 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-30 07:28:55 +00:00
ko1 dff42b0ea0 * ext/**/*.c (*_memsize): same as r52986 for extensions.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52988 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-09 01:01:17 +00:00
nobu 9949407fd9 suppress a warning
* ext/socket/raddrinfo.c (rsock_fd_family): suppress a
  sign-compare warning.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52196 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-19 16:28:56 +00:00
akr e794fa5cb5 * ext/socket/raddrinfo.c (rsock_fd_family): Check sa_len.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52119 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-13 13:49:58 +00:00
nobu 61053459cf rsock_addrinfo: specify address family
* ext/socket/rsock_addrinfo (rsock_addrinfo): specify address
  family.  [Fix GH-1052]
* ext/socket/udpsocket.c (udp_connect, udp_bind, udp_send):
  address family by the receiver.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52117 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-13 03:14:13 +00:00
nobu 1ab22a5672 raddrinfo.c: suppress a warning
* ext/socket/raddrinfo.c (parse_numeric_port): used only when
  inet_pton() is available.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50904 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-14 23:40:51 +00:00
nobu d4440631b7 raddrinfo.c: suppress a warning
* ext/socket/raddrinfo.c (parse_numeric_port): explict cast to
  suppress a warning for precision losing conversion.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50894 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-14 12:25:42 +00:00
akr 2f8d3280e0 * ext/socket/raddrinfo.c (parse_numeric_port): Detect
port overflow.
  (numeric_getaddrinfo): Use parse_numeric_port.
  numeric_getaddrinfo fails if port is too big now.
  This makes rb_getaddrinfo invokes the real getaddrinfo()
  on such condition.
  This change is related to [ruby-core:69355] [Bug #11179].



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50890 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-14 10:11:01 +00:00
nobu 816504c29c raddrinfo.c: fix memory leak
* ext/socket/raddrinfo.c (addrinfo_mload): fix memory leak of
  addrinfo.  [ruby-dev:48923] [Bug #11051]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50187 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-08 23:24:10 +00:00
naruse 4e8fbe1778 * ext/socket/extconf.rb: Solaris 11 has struct tcp_info.tcpi_ca_state,
but it is a dummy.

* ext/socket/option.c: Solaris 11 doesn't have u_intN_t.

* ext/socket/option.c: Solaris 11 needs inspect_tcpi_msec.

* ext/socket/raddrinfo.c: Solaris 11 has AF_PACKET but doesn't have
  related macros.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50089 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-25 08:10:14 +00:00
nobu 1a18454da9 getaddrinfo.c: GHOST vulnerability check
* ext/socket/getaddrinfo.c (get_addr): reject too long hostname to
  get rid of GHOST vulnerability on very old platforms.
* ext/socket/raddrinfo.c (make_hostent_internal): ditto, paranoic
  check for the canonnical name.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49543 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-08 04:04:32 +00:00
nobu 28b9f11d5a protoize no-arguments functions
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47744 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-30 05:25:32 +00:00
normal 4d10c2b91d ext/socket/*.c: trivial struct packing for 64-bit
* ext/socket/ancdata.c ({send,recv}msg_args_struct): 24 => 16 bytes
* ext/socket/init.c (connect_arg): ditto
* ext/socket/raddrinfo.c (getnameinfo_arg): 56 => 48 bytes

Other big stack reductions are less trivial.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47679 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-22 00:46:25 +00:00
normal 48a2b96d2b introduce ZALLOC{,_N} to replace ALLOC{,_N}+MEMZERO use
Using calloc where possible reduces code and binary sizes.

* include/ruby/ruby.h (ZALLOC, ZALLOC_N): implement
  (Data_Make_Struct, TypedData_Make_Struct):
  ZALLOC replaces ALLOC+memset
* compile.c (iseq_seq_sequence): ZALLOC_N replaces ALLOC_N+MEMZERO
* cont.c (fiber_t_alloc): ZALLOC replaces ALLOC+MEMZERO
* io.c (rb_io_reopen): ditto
* iseq.c (prepare_iseq_build): ditto
* parse.y (new_args_tail_gen, parser_new, ripper_s_allocate): ditto
* re.c (match_alloc): ditto
* variable.c (rb_const_set): ditto
* ext/socket/raddrinfo.c (get_addrinfo): ditto
* ext/strscan/strscan.c (strscan_s_allocate): ditto
* gc.c (rb_objspace_alloc): calloc replaces malloc+MEMZERO

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-25 21:34:35 +00:00
nobu 82eeaadc5d option.c: use rb_w32_inet_pton
* ext/socket/option.c (inet_pton): use rb_w32_inet_pton, instead of
  inet_ntop directly, which is unavailable on older version Windows.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45151 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-23 03:18:56 +00:00
nobu 95be5381ec raddrinfo.c: suppress warnings
* ext/socket/raddrinfo.c (numeric_getaddrinfo): move conditionally
  used variables inside the block, to suppress warnings on platforms
  where inet_pton() is not available.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45146 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-23 01:29:25 +00:00
akr a6da4b274d Fix a filename.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45101 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-22 04:02:43 +00:00
kazu fedc3a4b5f fix second argument of MEMZERO
* ext/socket/raddrinfo.c (rb_getaddrinfo): second argument of
  MEMZERO is type.  Coverity Scan found this bug.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45087 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-21 16:04:50 +00:00
akr 81dfa8b397 * ext/socket/raddrinfo.c (numeric_getaddrinfo): Use xcalloc.
Suggested by Eric Wong.
  https://bugs.ruby-lang.org/issues/9525#note-14



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45063 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-20 13:22:44 +00:00
akr 2e6b97a45d * ext/socket: Bypass getaddrinfo() if node and serv are numeric.
Reporeted by Naotoshi Seo.  [ruby-core:60801] [Bug #9525]

* ext/socket/extconf.rb: Detect struct sockaddr_in6.sin6_len.

* ext/socket/sockport.h (SET_SIN6_LEN): New macro.
  (INIT_SOCKADDR_IN6): Ditto.

* ext/socket/rubysocket.h (struct rb_addrinfo): Add
  allocated_by_malloc field.

* ext/socket/raddrinfo.c (numeric_getaddrinfo): New function.
  (rb_getaddrinfo): Call numeric_getaddrinfo at first.
  (rb_freeaddrinfo): Free struct addrinfo properly when it is
  allocated by numeric_getaddrinfo.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45047 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-19 10:37:43 +00:00
akr dd1c3a7509 * ext/socket: Wrap struct addrinfo by struct rb_addrinfo.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45046 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-19 09:38:24 +00:00
kou e214b1b6d3 * ext/socket/raddrinfo.c (nogvl_getaddrinfo): Fix indent.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41217 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-10 12:51:48 +00:00
kou f6921a3cd1 * ext/socket/raddrinfo.c (nogvl_getaddrinfo): Add missing return
value assignment.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41216 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-10 12:50:45 +00:00
naruse 52a802a428 * ext/socket/raddrinfo.c (nogvl_getaddrinfo): work around for Ubuntu
13.04's getaddrinfo issue with mdns4. [ruby-list:49420]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41215 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-10 11:59:36 +00:00
naruse 5aa618819b * ext/socket/rubysocket.h (rsock_inspect_sockaddr): as r40646
check HAVE_TYPE_STRUCT_SOCKADDR_DL.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40654 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-12 07:09:26 +00:00
nobu 5b20e5e1fe raddrinfo.c: suppress warnings
* ext/socket/raddrinfo.c (rsock_inspect_sockaddr): cast down
  explicitly to suppress warnings.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40648 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-11 18:28:32 +00:00
akr 26cb14f846 * ext/socket/raddrinfo.c (rsock_inspect_sockaddr): Add casts to
suppress warnings.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40644 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-11 13:04:39 +00:00
akr b323d7d54c * ext/socket: New method, Socket.getifaddrs, implemented.
[ruby-core:54777] [Feature #8368]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40639 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-11 08:32:26 +00:00
akr ce6db8f286 * ext/socket/rubysocket.h (SOCKLEN_MAX): Defined.
* ext/socket/raddrinfo.c (ext/socket/raddrinfo.c): Reject too long
  Linux abstract socket name.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40335 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-17 11:01:17 +00:00
nobu c7135ddd2d socket/extconf.rb: RSTRING_SOCKLEN
* ext/socket/extconf.rb (RSTRING_SOCKLEN): macro to cast RSTRING_LEN
  to socklen_t.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-06 07:58:51 +00:00
akr cb302bf351 * ext/socket/rubysocket.h (SockAddrStringValueWithAddrinfo): New macro.
(rsock_sockaddr_string_value_with_addrinfo): New declaration.
  (rsock_addrinfo_inspect_sockaddr): Ditto.
  (rsock_sys_fail_addrinfo): Ditto.
  (rsock_sys_fail_sockaddr_or_addrinfo): Ditto.

* ext/socket/raddrinfo.c (rsock_addrinfo_inspect_sockaddr): Renamed
  from addrinfo_inspect_sockaddr and exported.
  (rsock_sockaddr_string_value_with_addrinfo): New function to obtain
  string and possibly addrinfo object.

* ext/socket/socket.c (rsock_sys_fail_sockaddr): Don't use
  rsock_sys_fail_host_port which is IP dependent.  Invoke
  rsock_sys_fail_addrinfo.
  (rsock_sys_fail_addrinfo): New function using
  rsock_addrinfo_inspect_sockaddr.
  (rsock_sys_fail_addrinfo_or_sockaddr): New function.
  (sock_connect): Use SockAddrStringValueWithAddrinfo and
  rsock_sys_fail_addrinfo_or_sockaddr.
  (sock_connect_nonblock): Ditto.
  (sock_bind): Ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40154 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-06 05:50:42 +00:00
akr 338ec3cee7 * ext/socket/raddrinfo.c (inspect_sockaddr): don't show that Unix
domain socket filename is bigger than sizeof(sun_path).
  This limit is not rigid on some platforms such as Darwin and SunOS.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39538 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-28 13:29:55 +00:00
akr c89844dbc5 * ext/socket: define and use union_sockaddr instead of struct
sockaddr_storage for less casts.

* ext/socket/rubysocket.h (union_sockaddr): defined.

* ext/socket/socket.c (sock_accept): use union_sockaddr.
  (sock_accept_nonblock): ditto.
  (sock_sysaccept): ditto.
  (sock_s_getnameinfo): ditto.

* ext/socket/basicsocket.c (bsock_getsockname): ditto.
  (bsock_getpeername): ditto.
  (bsock_local_address): ditto.
  (bsock_remote_address): ditto.

* ext/socket/ancdata.c (bsock_recvmsg_internal): ditto.

* ext/socket/init.c (recvfrom_arg): ditto.
  (recvfrom_blocking): ditto.
  (rsock_s_recvfrom): ditto.
  (rsock_s_recvfrom_nonblock): ditto.
  (rsock_getfamily): ditto.

* ext/socket/raddrinfo.c (rb_addrinfo_t): ditto.
  (ai_get_afamily): ditto.
  (inspect_sockaddr): ditto.
  (addrinfo_mdump): ditto.
  (addrinfo_mload): ditto.
  (addrinfo_getnameinfo): ditto.
  (addrinfo_ip_port): ditto.
  (extract_in_addr): ditto.
  (addrinfo_ipv6_to_ipv4): ditto.
  (addrinfo_unix_path): ditto.

* ext/socket/tcpserver.c (tcp_accept): ditto.
  (tcp_accept_nonblock): ditto.
  (tcp_sysaccept): ditto.

* ext/socket/ipsocket.c (ip_addr): ditto.
  (ip_peeraddr): ditto.
  (ip_s_getaddress): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39477 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-24 17:51:17 +00:00
akr cb31e78379 * ext/socket/extconf.rb: test struct sockaddr_un and its member,
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
2013-02-15 22:19:05 +00:00
akr 84a525bc4e * ext/socket/sockport.h (INIT_SOCKADDR_IN): don't need family
argument.  it is always AF_INET.

* ext/socket/raddrinfo.c (make_inetaddr): follow INIT_SOCKADDR_IN
  change.
  (addrinfo_ipv6_to_ipv4): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-15 22:08:25 +00:00
akr e41b789c99 * ext/socket/sockport.h (SET_SIN_LEN): defined for strict-aliasing
rule.
  (INIT_SOCKADDR_IN): ditto.

* ext/socket/raddrinfo.c (make_inetaddr): use INIT_SOCKADDR_IN.
  (addrinfo_ipv6_to_ipv4): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39254 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-15 11:30:19 +00:00
nobu 66c1e7960c socket: ai_addrlen is socklen_t
* ext/socket/raddrinfo.c (rsock_make_hostent): ai_addrlen is not
  size_t but socklen_t.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39251 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-15 07:54:38 +00:00
akr 1ff7108306 * ext/socket/sockport.h (SET_SS_LEN): removed.
(SET_SIN_LEN): removed.
  (INIT_SOCKADDR): new macro.

* ext/socket/ancdata.c (extract_ipv6_pktinfo): use INIT_SOCKADDR.

* ext/socket/raddrinfo.c (make_inetaddr): use INIT_SOCKADDR.
  (addrinfo_ipv6_to_ipv4): ditto.

* ext/socket/getaddrinfo.c (GET_AI): use INIT_SOCKADDR.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39248 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-14 23:14:22 +00:00
akr 18a8046d1c * ext/socket: always operate length of socket addess companion with
socket address. 

* ext/socket/rubysocket.h (rsock_make_ipaddr): add an argument for
  socket address length.
  (rsock_ipaddr): ditto.

* ext/socket/ipsocket.c (ip_addr): pass length to rsock_ipaddr.
  (ip_peeraddr): ditto.
  (ip_s_getaddress): pass length to rsock_make_ipaddr.

* ext/socket/socket.c (make_addrinfo): pass length to rsock_ipaddr.
  (sock_s_getnameinfo): pass actual address length to rb_getnameinfo.
  (sock_s_unpack_sockaddr_in): pass length to rsock_make_ipaddr.
  
* ext/socket/init.c (rsock_s_recvfrom): pass length to rsock_ipaddr.
  (rsock_s_recvfrom_nonblock): ditto.

* ext/socket/tcpsocket.c (tcp_sockaddr): pass length to
  rsock_make_ipaddr.

* ext/socket/raddrinfo.c (make_ipaddr0): add an argument for socket
  address length.  pass the length to rb_getnameinfo.
  (rsock_ipaddr): ditto.
  (rsock_make_ipaddr): add an argument for socket address length. 
  pass the length to make_ipaddr0.
  (make_inetaddr): pass length to make_ipaddr0.
  a local variable renamed.
  (host_str): a local variable renamed.
  (port_str): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39239 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-14 11:28:49 +00:00
shugo 4ccfb2743f * ext/socket/raddrinfo.c (rsock_unix_sockaddr_len): return
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
2013-01-31 04:59:31 +00:00
shugo 07e9f122a9 * ext/socket/raddrinfo (rsock_unix_sockaddr_len): renamed from
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
2013-01-25 23:33:50 +00:00
shugo ad55d141eb * ext/socket/raddrinfo.c (rsock_unixpath_len, init_unix_addrinfo),
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
2013-01-25 08:15:26 +00:00
drbrain 3efea48a70 * ext/socket/raddrinfo.c (addrinfo_ipv6_unique_local_p): Added
Addrinfo#ipv6_unique_local? to detect RFC 4193 unique local
  addresses.  Part of #6692
* ext/socket/rubysocket.h:  Add IN6_IS_ADDR_UNIQUE_LOCAL macro if
  missing.
* test/socket/test_addrinfo.rb:  Test for ipv6_unqiue_local?


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36474 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-20 00:32:35 +00:00
nobu 7bca2f031a get rid of warnings
* io.c (sysopen_func, rb_sysopen_internal): cast through VALUE to get
  rid of warnings.  fixup of r36355.
* process.c (rb_waitpid_blocking, rb_waitpid): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36361 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-11 03:17:35 +00:00
nobu c51a826764 rb_thread_call_without_gvl
* include/ruby/thread.h: new header file for thread stuff.
* thread.c (rb_thread_call_without_gvl): export.  [Feature#4328]
  returns void* instead of VALUE.  [Feature #5543]
* thread.c (rb_thread_blocking_region): deprecate.  [ruby-core:46295]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36355 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-10 13:57:11 +00:00
nobu b0dd250dc9 use RB_TYPE_P() instead of comparison of TYPE()
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35763 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-23 07:13:21 +00:00