summaryrefslogtreecommitdiff
path: root/io.c
AgeCommit message (Collapse)Author
25 hoursPre-allocate IO.select result arrays based on input size (#15850)Chris Hasiński
io.c: pre-allocate IO.select result arrays based on input size The ternary (rp?rb_ary_new():rb_ary_new2(0)) became pointless after commit a51f30c671 (Variable Width Allocation, Mar 2022) made both rb_ary_new() and rb_ary_new2(0) equivalent. Instead of just removing the dead code, improve on the original intent by pre-allocating based on the actual input array size. This avoids reallocations when many FDs are ready. Benchmark (100 ready FDs): ~8% improvement (5.59 -> 5.11 us/op)
2025-12-26[DOC] Use Japanese for multi-byte characters (#15745)Burdette Lamar
2025-12-26[DOC] Remove outdated documentation about command injectionJean Boussier
[Feature #19630] This dangerous behavior was removed in 4.0 (996cae65f3cc8fed60c6bb758b00882cac49389d) but the documentation wasn't updated.
2025-12-20remove obsolete workaroundYO4
This appears to be a workaround for Windows XP behavior. It is unnecessary now.
2025-12-19Fiber scheduler: invoke `#io_write` hook on IO flush (#15609)Sharon Rosner
Previously, calling IO#flush or closing an IO with unflushed buffered writes would just invoke `#blocking_operation_wait` and flush the write buffer using a `write` syscall. This change adds flushing through the fiber scheduler by invoking the `#io_write` hook. * Prefer IO::Buffer#write in IOScheduler * Use Dir.tmpdir for test file * Correctly handle errors in io_flush_buffer_fiber_scheduler
2025-12-12Fewer calls to `GET_EC()` and `GET_THREAD()` (#15506)Luke Gruber
The changes are to `io.c` and `thread.c`. I changed the API of 2 exported thread functions from `internal/thread.h` that didn't look like they had any use in C extensions: * rb_thread_wait_for_single_fd * rb_thread_io_wait I didn't change the following exported internal function because it's used in C extensions: * rb_thread_fd_select I added a comment to note that this function, although internal, is used in C extensions.
2025-12-08Re-introduce support for `io_close` hook. (#15434)Samuel Williams
2025-12-06Fix `io_pwrite` fiber scheduler hook. (#15428)Samuel Williams
Fix io_pwrite fiber scheduler hook.
2025-12-05[Bug #21764] Propagate the encoding of ID to warningNobuyoshi Nakada
2025-11-27Reorganize page documentations (#15154)Stan Lo
Re-organize page docs
2025-11-23Don't use non blocking pipes for RUBY_CRASH_REPORTPeter Zhu
[Bug #21703] RUBY_CRASH_REPORT does not work in some cases when shelling out on Linux. For example, given the following shell script dump.sh: #!/usr/bin/env bash cat > /tmp/crash And we see it fails like this: $ RUBY_CRASH_REPORT="|dump.sh" ruby -rfiddle -e "Fiddle::Pointer.new(1, 10)[0]" cat: -: Resource temporarily unavailable
2025-11-15refactor io_each_codepointYO4
2025-11-13[Bug #21683] Respect reading encoding at `each_codepoint`Nobuyoshi Nakada
2025-11-07Depricate IO operation with `|`Nobuyoshi Nakada
2025-10-29[Bug #21625] Allow io/wait methods with `IO#ungetc` in text modeNobuyoshi Nakada
2025-10-11For prism parser, do not update $_ from STDINKevin Newton
Fixes [Bug #21635]
2025-09-22Clarify what happens when IO.popen's block returns (#14626)Randy Stauner
2025-09-08Allow IO#each_codepoint to work with unetc even when encoding conversion activeYO4
Using IO#each_codepoint together with IO#ungetc causes an unwanted exception when encoding conversion is active. C:\>ruby -e "open('NUL', 'rt') { |f| f.ungetc('aa'); f.each_codepoint { |c| p c }}" 97 -e:1:in 'IO#each_codepoint': byte oriented read for character buffered IO (IOError) from -e:1:in 'block in <main>' from -e:1:in 'Kernel#open' from -e:1:in '<main>' Fixes [Bug #21131]
2025-07-31Make ARGF not pin references during markingPeter Zhu
ARGF supports compaction, but it pins all of its references, which means that none of it can move. This commit changes it to actually support compaction.
2025-07-12[Bug #21509] [DOC] Correct `IO#wait` descriptionNobuyoshi Nakada
2025-07-01[DOC] Fix ARGF exampleKevin Saison
2025-06-27[DOC] Remove a garbage in an exampleNobuyoshi Nakada
2025-06-27[DOC] Fix backquote exit status docsKenyon Ralph
It is `exitstatus`, not `status`, per https://github.com/ruby/ruby/blob/3d5619c8b1a76626e0991d758b71afc549829c38/process.c#L581
2025-05-16Don't enumerate `io->blocking_operations` if fork generation is different. ↵Samuel Williams
(#13359) Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2025-05-15Ensure that forked process do not see invalid blocking operations. (#13343)Samuel Williams
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2025-05-13Make `waiting_fd` behaviour per-IO. (#13127)Samuel Williams
- `rb_thread_fd_close` is deprecated and now a no-op. - IO operations (including close) no longer take a vm-wide lock. Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2025-04-19Fix style [ci skip]Nobuyoshi Nakada
2025-04-19Tidy up `rb_io_fptr_finalize`. (#13136)Samuel Williams
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2025-04-19Ensure `struct rb_io` is passed through to `thread.c`. (#13134)Samuel Williams
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2025-04-18Update usage of `enum rb_io_mode`. (#13128)Samuel Williams
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2025-04-16Introduce `enum rb_io_mode`. (#7894)Samuel Williams
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2025-04-15`IO.select` accepts +Float::INFINITY+ as a timeout argument.Tanaka Akira
matz accepted at the developper meeting 2024-07-11.
2025-03-31Provide compaction support for argf_typeMatt Valentine-House
Notes: Merged: https://github.com/ruby/ruby/pull/13021
2025-03-27Freeze $/ and make it ractor safeÉtienne Barrié
[Feature #21109] By always freezing when setting the global rb_rs variable, we can ensure it is not modified and can be accessed from a ractor. We're also making sure it's an instance of String and does not have any instance variables. Of course, if $/ is changed at runtime, it may cause surprising behavior but doing so is deprecated already anyway. Co-authored-by: Jean Boussier <jean.boussier@gmail.com> Notes: Merged: https://github.com/ruby/ruby/pull/12975
2025-03-23Fix handling of `error`/`errno` in `io_internal_wait`. (#12961)Samuel Williams
[Bug #21195] Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2025-02-18Ensure IO.copy_stream buffer is an independent stringJeremy Evans
Otherwise, changes to the buffer by the destination write method could result in data changing for supposedly independent strings. Fixes [Bug #21131] Notes: Merged: https://github.com/ruby/ruby/pull/12771
2025-01-02[Bug #20995] Protect `IO.popen` block from exiting by exceptionNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/12497
2025-01-02[DOC] Exclude 'Class' and 'Module' from RDoc's autolinkingNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/12496
2025-01-02[DOC] Exclude 'Process' from RDoc's autolinkingNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/12496
2024-12-11Use `rb_str_conv_enc` for simplicityNobuyoshi Nakada
2024-12-10[Bug #20924] Fix reading with delimiter in wide character encodingsNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/12304
2024-11-07[Bug #20869] Discard read buffer and encoding converters at seekingNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/12023
2024-11-07[Bug #20802] Copy encodings at reopen as wellNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/12022
2024-10-07[Bug #20787] Check the separator in `IO#readline` as well as 3.2Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/11811
2024-10-05Introduce `rb_io_blocking_region` which takes `struct rb_io` argument. (#11795)Samuel Williams
This does not change any actual behaviour, but provides a choke point for blocking IO operations. * Update `IO::Buffer` to use `rb_io_blocking_region`. * Update `File` to use `rb_io_blocking_region`. * Update `IO` to use `rb_io_blocking_region`. Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2024-10-04Better handling of timeout in `rb_io_maybe_wait_*`. (#9531)Samuel Williams
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2024-09-26Import patches for old macOS from MacPortsNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/11690
2024-09-04[Bug #20708] Retry `open` on EINTRNobuyoshi Nakada
Co-Authored-By: Martin Dorey <martin.dorey@hds.com> Notes: Merged: https://github.com/ruby/ruby/pull/11537
2024-06-19[DOC] IO#close on closed IO is not an error.Tanaka Akira
2024-06-02IO.select accepts a numeric value as timeout.Tanaka Akira
[DOC] IO.select accepts a numeric value as timeout, not only an integer.