aboutsummaryrefslogtreecommitdiffstats
path: root/io.c
Commit message (Collapse)AuthorAgeFilesLines
* * io.c (pipe_open): cmd is no longer used if fork is available.nobu2012-03-021-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34868 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (io_binwrite, rb_io_syswrite): use shared frozen sourcenobu2012-02-281-0/+4
| | | | | | strings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34847 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (io_fread, io_getpartial, rb_io_sysread): set buffer sizenobu2012-02-281-0/+5
| | | | | | | after check if readable, which can cause thread switch. [ruby-dev:45297][Bug #6099] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34846 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_io_set_pos): add rdoc about textmode.usa2012-02-271-0/+2
| | | | | | | * test/ruby/test_io.rb (TestIO#test_setpos): use binmode. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34834 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c, process.c, time.c, ext: use rb_sys_fail_str instead ofnobu2012-02-271-13/+13
| | | | | | | rb_sys_fail. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * dir.c (dir_inspect), io.c (rb_io_inspect): keep encoding of path.nobu2012-02-241-12/+10
| | | | | | | [Bug #6072] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34795 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * dir.c, file.c, io.c (rb_sys_fail_path): use rb_sys_fail_str.nobu2012-02-241-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34788 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * dir.c, file.c, io.c: use rb_sys_fail_path.nobu2012-02-241-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34786 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (set_binary_mode_with_seek_cur): reorder function qualifiers.nobu2012-02-241-1/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34785 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_io_f_sync): Fix double-negative typo. [ruby-trunk - #5837]drbrain2012-02-231-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34759 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_io_extract_modeenc): fail only if conflictingnobu2012-02-221-1/+6
| | | | | | text/binary modes given explicitly. [ruby-dev:45268][Bug #6055] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34753 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_io_s_foreach): argument check before making Enumerator.nobu2012-02-221-1/+2
| | | | | | [ruby-dev:31525] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34736 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_io_s_foreach): return enumerator including kerwordnobu2012-02-221-1/+1
| | | | | | arguments. [ruby-dev:45267][Bug #6054] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34735 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (io_strsetbuf): call rb_str_modify to make str independentnaruse2012-02-151-1/+4
| | | | | | before calling rb_str_set_len for r34580. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34624 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (io_setstrbuf): cut down the buffer if longer.nobu2012-02-141-3/+8
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34592 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (io_setstrbuf): defer resizing buffer string until data isnobu2012-02-131-30/+15
| | | | | | read actually. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34580 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (Init_IO): use directive hack to make ARGF documentablenobu2012-02-131-4/+5
| | | | | | in other tools. [ruby-core:42515][Bug #6007] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (argf_next_argv): reset ARGF.next_p on ARGV.replace.naruse2012-02-021-0/+8
| | | | | | | r34409 breaks replacing ARGV. [ruby-dev:45160] [Bug #5952] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34417 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (argf_close): skip stdin, which should be readable again.nobu2012-01-311-0/+2
| | | | | | | | [ruby-dev:45160] [Bug #5952] * io.c (argf_readlines): reinitialize after all read to be readable again. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (extract_binmode): raise an exception if binmode/textmodenaruse2012-01-231-4/+12
| | | | | | | is specified with both vmode and opthash. [ruby-core:42199] [Bug #5918] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34359 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_io_extract_modeenc): set ASCII-8BIT if binmode is specifiednaruse2012-01-231-1/+4
| | | | | | with opthash. [ruby-core:42197] [Bug #5917] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34358 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_io_s_read): Fix formatting of open_args comment. Reporteddrbrain2012-01-131-12/+16
| | | | | | | by Adam Prescott. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34296 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_sys_fail_path): move the definition.shirosaki2011-12-261-26/+32
| | | | | | | | | | | | | | | | | | | | | Move above for using it in set_binary_mode_with_seek_cur(). * io.c (set_binary_mode_with_seek_cur): fix improper seek cursor. Seeking file cursor with setting binary mode has possibility to cause infinite loop. Fixed the bug and refined error handling. Introduced at r34043. And cleanups as below. Remove unnecessary parentheses of `fptr`. Use return value of setmode(). * test/ruby/test_io_m17n.rb (TestIO_M17N#test_seek_with_setting_binmode): add a test for abobe. [ruby-core:41671] [Bug #5714] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34132 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c: Improve rdoc for {File|IO}.writemarcandre2011-12-201-6/+10
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34081 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (argf_type): make typed data.nobu2011-12-151-1/+16
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34055 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * win32/win32.c, include/ruby/win32.h (rb_w32_fd_is_text): new function.usa2011-12-141-17/+69
| | | | | | | | | | | | | | | | | | | | | | | | | * win32/win32.c (init_stdhandle): set default mode of stdin as binmode. * io.c (set_binary_mode_with_seek_cur): new function to replace SET_BINARY_MODE_WITH_SEEK_CUR macro. now returns previous mode of the fd and take care of LF in rbuf. * io.c (do_writeconv): set text mode when needed. * io.c (io_read): need to change the mode of the IO to binmode temporally when the length for IO#read, because IO#read with length must behave so. * test/ruby/test_io_m17n.rb (TestIO_M17N#est_{read_with_length, read_with_length_binmode,get[cs]_and_read_with_binmode, read_with_binmode_and_get[cs],read_write_with_binmode}): tests for above changes. all patches are written by Hiroshi Shirosaki. [ruby-core:41496] [Feature #5714] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34043 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (Init_IO): Mention io/console methods. [Ruby 1.9 - Bug #5602]drbrain2011-12-071-0/+29
| | | | | | | | * ext/io/console/console.c: Mention that io/console must be required similar to lib/time.rb git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33968 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (big_rshift), compile.c (validate_label,nobu2011-12-051-3/+8
| | | | | | | | | | | | | | iseq_build_from_ary_exception), cont.c (cont_capture), dir.c (dir_open_dir), gc.c (objspace_each_objects), io.c (pipe_open) (rb_io_advise), parse.y (parser_compile_string) (rb_parser_compile_file), proc.c (binding_free), process.c (rb_proc_exec_n, rb_seteuid_core, proc_setegid, rb_setegid_core) (p_uid_exchange, p_gid_exchange), regparse.c (strdup_with_null), signal.c (sig_dfl), vm.c (rb_iseq_eval, rb_iseq_eval_main), vm_insnhelper.c (vm_expandarray): suppress unused-but-set-variable warnings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33951 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c: suppress unused-value warnings. fixup of r33937.nobu2011-12-041-4/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33944 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Introduce NEED_READCONV and NEED_WRITECONV to replace universal newline ↵luislavena2011-12-041-7/+126
| | | | | | | | | decorator Use CRLF only when required to improve file reading and writing under Windows. Patch by Hiroshi Shirosaki. [ruby-core:40706] [Feature #5562] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33937 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (linux_get_maxfd): change local variable name.akr2011-12-011-4/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_write_error2): suppress unused variable warning.nobu2011-11-291-2/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33894 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_write_error2): fwrite() returns ssize_t.nobu2011-11-281-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33884 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_io_flush): release GVL during fsync() on Windows.usa2011-11-281-9/+12
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33878 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_write_error2): get rid of warning on linux. fwritekosaki2011-11-271-1/+2
| | | | | | | | of glibc is tagged __attribute__ ((__warn_unused_result__)) if _FORTIFY_SOURCE != 0. * vm_dump.c (rb_vm_bugreport): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33871 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (copy_stream_body): use 0666 for permission argument for open.akr2011-11-261-1/+1
| | | | | | | [ruby-core:40865] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33851 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (ioctl_narg_len, linux_iocparm_len): reinstantiate linuxkosaki2011-11-251-1/+27
| | | | | | | | specific narg length calculation. * test/ruby/test_io.rb (test_ioctl_linux2): add new test for old and unstructured ioctl. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33839 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_io_reopen): re-initialize buffereing mode for stdout andakr2011-11-241-0/+8
| | | | | | | | stderr. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33828 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Merge branch 'fsync-nogvl' into trunkkosaki2011-11-241-2/+16
| | | | | | | Conflicts: ChangeLog git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33826 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (ioctl_narg_len): don't use _IOC_SIZE macro on Linux.naruse2011-11-231-2/+0
| | | | | | | | | | | | On Linux some constants for ioctl(2) doesn't include the size of its return value and 16bit value; for example FIONREAD 0x541B. Moreover the manual, ioctl_list(2), says "Note that the size bits are very unreliable: in lots of cases they are wrong, either because of buggy macros using sizeof(sizeof(struct)), or because of legacy values." So we shouldn't use it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33819 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (linux_get_maxfd): get rid of a warning.akr2011-11-211-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33806 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (linux_get_maxfd): new function to find maximum fd on Linux.akr2011-11-211-5/+51
| | | | | | | (rb_close_before_exec): use linux_get_maxfd. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33805 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_cloexec_open): set O_NOINHERIT instead of O_CLOEXEC if it isusa2011-11-181-0/+2
| | | | | | | | | | available (for Windows). * win32/win32.c (fcntl): on F_DUPFD, determine the inheritance of the new handle by O_NOINHERIT flag of original fd. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33783 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (argf_next_argv): wrong timing of setting ecflags.usa2011-11-161-3/+3
| | | | | | | fixed the failure of TestArgf#test_textmode introduced at r33662. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33770 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * 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