Ruby 3.3.2p78 (2024-05-30 revision e5a195edf62fe1bf7146a191da13fa1c4fecbd71)
io.h
1#ifndef INTERNAL_IO_H /*-*-C-*-vi:se ft=c:*/
2#define INTERNAL_IO_H
11#include "ruby/ruby.h" /* for VALUE */
12
13#define HAVE_RB_IO_T
14struct rb_io;
15
16#include "ruby/io.h" /* for rb_io_t */
17
19struct rb_io {
20
22 VALUE self;
23
26
28 int fd;
29
31 int mode;
32
34 rb_pid_t pid;
35
37 int lineno;
38
41
43 void (*finalize)(struct rb_io*,int);
44
47
53
60
61 struct rb_io_encoding encs;
65
71
74
82
85
91
97
106
111};
112
113/* io.c */
114void ruby_set_inplace_mode(const char *);
115void rb_stdio_set_default_encoding(void);
116VALUE rb_io_flush_raw(VALUE, int);
117size_t rb_io_memsize(const rb_io_t *);
118int rb_stderr_tty_p(void);
119void rb_io_fptr_finalize_internal(void *ptr);
120#ifdef rb_io_fptr_finalize
121# undef rb_io_fptr_finalize
122#endif
123#define rb_io_fptr_finalize rb_io_fptr_finalize_internal
124VALUE rb_io_popen(VALUE pname, VALUE pmode, VALUE env, VALUE opt);
125
126VALUE rb_io_prep_stdin(void);
127VALUE rb_io_prep_stdout(void);
128VALUE rb_io_prep_stderr(void);
129
130RUBY_SYMBOL_EXPORT_BEGIN
131/* io.c (export) */
132void rb_maygvl_fd_fix_cloexec(int fd);
133int rb_gc_for_fd(int err);
134void rb_write_error_str(VALUE mesg);
135RUBY_SYMBOL_EXPORT_END
136
137#endif /* INTERNAL_IO_H */
char * ptr
Pointer to the underlying memory region, of at least capa bytes.
Definition io.h:2
Decomposed encoding flags (e.g.
Definition io.h:119
IO buffers.
Definition io.h:94
Ruby's IO, metadata and buffers.
Definition io.h:143
int mode
mode flags: FMODE_XXXs
Definition io.h:158
rb_io_buffer_t wbuf
Write buffer.
Definition io.h:178
void(* finalize)(struct rb_io *, int)
finalize proc
Definition io.h:174
rb_econv_t * readconv
Encoding converter used when reading from this IO.
Definition io.h:200
rb_econv_t * writeconv
Encoding converter used when writing to this IO.
Definition io.h:211
struct rb_io_encoding encs
Decomposed encoding flags.
Definition io.h:196
VALUE self
The IO's Ruby level counterpart.
Definition io.h:146
VALUE write_lock
This is a Ruby level mutex.
Definition io.h:248
VALUE timeout
The timeout associated with this IO when performing blocking operations.
Definition io.h:254
FILE * stdio_file
stdio ptr for read/write, if available.
Definition io.h:150
VALUE writeconv_pre_ecopts
Value of rb_io_t::rb_io_enc_t::ecopts stored right before initialising rb_io_t::writeconv.
Definition io.h:238
VALUE tied_io_for_writing
Duplex IO object, if set.
Definition io.h:193
int writeconv_initialized
Whether rb_io_t::writeconv is already set up.
Definition io.h:224
int fd
file descriptor.
Definition io.h:154
rb_io_buffer_t rbuf
(Byte) read buffer.
Definition io.h:185
int lineno
number of lines read
Definition io.h:166
VALUE writeconv_asciicompat
This is, when set, an instance of rb_cString which holds the "common" encoding.
Definition io.h:220
rb_io_buffer_t cbuf
rb_io_ungetc() destination.
Definition io.h:207
rb_pid_t pid
child's pid (for pipes)
Definition io.h:162
int writeconv_pre_ecflags
Value of rb_io_t::rb_io_enc_t::ecflags stored right before initialising rb_io_t::writeconv.
Definition io.h:231
VALUE pathv
pathname for file
Definition io.h:170
uintptr_t VALUE
Type that represents a Ruby object.
Definition value.h:40