summaryrefslogtreecommitdiff
path: root/io.c
AgeCommit message (Collapse)Author
2011-11-08* io.c (io_fwrite): call rb_w32_write_console() only if FMODE_TTY isusa
set. this is the one of the reason of IO writing slowness of Windows in 1.9.3 or later. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33667 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-07update doc.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33664 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-07* include/ruby/encoding.h (ECONV_NEWLINE_DECORATOR_READ_MASK,usa
ECONV_NEWLINE_DECORATOR_WRITE_MASK): new macro. * io.c (rb_io_extract_modeenc, pipe_open, prep_stdio, argf_next_argv): set TEXTMODE_NEWLINE_DECORATOR_ON_WRITE for textmode on creating IO if the flag is available. * io.c (make_writeconv): drop decorators for reading. * io.c (make_readconv): drop decorators for writing. * io.c (do_writeconv): existing writeconv is not the condition to raise ArgumentError. should check textmode or not. * test/ruby/test_io_m17n.rb (TestIO_M17N#test_{cr,lf,crlf}_decorator_on_stdout): test above changes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-07* io.c (io_fflush): remove fsync().usa
* io.c (rb_io_flush, rb_io_rewind): fsync() here. these changes reduces fsync() calls to improve performance. first reported at [ruby-list:48515] by ak7 at mail.goo.ne.jp . [Bug #5585] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-07* io.c (rb_close_before_exec): use F_MAXFD if available.akr
F_MAXFD is available on NetBSD since NetBSD 2.0. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33650 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-05* io.c (rb_cloexec_fcntl_dupfd): don't clear try_dupfd_cloexec ifakr
fcntl(F_DUPFD) failed as fcntl(F_DUPFD_CLOEXEC). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33641 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-04* whitespace cleanup.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33634 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-03* io.c (make_writeconv): fixed typo of previous commit.usa
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33629 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-03* io.c (make_writeconv): fixed typo of previous commit.usa
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33628 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-03* io.c (make_writeconv): unversal_newline converter is for reading.usa
so, if the io is text mode and has ECONV_UNIVERSAL_NEWLINE_DECORATOR flag, use crlf_newline converter for writing. this change fixes the problem about the luck of CR up Kernel.p and Kernel.puts to stdout/stderr on Windows. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33627 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-01* io.c (rb_cloexec_pipe): remove workaround of r33587.naruse
The bug of NetBSD is fixed on Mon Oct 31 21:31:29 UTC 2011. http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=45545 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33606 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-01* io.c (rb_io_reopen): call rb_fd_fix_cloexec instead ofakr
rb_maygvl_fd_fix_cloexec. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33605 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-01* io.c (rb_io_reopen): call rb_maygvl_fd_fix_cloexec after freopen().akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33604 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-01* io.c (nogvl_io_cntl): rb_cloexec_fcntl_dupfd's 2nd argument is int.naruse
* process.c (move_fds_to_avoid_crash): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33602 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-01* io.c (rb_maygvl_fd_fix_cloexec): renamed from fd_set_cloexec.akr
* internal.h (rb_maygvl_fd_fix_cloexec): declared. * ext/socket/init.c (cloexec_accept): use rb_maygvl_fd_fix_cloexec. (rsock_s_accept_nonblock): use rb_update_max_fd. (rsock_s_accept): use rb_update_max_fd. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33598 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-31add comment.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-31Fix previous commit (r33586).naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33588 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-31* io.c (rb_cloexec_pipe): NetBSD 6.0 will support pipe2(2),naruse
but its return value is -1 or larger than 0. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33587 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://ci.ruby-lang.org/ruby/trunk@33585 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-31* io.c (fd_set_cloexec): clear CLOEXEC flag for standard fileakr
descriptors. (rb_cloexec_dup): use rb_cloexec_fcntl_dupfd. (rb_cloexec_fcntl_dupfd): use F_DUPFD_CLOEXEC if available. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33583 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-31* io.c (rb_cloexec_dup2): check oldfd == newfd at first.akr
pointed by KOSAKI Motohiro. [ruby-dev:44713] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33579 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-31* io.c (rb_cloexec_fcntl_dupfd): this function needs F_DUPFD.usa
* io.c (nogvl_io_cntl): use rb_cloexec_fcntl_dupfd() only if the platform has F_DUPFD. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33578 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-30* include/ruby/intern.h (rb_cloexec_fcntl_dupfd): declared.akr
* io.c (rb_cloexec_fcntl_dupfd): new function. (nogvl_io_cntl): use rb_cloexec_fcntl_dupfd. * process.c (move_fds_to_avoid_crash): use rb_cloexec_fcntl_dupfd. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33575 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-30* configure.in: check pipe2.akr
* io.c (rb_cloexec_pipe): use pipe2 if available. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33574 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-30* include/ruby/intern.h (rb_cloexec_pipe): declared.akr
* io.c (rb_cloexec_pipe): new function. (rb_pipe): use rb_cloexec_pipe. * thread_pthread.c (rb_thread_create_timer_thread): use rb_cloexec_pipe. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33572 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-30* io.c (rb_cloexec_dup): refine control flow.akr
(rb_cloexec_dup2): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33571 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-30* io.c (rb_cloexec_dup, rb_cloexec_dup2): CLOEXEC has been set ifnobu
dup3 succeeded. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-30* io.c (rb_cloexec_dup): don't allocate standard file descriptors.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33564 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-29* io.c (rb_cloexec_dup2): don't set CLOEXEC for standard fileakr
descriptors. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33563 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-29* configure.in: check dup3.akr
* io.c (rb_cloexec_dup2): use dup3 if available. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33561 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-29* include/ruby/intern.h (rb_cloexec_dup2): declared.akr
* io.c (rb_cloexec_dup2): new function. (io_reopen): use rb_cloexec_dup2. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33557 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-29* io.c (rb_cloexec_dup): use F_DUPFD_CLOEXEC if available.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33555 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-29add a comment.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33554 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-29* include/ruby/intern.h (rb_cloexec_dup): declared.akr
* io.c (rb_cloexec_dup): new function. (ruby_dup): use rb_cloexec_dup. * ext/pty/pty.c (pty_getpty): use rb_cloexec_dup. * ext/openssl/ossl_bio.c (ossl_obj2bio): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33553 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-29* io.c (rb_cloexec_open): use O_CLOEXEC if available.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33551 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-29* include/ruby/intern.h (rb_cloexec_open): declared.akr
* io.c (fd_set_cloexec): extracted from rb_fd_set_cloexec. (rb_cloexec_open): new function. (sysopen_func): use rb_cloexec_open. (rb_sysopen_internal): use rb_update_max_fd instead of rb_fd_set_cloexec. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33549 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-24* io.c: use "__sun" instead of "sun" to detect SunOS.akr
* dln.c: ditto. * cont.c: ditto. * ext/sdbm/_sdbm.c: ditto. [ruby-dev:44693] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33520 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-23* io.c (copy_stream_fallback_body): check nil for EOF of read method.akr
patch by Eric Wong. [ruby-core:39134] [Bug #5237] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33515 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-22* io.c (rb_fd_set_cloexec): set close-on-exec flag only if F_GETFD isakr
defined. reported by Luis Lavena. [ruby-core:40281] [Bug #5470] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33509 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://ci.ruby-lang.org/ruby/trunk@33507 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-02* io.c: fix documentation of ARGF.lineno=.ktsj
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33375 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-29* use RB_TYPE_P which is optimized for constant types, instead ofnobu
comparison with TYPE. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-12* io.c (Init_IO): update BINARY comment. it should not change thematz
encoding of the result to ASCII-8BIT. [ruby-talk:387719] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33260 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-03* io.c (argf_next_argv): open in default text mode.nobu
[ruby-core:39234] [Bug #5268] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33171 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-02* io.c (validate_enc_binmode, prep_stdio): default to text mode onnobu
dosish platforms. [ruby-core:38822] [Bug #5164] * transcode.c (rb_econv_prepare_options): keep default ecflags unchanged if no options. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33165 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-03* util.c, include/ruby/util.h (ruby_add_suffix): remove the function.usa
[Bug #5153] [ruby-core:38736] * io.c (argf_next_argv): remove the call of above function. * ext/-test-/add_suffix, test/-ext-/test_add_suffix.rb: remove the test extension module because this is only for testsing ruby_add_suffix(). * LEGAL: remove the mention about a part of util.c, because now we removed the part. * io.c (argf_next_argv): now the new filename is not guranteed to use, so should check the return value of rename(2). * test/ruby/test_argf.rb (TestArgf#test_inplace_rename_impossible): now we expect same result with other platforms on no_safe_rename platforms (=Windows). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32826 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-31* io.c (rb_pipe): pipe on cygwin can succeed half but failnobu
half. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32771 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-30* io.c (rb_io_each_byte): remove unused variable e.naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-30* io.c (rb_io_each_byte): rbuf can be refreshed during yield.nobu
[Bug #5119] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32758 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-23* io.c (rb_update_max_fd): validate fd.akr
* 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