diff options
author | Samuel Williams <samuel.williams@oriontransfer.co.nz> | 2023-05-30 10:02:40 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-30 10:02:40 +0900 |
commit | 18e55fc1e1ec20e8f3166e3059e76c885fc9f8f2 (patch) | |
tree | 7e35773b3cd1ae50a0a94937df7fb175a3bed9ba /ext/objspace | |
parent | 7ddcd0622f3275effa603c16934b0215cc8a542b (diff) | |
download | ruby-18e55fc1e1ec20e8f3166e3059e76c885fc9f8f2.tar.gz |
Hide most of the implementation of `struct rb_io`. (#6511)
* Add rb_io_path and rb_io_open_descriptor.
* Use rb_io_open_descriptor to create PTY objects
* Rename FMODE_PREP -> FMODE_EXTERNAL and expose it
FMODE_PREP I believe refers to the concept of a "pre-prepared" file, but
FMODE_EXTERNAL is clearer about what the file descriptor represents and
aligns with language in the IO::Buffer module.
* Ensure that rb_io_open_descriptor closes the FD if it fails
If FMODE_EXTERNAL is not set, then it's guaranteed that Ruby will be
responsible for closing your file, eventually, if you pass it to
rb_io_open_descriptor, even if it raises an exception.
* Rename IS_EXTERNAL_FD -> RUBY_IO_EXTERNAL_P
* Expose `rb_io_closed_p`.
* Add `rb_io_mode` to get IO mode.
---------
Co-authored-by: KJ Tsanaktsidis <ktsanaktsidis@zendesk.com>
Diffstat (limited to 'ext/objspace')
-rw-r--r-- | ext/objspace/depend | 1 | ||||
-rw-r--r-- | ext/objspace/objspace_dump.c | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/ext/objspace/depend b/ext/objspace/depend index 91ae569d67..3cdfaffa66 100644 --- a/ext/objspace/depend +++ b/ext/objspace/depend @@ -580,6 +580,7 @@ objspace_dump.o: $(top_srcdir)/internal/compilers.h objspace_dump.o: $(top_srcdir)/internal/gc.h objspace_dump.o: $(top_srcdir)/internal/hash.h objspace_dump.o: $(top_srcdir)/internal/imemo.h +objspace_dump.o: $(top_srcdir)/internal/io.h objspace_dump.o: $(top_srcdir)/internal/sanitizers.h objspace_dump.o: $(top_srcdir)/internal/serial.h objspace_dump.o: $(top_srcdir)/internal/static_assert.h diff --git a/ext/objspace/objspace_dump.c b/ext/objspace/objspace_dump.c index d8a11083d6..39584e03b8 100644 --- a/ext/objspace/objspace_dump.c +++ b/ext/objspace/objspace_dump.c @@ -18,6 +18,7 @@ #include "internal/class.h" #include "internal/gc.h" #include "internal/hash.h" +#include "internal/io.h" #include "internal/string.h" #include "internal/sanitizers.h" #include "symbol.h" |