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

1068 Коммитов

Автор SHA1 Сообщение Дата
akr 60e078c860 * io.c: use select() appropriately for sendfile().
Fixed by Eric Wong.  [ruby-core:36150]
  (maygvl_copy_stream_wait_readwrite): removed.
  (nogvl_copy_stream_sendfile): use nogvl_copy_stream_wait_write and
  maygvl_copy_stream_wait_read instead of
  maygvl_copy_stream_wait_readwrite.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32019 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-12 02:18:51 +00:00
nobu 34b19050b3 * io.c (io_getc): should be 7bit if ascii. fixes #4557
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32000 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-11 09:02:11 +00:00
akr 87f025da25 * io.c: fix IO.copy_stream interrupt handling.
based on the patch by Eric Wong.  [ruby-core:36156]

* vm_core.h (rb_thread_call_with_gvl): don't declare here.

* thread.c: include internal.h.
  (rb_thread_execute_interrupts): new function.

* internal.h (rb_thread_execute_interrupts): declared.
  (rb_thread_call_with_gvl): declared.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31971 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-09 15:02:46 +00:00
usa 19c78f9b9b * io.c (io_fflush): windows -- call fsync() only when the FD is tied to
file, because if the FD is pipe, it blocks.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31909 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-03 10:59:37 +00:00
usa fd8010fc0a * io.c (rb_io_s_write, rb_io_s_binwrite): return!!!
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31905 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-02 11:06:40 +00:00
sorah 7b3948f055 * io.c: Add File.write, File.binwrite. [Feature #1081] [ruby-core:21701]
* test/ruby/test_io.rb: Test for File.write, File.binwrite.

* NEWS: News for above.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31902 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-02 07:30:11 +00:00
usa 2b0363df5d * io.c (io_flush, rb_io_flush): need to fsync() when ruby calls internal
flush. [ruby-core:36670] [Bug #4813]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31901 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-02 03:35:40 +00:00
ryan 38de163f1e doco: p outputs newline regardless of record separator
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31883 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-01 00:48:09 +00:00
nobu fcc86b0f4c * io.c (io_encoding_set): should honor already set ecflags since it
might be set by mode option.  fixed #4804

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-31 16:15:15 +00:00
nobu a010ea9a45 no space inside parens
* io.c: remove spaces before closing parens.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31866 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-31 15:05:09 +00:00
usa da1db8b454 * io.c (rb_io_s_pipe): potential bug. the mode of read IO is set as
DEFAULT_TEXTMODE in call of io_set_encoding(), and of write IO is
  also set as it in call of io_new_instance() via rb_protect().
  so, if DEFAULT_TEXTMODE is not 0, we should check the result of
  extract_binmode() and avoid crush of default IO mode and the result.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31859 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-31 05:21:36 +00:00
naruse 9efb5a9d6a * io.c (fill_cbuf): return MORE_CHAR_SUSPENDED when cbuf is not empty.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31758 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-27 18:06:42 +00:00
kosaki 78271e8c72 * io.c (fill_cbuf): Fix test-all crash.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31755 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-27 17:09:27 +00:00
nobu b5bc09d234 * io.c (validate_enc_binmode): do not clear textmode flag if
default.  fixed #4732

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31748 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-27 13:45:12 +00:00
nobu 9909c67583 * io.c (fill_cbuf): finish reading at EOF.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31747 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-27 13:38:56 +00:00
kosaki 67cf354b46 * io.c (rb_io_extract_modeenc): accept combination hash and
File::Constants. (eg. File.open('yo', :mode => File::WRONLY))
  [Feature #4742][ruby-core:36338]
* test/ruby/test_io.rb (TestIO#test_open_mode): new test.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31671 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-21 13:20:43 +00:00
kosaki 898374126e revert O_CLOEXEC patch series completely.
because boron chkbuild test result says, An old linux kernel ignore O_CLOEXEC
silently instead of return an error. It may lead to bring new security risk.
So, we have to be pending it until finish to implement proper fallback logic.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31643 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-19 12:18:41 +00:00
nobu 3a47cf3395 * remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31573 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-15 11:55:52 +00:00
kosaki 836a8cf214 * io.c (select_internal): remove unused variable (interrupt_flag).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-12 17:16:21 +00:00
kosaki be62297f92 * io.c (Init_IO): Added File::CLOEXEC constant. [ruby-core:22893] [Feature #1291]
* test/ruby/test_io.rb (TestIO#test_o_cloexec): test for File::CLOEXEC.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31430 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-04 11:29:24 +00:00
kosaki d7fa4d837e * io.c (rb_f_select): remove useless ifdef.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31425 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-04 02:54:34 +00:00
kosaki 9be37ca7d5 * thread.c (rb_wait_for_single_fd): new.
* thread.c (select_single): select(2) based backend for rb_wait_for_single_fd().

* io.c (make_writeconv): use rb_wait_for_single_fd() instaed of
  rb_thread_fd_select().
* io.c (rb_io_wait_readable): ditto.
* thread.c (rb_thread_wait_fd_rw): ditto.

* io.c (wait_readable): removed.
* thread.c (init_set_fd): new helper function.
* include/ruby/io.h (RB_WAITFD_IN, RB_WAITFD_PRI, RB_WAITFD_OUT):
  new constant for rb_single_wait_fd().

The patch was written by Eric Wong. [Ruby 1.9 - Feature #4531]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31419 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-04 00:59:57 +00:00
kosaki 2d2544c8e6 * include/ruby/intern.h (rb_thread_select): mark as deprecated.
* ext/io/wait/wait.c (wait_readable): use rb_thread_fd_select
  instead of rb_thread_select.
* ext/socket/init.c (wait_connectable0): ditto.
* ext/readline/readline.c (readline_event): ditto.
* io.c (rb_io_wait_readable, wait_readable, rb_io_wait_writable,
  wait_writable): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31394 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-30 11:15:15 +00:00
kosaki 98c7ca9b65 * io.c (copy_stream_body, rb_io_s_copy_stream): move rb_fd_init()
from copy_stream_body to rb_io_s_copy_stream. fds of passing
  rb_fd_term() have to be guaranteed initialized.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31391 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-30 07:30:45 +00:00
nobu 85c1d5d41d * io.c (make_writeconv): do not add textmode newline decorator if any
newline decorator is set already.  fixes #4618, fixes #4619

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31377 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-29 01:24:54 +00:00
nobu 9c48e59907 * io.c (rb_io_extract_modeenc, rb_f_backquote): set default text
mode.  fixes #4619
* io.c (pipe_open): set universal newline decorator if needed.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31367 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-27 21:06:59 +00:00
nobu 8761467727 * io.c (validate_enc_binmode, rb_io_extract_modeenc): set newline
decorator according to open mode.
* transcode.c (rb_econv_prepare_options): new function, to prepare
  econv options with newline flags.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31355 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-26 15:55:21 +00:00
kazu fb7f3bf37c * io.c (rb_f_syscall): reduce warning: "HAVE___SYSCALL" is not defined.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31272 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-14 07:02:54 +00:00
kazu c5a284aa17 * io.c (rb_io_fdatasync): remove unused variable.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31268 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-13 11:22:34 +00:00
kosaki 0f771e33e2 * io.c: revert r31230.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31261 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-11 12:52:22 +00:00
kosaki 3ba502d5f0 * io.c (rb_io_syswrite): While local FS writes are usually
buffered, the buffers can be full or the file opened with
  O_SYNC. IO#syswrite can also be used on blocking IOs
  (pipe/socket) just like IO#write.
  The patch is written by Eric Wong. [ruby-core:35554]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31237 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-04 12:43:28 +00:00
kosaki f4755f214c * configure.in: disable fdatasync again on Mac OS X.
[ruby-core:35493][Bug #4500]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31232 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-03 12:35:29 +00:00
kosaki f35a7770cd * io.c (io_reopen): IO#close releases GVL if possible.
close() may block for certain file types (NFS, SO_LINGER
  sockets, inotify), so let other threads run. The patch was
  created by Eric Wong [ruby-core:35555][Bug #4527]

* io.c (fptr_finalize): ditto.

* io.c (maygvl_fclose): new.
* io.c (nogvl_fclose): ditto.
* io.c (maygvl_close): ditto.
* io.c (nogvl_close): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31230 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-03 12:23:59 +00:00
kosaki b2a8d109b6 * io.c (io_cntl): use rb_thread_io_blocking_region() instead
rb_thread_blocking_region().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31029 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-05 18:23:55 +00:00
kosaki c0359f8176 * io.c (io_cntl, nogvl_io_cntl): IO.fcntl() and IO.ioctl()
release GVL during calling kernel interface.
  Suggested by Eric Wong. [ruby-core:35417][Bug #4463]

* test/ruby/test_io.rb (TestIO#test_fcntl_lock): add new test for
  IO.fcntl().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31025 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-04 16:38:34 +00:00
kosaki ff07709777 * io.c (io_cntl): change 'cmd' type to int. ioctl and fcntl need to
be passed int.
* io.c (rb_io_ctl): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31022 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-04 13:02:45 +00:00
nobu e7c0a6e1d7 * prevent temporary objects from GC, and should not use
RSTRING_PTR() for function calls since it evaluates the argument
  a couple of times.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-20 07:23:55 +00:00
nobu 58b325366d * thread.c (rb_thread_io_blocking_region): new function to run
blocking region with GIL released, for fd.
* thread.c (rb_thread_fd_close): implement.  [ruby-core:35203]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30852 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-12 05:44:23 +00:00
kosaki 0559227e87 * io.c (rb_io_s_sysopen): use NUM2MODET() instead NUM2UINT().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30823 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-08 07:04:45 +00:00
kosaki 3722e3a29a * io.c (rb_io_fdatasync): Use fsync(2) if if the underlying
operating system does not support fdatasync(2).



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30762 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-02 08:11:29 +00:00
kanemoto 2a5177e757 io.c (struct argf): char behaves like an unsigned char by default on AIX.
http://publib.boulder.ibm.com/infocenter/comphelp/v111v131/index.jsp?topic=/com.ibm.xlcpp111.aix.doc/language_ref/ch.html


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30726 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-30 01:02:46 +00:00
kosaki 4afa5fead8 * io.c (rb_io_open): Use NUM2MODET() instead NUM2UINT().
* io.c (rb_scan_open_args): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30686 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-28 02:23:58 +00:00
nobu 7909af18ed * io.c (argf_next_argv): go advance when the next file cannot be
read.  [ruby-core:34446]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30536 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-13 22:30:50 +00:00
kosaki b1f8bbf4f7 * io.c (rb_f_syscall): Add warning messages. [ruby-core:34062]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30527 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-12 14:22:39 +00:00
kosaki da235830b5 * io.c (rb_f_syscall): Some syscall return unsigned or pointer value.
Therefore we should only check the result is -1 or not. [ruby-core:34062]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30526 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-12 14:16:01 +00:00
kosaki caab5dcee7 * io.c (rb_f_syscall): Add 64bit Linux support. Some syscall takes
long type arguments.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30525 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-12 14:11:06 +00:00
yugui 45493bb28a * io.c (Kernel.#syscall): implemented on LP64/LLP64 environments too.
also uses __syscall if available for *BSD on 64bit architecture.
  [ruby-core:34062]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30499 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-09 07:39:22 +00:00
akr d3b337c58d fix spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30495 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-08 13:07:20 +00:00
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