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
charliesome
73ac899b7f
* ext/socket/socket.c (sock_gethostname): Use NI_MAXHOST to support
...
hostnames longer than 64 characters if the system supports it.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46935 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-25 04:17:50 +00:00
akr
eb9f446ebf
* ext/socket/unixsocket.c (rsock_init_unixsock): Open a socket
...
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
2014-05-28 15:42:09 +00:00
naruse
313fa18033
* ext/socket/ifaddr.c (ifaddr_inspect_flags): support IFF_SIMPLEX.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46173 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-27 12:29:19 +00:00
akr
b54f42c93f
* ext/socket/mkconstants.rb: More constants
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46063 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-23 20:54:40 +00:00
akr
35cd72172c
* ext/socket/mkconstants.rb: More TCP option constants.
...
Describe Linux and glibc versions.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46048 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-22 14:08:17 +00:00
akr
5b629a7b8a
* ext/socket/option.c: Fix complation error on Android.
...
Bionic doesn't define TCP state constants.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46034 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-21 03:22:18 +00:00
akr
7a1972ab9c
* ext/socket/extconf.rb: Don't check fields of struct tcp_info if the
...
structure is not available.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-19 20:00:00 +00:00
akr
b9a178e56c
* ext/socket/option.c (inspect_tcp_info): Permit longer data. (glibc
...
2.7 adds tcpi_rcv_rtt, tcpi_rcv_space and tcpi_total_retrans to
struct tcp_info.)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46022 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-19 14:28:26 +00:00
akr
3aacf88500
* ext/socket/option.c (inspect_tcp_info): New function to inspect struct tcp_info.
...
(sockopt_inspect): Use inspect_tcp_info.
* ext/socket/extconf.rb: Check tcp_info related things.
* ext/socket/rubysocket.h: Include netinet/tcp_fsm.h if available.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46017 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-19 11:52:03 +00:00
akr
543b402f38
* ext/socket/ifaddr.c (IS_IFADDRS): Unused macro removed.
...
* ext/strscan/strscan.c (BUFSIZE): Ditto.
* ext/zlib/zlib.c (OBJ_IS_FREED): Ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-11 16:31:51 +00:00
akr
17a2f1ecc3
* ext/socket/mkconstants.rb: Add IP_TRANSPARENT.
...
IP_TRANSPARENT is provieded since glibc-2.12.
Reported by Eliezer Croitoru. [ruby-core:50372] [Bug #7476 ]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45830 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-05 15:15:20 +00:00
akr
1aa54bebaf
* ext/socket/socket.c (sock_s_getnameinfo): Save errno for EAI_SYSTEM.
...
Reported by Saravana kumar. [ruby-core:61820] [Bug #9697 ]
Fixed by Heesob Park. [ruby-core:61868]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45530 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-07 12:14:29 +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
shugo
139d06c34f
* ext/socket/init.c (wait_connectable): break if the socket is
...
writable to avoid infinite loops on FreeBSD and other platforms
which conforms to SUSv3. This problem cannot be reproduced with
loopback interfaces, so it's hard to write test code.
rsock_connect() and wait_connectable() are overly complicated, so
they should be refactored, but I commit this fix as a workaround
for the release of Ruby 1.9.3 scheduled on Feb 24.
[ruby-core:60940] [Bug #9547 ]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45084 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-21 14:59:44 +00:00
normal
d691a28d91
socket: sendmsg/recvmsg only retries blocking on errors
...
* ext/socket/ancdata.c (bsock_sendmsg_internal): only retry on error
(bsock_recvmsg_internal): ditto
* test/socket/test_unix.rb: test above for infinite loop
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45066 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-21 00:55:13 +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
akr
948ce9decb
* ext/socket/ipsocket.c (ip_s_getaddress): Don't access freed memory.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45045 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-19 08:51:33 +00:00
akr
6f8b0e9bb0
* include/ruby/intern.h,
...
include/ruby/io.h,
include/ruby/ruby.h,
include/ruby/win32.h,
include/ruby/backward/rubysig.h,
bignum.c,
gc.c,
io.c,
process.c,
safe.c,
struct.c,
thread.c,
ext/socket/rubysocket.h,
ext/-test-/old_thread_select: Remove deprecated definitions
[ruby-core:60581] [Feature #9502 ]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44955 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-14 15:16:31 +00:00
normal
cb07275001
socket: split out SOCK_CLOEXEC versions of wrappers for readability
...
* ext/socket/init.c (rsock_socket0): split out SOCK_CLOEXEC version
* ext/socket/socket.c (rsock_socketpair0): ditto
[ruby-core:60377]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44776 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-31 08:06:19 +00:00
nobu
d0a84c2ce9
socket.c: suppress warnings
...
* ext/socket/init.c (rsock_socket0): suppress unused label
warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44775 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-31 07:08:52 +00:00
nobu
0cee7f8e2f
socket.c: suppress warnings
...
* ext/socket/socket.c (rsock_socketpair0): suppress unused label
warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-29 02:04:16 +00:00
akr
965b947fff
* ext/socket: Avoid redundant fcntl/fstat syscalls for cloexec
...
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
2014-01-28 14:37:34 +00:00
akr
3ffc7535ba
Several more OS information for TYPE_IP_MULTICAST_LOOP and
...
TYPE_IP_MULTICAST_TTL.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44678 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-21 13:39:08 +00:00
nobu
6cfa67afe7
ext/socket/option.c: fix typo
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44669 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-20 22:52:17 +00:00
akr
8b5694d5e8
* ext/socket/option.c: Use "int" for IP_MULTICAST_LOOP and
...
IP_MULTICAST_TTL on Windows.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44668 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-20 19:35:11 +00:00
akr
779a630aee
* ext/socket/option.c: Use "int" for IP_MULTICAST_LOOP and
...
IP_MULTICAST_TTL on Mac OS X.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44667 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-20 19:32:03 +00:00
akr
3682c6a327
* ext/socket/option.c: Use "byte" as default argument for
...
IP_MULTICAST_LOOP and IP_MULTICAST_TTL socket option to follow
the original multicast implementation.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44664 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-20 15:43:47 +00:00
akr
3b8bcf42a7
* ext/socket/option.c: Use preprocessor macros to avoid repeated
...
conditionals.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44663 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-20 13:48:42 +00:00
nobu
5ecbe189af
socket/option.c: helper functions
...
* ext/socket/option.c (sockopt_pack_byte, sockopt_pack_int):
extract helper functions to pack integers in a String.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44658 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-19 14:56:05 +00:00
nobu
5c179cd66c
socket/option.c: revert r44647
...
* ext/socket/option.c (NUM2SOCKOPT, sockopt_value): revert because
these names are confusing. [ruby-dev:47903]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44656 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-19 13:04:53 +00:00
hsbt
d1ab866d4a
* ext/nkf/nkf-utf8/nkf.c: fix typo by @windwiny [fix GH-506]
...
* ext/openssl/ossl_ssl.c: ditto
* ext/psych/yaml/scanner.c: ditto
* ext/socket/init.c: ditto
* ext/socket/socket.c: ditto
* ext/tk/tcltklib.c: ditto
* ext/win32ole/win32ole.c: ditto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44649 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-19 05:43:23 +00:00
nobu
6282b3b5c3
socket/option.c: socket option variations
...
* ext/socket/option.c (NUM2SOCKOPT, sockopt_value): extract to wrap
socket option variations.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44647 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-19 01:11:01 +00:00
akr
971ef82267
* ext/socket: Avoid unnecessary ppoll/select on Linux.
...
Patch by Eric Wong. [ruby-core:57950] [Bug #9039 ]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44643 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-18 14:13:22 +00:00
akr
7efaa4f5d0
[DOC]
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44639 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-18 12:44:36 +00:00
akr
57b2190d55
* ext/socket/option.c: IP_MULTICAST_LOOP and IP_MULTICAST_TTL socket
...
option takes a byte on OpenBSD.
Fixed by Jeremy Evans. [ruby-core:59496] [Bug #9350 ]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44638 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-18 12:31:57 +00:00
nobu
5b0fb1aadd
socket.c: format flags
...
* ext/socket/socket.c (rsock_syserr_fail_host_port): use format flags,
'+' to inspect, ' ' to quote unprintables.
* ext/socket/socket.c (rsock_syserr_fail_path): ditto.
* ext/socket/socket.c (rsock_syserr_fail_raddrinfo): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44497 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-04 10:15:31 +00:00
nobu
a3f2fe4e4d
socket.c: use rb_syserr_fail
...
* ext/socket/socket.c (rsock_syserr_fail_host_port): add errno
argument version anduse rb_syserr_fail_str() instead of
rb_sys_fail_str() with restoring errno.
* ext/socket/socket.c (rsock_syserr_fail_path): ditto, and
rb_syserr_fail().
* ext/socket/socket.c (rsock_sys_fail_sockaddr): ditto, use
rsock_syserr_fail_raddrinfo().
* ext/socket/socket.c (rsock_sys_fail_raddrinfo): ditto.
* ext/socket/socket.c (setup_domain_and_type): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44496 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-04 10:13:36 +00:00
charliesome
8f04556111
* ext/socket/socket.c (rsock_sys_fail_host_port): save and restore errno
...
before calling rb_sys_fail_str to prevent [BUG] errno == 0.
Patch by Eric Wong. [ruby-core:59498] [Bug #9352 ]
* ext/socket/socket.c (rsock_sys_fail_path): ditto
* ext/socket/socket.c (rsock_sys_fail_sockaddr): ditto
* ext/socket/socket.c (rsock_sys_fail_raddrinfo): ditto
* ext/socket/socket.c (rsock_sys_fail_raddrinfo_or_sockaddr): ditto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44490 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-03 10:12:38 +00:00
akr
4fd53e476e
* ext/socket/lib/socket.rb: Don't test $! in "ensure" clause because
...
it may be set before the body.
Reported by ko1 and mrkn. [ruby-core:59088] [Bug #9247 ]
* lib/cgi/core.rb: Ditto.
* lib/drb/ssl.rb: Ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44184 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-13 16:11:12 +00:00
mame
a6ae6a8b17
* ext/socket/ifaddr.c (rsock_getifaddrs): fix possible memory leak.
...
When a system had no interface, this function used xmalloc for root
but did not return any reference to it. This patch fixes it by
immediately returning an empty array if no interface is found.
Coverity Scan found this bug.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43121 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-02 12:41:28 +00:00
glass
0e7c28a1c3
* ext/socket/mkconstants.rb: define MSG_FASTOPEN.
...
[ruby-core:57138] [Feature #8897 ]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42948 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-15 15:48:38 +00:00
akr
888e5cbbe7
* process.c: Remove spaces between SI prefix and unit to follow
...
SI brochure.
http://www.bipm.org/en/si/si_brochure/
https://www.nmij.jp/library/units/si/
* time.c: Ditto.
* ext/socket/ancdata.c: Ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42897 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-09 12:33:36 +00:00
akr
dd946739dd
* ext/socket/mkconstants.rb (TCP_FASTOPEN): Defined for TCP fast open.
...
[ruby-core:57048] [Feature #8871 ] patch by Masaki Matsushita.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-07 01:41:47 +00:00
zzak
77ca81e465
* ext/socket/unixserver.c: [DOC] Document #accept
...
* ext/socket/tcpserver.c: ditto
* ext/socket/udpsocket.c: [DOC] Fix indentation of documentation
* ext/socket/socket.c: ditto
Patches by David Rodríguez [ruby-core:56734] [Bug #8802 ]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42629 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-19 16:54:59 +00:00