summaryrefslogtreecommitdiff
path: root/io.c
AgeCommit message (Collapse)Author
2020-11-18fix public interfaceKoichi Sasada
To make some kind of Ractor related extensions, some functions should be exposed. * include/ruby/thread_native.h * rb_native_mutex_* * rb_native_cond_* * include/ruby/ractor.h * RB_OBJ_SHAREABLE_P(obj) * rb_ractor_shareable_p(obj) * rb_ractor_std*() * rb_cRactor and rm ractor_pub.h and rename srcdir/ractor.h to srcdir/ractor_core.h (to avoid conflict with include/ruby/ractor.h) Notes: Merged: https://github.com/ruby/ruby/pull/3775
2020-11-07Rename to `Fiber#set_scheduler`.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/3742
2020-10-28Fix error in update-deps due to tab/space differenceJeremy Evans
Notes: Merged: https://github.com/ruby/ruby/pull/3715
2020-10-21Don't redefine #rb_intern over and over againStefan Stüben
Notes: Merged: https://github.com/ruby/ruby/pull/3589
2020-10-20Some global variables can be accessed from ractorsKoichi Sasada
Some global variables should be used from non-main Ractors. [Bug #17268] ```ruby # ractor-local (derived from created ractor): debug '$DEBUG' => $DEBUG, '$-d' => $-d, # ractor-local (derived from created ractor): verbose '$VERBOSE' => $VERBOSE, '$-w' => $-w, '$-W' => $-W, '$-v' => $-v, # process-local (readonly): other commandline parameters '$-p' => $-p, '$-l' => $-l, '$-a' => $-a, # process-local (readonly): getpid '$$' => $$, # thread local: process result '$?' => $?, # scope local: match '$~' => $~.inspect, '$&' => $&, '$`' => $`, '$\'' => $', '$+' => $+, '$1' => $1, # scope local: last line '$_' => $_, # scope local: last backtrace '$@' => $@, '$!' => $!, # ractor local: stdin, out, err '$stdin' => $stdin.inspect, '$stdout' => $stdout.inspect, '$stderr' => $stderr.inspect, ``` Notes: Merged: https://github.com/ruby/ruby/pull/3670
2020-10-11Respect the original styles [ci skip]Nobuyoshi Nakada
2020-09-17Prefer to use `prep_io` for temporary IO instances.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/3550
2020-09-15Fix handling of FMODE_PREP.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/3542
2020-09-15Fix incorrect initialization of `rb_io_t::self`.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/3542
2020-09-14Prefer `rb_thread_current_scheduler`.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/3434
2020-09-14Add support for hooking `IO#read`.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/3434
2020-09-14Standardised scheduler interface.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/3434
2020-09-14Simplify bitmasks for IO events.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/3434
2020-09-12Check copy_file_range(2) is actually supported.Masaki Matsushita
see also: https://gitlab.com/gitlab-org/gitlab/-/issues/218999#note_363225872
2020-09-05break around function definition [ci skip]Nobuyoshi Nakada
2020-09-03Introduce Ractor mechanism for parallel executionKoichi Sasada
This commit introduces Ractor mechanism to run Ruby program in parallel. See doc/ractor.md for more details about Ractor. See ticket [Feature #17100] to see the implementation details and discussions. [Feature #17100] This commit does not complete the implementation. You can find many bugs on using Ractor. Also the specification will be changed so that this feature is experimental. You will see a warning when you make the first Ractor with `Ractor.new`. I hope this feature can help programmers from thread-safety issues. Notes: Merged: https://github.com/ruby/ruby/pull/3365
2020-08-29IO.copy_stream: handle EOPNOTSUP instead of ENOTSUPMasaki Matsushita
2020-08-29IO.copy_stream: handle ENOTSUP on copy_file_range(2)Masaki Matsushita
fallback to other methods on ENOTSUP. some RedHat kernels may return ENOTSUP on an NFS mount. [Feature #16965]
2020-08-12Fix corruption in ARGF.inplacePeter Zhu
Extension string stored in `ARGF.inplace` is created using an api designed for C string constants to create a Ruby string that points at another Ruby string. When the original string is swept, the extension string gets corrupted. Reproduction script (on MacOS): ```ruby #!/usr/bin/ruby -pi.bak BEGIN { GC.start(full_mark: true) arr = [] 1000000.times do |x| arr << "fooo#{x}" end } puts "hello" ``` Co-Authored-By: Matt Valentine-House <31869+eightbitraptor@users.noreply.github.com> Notes: Merged: https://github.com/ruby/ruby/pull/3409 Merged-By: nobu <nobu@ruby-lang.org>
2020-07-20Remove trailing spaces [ci skip]Nobuyoshi Nakada
2020-07-20Rename `rb_current_thread_scheduler` to `rb_thread_scheduler_if_nonblocking`.Samuel Williams
Correctly capture thread before releasing GVL and pass as argument to `rb_thread_scheduler_if_nonblocking`. Notes: Merged: https://github.com/ruby/ruby/pull/3323
2020-06-29add UNREACHABLE_RETURN卜部昌平
Not every compilers understand that rb_raise does not return. When a function does not end with a return statement, such compilers can issue warnings. We would better tell them about reachabilities. Notes: Merged: https://github.com/ruby/ruby/pull/3247
2020-06-29rb_io_modestr_fmode: do not goto into a branch卜部昌平
I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor. Notes: Merged: https://github.com/ruby/ruby/pull/3247
2020-06-29rb_io_each_codepoint: do not goto into a branch卜部昌平
I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor. Notes: Merged: https://github.com/ruby/ruby/pull/3247
2020-05-21Fixed a variable name [Bug #16903]Nobuyoshi Nakada
Fix up of 0e3b0fcdba7 From: fd0 (Daisuke Fujimura)
2020-05-14Thread scheduler for light weight concurrency.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/3032 Merged-By: ioquatix <samuel@codeotaku.com>
2020-05-11sed -i 's|ruby/impl|ruby/internal|'卜部昌平
To fix build failures. Notes: Merged: https://github.com/ruby/ruby/pull/3079
2020-05-11sed -i s|ruby/3|ruby/impl|g卜部昌平
This shall fix compile errors. Notes: Merged: https://github.com/ruby/ruby/pull/3079
2020-04-17Refactored rb_readwrite_syserr_failNobuyoshi Nakada
* renamed argument `writable` as `waiting` * hosited out creating and raising exception * turned into a `switch`
2020-04-15Raise EPIPE at broken pipe for the backward compatibilityNobuyoshi Nakada
Instead of SignalException for SIGPIPE, raise `Errno::EPIPE` with instance variable `signo` and re-send that signal at exit. [Feature #14413] Notes: Merged: https://github.com/ruby/ruby/pull/3035
2020-04-12PAGER without fork&exec too [Feature #16754]Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/3000
2020-04-11Silence broken pipe error messages on STDOUT [Feature #14413]Nobuyoshi Nakada
Raise `SignalException` for SIGPIPE to abort when EPIPE occurs. Notes: Merged: https://github.com/ruby/ruby/pull/3013 Merged-By: nobu <nobu@ruby-lang.org>
2020-04-10Make `#inspect` interruptible in `Kernel#p`Nobuyoshi Nakada
Only writing the inspected result and a newline is uninterruptible.
2020-04-10Constified writev function familyNobuyoshi Nakada
2020-04-08Merge pull request #2991 from shyouhei/ruby.h卜部昌平
Split ruby.h Notes: Merged-By: shyouhei <shyouhei@ruby-lang.org>
2020-03-27Set external encoding correctly for File.open('f', FILE::BINARY) on WindowsJeremy Evans
Previously, the external encoding was only set correctly for File::BINARY if keyword arguments were provided. This copies the logic for the keyword arguments case to the no keyword arguments case. Possibly it should be refactored into a separate function. Fixes [Bug #16737] Notes: Merged: https://github.com/ruby/ruby/pull/2985
2020-02-27Remove support for passing nil to IO#ungetcJeremy Evans
Fixes [Bug #13675] Notes: Merged: https://github.com/ruby/ruby/pull/2935
2020-02-23Warn non-nil `$/` [Feature #14240]Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/2920
2020-02-23Warn non-nil `$\` [Feature #14240]Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/2920
2020-02-23Warn non-nil `$,` in `IO#print` tooNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/2920
2020-02-18Pass keyword arguments to IOs properly [Bug #16639]Nobuyoshi Nakada
2020-01-22Drop executable bit set by 25f2005a638570cce832d218a451072057610f06Nobuyoshi Nakada
2020-01-21Also check EWOULDBLOCK as well as EAGAINNobuyoshi Nakada
2020-01-21fix load error with EAGAINXia Xionjun
This is a fix related to the following issue. rails/rails#33464 Not only in rails apps, some little ruby app with only 2 or 3 ruby files reproduce the problem during many years. When I edit linux ruby files by vs code via samba on windows, and then I execute the ruby files on linux, "require_relative" will sometimes not work properly. My solution is to wait a monument if the required relative file is busy. Notes: Merged: https://github.com/ruby/ruby/pull/2702
2020-01-09io.c, ruby.c: include internal/variable.h for rb_gvar_readonly_setterYusuke Endoh
Same as 053f78e13988e9253d1f207bf5e23d9505112b32. emscripten requires a prototype declaration of rb_gvar_readonly_setter if it is refered as a function pointer.
2019-12-29Separate builtin initialization callsNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/2792
2019-12-26decouple internal.h headers卜部昌平
Saves comitters' daily life by avoid #include-ing everything from internal.h to make each file do so instead. This would significantly speed up incremental builds. We take the following inclusion order in this changeset: 1. "ruby/config.h", where _GNU_SOURCE is defined (must be the very first thing among everything). 2. RUBY_EXTCONF_H if any. 3. Standard C headers, sorted alphabetically. 4. Other system headers, maybe guarded by #ifdef 5. Everything else, sorted alphabetically. Exceptions are those win32-related headers, which tend not be self- containing (headers have inclusion order dependencies). Notes: Merged: https://github.com/ruby/ruby/pull/2711
2019-12-20Refined the warning message for $, and $;Nobuyoshi Nakada
[Bug #16438]
2019-12-19Added rb_warn_deprecatedNobuyoshi Nakada
2019-12-15IO#set_encoding_by_bom should err when encoding is already setNobuyoshi Nakada
Except for ASCII-8BIT. [Bug #16422]