aboutsummaryrefslogtreecommitdiffstats
path: root/io.c
Commit message (Collapse)AuthorAgeFilesLines
* * io.c (Init_IO): Added File::CLOEXEC constant. [ruby-core:22893] [Feature ↵kosaki2011-05-041-0/+4
| | | | | | | | | | #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
* * io.c (rb_f_select): remove useless ifdef.kosaki2011-05-041-8/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31425 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (rb_wait_for_single_fd): new.kosaki2011-05-041-40/+2
| | | | | | | | | | | | | | | | | | | | * 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
* * include/ruby/intern.h (rb_thread_select): mark as deprecated.kosaki2011-04-301-4/+4
| | | | | | | | | | | | | * 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
* * io.c (copy_stream_body, rb_io_s_copy_stream): move rb_fd_init()kosaki2011-04-301-1/+1
| | | | | | | | | 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
* * io.c (make_writeconv): do not add textmode newline decorator if anynobu2011-04-291-1/+2
| | | | | | 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
* * io.c (rb_io_extract_modeenc, rb_f_backquote): set default textnobu2011-04-271-2/+5
| | | | | | | 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
* * io.c (validate_enc_binmode, rb_io_extract_modeenc): set newlinenobu2011-04-261-13/+29
| | | | | | | | 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
* * io.c (rb_f_syscall): reduce warning: "HAVE___SYSCALL" is not defined.kazu2011-04-141-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31272 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_io_fdatasync): remove unused variable.kazu2011-04-131-1/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31268 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c: revert r31230.kosaki2011-04-111-43/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31261 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_io_syswrite): While local FS writes are usuallykosaki2011-04-041-1/+1
| | | | | | | | | | | 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
* * configure.in: disable fdatasync again on Mac OS X.kosaki2011-04-031-2/+3
| | | | | | | | [ruby-core:35493][Bug #4500] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31232 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (io_reopen): IO#close releases GVL if possible.kosaki2011-04-031-4/+43
| | | | | | | | | | | | | | | | | 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
* * io.c (io_cntl): use rb_thread_io_blocking_region() insteadkosaki2011-03-051-1/+1
| | | | | | | | rb_thread_blocking_region(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31029 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (io_cntl, nogvl_io_cntl): IO.fcntl() and IO.ioctl()kosaki2011-03-041-13/+32
| | | | | | | | | | | | 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
* * io.c (io_cntl): change 'cmd' type to int. ioctl and fcntl need tokosaki2011-03-041-3/+3
| | | | | | | | | 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
* * prevent temporary objects from GC, and should not usenobu2011-02-201-2/+3
| | | | | | | 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
* * thread.c (rb_thread_io_blocking_region): new function to runnobu2011-02-121-4/+5
| | | | | | | 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
* * io.c (rb_io_s_sysopen): use NUM2MODET() instead NUM2UINT().kosaki2011-02-081-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30823 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_io_fdatasync): Use fsync(2) if if the underlyingkosaki2011-02-021-4/+8
| | | | | | | | operating system does not support fdatasync(2). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30762 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* io.c (struct argf): char behaves like an unsigned char by default on AIX.kanemoto2011-01-301-1/+1
| | | | | | | 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
* * io.c (rb_io_open): Use NUM2MODET() instead NUM2UINT().kosaki2011-01-281-2/+2
| | | | | | | | * io.c (rb_scan_open_args): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30686 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (argf_next_argv): go advance when the next file cannot benobu2011-01-131-1/+1
| | | | | | read. [ruby-core:34446] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30536 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_f_syscall): Add warning messages. [ruby-core:34062]kosaki2011-01-121-0/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30527 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_f_syscall): Some syscall return unsigned or pointer value.kosaki2011-01-121-1/+2
| | | | | | | | 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
* * io.c (rb_f_syscall): Add 64bit Linux support. Some syscall takeskosaki2011-01-121-0/+12
| | | | | | | | long type arguments. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30525 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (Kernel.#syscall): implemented on LP64/LLP64 environments too.yugui2011-01-091-48/+72
| | | | | | | 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
* fix spaces.akr2011-01-081-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30495 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (maygvl_copy_stream_wait_readwrite): define if USE_SENDFILEnobu2010-12-291-16/+16
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30425 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix a typokazu2010-12-271-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30410 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (advice_arg_check): Change argument check.kosaki2010-12-251-5/+19
| | | | | | | | | 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
* * io.c (pipe_open): Added rb_thread_atfork(). We must reinitializekosaki2010-12-251-0/+1
| | | | | | | | | GVL at new process creation. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30364 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_io_extract_encoding_option): accept Encoding object asnobu2010-12-251-4/+12
| | | | | | encoding: optional argument. [ruby-dev:42884] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30349 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c : add an extra byte to buffer for the specification of readtarui2010-12-201-36/+34
| | | | | | | | 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
* * io.c (Init_IO): Added O_DIRECT. This feature was propsed by Run ↵kosaki2010-12-191-0/+4
| | | | | | | | | | 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
* * io.c: removed garbage line.nobu2010-12-161-1/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_io_advise): removed unused variable, and fix indent.nobu2010-12-161-15/+15
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fix indentationkosaki2010-12-161-32/+32
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30231 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (rb_io_advise): New API. IO#advise() allows to tell thekosaki2010-12-161-0/+161
| | | | | | | | | | | | | | 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
* * io.c: parenthesize macro arguments.akr2010-12-161-12/+12
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30227 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (nogvl_copy_stream_sendfile): fix missing condition.nobu2010-12-151-0/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30217 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (simple_sendfile): enable on Mac OS X.nobu2010-12-151-15/+30
| | | | | | | | * 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
* * io.c (simple_sendfile): improve linux compatibility on FreeBSD,naruse2010-12-141-5/+12
| | | | | | 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
* * io.c (simple_sendfile): disable the use of sendfile(2) onnaruse2010-12-131-3/+6
| | | | | | 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
* * io.c: define USE_SENDFILE on FreeBSD or DragonFly BSD.naruse2010-12-131-1/+3
| | | | | | 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
* * io.c (simple_sendfile): added for BSD version of sendfile(2).naruse2010-12-131-8/+28
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30190 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (io_read): duplicate string if shared. [ruby-dev:42719]tarui2010-12-071-1/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30122 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (struct argf): make lineno long, and reorder members.nobu2010-11-281-6/+5
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29960 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (io_fwrite): use rb_w32_write_console under Windows.luislavena2010-11-271-0/+4
| | | | | | | * 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