Repository navigation
C API: rb_io_t for GetOpenFile, IO waits, fd sets - #243
Merged
Merged
Conversation
Extensions that use GetOpenFile/RB_IO_POINTER read RFILE(io)->fptr, and ruby/spec's io specs failed on everything that goes through it, plus the rb_io_maybe_wait family, rb_fd_* and rb_thread_fd_select, all of which were NotImplementedError stubs. - An IO's handle slot now points at a native struct rb_io that rb_io_taint_check fills in (self, fd, FMODE_* mode, pathv). The layout comes from the shim, compiled from the headers, so C# does not repeat it. The rb_io_t* functions (rb_io_check_closed/readable/writable, rb_io_set_nonblock) find the IO again through fptr->self. - rb_io_wait goes through IO.select. rb_io_maybe_wait* and the descriptor waits are in C, where errno.h has the platform's values. - rb_thread_fd_select selects in 100ms slices with rb_thread_check_ints in between, so Thread#raise and #kill still reach a waiting thread. - rb_fd_*, rb_cloexec_*, rb_fd_fix_cloexec follow thread.c and io.c. capi specs: 221 failures and errors -> 168, none new. io_spec.rb is down to rb_fd_fix_cloexec, which needs File#fileno to be the OS descriptor.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #242 (base
capi-batch1); retarget to master once that merges.Extensions that use
GetOpenFile/RB_IO_POINTERreadRFILE(io)->fptr. ruby/spec's io specs failed on everything that goes through it. They also failed on therb_io_maybe_waitfamily,rb_fd_*andrb_thread_fd_select, which were all NotImplementedError stubs.rb_io_t: an IO's handle slot now points at a nativestruct rb_io, whichrb_io_taint_checkfills in withself,fd, theFMODE_*mode andpathv. The shim compiles the layout from the headers (rb_ir_io_layout). Therb_io_t *functions find the IO again throughfptr->self:rb_io_check_closed/readable/writable,rb_io_set_nonblock.rb_io_waitgoes throughIO.select.rb_io_maybe_wait*and the descriptor waits (rb_io_wait_readable(fd),rb_wait_for_single_fd,rb_thread_wait_fd) are in C, whereerrno.hhas the platform's values.rb_thread_fd_selectselects in 100 ms slices withrb_thread_check_intsin between. That way Thread#raise and #kill still reach a thread waiting there.rb_fd_*,rb_cloexec_*,rb_fd_fix_cloexec.Specs
spec/optional/capion Linux:None of the remaining failures are new.
io_spec.rbnow has 1 failure out of 85 examples:rb_fd_fix_cloexec. That one needsFile#filenoto be the OS descriptor, and IronRuby's is a virtual one for files.