aboutsummaryrefslogtreecommitdiffstats
path: root/io.c
Commit message (Collapse)AuthorAgeFilesLines
* * io.c, thread.c, ext/pty/pty.c, ext/fiddle/closure.c: useakr2011-11-151-2/+2
| | | | | | | | __linux__ macro for consistency. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33761 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (do_ioctl, ioctl_narg_len, setup_narg, rb_ioctl): usenobu2011-11-121-5/+5
| | | | | | ioctl_req_t. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33727 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ChangeLog, io.c: whitespace-cleanup.nobu2011-11-121-3/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33724 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (fcntl_narg_len): introduce narg calculation for fcntl insteadkosaki2011-11-121-1/+136
| | | | | | | | | of hard coded 256. * io.c (setup_narg): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33721 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (ioctl_narg_len): Linux doesn't have IOCPARM_LEN macro, butkosaki2011-11-121-0/+2
| | | | | | | | has _IOC_SIZE. support it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33718 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_ioctl): don't expose our sanity check value to ruby script.kosaki2011-11-121-4/+8
| | | | | | | | | | It may change string value meaning if the value is string. (e.g. MacOS X has F_GETPATH ioctl) * io.c (rb_fcntl): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33717 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (ioctl_req_t): Type of req argument of ioctl() depend on platform.kosaki2011-11-121-2/+10
| | | | | | | | | | | | | Moreover almost all linux ioctl can't be represented by 32bit integer (i.e. MSB is 1). We need wrap ioctl argument type. [Bug #5429] [ruby-dev:44589] * io.c (struct ioctl_arg): ditto. * io.c (rb_ioctl): ditto. * test/ruby/test_io.rb (test_ioctl_linux): add a testcase for ioctl git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (struct io_cntl_arg): remove io_p member.kosaki2011-11-121-44/+80
| | | | | | | | | | | | * io.c (nogvl_fcntl, do_fcntl, rb_fcntl): separated from ioctl functions. * io.c (nogvl_io_cntl): remove fcntl depended logic. * io.c (io_cntl): ditto. * io.c (rb_io_ctl): ditto. * io.c (rb_io_ioctl): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33715 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (setup_narg): fix off by one bug.kosaki2011-11-121-5/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33714 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (+setup_narg): factor out length calculation logic.kosaki2011-11-121-11/+22
| | | | | | | | * io.c (rb_io_ctl): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33713 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (+ioctl_narg_len) new helper function.kosaki2011-11-121-10/+24
| | | | | | | | | * io.c (rb_io_ctl): don't use ioctl specific length check if caller is fcntl. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33711 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (pipe_open): Remove fflush(stdin). it's no effect.kosaki2011-11-111-1/+0
| | | | | | | | | Pointed out by Ikegami Daisuke <ikegami.da@gmail.com>. Thank you. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33704 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_update_max_fd): fstat(2) can fail with other thannobu2011-11-091-1/+1
| | | | | | | EBADF. [ruby-dev:44837] [Backport #4339]. Cf. http://pubs.opengroup.org/onlinepubs/9699919799/functions/fstat.html git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_sysopen): max fd is updated in rb_sysopen_internal()nobu2011-11-091-1/+0
| | | | | | already. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (io_fwrite): call rb_w32_write_console() only if FMODE_TTY isusa2011-11-081-2/+4
| | | | | | | | 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
* update doc.akr2011-11-071-1/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33664 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/encoding.h (ECONV_NEWLINE_DECORATOR_READ_MASK,usa2011-11-071-16/+35
| | | | | | | | | | | | | | | | | | | | | | 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
* * io.c (io_fflush): remove fsync().usa2011-11-071-5/+10
| | | | | | | | | | | * 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
* * io.c (rb_close_before_exec): use F_MAXFD if available.akr2011-11-071-0/+7
| | | | | | | | 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
* * io.c (rb_cloexec_fcntl_dupfd): don't clear try_dupfd_cloexec ifakr2011-11-051-1/+3
| | | | | | | | 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
* * whitespace cleanup.nobu2011-11-041-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33634 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (make_writeconv): fixed typo of previous commit.usa2011-11-031-1/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33629 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (make_writeconv): fixed typo of previous commit.usa2011-11-031-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33628 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (make_writeconv): unversal_newline converter is for reading.usa2011-11-031-1/+3
| | | | | | | | | | 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
* * io.c (rb_cloexec_pipe): remove workaround of r33587.naruse2011-11-011-6/+0
| | | | | | | 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
* * io.c (rb_io_reopen): call rb_fd_fix_cloexec instead ofakr2011-11-011-1/+1
| | | | | | | rb_maygvl_fd_fix_cloexec. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33605 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_io_reopen): call rb_maygvl_fd_fix_cloexec after freopen().akr2011-11-011-0/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33604 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (nogvl_io_cntl): rb_cloexec_fcntl_dupfd's 2nd argument is int.naruse2011-11-011-1/+1
| | | | | | * 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
* * io.c (rb_maygvl_fd_fix_cloexec): renamed from fd_set_cloexec.akr2011-11-011-11/+11
| | | | | | | | | | | | * 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
* add comment.akr2011-10-311-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fix previous commit (r33586).naruse2011-10-311-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33588 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_cloexec_pipe): NetBSD 6.0 will support pipe2(2),naruse2011-10-311-0/+6
| | | | | | | 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
* * include/ruby/intern.h (rb_fd_fix_cloexec): renamed fromakr2011-10-311-3/+3
| | | | | | | | | | | | | | | | | | | 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 (fd_set_cloexec): clear CLOEXEC flag for standard fileakr2011-10-311-40/+32
| | | | | | | | | 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
* * io.c (rb_cloexec_dup2): check oldfd == newfd at first.akr2011-10-311-14/+21
| | | | | | | pointed by KOSAKI Motohiro. [ruby-dev:44713] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33579 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_cloexec_fcntl_dupfd): this function needs F_DUPFD.usa2011-10-311-0/+6
| | | | | | | | * 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
* * include/ruby/intern.h (rb_cloexec_fcntl_dupfd): declared.akr2011-10-301-2/+15
| | | | | | | | | | | * 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
* * configure.in: check pipe2.akr2011-10-301-0/+18
| | | | | | | | * 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
* * include/ruby/intern.h (rb_cloexec_pipe): declared.akr2011-10-301-12/+23
| | | | | | | | | | | | * 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
* * io.c (rb_cloexec_dup): refine control flow.akr2011-10-301-8/+6
| | | | | | | (rb_cloexec_dup2): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33571 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_cloexec_dup, rb_cloexec_dup2): CLOEXEC has been set ifnobu2011-10-301-0/+6
| | | | | | dup3 succeeded. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_cloexec_dup): don't allocate standard file descriptors.akr2011-10-301-2/+7
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33564 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_cloexec_dup2): don't set CLOEXEC for standard fileakr2011-10-291-1/+1
| | | | | | | descriptors. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33563 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * configure.in: check dup3.akr2011-10-291-0/+15
| | | | | | | | * 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
* * include/ruby/intern.h (rb_cloexec_dup2): declared.akr2011-10-291-4/+15
| | | | | | | | | * 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
* * io.c (rb_cloexec_dup): use F_DUPFD_CLOEXEC if available.akr2011-10-291-0/+16
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33555 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* add a comment.akr2011-10-291-0/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33554 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/intern.h (rb_cloexec_dup): declared.akr2011-10-291-3/+12
| | | | | | | | | | | | | * 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
* * io.c (rb_cloexec_open): use O_CLOEXEC if available.akr2011-10-291-0/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33551 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/intern.h (rb_cloexec_open): declared.akr2011-10-291-3/+22
| | | | | | | | | | | | * 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