path: root/ext/socket/ancdata.c
AgeCommit message (Collapse)Author
2015-11-19* ext/socket/ancdata.c: Check buffer full and ignore MSG_TRUNC flag.akr
buffer fullness is more robust to detect the message is too big for the buffer. AIX 7.1 recvmsg doesn't set MSG_TRUNC for rflags when MSG_PEEK is given. git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-18* ext/socket/ancdata.c (bsock_recvmsg_internal): stretch the buffer sizeusa
only when vmaxdatlen is nil. git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-18* ext/socket/ancdata.c (bsock_recvmsg_internal): stretch the buffer sizeusa
when EMSGSIZE occurs on non HAVE_STRUCT_MSGHDR_MSG_CONTROL platforms (such as, Windows). fixes a test error revealed by r52625. git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-18socket: fix typo for default sizenormal
* ext/socket/ancdata.c (bsock_recvmsg_internal): use 4096 as default size to match pre-r52610, which also maps to a common page size. Oops; absolutely no idea why I made this typo... git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-17socket: fix recvmsg without argumentnormal
* ext/socket/ancdata.c (bsock_recvmsg_internal): grow buffer on unspecified maxdatlen [ruby-core:71517] [Bug #11701] * ext/socket/lib/socket.rb (Socket#recvmsg): nil default for dlen (Socket#recvmsg_nonblock): ditto * test/socket/test_socket.rb (test_recvmsg_udp_no_arg): new test git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-17* ext/socket/lib/socket.rb (Socket#recvmsg{,_nonblock}): default valuesusa
of clen must be nil. * ext/socket/ancdata.c (bsock_sendmsg_internal): handle nil of clen. fixes test errors introduced at r52602. git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-17socket: avoid arg parsing in bsock_sendmsg_internalnormal
* ext/socket/ancdata.c (bsock_sendmsg_internal): avoid arg parsing [ruby-core:71439] [Feature #11339] (rsock_bsock_sendmsg): make private, adjust for above (rsock_bsock_sendmsg_nonblock): ditto * ext/socket/rubysocket.h: adjust prototypes (rsock_opt_false_p): remove * ext/socket/basicsocket.c (rsock_init_basicsocket): define private methods * ext/socket/lib/socket.rb (BasicSocket#sendmsg): new wrapper (BasicSocket#sendmsg_nonblock): ditto target 0: a (ruby 2.3.0dev (2015-11-12 trunk 52550) [x86_64-linux]) target 1: b (ruby 2.3.0dev (2015-11-12 avoid-kwarg-capi 52550) [x86_64-linux] ----------------------------------------------------------- sendmsg_nonblock require 'socket' nr = 1_000_000 i = 0 msg = '.' buf = '.' begin r, w = UNIXSocket.pair(:SEQPACKET) while i < nr i += 1 w.sendmsg_nonblock(msg, exception: false) r.recv(1, 0, buf) end ensure r.close w.close end ----------------------------------------------------------- raw data: [["sendmsg_nonblock", [[1.875997293740511, 1.8452614955604076, 1.8449317328631878, 1.8418389447033405, 1.869386937469244], [1.5175109766423702, 1.4987873211503029, 1.4989623799920082, 1.47918451577425, 1.5017359890043736]]]] Elapsed time: 16.775453245 (sec) ----------------------------------------------------------- benchmark results: minimum results in each 5 measurements. Execution time (sec) name a b sendmsg_nonblock 1.842 1.479 Speedup ratio: compare with the result of `a' (greater is better) name b sendmsg_nonblock 1.245 git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-17socket (bsock_recvmsg_internal): avoid arg parsingnormal
* ext/socket/ancdata.c (bsock_recvmsg_internal): avoid arg parsing (rsock_bsock_recvmsg): adjust for above change (rsock_bsock_recvmsg_nonblock): ditto [ruby-core:71439] [Feature #11339] * ext/socket/rubysocket.h: adjust prototypes for above * ext/socket/basicsocket.c (rsock_init_basicsocket): adjust private methods * ext/socket/lib/socket.rb (BasicSocket#recvmsg): wrapper method (BasicSocket#recvmsg_nonblock): ditto target 0: a (ruby 2.3.0dev (2015-11-12 trunk 52550) [x86_64-linux]) target 1: b (ruby 2.3.0dev (2015-11-12 avoid-kwarg-capi 52550) [x86_64-linux] ----------------------------------------------------------- recvmsg_nonblock require 'socket' nr = 1_000_000 i = 0 msg = '.' buf = '.' begin r, w = UNIXSocket.pair(:SEQPACKET) while i < nr i += 1 w.sendmsg(msg) r.recvmsg_nonblock(1, exception: false) end ensure r.close w.close end ----------------------------------------------------------- raw data: [["recvmsg_nonblock", [[3.721687912940979, 3.6072621569037437, 3.580637402832508, 3.614185404032469, 3.6029579415917397], [2.4694008752703667, 2.4908322244882584, 2.5051278844475746, 2.5037173740565777, 2.548359278589487]]]] Elapsed time: 30.646087052 (sec) ----------------------------------------------------------- benchmark results: minimum results in each 5 measurements. Execution time (sec) name a b recvmsg_nonblock 3.581 2.469 Speedup ratio: compare with the result of `a' (greater is better) name b recvmsg_nonblock 1.450 git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-05ext: use RARRAY_AREFnobu
* ext/**/*.c: prefer RARRAY_AREF to indexing RARRAY_CONST_PTR. pointed out by hanmac. git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-04ext: use RARRAY_CONST_PTRnobu
* ext/bigdecimal/bigdecimal.c: use RARRAY_CONST_PTR just fore reference instead of RARRAY_PTR, to keep the array WB-protected. git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-15use rb_sym2strnobu
* ext/openssl/ossl_ssl.c (ossl_sslctx_set_ssl_version): use rb_sym2str to get rid of inadvertent ID creations. * ext/socket/ancdata.c (ancillary_inspect): ditto. * ext/socket/option.c (sockopt_inspect): ditto. git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-02socket: memoize common socket families in fptr->modenormal
This provides a minor speedup by avoiding an extra syscall require 'socket' require 'benchmark' nr = 100000 msg = 'hello world' buf = '' size = msg.bytesize puts(Benchmark.measure do UNIXSocket.pair(:SEQPACKET) do |a, b| nr.times do a.sendmsg_nonblock(msg, 0, exception: false) b.recv(size, 0, buf) end end end) user system total real before: 0.330000 0.340000 0.670000 ( 0.678235) after: 0.290000 0.240000 0.530000 ( 0.534527) * ext/socket/rubysocket.h: flags for common socket families (rsock_getfamily): update signature * include/ruby/io.h: comment socket FMODE flags * ext/socket/init.c (rsock_getfamily): memoize family * ext/socket/basicsocket.c: adjust rsock_getfamily calls * ext/socket/ancdata.c: ditto [ruby-core:69713] [Feature #11298] git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-23ext/socket/ancdata.c (bsock_recvmsg_internal): reduce stack usenormal
Using 8K stack is probably too much. As reference, ALLOCV falls back to heap allocation at a mere 1K. Since bsock_recvmsg_internal is a function which will always allocate and can trigger GC, it is in our best interest to minimize stack usage to avoid scanning 8K of stack on GC. [ruby-core:69595] [Feature #11263] git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-15socket: allow exception-free nonblocking sendmsg/recvmsgnormal
As documented before, exceptions are expensive and IO::Wait*able are too common in socket applications to be the exceptional case. Datagram sockets deserve the same API which stream sockets are allowed with read_nonblock and write_nonblock. Note: this does not offer a performance advantage under optimal conditions when both ends are equally matched in speed, but it it does make debug output cleaner by avoiding exceptions whenever the receiver slows down. * ext/socket/ancdata.c (bsock_sendmsg_internal, bsock_recvmsg_internal): support "exception: false" kwarg * ext/socket/init.c (rsock_s_recvfrom_nonblock): ditto * ext/socket/init.c (rsock_s_recvfrom_nonblock): use rsock_opt_false_p * ext/socket/socket.c (sock_connect_nonblock): ditto * ext/socket/rubysocket.h (rsock_opt_false_p): new function * ext/socket/basicsocket.c (bsock_recv_nonblock): update rdoc * ext/socket/udpsocket.c (udp_recvfrom_nonblock): ditto * test/socket/test_nonblock.rb: new tests [ruby-core:69542] [Feature #11229] git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-05* ext/socket/ancdata.c (bsock_sendmsg_internal): drop redundant assignmentnormal
We call memset to zero `mh' a few lines above anyways, making explicitly zero-ing each field unnecessary. Compilers optimize this code away anyways, but it still costs me 4 lines of my small terminal and even smaller attention span. git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-05* ext/socket/ancdata.c (bsock_sendmsg_internal): all arguments arengoto
parsed even on systems without HAVE_STRUCT_MSGHDR_MSG_CONTROL to prevent SEGV caused by passing Qnil to RARRAY_LENINT and to preserve behavior before r50776. [Bug #11224] [ruby-core:69468] [Bug #11225] [ruby-core:69469] git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-05ext/socket/ancdata.c (bsock_sendmsg_internal): portability fixnormal
* ext/socket/ancdata.c (bsock_sendmsg_internal): avoid msg_control ptr if msg_controllen is zero to fix portability problems. git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-05ext/socket/ancdata.c (bsock_sendmsg_internal): fix build error from r50776normal
Systems without HAVE_STRUCT_MSGHDR_MSG_CONTROL still need controls to be nil for the check after argument parsing. Note: not actually tested on a real system without msg_control git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-04ext/socket/ancdata.c (bsock_sendmsg_internal): use rb_scan_argsnormal
This should make the code more maintainable and make it easier to add keyword argument support for "exception: false" in the future. git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-30ext/socket/ancdata.c: use RB_GC_GUARD instead of volatilenormal
See doc/extension.rdoc for explanation. [ruby-core:69419] [Feature #11198] git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-29socket: avoid redundant fcntl on Linuxnormal
* ext/socket/ancdata.c (bsock_sendmsg_internal, bsock_recvmsg_internal): avoid redundant fcntl on Linux [ruby-core:69154] [Feature #11145] * ext/socket/init.c (rsock_s_recvfrom_nonblock): ditto * ext/socket/rubysocket.h (MSG_DONTWAIT_RELIABLE): new macro MSG_DONTWAIT is enough to force non-blocking I/O under Linux, so avoid changing the state of a socket. This will allow certain threads to do a non-destructive non-blocking "peek" while others block (without relying on an extra ppoll syscall). We shall be conservative about enabling this feature since some OSes may have incomplete support for MSG_DONTWAIT. I shall defer to a FreeBSD expert to enable that for FreeBSD. git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-08ext/socket/ancdata.c (bsock_recvmsg_internal): GC guardnormal
The control buffer may be used throughout the function, so prevent the string from being lost to GC. * ext/socket/ancdata.c (bsock_recvmsg_internal): GC guard [Bug #11123] git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-22ext/socket/*.c: trivial struct packing for 64-bitnormal
* 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:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-21socket: sendmsg/recvmsg only retries blocking on errorsnormal
* 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:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-28* ext/socket: Avoid redundant fcntl/fstat syscalls for cloexecakr
sockets. Patch by Eric Wong. [ruby-core:59429] [Feature #9330] git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-09* process.c: Remove spaces between SI prefix and unit to followakr
SI brochure. * time.c: Ditto. * ext/socket/ancdata.c: Ditto. git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-12* safe.c (rb_set_safe_level, safe_setter): raise an ArgumentErrorshugo
when $SAFE is set to 4. $SAFE=4 is now obsolete. [ruby-core:55222] [Feature #8468] * object.c (rb_obj_untrusted, rb_obj_untrust, rb_obj_trust): Kernel#untrusted?, untrust, and trust are now deprecated. Their behavior is same as tainted?, taint, and untaint, respectively. * include/ruby/ruby.h (OBJ_UNTRUSTED, OBJ_UNTRUST): OBJ_UNTRUSTED() and OBJ_UNTRUST() are aliases of OBJ_TAINTED() and OBJ_TAINT(), respectively. * array.c, class.c, debug.c, dir.c, encoding.c, error.c, eval.c, ext/curses/curses.c, ext/dbm/dbm.c, ext/dl/cfunc.c, ext/dl/cptr.c, ext/dl/dl.c, ext/etc/etc.c, ext/fiddle/fiddle.c, ext/fiddle/pointer.c, ext/gdbm/gdbm.c, ext/readline/readline.c, ext/sdbm/init.c, ext/socket/ancdata.c, ext/socket/basicsocket.c, ext/socket/socket.c, ext/socket/udpsocket.c, ext/stringio/stringio.c, ext/syslog/syslog.c, ext/tk/tcltklib.c, ext/win32ole/win32ole.c, file.c, gc.c, hash.c, io.c, iseq.c, load.c, marshal.c, object.c, proc.c, process.c, random.c, re.c, safe.c, string.c, thread.c, transcode.c, variable.c, vm_insnhelper.c, vm_method.c, vm_trace.c: remove code for $SAFE=4. * test/dl/test_dl2.rb, test/erb/test_erb.rb, test/readline/test_readline.rb, test/readline/test_readline_history.rb, test/ruby/test_alias.rb, test/ruby/test_array.rb, test/ruby/test_dir.rb, test/ruby/test_encoding.rb, test/ruby/test_env.rb, test/ruby/test_eval.rb, test/ruby/test_exception.rb, test/ruby/test_file_exhaustive.rb, test/ruby/test_hash.rb, test/ruby/test_io.rb, test/ruby/test_method.rb, test/ruby/test_module.rb, test/ruby/test_object.rb, test/ruby/test_pack.rb, test/ruby/test_rand.rb, test/ruby/test_regexp.rb, test/ruby/test_settracefunc.rb, test/ruby/test_struct.rb, test/ruby/test_thread.rb, test/ruby/test_time.rb: remove tests for $SAFE=4. git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13* include/ruby/ruby.h: constify RBasic::klass and addko1
RBASIC_CLASS(obj) macro which returns a class of `obj'. This change is a part of RGENGC branch [ruby-trunk - Feature #8339]. * object.c: add new function rb_obj_reveal(). This function reveal interal (hidden) object by rb_obj_hide(). Note that do not change class before and after hiding. Only permitted example is: klass = RBASIC_CLASS(obj); rb_obj_hide(obj); .... rb_obj_reveal(obj, klass); TODO: API design. rb_obj_reveal() should be replaced with others. TODO: modify constified variables using cast may be harmful for compiler's analysis and optimizaton. Any idea to prohibt inserting RBasic::klass directly? If rename RBasic::klass and force to use RBASIC_CLASS(obj), then all codes such as `RBASIC(obj)->klass' will be compilation error. Is it acceptable? (We have similar experience at Ruby 1.9, for example "RARRAY(ary)->ptr" to "RARRAY_PTR(ary)". * internal.h: add some macros. * RBASIC_CLEAR_CLASS(obj) clear RBasic::klass to make it internal object. * RBASIC_SET_CLASS(obj, cls) set RBasic::klass. * RBASIC_SET_CLASS_RAW(obj, cls) same as RBASIC_SET_CLASS without write barrier (planned). * RCLASS_SET_SUPER(a, b) set super class of a. * array.c, class.c, compile.c, encoding.c, enum.c, error.c, eval.c, file.c, gc.c, hash.c, io.c, iseq.c, marshal.c, object.c, parse.y, proc.c, process.c, random.c, ruby.c, sprintf.c, string.c, thread.c, transcode.c, vm.c, vm_eval.c, win32/file.c: Use above macros and functions to access RBasic::klass. * ext/coverage/coverage.c, ext/readline/readline.c, ext/socket/ancdata.c, ext/socket/init.c, * ext/zlib/zlib.c: ditto. git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-09* ext/socket/ancdata.c (bsock_sendmsg_internal): controls_num shouldakr
not be negative. git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-09* ext/socket/ancdata.c (bsock_sendmsg_internal): Always setakr
controls_num to raise NotImplementedError appropriately. (bsock_recvmsg_internal): Raise NotImplementedError if :scm_rights=>true is given on platforms which don't have 4.4BSD style control message. git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-09* ext/socket/rubysocket.h, ext/socket/unixsocket.c,akr
ext/socket/ancdata.c: Use HAVE_STRUCT_MSGHDR_MSG_CONTROL instead of HAVE_ST_MSG_CONTROL. git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-07* ext/socket/ancdata.c (bsock_recvmsg_internal): Add a cast toakr
suppress warning. Bionic defines socklen_t as int. Bionic defines msg_controllen as unsigned int (__kernel_size_t) instead of socklen_t as POSIX. git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-07* ext/socket/ancdata.c (ancillary_inspect): Don't callakr
anc_inspect_ipv6_pktinfo if !HAVE_TYPE_STRUCT_IN6_PKTINFO. anc_inspect_ipv6_pktinfo is not defined in the case. git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-01ancdata.c: suppress warningsnobu
* ext/socket/ancdata.c (bsock_sendmsg_internal): suppress warnings on platforms where msghdr does not have msg_control. * ext/socket/ancdata.c (bsock_recvmsg_internal): ditto. git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-08Fix #6154 by introducing new EAGAIN/EWOULDBLOCK/EINPROGRESSheadius
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:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-06socket/extconf.rb: RSTRING_SOCKLENnobu
* ext/socket/extconf.rb (RSTRING_SOCKLEN): macro to cast RSTRING_LEN to socklen_t. git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-24* ext/socket: define and use union_sockaddr instead of structakr
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:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-16* ext/socket/ancdata.c (rsock_recvmsg): ignore truncated part ofakr
socket address returned from recvmsg(). * ext/socket/init.c (recvfrom_blocking): ignore truncated part of socket address returned from recvfrom(). (rsock_s_recvfrom_nonblock): ditto. git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-14* ext/socket/sockport.h (SET_SS_LEN): removed.akr
(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:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-22Supress warnings: unused variablesnaruse
git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-20* include/ruby/ruby.h: add C APIs.nari
VALUE rb_newobj_of(VALUE klass, VALUE flags) #define NEWOBJ_OF(obj,type,klass,flags) These allow to change a allocation strategy depending on klass or flags. * gc.c: ditto * array.c: use new C API. * bignum.c: ditto * class.c: ditto * complex.c: ditto * ext/socket/ancdata.c: ditto * ext/socket/option.c: ditto * hash.c: ditto * io.c: ditto * marshal.c: ditto * numeric.c: ditto * object.c: ditto * random.c: ditto * range.c: ditto * rational.c: ditto * re.c: ditto * string.c: ditto * struct.c: ditto [Feature #7177][Feature #7047] git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-28ext/socket: suppress warnings on mingw64nobu
* ext/socket/ancdata.c (nogvl_sendmsg_func): explicitly cast via VALUE to suppress a warning on mingw64. * ext/socket/option.c: declare inet_ntop() for mingw64 which has the function but lacks arpa/inet.h. git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* 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:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-23use RB_TYPE_P() instead of comparison of TYPE()nobu
git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-20* ext/bigdecimal/README: Update to bugs.ruby-lang.orgkazu
* ext/socket/ancdata.c: ditto * test/-ext-/wait_for_single_fd/test_wait_for_single_fd.rb: ditto * test/syck/test_yaml.rb: ditto * doc/ChangeLog-1.9.3: ditto git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-06* ext/socket/rubysocket.h (rsock_recvmsg): declared.akr
* ext/socket/ancdata.c (rsock_recvmsg): extracted from nogvl_recvmsg_func. (nogvl_recvmsg_func): use rsock_recvmsg. git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-04* whitespace cleanup.nobu
git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-31* ext/socket/ancdata.c (nogvl_recvmsg_func): use MSG_CMSG_CLOEXEC ifakr
available. * ext/socket/unixsocket.c (recvmsg_blocking): ditto. git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-31* include/ruby/intern.h (rb_fd_fix_cloexec): renamed fromakr
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:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-22* include/ruby/intern.h (rb_fd_set_cloexec): declared.akr
* 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:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e