Граф коммитов

1020 Коммитов

Автор SHA1 Сообщение Дата
nobu ae167e1e79 * io.c (maygvl_copy_stream_wait_readwrite): define if USE_SENDFILE
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30425 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-29 12:20:16 +00:00
kazu 1f4401ebe0 fix a typo
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30410 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-27 22:27:13 +00:00
kosaki 085e40d45b * io.c (advice_arg_check): Change argument check.
Now, an unsupported advice makes NotImplementedError.
    [ruby-dev:42887] [Ruby 1.9-Feature#4204]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30375 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-25 17:25:02 +00:00
kosaki c9958d6ab4 * io.c (pipe_open): Added rb_thread_atfork(). We must reinitialize
GVL at new process creation.




git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30364 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-25 10:22:48 +00:00
nobu 522c538e93 * io.c (rb_io_extract_encoding_option): accept Encoding object as
encoding: optional argument.  [ruby-dev:42884]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30349 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-25 05:27:12 +00:00
tarui da4d3e8464 * io.c : add an extra byte to buffer for the specification of read
in Windows. see [ruby-core:33460] and r29980. and, we have to
	  discuss how to do this one byte.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30280 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-20 16:45:08 +00:00
kosaki a3ba982c75 * io.c (Init_IO): Added O_DIRECT. This feature was propsed by Run Paint Run Run.
[Feature #4015] [ruby-core:33018]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30247 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-19 16:18:16 +00:00
nobu 2d39e5265f * io.c: removed garbage line.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-16 22:08:50 +00:00
nobu 594ab9c8fd * io.c (rb_io_advise): removed unused variable, and fix indent.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-16 22:06:33 +00:00
kosaki 39058e1d87 Fix indentation
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30231 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-16 15:36:49 +00:00
kosaki cc9b886691 * io.c (rb_io_advise): New API. IO#advise() allows to tell the
ruby runtime how it expects to use a file handle. This feature
          can be improved a performance some situations.
          Note: This feature is mainly developed by Run Paint Run Run.
          Thank you! [ruby-core:33110] [Ruby 1.9-Feature#4038]

        * io.c (do_io_advise): Helper function.
        * io.c (io_advise_sym_to_const): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30229 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-16 15:01:55 +00:00
akr e5ad455a08 * io.c: parenthesize macro arguments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30227 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-16 12:53:09 +00:00
nobu b2c7ef2f76 * io.c (nogvl_copy_stream_sendfile): fix missing condition.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30217 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-15 02:22:08 +00:00
nobu eb36519b96 * io.c (simple_sendfile): enable on Mac OS X.
* io.c (nogvl_copy_stream_sendfile): moved precheck of copy length.
* io.c (nogvl_copy_stream_sendfile): should wait for both of
  read/write fds.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30215 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-15 02:07:37 +00:00
naruse bdd3f75598 * io.c (simple_sendfile): improve linux compatibility on FreeBSD,
and now it works. But without cpuset -l 0, it still gets stuck.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30210 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-14 15:01:32 +00:00
naruse 903538cbb3 * io.c (simple_sendfile): disable the use of sendfile(2) on
FreeBSD. It blocks on TestIO#test_copy_stream_socket.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30194 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-13 12:28:09 +00:00
naruse 7d481b5423 * io.c: define USE_SENDFILE on FreeBSD or DragonFly BSD.
Remove Mac OS X because its argument is different from them.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30193 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-13 09:37:09 +00:00
naruse b36c91b6b5 * io.c (simple_sendfile): added for BSD version of sendfile(2).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30190 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-13 02:34:50 +00:00
tarui 9865ee2c46 * io.c (io_read): duplicate string if shared. [ruby-dev:42719]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30122 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-07 13:38:36 +00:00
nobu bc8b100873 * io.c (struct argf): make lineno long, and reorder members.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29960 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-28 05:56:39 +00:00
luislavena ac0f5a53b6 * io.c (io_fwrite): use rb_w32_write_console under Windows.
* win32/win32.c (rb_w32_write_console): added to write to write
    Unicode using WriteConsoleW for stdout/stderr. [ruby-core:33166]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29955 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-27 19:49:58 +00:00
nobu c6e4767068 * include/ruby/io.h (rb_io_buffer_t): extract from rb_io_t.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29826 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-18 13:58:47 +00:00
nobu f2dd4eb3cc * io.c (argf_readlines): forward to current_file for arguments
check.  http://twitter.com/nagachika/status/3634254856589312


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29781 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-14 03:05:29 +00:00
nobu a77d2ac5ba * io.c (argf_close): untie tied io before closing.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29756 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-11 14:03:17 +00:00
nobu 41131d4215 * io.c (argf_write): add ARGF.write and so on.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29752 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-11 12:56:16 +00:00
nobu b3dcfcf22b * io.c (argf_read_nonblock): add ARGF.read_nonblock.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29751 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-11 12:52:18 +00:00
nobu db0ebb32c9 * io.c (pipe_finalize): status is success if no process.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-11 12:26:30 +00:00
nobu ee388f6ee2 * io.c (rb_io_readlines, rb_io_each_line): limit must not be zero.
a patch from Tomoyuki Chikanaga at [ruby-dev:42538].  #4024

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29694 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-04 15:39:07 +00:00
naruse f1dc85e237 * io.c (rb_f_select): change rdoc.
patched by Eito Katagiri [ruby-core:31805]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29547 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-21 07:09:17 +00:00
naruse d835a87cc1 * io.c (rb_f_select): add correct rdoc.
patched by Dave Thomas [ruby-core:32467]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29545 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-21 06:51:49 +00:00
nobu a176b065d2 * io.c (rb_io_ctl), parse.y (LVAR_USED): suppress warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29469 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-12 15:10:04 +00:00
naruse b487f7881f * io.c (rb_io_ungetc): always see Bignum. On 32bit valid value
may be a Bignum. On 64bit for errors. [ruby-dev:42366]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29454 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-12 09:30:42 +00:00
naruse 7587eb706a * io.c (rb_io_ungetc): use unsigned int for GB18030.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29448 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-12 06:37:27 +00:00
naruse 0a8f047a98 * io.c (rb_io_putc): support multibyte characters.
[ruby-core:30697]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-12 06:18:11 +00:00
naruse e1646652e7 * io.c (rb_io_set_encoding): use rb_funcall2 when the io is not
a T_FILE. [ruby-dev:42356]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29435 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-10 21:29:29 +00:00
nobu 915ae780c3 * io.c (fptr_finalize): write_mutex might have been destroyed
already in finalization phase, as the order of finalizers is not
  guaranteed.  rb_mutex_t should be used in place of Mutex object
  in the future.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29415 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-06 02:52:26 +00:00
nobu 61ee785c61 * io.c (rb_io_puts): fix for wide char encoding strings.
[ruby-dev:42212]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29256 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-15 00:12:05 +00:00
knu 82abe79b9f * class.c (rb_scan_args): Add support for optional keyword
argument hash.

* README.EXT, README.EXT.ja: Update documentation accordingly.

* dir.c (dir_initialize): Make use of the new rb_scan_args()
  feature.

* io.c (rb_io_s_popen, rb_scan_open_args, rb_io_initialize)
  (rb_io_s_pipe, open_key_args, io_s_foreach, io_s_readlines)
  (rb_io_s_read, rb_io_set_encoding): Ditto.

* transcode.c (str_transcode, econv_args)
  (econv_primitive_convert): Ditto.

* ext/zlib/zlib.c (rb_gzreader_initialize): Ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29214 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-10 07:51:58 +00:00
nobu aa5c05b8ba * ext/pty/pty.c (chfunc): pass through exceptions.
* io.c (rb_io_bufwrite, rb_io_bufread): added.

* process.c (rb_fork_err): protect from exceptions.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29171 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-02 21:40:55 +00:00
nobu 909477ec1d * file.c (null_device): move from io.c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29118 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-27 06:26:41 +00:00
nobu 3e5e1b6c45 * io.c (null_device): the name of null device. [ruby-dev:41791]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29110 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-27 03:25:08 +00:00
nobu dccf9e0c45 * configure.in, include/ruby/defines.h (RUBY_FUNC_EXPORTED): macro
to declare exported function.

* array.c (rb_ary_memsize), string.c (rb_str_memsize),
  variable.c (rb_objspace_data_type_memsize): used in
  objspace.  [ruby-dev:42022]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28982 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-14 06:33:06 +00:00
nobu a23b1f7450 * io.c (rb_io_memsize): constified.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28981 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-14 06:19:57 +00:00
akr 8488b62d59 update doc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-07 23:30:45 +00:00
nobu a3419bc919 * io.c (io_flush_buffer): write and buffer operations should be
monolithic.  [ruby-core:31348]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28687 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-20 03:50:41 +00:00
akr 5bf4c6a635 * io.c (nogvl_copy_stream_sendfile): jump to retry_sendfile directly
to avoid select() on a socket which TCP state is CLOSED.
  patch by Eric Wong.  [ruby-core:31053]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28557 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-06 13:59:12 +00:00
nobu 6fb59decd0 * io.c (swallow, prepare_getline_args, rb_io_getline_1): fix for
paragraph mode reading in non-ascii-compatible encoding.
  [ruby-dev:41803]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28537 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-04 08:13:15 +00:00
usa 09ee12bb20 * io.c (argf_inplace_mode_set): prohibits an assignment of a tainted
value.

* file.c (ruby_find_basename, ruby_find_extname): split from
  rb_file_s_basename() and rb_file_s_extname().

* util.c (ruby_add_suffix): support arbitrary length of the suffix
  to get rid of the potential buffer overflow.
  reported by tarui.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28525 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-02 14:31:26 +00:00
nobu a67f1a9534 * include/ruby/io.h, io.c: reverted r21709.
* ruby.c (load_file_internal): nothing to read if EOF reached
  while reading shebang.  [ruby-core:30910]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28451 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-27 14:31:19 +00:00
akr d9edd4ca87 * io.c (simple_sendfile): don't try to send data more than SSIZE_MAX
with single sendfile call..
  based on the patch by Eric Wong.  [ruby-core:30908]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28450 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-27 04:30:31 +00:00