#include "ruby/ruby.h"
#include "ruby/io.h"
#include "dln.h"
#include <ctype.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "ruby/util.h"
Go to the source code of this file.
#define ARGF argf_of(argf) |
Definition at line 164 of file io.c.
Referenced by argf_argv(), argf_binmode_m(), argf_binmode_p(), argf_close_m(), argf_closed(), argf_each_byte(), argf_each_char(), argf_each_line(), argf_eof(), argf_external_encoding(), argf_file(), argf_filename(), argf_fileno(), argf_forward(), argf_getbyte(), argf_getc(), argf_getline(), argf_initialize(), argf_initialize_copy(), argf_inplace_mode_get(), argf_inplace_mode_set(), argf_internal_encoding(), argf_lineno(), argf_lineno_getter(), argf_lineno_setter(), argf_next_argv(), argf_read(), argf_readchar(), argf_readpartial(), argf_rewind(), argf_seek_m(), argf_set_encoding(), argf_set_lineno(), argf_set_pos(), argf_skip(), argf_tell(), argf_to_io(), Init_IO(), rb_get_argv(), rb_gets(), rb_io_getline_1(), rb_io_getline_fast(), rb_io_rewind(), ruby_get_inplace_mode(), and ruby_set_inplace_mode().
do {\ if (ARGF_GENERIC_INPUT_P())\ return argf_forward(argc, argv, argf);\ } while (0)
Definition at line 6712 of file io.c.
Referenced by argf_binmode_m(), argf_closed(), argf_eof(), argf_fileno(), argf_readline(), argf_rewind(), argf_seek_m(), argf_set_pos(), argf_tell(), and argf_to_io().
#define ARGF_GENERIC_INPUT_P | ( | ) | (ARGF.current_file == rb_stdin && TYPE(ARGF.current_file) != T_FILE) |
Definition at line 6710 of file io.c.
Referenced by argf_getc(), argf_getline(), argf_read(), and argf_readpartial().
#define argf_of | ( | obj | ) | (*(struct argf *)DATA_PTR(obj)) |
Definition at line 163 of file io.c.
Referenced by argf_initialize_copy().
#define FMODE_PREP (1<<16) |
Definition at line 3345 of file io.c.
Referenced by prep_stdio(), and rb_io_autoclose_p().
#define free | ( | x | ) | xfree(x) |
Definition at line 20 of file io.c.
Referenced by argf_inplace_mode_set(), clear_readconv(), pipe_del_fptr(), rb_io_fptr_finalize(), and ruby_set_inplace_mode().
#define GetWriteIO | ( | io | ) | rb_io_get_write_io(io) |
Definition at line 182 of file io.c.
Referenced by copy_stream_body(), io_write(), rb_io_binmode_m(), rb_io_close(), rb_io_close_read(), rb_io_close_write(), rb_io_closed(), rb_io_flush(), rb_io_init_copy(), rb_io_set_sync(), rb_io_sync(), rb_io_syswrite(), rb_io_write_nonblock(), and select_internal().
#define IO_CBUF_CAPA_MIN (128*1024) |
Definition at line 113 of file io.c.
Referenced by make_readconv().
#define IO_RBUF_CAPA_FOR | ( | fptr | ) | (NEED_READCONV(fptr) ? IO_CBUF_CAPA_MIN : IO_RBUF_CAPA_MIN) |
Definition at line 114 of file io.c.
Referenced by io_fillbuf(), and io_ungetbyte().
#define io_seek | ( | fptr, | ||
ofs, | ||||
whence | ||||
) | (errno = 0, lseek(flush_before_seek(fptr)->fd, ofs, whence)) |
Definition at line 401 of file io.c.
Referenced by io_reopen(), rb_io_init_copy(), rb_io_rewind(), rb_io_seek(), and rb_io_set_pos().
#define io_tell | ( | fptr | ) | lseek(flush_before_seek(fptr)->fd, 0, SEEK_CUR) |
Definition at line 402 of file io.c.
Referenced by io_reopen(), rb_io_init_copy(), and rb_io_tell().
#define IS_PREP_STDIO | ( | f | ) | ((f)->mode & FMODE_PREP) |
Definition at line 3346 of file io.c.
Referenced by fptr_finalize(), io_reopen(), and rb_io_reopen().
#define is_socket | ( | fd, | ||
path | ||||
) | 0 |
Definition at line 243 of file io.c.
Referenced by rb_io_close_read(), and rb_io_close_write().
#define MODE_BINARY | ( | a, | ||
b | ||||
) | (a) |
Referenced by rb_io_oflags_modestr().
#define MODE_BTMODE | ( | a, | ||
b, | ||||
c | ||||
) |
((fmode & FMODE_BINMODE) ? (b) : \ (fmode & FMODE_TEXTMODE) ? (c) : (a))
Referenced by rb_io_fmode_modestr().
#define MORE_CHAR_FINISHED Qnil |
Definition at line 1633 of file io.c.
Referenced by appendline(), io_getc(), more_char(), rb_io_each_codepoint(), read_all(), and swallow().
#define MORE_CHAR_SUSPENDED Qtrue |
Definition at line 1632 of file io.c.
Referenced by more_char(), and read_all().
#define NEED_NEWLINE_DECORATOR_ON_READ | ( | fptr | ) | (fptr->mode & FMODE_TEXTMODE) |
Definition at line 228 of file io.c.
Referenced by make_readconv().
#define NEED_NEWLINE_DECORATOR_ON_WRITE | ( | fptr | ) | 0 |
Definition at line 229 of file io.c.
Referenced by make_writeconv().
#define NEED_READCONV | ( | fptr | ) | (fptr->encs.enc2 != NULL || NEED_NEWLINE_DECORATOR_ON_READ(fptr)) |
Definition at line 231 of file io.c.
Referenced by appendline(), io_getc(), rb_io_each_codepoint(), rb_io_getline_1(), rb_io_ungetc(), read_all(), and swallow().
#define NEED_WRITECONV | ( | fptr | ) | ((fptr->encs.enc != NULL && fptr->encs.enc != rb_ascii8bit_encoding()) || NEED_NEWLINE_DECORATOR_ON_WRITE(fptr) || (fptr->encs.ecflags & (ECONV_DECORATOR_MASK|ECONV_STATEFUL_DECORATOR_MASK))) |
Definition at line 232 of file io.c.
Referenced by do_writeconv().
do {\ if (!next_argv()) return Qnil;\ ARGF_FORWARD(argc, argv);\ } while (0)
Definition at line 6716 of file io.c.
Referenced by argf_readbyte().
#define next_argv | ( | ) | argf_next_argv(argf) |
Definition at line 6709 of file io.c.
Referenced by argf_binmode_m(), argf_close_m(), argf_closed(), argf_each_byte(), argf_each_char(), argf_each_line(), argf_eof(), argf_file(), argf_filename(), argf_fileno(), argf_getbyte(), argf_getc(), argf_getline(), argf_read(), argf_readchar(), argf_readline(), argf_readpartial(), argf_rewind(), argf_seek_m(), argf_set_encoding(), argf_set_pos(), argf_tell(), argf_to_io(), and rb_gets().
#define numberof | ( | array | ) | (int)(sizeof(array) / sizeof((array)[0])) |
Definition at line 110 of file io.c.
Referenced by rb_f_select().
#define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR) |
Definition at line 95 of file io.c.
Referenced by Init_fcntl().
#define O_BINARY 0 |
#define off_t long |
Definition at line 60 of file io.c.
Referenced by copy_stream_body(), copy_stream_fallback(), copy_stream_fallback_body(), fseeko(), ftello(), io_reopen(), io_unread(), maygvl_copy_stream_read(), nogvl_copy_stream_read_write(), rb_chsize(), rb_io_init_copy(), rb_io_seek(), rb_io_set_pos(), rb_io_sysseek(), rb_io_tell(), rb_stat_s(), and remain_size().
#define PIPE_BUF 512 |
Definition at line 106 of file io.c.
Referenced by io_writable_length().
#define PREP_STDIO_NAME | ( | f | ) | (RSTRING_PTR((f)->pathv)) |
Definition at line 3347 of file io.c.
Referenced by io_reopen(), and rb_io_reopen().
#define rb_f_syscall rb_f_notimplement |
#define rb_intern | ( | str | ) | rb_intern_const(str) |
#define rb_io_close_on_exec_p rb_f_notimplement |
#define rb_io_fcntl rb_f_notimplement |
#define rb_io_fdatasync rb_f_notimplement |
#define rb_io_fsync rb_f_notimplement |
#define rb_io_set_close_on_exec rb_f_notimplement |
#define rb_sys_fail_path | ( | path | ) | rb_sys_fail(NIL_P(path) ? 0 : RSTRING_PTR(path)) |
Definition at line 238 of file io.c.
Referenced by fptr_finalize(), io_fillbuf(), io_fread(), io_getpartial(), io_reopen(), io_write(), rb_io_close_read(), rb_io_close_write(), rb_io_ctl(), rb_io_reopen(), rb_io_rewind(), rb_io_seek(), rb_io_set_nonblock(), rb_io_set_pos(), rb_io_sysread(), rb_io_sysseek(), rb_io_syswrite(), rb_io_tell(), rb_io_write_nonblock(), and swallow().
#define READ_CHAR_PENDING | ( | fptr | ) | ((fptr)->cbuf_len) |
Definition at line 189 of file io.c.
Referenced by rb_io_check_byte_readable(), rb_io_eof(), rb_io_read_pending(), rb_io_sysseek(), and select_internal().
#define READ_CHAR_PENDING_COUNT | ( | fptr | ) | ((fptr)->cbuf_len) |
#define READ_CHAR_PENDING_PTR | ( | fptr | ) | ((fptr)->cbuf+(fptr)->cbuf_off) |
#define READ_CHECK | ( | fptr | ) |
do {\ if (!READ_DATA_PENDING(fptr)) {\ WAIT_FD_IN_WIN32(fptr);\ rb_io_check_closed(fptr);\ }\ } while(0)
Definition at line 200 of file io.c.
Referenced by appendline(), fill_cbuf(), io_getpartial(), io_read(), rb_io_each_byte(), rb_io_each_char(), rb_io_each_codepoint(), rb_io_eof(), rb_io_getbyte(), rb_io_getc(), rb_io_getline_fast(), read_all(), and swallow().
#define READ_DATA_BUFFERED | ( | fptr | ) | READ_DATA_PENDING(fptr) |
Definition at line 187 of file io.c.
Referenced by rb_io_sysread(), and rb_io_sysseek().
#define READ_DATA_PENDING | ( | fptr | ) | ((fptr)->rbuf_len) |
Definition at line 184 of file io.c.
Referenced by io_fread(), rb_io_eof(), rb_io_read_check(), rb_io_read_pending(), and select_internal().
#define READ_DATA_PENDING_COUNT | ( | fptr | ) | ((fptr)->rbuf_len) |
Definition at line 185 of file io.c.
Referenced by appendline(), rb_io_getline_fast(), read_buffered_data(), remain_size(), and swallow().
#define READ_DATA_PENDING_PTR | ( | fptr | ) | ((fptr)->rbuf+(fptr)->rbuf_off) |
Definition at line 186 of file io.c.
Referenced by appendline(), rb_io_getline_fast(), and swallow().
#define S_ISREG | ( | m | ) | ((m & S_IFMT) == S_IFREG) |
Definition at line 533 of file io.c.
Referenced by remain_size(), and wsplit_p().
#define SEEK_CUR 1 |
Definition at line 406 of file io.c.
Referenced by fseeko(), Init_IO(), io_unread(), rb_chsize(), and remain_size().
#define SEEK_END 2 |
#define SEEK_SET 0 |
Definition at line 405 of file io.c.
Referenced by getdbit(), getnext(), getpage(), Init_IO(), io_reopen(), makroom(), nogvl_copy_stream_read_write(), rb_chsize(), rb_io_init_copy(), rb_io_s_binread(), rb_io_set_pos(), sdbm_delete(), sdbm_firstkey(), and setdbit().
#define SHUT_RD 0 |
#define SHUT_WR 1 |
#define shutdown | ( | a, | ||
b | ||||
) | 0 |
Definition at line 235 of file io.c.
Referenced by bsock_close_read(), bsock_close_write(), bsock_shutdown(), rb_io_close_read(), rb_io_close_write(), rb_w32_shutdown(), and ruby_shutdown().
#define STDIO_READ_DATA_PENDING | ( | fp | ) | (!feof(fp)) |
Definition at line 179 of file io.c.
Referenced by rb_read_check().
#define UPDATE_MAXFD | ( | fd | ) |
do { \ if (max_file_descriptor < (fd)) max_file_descriptor = (fd); \ } while (0)
Definition at line 158 of file io.c.
Referenced by io_cntl(), rb_io_initialize(), rb_pipe(), rb_sysopen(), and ruby_dup().
typedef struct rb_io_enc_t convconfig_t |
Definition at line 2205 of file io.c.
References rb_io_t::cbuf, rb_io_t::cbuf_len, rb_io_t::cbuf_off, clear_readconv(), io_fillbuf(), last, len, make_readconv(), more_char(), MORE_CHAR_FINISHED, NEED_READCONV, NIL_P, rb_str_buf_cat(), rb_str_buf_new(), rb_str_new(), rb_str_resize(), rb_str_set_len, read_buffered_data(), READ_CHECK, READ_DATA_PENDING_COUNT, READ_DATA_PENDING_PTR, RSTRING_LEN, and RSTRING_PTR.
Referenced by rb_io_getline_1().
Definition at line 6623 of file io.c.
References argf_free(), argf_init(), argf_mark(), Data_Make_Struct, and Qnil.
Referenced by Init_IO().
Definition at line 9616 of file io.c.
References ARGF.
Referenced by argf_argv_getter(), and Init_IO().
Definition at line 9412 of file io.c.
References ARGF, ARGF_FORWARD, next_argv, and rb_io_ascii8bit_binmode().
Referenced by Init_IO().
static void argf_close | ( | VALUE | file | ) | [static] |
Definition at line 6722 of file io.c.
References rb_funcall3(), and rb_intern.
Referenced by argf_close_m(), argf_getbyte(), argf_getc(), argf_getline(), argf_read(), argf_readchar(), argf_readpartial(), and argf_skip().
Definition at line 9502 of file io.c.
References ARGF, ARGF_FORWARD, next_argv, and rb_io_closed().
Referenced by Init_IO().
Definition at line 9300 of file io.c.
References ARGF, next_argv, rb_block_call, rb_intern, and RETURN_ENUMERATOR.
Referenced by Init_IO().
Definition at line 9330 of file io.c.
References ARGF, next_argv, rb_block_call, rb_intern, and RETURN_ENUMERATOR.
Referenced by Init_IO().
Definition at line 9265 of file io.c.
References ARGF, next_argv, rb_block_call, rb_intern, and RETURN_ENUMERATOR.
Referenced by Init_IO().
Definition at line 8893 of file io.c.
References ARGF, ARGF_FORWARD, next_argv, rb_io_eof(), and RTEST.
Referenced by Init_IO().
Definition at line 8677 of file io.c.
References ARGF, rb_default_external_encoding(), rb_enc_from_encoding(), rb_io_check_io(), rb_io_external_encoding(), and RTEST.
Referenced by Init_IO().
Definition at line 8845 of file io.c.
References ARGF, ARGF_FORWARD, next_argv, rb_eArgError, rb_io_fileno(), and rb_raise().
Referenced by Init_IO().
Definition at line 6704 of file io.c.
References ARGF, rb_frame_this_func(), and rb_funcall3().
Referenced by argf_forward_call(), and argf_read().
Definition at line 8996 of file io.c.
References argf_call_arg::argc, argf_call_arg::argf, argf_forward(), and argf_call_arg::argv.
Referenced by argf_readpartial().
static void argf_free | ( | void * | ptr | ) | [static] |
Definition at line 6606 of file io.c.
References argf::inplace, and xfree().
Referenced by argf_alloc().
Definition at line 9136 of file io.c.
References ARGF, argf_close(), next_argv, NIL_P, rb_funcall3(), rb_intern, rb_io_getbyte(), T_FILE, and TYPE.
Referenced by argf_readbyte(), and Init_IO().
Definition at line 9096 of file io.c.
References ARGF, argf_close(), ARGF_GENERIC_INPUT_P, next_argv, NIL_P, rb_funcall3(), rb_intern, and rb_io_getc().
Referenced by Init_IO().
Definition at line 6858 of file io.c.
References ARGF, argf_close(), ARGF_GENERIC_INPUT_P, next_argv, NIL_P, rb_default_rs, rb_funcall3(), rb_intern, rb_io_getline(), rb_io_gets(), and rb_rs.
Referenced by argf_gets(), and argf_readlines().
Definition at line 6963 of file io.c.
References argf_getline(), and rb_lastline_set().
Referenced by argf_readline(), Init_IO(), and rb_f_gets().
Definition at line 6614 of file io.c.
References argf::argv, argf::current_file, argf::filename, and argf::lineno.
Referenced by argf_alloc(), and argf_initialize().
Definition at line 6646 of file io.c.
References ARGF, argf_of, argf::inplace, rb_obj_dup(), and ruby_strdup().
Referenced by Init_IO().
Definition at line 9530 of file io.c.
References ARGF, and rb_str_new2().
Referenced by Init_IO(), and opt_i_get().
Definition at line 9563 of file io.c.
References ARGF, free, OBJ_TAINTED, rb_insecure_operation(), rb_safe_level, RSTRING_PTR, RTEST, strdup, and StringValue.
Referenced by Init_IO(), and opt_i_set().
Definition at line 8699 of file io.c.
References ARGF, rb_default_external_encoding(), rb_enc_from_encoding(), rb_io_check_io(), rb_io_internal_encoding(), and RTEST.
Referenced by Init_IO().
static void argf_mark | ( | void * | ptr | ) | [static] |
Definition at line 6596 of file io.c.
References argf::argv, argf::current_file, argf::encs, argf::filename, and rb_gc_mark().
Referenced by argf_alloc().
static int argf_next_argv | ( | VALUE | argf | ) | [static] |
Definition at line 6728 of file io.c.
References ARGF, chown(), clear_codeconv(), rb_io_t::encs, errno, FMODE_BINMODE, FMODE_READABLE, FMODE_WRITABLE, fstat, GetOpenFile, rb_io_t::mode, NIL_P, orig_stdout, prep_io(), RARRAY_LEN, rb_ary_shift(), rb_cFile, rb_fatal(), rb_io_ascii8bit_binmode(), rb_io_binmode(), rb_io_close(), rb_stdin, rb_stdout, rb_str_cat2(), rb_str_new2(), rb_sysopen(), rb_warn(), RSTRING_PTR, stat, strerror(), StringValueCStr, T_FILE, and TYPE.
Definition at line 8945 of file io.c.
References ARGF, argf_close(), argf_forward(), ARGF_GENERIC_INPUT_P, INT2NUM(), io_read(), len, next_argv, NIL_P, NUM2LONG(), rb_scan_args(), rb_str_append(), rb_str_resize(), RSTRING_LEN, and StringValue.
Referenced by Init_IO().
Definition at line 9216 of file io.c.
References argf_getbyte(), NEXT_ARGF_FORWARD, NIL_P, and rb_eof_error().
Referenced by Init_IO().
Definition at line 9176 of file io.c.
References ARGF, argf_close(), next_argv, NIL_P, rb_eof_error(), rb_funcall3(), rb_intern, rb_io_getc(), T_FILE, and TYPE.
Referenced by Init_IO().
Definition at line 7038 of file io.c.
References ARGF_FORWARD, argf_gets(), next_argv, NIL_P, and rb_eof_error().
Referenced by Init_IO(), and rb_f_readline().
Definition at line 7090 of file io.c.
References argf_getline(), NIL_P, rb_ary_new(), and rb_ary_push().
Referenced by Init_IO(), and rb_f_readlines().
Definition at line 9032 of file io.c.
References argf_call_arg::argc, ARGF, argf_call_arg::argf, argf_close(), argf_forward_call(), ARGF_GENERIC_INPUT_P, argf_call_arg::argv, io_getpartial(), next_argv, NIL_P, NULL, Qnil, RARRAY_LEN, rb_eEOFError, rb_eof_error(), rb_rescue2(), rb_scan_args(), rb_str_new(), rb_str_resize(), RUBY_METHOD_FUNC, and StringValue.
Referenced by Init_IO().
Definition at line 8825 of file io.c.
References ARGF, ARGF_FORWARD, next_argv, rb_eArgError, rb_io_rewind(), and rb_raise().
Referenced by Init_IO().
Definition at line 8782 of file io.c.
References ARGF, ARGF_FORWARD, next_argv, rb_eArgError, rb_io_seek_m(), and rb_raise().
Referenced by Init_IO().
Definition at line 8739 of file io.c.
References ARGF, rb_io_t::encs, GetOpenFile, next_argv, rb_eArgError, rb_io_set_encoding(), and rb_raise().
Referenced by Init_IO().
Definition at line 8803 of file io.c.
References ARGF, ARGF_FORWARD, next_argv, rb_eArgError, rb_io_set_pos(), and rb_raise().
Referenced by Init_IO().
Definition at line 8765 of file io.c.
References ARGF, ARGF_FORWARD, next_argv, rb_eArgError, rb_io_tell(), and rb_raise().
Referenced by Init_IO().
Definition at line 5471 of file io.c.
References OBJ_INFECT, rb_enc_ascget(), rb_enc_get(), rb_str_new(), RSTRING_LEN, and RSTRING_PTR.
Referenced by rb_f_open(), and rb_io_open().
static void clear_codeconv | ( | rb_io_t * | fptr | ) | [static] |
Definition at line 3509 of file io.c.
References clear_readconv(), and clear_writeconv().
Referenced by argf_next_argv(), io_encoding_set(), mode_enc(), rb_io_ascii8bit_binmode(), rb_io_fptr_finalize(), and rb_io_initialize().
static void clear_readconv | ( | rb_io_t * | fptr | ) | [static] |
Definition at line 3486 of file io.c.
References rb_io_t::cbuf, free, rb_econv_close(), and rb_io_t::readconv.
Referenced by appendline(), clear_codeconv(), io_getc(), rb_io_each_codepoint(), rb_io_rewind(), and read_all().
static void clear_writeconv | ( | rb_io_t * | fptr | ) | [static] |
Definition at line 3499 of file io.c.
References rb_econv_close(), rb_io_t::writeconv, and rb_io_t::writeconv_initialized.
Referenced by clear_codeconv().
Definition at line 8389 of file io.c.
References copy_stream_struct::close_dst, copy_stream_struct::close_src, copy_stream_struct::copy_length, copy_stream_fallback(), copy_stream_struct::dst, copy_stream_struct::dst_fd, rb_io_t::fd, copy_stream_struct::fds, FilePathValue, GetOpenFile, GetWriteIO, INT2FIX, INT2NUM(), io_binwrite(), io_fflush(), len, NIL_P, nogvl_copy_stream_func(), off_t, rb_cFile, rb_class_new_instance(), rb_eIOError, rb_fd_init, rb_fd_set, rb_intern, rb_io_check_byte_readable(), rb_io_check_writable(), rb_io_write(), rb_raise(), rb_respond_to(), rb_str_buf_new(), rb_str_resize(), rb_sys_fail(), rb_thread_blocking_region(), rb_thread_current(), rb_io_t::rbuf_len, read_buffered_data(), RSTRING_PTR, RUBY_UBF_IO, copy_stream_struct::src, copy_stream_struct::src_fd, copy_stream_struct::src_offset, T_FILE, T_STRING, copy_stream_struct::th, copy_stream_struct::total, and TYPE.
Referenced by rb_io_s_copy_stream().
static VALUE copy_stream_fallback | ( | struct copy_stream_struct * | stp | ) | [static] |
Definition at line 8377 of file io.c.
References ANYARGS, copy_stream_fallback_body(), off_t, rb_eArgError, rb_eEOFError, rb_raise(), rb_rescue2(), copy_stream_struct::src_fd, and copy_stream_struct::src_offset.
Referenced by copy_stream_body().
Definition at line 8321 of file io.c.
References buf, copy_stream_struct::copy_length, copy_stream_struct::dst, id_read, id_readpartial, INT2FIX, maygvl_copy_stream_read(), NUM2LONG(), off_t, rb_eof_error(), rb_funcall(), rb_io_write(), rb_respond_to(), rb_str_buf_new(), rb_str_resize(), rb_thread_wait_fd(), RSTRING_LEN, RSTRING_PTR, copy_stream_struct::src, copy_stream_struct::src_fd, copy_stream_struct::src_offset, and copy_stream_struct::total.
Referenced by copy_stream_fallback().
Definition at line 8498 of file io.c.
References copy_stream_struct::close_dst, copy_stream_struct::close_src, copy_stream_struct::dst, errno, copy_stream_struct::error_no, copy_stream_struct::fds, copy_stream_struct::notimp, rb_eNotImpError, rb_fd_term, rb_io_close_m(), rb_raise(), rb_sys_fail(), copy_stream_struct::src, and copy_stream_struct::syserr.
Referenced by rb_io_s_copy_stream().
Definition at line 906 of file io.c.
References ECONV_PARTIAL_INPUT, rb_io_t::rb_io_enc_t::enc, rb_io_t::rb_io_enc_t::enc2, rb_io_t::encs, make_writeconv(), NEED_WRITECONV, NIL_P, rb_ascii8bit_encoding(), rb_eArgError, rb_econv_str_convert(), rb_enc_asciicompat, rb_enc_from_encoding(), rb_enc_get(), rb_enc_name, rb_raise(), rb_str_encode(), rb_io_t::writeconv, rb_io_t::writeconv_asciicompat, rb_io_t::writeconv_pre_ecflags, and rb_io_t::writeconv_pre_ecopts.
Referenced by io_fwrite().
static void extract_binmode | ( | VALUE | opthash, | |
int * | fmode | |||
) | [static] |
Definition at line 4377 of file io.c.
References FMODE_BINMODE, FMODE_TEXTMODE, NIL_P, rb_eArgError, rb_hash_aref(), rb_raise(), RTEST, sym_binmode, and sym_textmode.
Referenced by rb_io_extract_modeenc(), and rb_io_s_pipe().
Definition at line 1635 of file io.c.
References rb_io_t::cbuf, rb_io_t::cbuf_capa, rb_io_t::cbuf_len, rb_io_t::cbuf_off, econv_finished, econv_source_buffer_empty, io_fillbuf(), memmove(), NIL_P, NULL, rb_econv_check_error(), rb_econv_convert(), rb_econv_make_exception(), rb_econv_putback(), rb_econv_putbackable(), rb_io_t::rbuf, rb_io_t::rbuf_len, rb_io_t::rbuf_off, READ_CHECK, and rb_io_t::readconv.
Referenced by more_char(), and read_all().
Definition at line 3350 of file io.c.
References buf, econv_destination_buffer_full, econv_incomplete_input, econv_invalid_byte_sequence, econv_undefined_conversion, errno, rb_io_t::fd, INT2NUM(), io_fflush(), NULL, Qtrue, rb_econv_convert(), rb_econv_make_exception(), rb_eIOError, rb_exc_new3(), rb_io_wait_writable(), rb_str_new_cstr(), rb_write_internal(), rb_io_t::wbuf, rb_io_t::wbuf_capa, rb_io_t::wbuf_len, rb_io_t::wbuf_off, and rb_io_t::writeconv.
Referenced by finish_writeconv_sync(), and fptr_finalize().
Definition at line 3415 of file io.c.
References finish_writeconv(), finish_writeconv_arg::fptr, and finish_writeconv_arg::noalloc.
Referenced by fptr_finalize().
Definition at line 392 of file io.c.
References errno, io_fflush(), io_unread(), and rb_sys_fail().
static void fptr_finalize | ( | rb_io_t * | fptr, | |
int | noraise | |||
) | [static] |
Definition at line 3422 of file io.c.
References err, errno, rb_io_t::fd, finish_writeconv(), finish_writeconv_sync(), FMODE_READABLE, finish_writeconv_arg::fptr, INT2NUM(), io_fflush(), IS_PREP_STDIO, rb_io_t::mode, NIL_P, finish_writeconv_arg::noalloc, NUM2INT, rb_io_t::pathv, Qtrue, rb_exc_raise(), rb_mutex_synchronize(), rb_sys_fail_path, rb_io_t::stdio_file, T_BIGNUM, T_FIXNUM, TYPE, rb_io_t::wbuf_len, rb_io_t::write_lock, and rb_io_t::writeconv.
Referenced by pipe_finalize(), and rb_io_fptr_cleanup().
void Init_File | ( | void | ) |
Definition at line 5224 of file file.c.
References define_filetest_function(), INT2FIX, LOCK_EX, LOCK_NB, LOCK_SH, LOCK_UN, PATH_SEP, Qnil, rb_cIO, rb_cObject, rb_define_alloc_func(), rb_define_class(), rb_define_class_under(), rb_define_const(), rb_define_global_function(), rb_define_method(), rb_define_module(), rb_define_module_under(), rb_define_singleton_method(), rb_f_test(), rb_file_atime(), rb_file_blockdev_p(), rb_file_chardev_p(), rb_file_chmod(), rb_file_chown(), rb_file_const(), rb_file_ctime(), rb_file_directory_p(), rb_file_executable_p(), rb_file_executable_real_p(), rb_file_exist_p(), rb_file_file_p(), rb_file_flock(), rb_file_grpowned_p(), rb_file_identical_p(), rb_file_lstat(), rb_file_mtime(), rb_file_owned_p(), rb_file_path(), rb_file_pipe_p(), rb_file_readable_p(), rb_file_readable_real_p(), rb_file_s_absolute_path(), rb_file_s_atime(), rb_file_s_basename(), rb_file_s_chmod(), rb_file_s_chown(), rb_file_s_ctime(), rb_file_s_dirname(), rb_file_s_expand_path(), rb_file_s_extname(), rb_file_s_ftype(), rb_file_s_join(), rb_file_s_lchmod, rb_file_s_lchown, rb_file_s_link, rb_file_s_lstat(), rb_file_s_mtime(), rb_file_s_path(), rb_file_s_readlink, rb_file_s_realdirpath(), rb_file_s_realpath(), rb_file_s_rename(), rb_file_s_size(), rb_file_s_split(), rb_file_s_stat(), rb_file_s_symlink, rb_file_s_truncate, rb_file_s_umask(), rb_file_s_unlink(), rb_file_s_utime(), rb_file_sgid_p(), rb_file_size(), rb_file_size_p(), rb_file_socket_p(), rb_file_sticky_p(), rb_file_suid_p(), rb_file_symlink_p(), rb_file_truncate, rb_file_world_readable_p(), rb_file_world_writable_p(), rb_file_writable_p(), rb_file_writable_real_p(), rb_file_zero_p(), rb_include_module(), rb_io_stat(), rb_mComparable, rb_obj_freeze(), rb_stat_atime(), rb_stat_b(), rb_stat_blksize(), rb_stat_blocks(), rb_stat_c(), rb_stat_cmp(), rb_stat_ctime(), rb_stat_d(), rb_stat_dev(), rb_stat_dev_major(), rb_stat_dev_minor(), rb_stat_f(), rb_stat_ftype(), rb_stat_gid(), rb_stat_grpowned(), rb_stat_init(), rb_stat_init_copy(), rb_stat_ino(), rb_stat_inspect(), rb_stat_l(), rb_stat_mode(), rb_stat_mtime(), rb_stat_nlink(), rb_stat_owned(), rb_stat_p(), rb_stat_R(), rb_stat_r(), rb_stat_rdev(), rb_stat_rdev_major(), rb_stat_rdev_minor(), rb_stat_S(), rb_stat_s(), rb_stat_s_alloc(), rb_stat_sgid(), rb_stat_size(), rb_stat_sticky(), rb_stat_suid(), rb_stat_uid(), rb_stat_W(), rb_stat_w(), rb_stat_wr(), rb_stat_ww(), rb_stat_X(), rb_stat_x(), rb_stat_z(), rb_str_new2(), and rb_usascii_str_new2().
Referenced by Init_IO().
void Init_IO | ( | void | ) |
Definition at line 9792 of file io.c.
References ARGF, argf_alloc(), argf_argv(), argf_argv_getter(), argf_binmode_m(), argf_binmode_p(), argf_close_m(), argf_closed(), argf_each_byte(), argf_each_char(), argf_each_line(), argf_eof(), argf_external_encoding(), argf_file(), argf_filename(), argf_filename_getter(), argf_fileno(), argf_getbyte(), argf_getc(), argf_gets(), argf_initialize(), argf_initialize_copy(), argf_inplace_mode_get(), argf_inplace_mode_set(), argf_internal_encoding(), argf_lineno(), argf_lineno_getter(), argf_lineno_setter(), argf_read(), argf_readbyte(), argf_readchar(), argf_readline(), argf_readlines(), argf_readpartial(), argf_rewind(), argf_seek_m(), argf_set_encoding(), argf_set_lineno(), argf_set_pos(), argf_skip(), argf_tell(), argf_to_io(), argf_to_s(), FMODE_READABLE, FMODE_SYNC, FMODE_WRITABLE, ID2SYM, id_flush, id_getc, id_read, id_readpartial, id_write, Init_File(), INT2FIX, io_alloc(), io_read(), io_read_nonblock(), io_readpartial(), io_write_m(), O_BINARY, O_NONBLOCK, OBJ_FREEZE, opt_i_get(), opt_i_set(), orig_stderr, orig_stdout, pipe_atexit(), prep_stdio(), rb_cFile, rb_cIO, rb_class_new(), rb_class_new_instance(), rb_cObject, rb_default_rs, rb_deferr, rb_define_alias(), rb_define_alloc_func(), rb_define_class(), rb_define_const(), rb_define_global_const(), rb_define_global_function(), rb_define_hooked_variable(), rb_define_method(), rb_define_module_under(), rb_define_readonly_variable(), rb_define_singleton_method(), rb_define_variable(), rb_define_virtual_variable(), rb_eEOFError, rb_eIOError, rb_eStandardError, rb_f_backquote(), rb_f_gets(), rb_f_open(), rb_f_p(), rb_f_print(), rb_f_printf(), rb_f_putc(), rb_f_puts(), rb_f_readline(), rb_f_readlines(), rb_f_select(), rb_f_syscall, rb_file_const(), rb_file_initialize(), rb_gc_register_mark_object(), rb_gvar_readonly_setter(), rb_include_module(), rb_intern, rb_io_addstr(), rb_io_autoclose_p(), rb_io_binmode_m(), rb_io_binmode_p(), rb_io_close_m(), rb_io_close_on_exec_p, rb_io_close_read(), rb_io_close_write(), rb_io_closed(), rb_io_each_byte(), rb_io_each_char(), rb_io_each_codepoint(), rb_io_each_line(), rb_io_eof(), rb_io_external_encoding(), rb_io_fcntl, rb_io_fdatasync, rb_io_fileno(), rb_io_flush(), rb_io_fsync, rb_io_getbyte(), rb_io_getc(), rb_io_gets_m(), rb_io_init_copy(), rb_io_initialize(), rb_io_inspect(), rb_io_internal_encoding(), rb_io_ioctl(), rb_io_isatty(), rb_io_lineno(), rb_io_pid(), rb_io_print(), rb_io_printf(), rb_io_putc(), rb_io_puts(), rb_io_readbyte(), rb_io_readchar(), rb_io_readline(), rb_io_readlines(), rb_io_reopen(), rb_io_rewind(), rb_io_s_binread(), rb_io_s_copy_stream(), rb_io_s_for_fd(), rb_io_s_foreach(), rb_io_s_new(), rb_io_s_open(), rb_io_s_pipe(), rb_io_s_popen(), rb_io_s_read(), rb_io_s_readlines(), rb_io_s_sysopen(), rb_io_s_try_convert(), rb_io_seek_m(), rb_io_set_autoclose(), rb_io_set_close_on_exec, rb_io_set_encoding(), rb_io_set_lineno(), rb_io_set_pos(), rb_io_set_sync(), rb_io_sync(), rb_io_sysread(), rb_io_sysseek(), rb_io_syswrite(), rb_io_tell(), rb_io_to_io(), rb_io_ungetbyte(), rb_io_ungetc(), rb_io_write_nonblock(), rb_lastline_get(), rb_lastline_set(), rb_mEnumerable, rb_mKernel, rb_mWaitReadable, rb_mWaitWritable, rb_obj_display(), rb_output_fs, rb_output_rs, rb_rs, rb_set_class_path(), rb_stderr, rb_stdin, rb_stdout, rb_str_new2(), rb_str_setter(), rb_usascii_str_new2(), SEEK_CUR, SEEK_END, SEEK_SET, stdout_setter(), sym_autoclose, sym_binmode, sym_encoding, sym_extenc, sym_intenc, sym_mode, sym_open_args, sym_perm, and sym_textmode.
static VALUE internal_read_func | ( | void * | ptr | ) | [static] |
Definition at line 566 of file io.c.
References io_internal_struct::buf, io_internal_struct::capa, and io_internal_struct::fd.
Referenced by rb_read_internal().
static VALUE internal_write_func | ( | void * | ptr | ) | [static] |
Definition at line 573 of file io.c.
References io_internal_struct::buf, io_internal_struct::capa, and io_internal_struct::fd.
Referenced by rb_write_internal().
Definition at line 522 of file io.c.
References NEWOBJ, OBJSETUP, and T_FILE.
Referenced by Init_IO(), pipe_open(), prep_io(), rb_file_open(), rb_file_open_str(), rb_io_open(), and rb_io_open_with_args().
Definition at line 832 of file io.c.
References ALLOC_N, errno, rb_io_t::fd, FMODE_SYNC, FMODE_TTY, binwrite_arg::fptr, io_binwrite_string(), io_fflush(), io_writable_length(), len, binwrite_arg::length, MEMMOVE, rb_io_t::mode, NULL, binwrite_arg::offset, rb_io_check_closed(), rb_io_wait_writable(), rb_mutex_new(), rb_mutex_synchronize(), rb_thread_fd_writable(), rb_write_internal(), RSTRING_LEN, RSTRING_PTR, rb_io_t::stdio_file, binwrite_arg::str, rb_io_t::wbuf, rb_io_t::wbuf_capa, rb_io_t::wbuf_len, rb_io_t::wbuf_off, and rb_io_t::write_lock.
Referenced by copy_stream_body(), and io_fwrite().
Definition at line 824 of file io.c.
References rb_io_t::fd, binwrite_arg::fptr, io_writable_length(), binwrite_arg::length, binwrite_arg::offset, rb_write_internal(), RSTRING_PTR, and binwrite_arg::str.
Referenced by io_binwrite().
Definition at line 3608 of file io.c.
References rb_funcall(), and rb_intern.
Referenced by io_close().
static void io_check_tty | ( | rb_io_t * | fptr | ) | [static] |
Definition at line 4582 of file io.c.
References rb_io_t::fd, FMODE_TTY, and rb_io_t::mode.
Referenced by prep_io(), rb_file_open_generic(), and rb_io_initialize().
Definition at line 3614 of file io.c.
References io_call_close(), and rb_rescue().
Referenced by pipe_pair_close(), rb_f_open(), rb_io_s_open(), and rb_io_s_popen().
static int io_cntl | ( | int | fd, | |
unsigned long | cmd, | |||
long | narg, | |||
int | io_p | |||
) | [static] |
Definition at line 7333 of file io.c.
References fcntl(), ioctl(), rb_notimplement(), and UPDATE_MAXFD.
Referenced by rb_io_ctl().
Definition at line 1596 of file io.c.
References io_read_encoding(), OBJ_TAINT, and rb_enc_associate().
Referenced by io_getc(), rb_io_getline_1(), rb_io_getline_fast(), and read_all().
static int io_encname_bom_p | ( | const char * | name, | |
long | len | |||
) | [static] |
Definition at line 4024 of file io.c.
References strchr(), and STRNCASECMP.
Referenced by parse_mode_enc(), and rb_io_modestr_fmode().
Definition at line 7601 of file io.c.
References clear_codeconv(), rb_io_t::rb_io_enc_t::ecflags, rb_io_t::rb_io_enc_t::ecopts, rb_io_t::rb_io_enc_t::enc, rb_io_t::rb_io_enc_t::enc2, rb_io_t::encs, rb_io_t::mode, NIL_P, NULL, parse_mode_enc(), rb_check_string_type(), rb_econv_prepare_opts(), rb_enc_asciicompat, rb_enc_get(), rb_io_ext_int_to_encs(), rb_to_encoding(), RSTRING_LEN, RSTRING_PTR, and validate_enc_binmode().
Referenced by io_set_encoding_by_bom(), rb_io_s_pipe(), and rb_io_set_encoding().
static int io_fflush | ( | rb_io_t * | fptr | ) | [static] |
Definition at line 650 of file io.c.
References rb_io_t::fd, io_flush_buffer(), rb_io_check_closed(), rb_io_wait_writable(), rb_thread_fd_writable(), and rb_io_t::wbuf_len.
Referenced by copy_stream_body(), finish_writeconv(), flush_before_seek(), fptr_finalize(), io_binwrite(), io_reopen(), rb_io_check_char_readable(), rb_io_flush(), rb_io_reopen(), rb_io_write_nonblock(), and remain_size().
static int io_fillbuf | ( | rb_io_t * | fptr | ) | [static] |
Definition at line 1205 of file io.c.
References ALLOC_N, rb_io_t::fd, IO_RBUF_CAPA_FOR, NULL, rb_io_t::pathv, rb_io_wait_readable(), rb_read_internal(), rb_sys_fail_path, rb_io_t::rbuf, rb_io_t::rbuf_capa, rb_io_t::rbuf_len, and rb_io_t::rbuf_off.
Referenced by appendline(), fill_cbuf(), io_fread(), io_getc(), rb_io_each_byte(), rb_io_each_codepoint(), rb_io_eof(), rb_io_getbyte(), rb_io_getline_fast(), and swallow().
static int io_flush_buffer | ( | rb_io_t * | fptr | ) | [inline, static] |
Definition at line 639 of file io.c.
References io_flush_buffer_async(), rb_mutex_synchronize(), and rb_io_t::write_lock.
Referenced by io_fflush().
Definition at line 633 of file io.c.
References io_flush_buffer_sync(), rb_thread_blocking_region(), and RUBY_UBF_IO.
Referenced by io_flush_buffer().
static VALUE io_flush_buffer_sync | ( | void * | arg | ) | [static] |
Definition at line 613 of file io.c.
References errno, rb_io_t::fd, io_writable_length(), rb_io_t::wbuf, rb_io_t::wbuf_len, and rb_io_t::wbuf_off.
Referenced by io_flush_buffer_async().
Definition at line 1523 of file io.c.
References rb_io_t::fd, io_fillbuf(), len, rb_io_t::pathv, rb_io_check_closed(), rb_io_wait_readable(), rb_read_internal(), rb_str_locktmp(), rb_str_unlocktmp(), rb_sys_fail_path, rb_thread_wait_fd(), read_buffered_data(), READ_DATA_PENDING, RSTRING_LEN, and RSTRING_PTR.
Referenced by io_read(), and read_all().
Definition at line 941 of file io.c.
References do_writeconv(), and io_binwrite().
Referenced by io_write().
static VALUE io_getc | ( | rb_io_t * | fptr, | |
rb_encoding * | enc | |||
) | [static] |
Definition at line 2795 of file io.c.
References rb_io_t::cbuf, rb_io_t::cbuf_capa, rb_io_t::cbuf_len, rb_io_t::cbuf_off, clear_readconv(), ENC_CODERANGE_BROKEN, ENC_CODERANGE_SET, io_enc_str(), io_fillbuf(), io_read_encoding(), io_shift_cbuf(), ISASCII, make_readconv(), MBCLEN_CHARFOUND_LEN, MBCLEN_CHARFOUND_P, MBCLEN_INVALID_P, MBCLEN_NEEDMORE_P, more_char(), MORE_CHAR_FINISHED, NEED_READCONV, rb_eIOError, rb_enc_asciicompat, rb_enc_mbclen(), rb_enc_precise_mbclen(), rb_enc_str_new(), rb_raise(), rb_str_cat(), rb_str_new(), rb_io_t::rbuf, rb_io_t::rbuf_len, rb_io_t::rbuf_off, RSTRING_LEN, and RSTRING_PTR.
Referenced by rb_io_each_char(), and rb_io_getc().
Definition at line 1822 of file io.c.
References errno, EWOULDBLOCK, rb_io_t::fd, GetOpenFile, len, NIL_P, NUM2LONG(), OBJ_TAINT, rb_io_t::pathv, rb_eArgError, rb_io_check_byte_readable(), rb_io_set_nonblock(), rb_io_wait_readable(), rb_mod_sys_fail(), rb_mWaitReadable, rb_raise(), rb_read_internal(), rb_scan_args(), rb_str_locktmp(), rb_str_modify(), rb_str_new(), rb_str_resize(), rb_str_unlocktmp(), rb_sys_fail_path, read_buffered_data(), READ_CHECK, RSTRING_PTR, and StringValue.
Referenced by argf_readpartial(), io_read_nonblock(), and io_readpartial().
static rb_encoding * io_input_encoding | ( | rb_io_t * | fptr | ) | [static] |
Definition at line 456 of file io.c.
References rb_io_t::rb_io_enc_t::enc2, rb_io_t::encs, and io_read_encoding().
Referenced by rb_io_each_char(), rb_io_each_codepoint(), and rb_io_getc().
Definition at line 7595 of file io.c.
References rb_class_new_instance().
Referenced by rb_io_s_pipe().
Definition at line 6059 of file io.c.
References RARRAY_LEN, RARRAY_PTR, rb_io_puts(), and rb_str_new2().
Referenced by rb_io_puts().
Definition at line 2151 of file io.c.
References rb_io_t::fd, GetOpenFile, io_fread(), len, NIL_P, NUM2LONG(), OBJ_TAINT, rb_eArgError, rb_io_check_byte_readable(), rb_io_check_char_readable(), rb_raise(), rb_scan_args(), rb_str_modify(), rb_str_new(), rb_str_resize(), read_all(), READ_CHECK, remain_size(), and StringValue.
Referenced by argf_read(), Init_IO(), and io_s_read().
static rb_encoding* io_read_encoding | ( | rb_io_t * | fptr | ) | [static] |
Definition at line 447 of file io.c.
References rb_io_t::rb_io_enc_t::enc, rb_io_t::encs, and rb_default_external_encoding().
Referenced by io_enc_str(), io_getc(), io_input_encoding(), prepare_getline_args(), rb_io_external_encoding(), rb_io_getline_1(), rb_io_internal_encoding(), rb_io_ungetc(), read_all(), and swallow().
Definition at line 1996 of file io.c.
References io_getpartial(), NIL_P, and rb_eof_error().
Referenced by Init_IO().
Definition at line 1935 of file io.c.
References io_getpartial(), NIL_P, and rb_eof_error().
Referenced by Init_IO().
Definition at line 5664 of file io.c.
References dup2(), errno, rb_io_t::fd, rb_io_t::finalize, FMODE_BINMODE, FMODE_READABLE, FMODE_WRITABLE, GetOpenFile, if(), io_fflush(), io_seek, io_tell, IS_PREP_STDIO, rb_io_t::lineno, rb_io_t::mode, OBJ_UNTRUSTED, off_t, rb_io_t::pathv, rb_io_t::pid, pipe_add_fptr(), pipe_finalize(), PREP_STDIO_NAME, Qnil, rb_eArgError, rb_eSecurityError, rb_io_binmode(), rb_io_fmode_modestr(), rb_io_get_io(), rb_obj_class(), rb_raise(), rb_safe_level, rb_sys_fail(), rb_sys_fail_path, rb_thread_fd_close(), RBASIC, RTEST, SEEK_SET, and rb_io_t::stdio_file.
Referenced by rb_io_reopen().
static VALUE io_s_foreach | ( | struct foreach_arg * | arg | ) | [static] |
Definition at line 7820 of file io.c.
References foreach_arg::argc, foreach_arg::argv, foreach_arg::io, NIL_P, rb_io_gets_m(), and rb_yield().
Referenced by rb_io_s_foreach().
static VALUE io_s_read | ( | struct foreach_arg * | arg | ) | [static] |
Definition at line 7904 of file io.c.
References foreach_arg::argc, foreach_arg::argv, foreach_arg::io, and io_read().
Referenced by rb_io_s_binread(), and rb_io_s_read().
static VALUE io_s_readlines | ( | struct foreach_arg * | arg | ) | [static] |
Definition at line 7869 of file io.c.
References foreach_arg::argc, foreach_arg::argv, foreach_arg::io, and rb_io_readlines().
Referenced by rb_io_s_readlines().
static void io_set_encoding_by_bom | ( | VALUE | io | ) | [static] |
Definition at line 4657 of file io.c.
References GetOpenFile, io_encoding_set(), io_strip_bom(), Qnil, rb_enc_from_encoding(), rb_enc_from_index(), and rb_io_internal_encoding().
Referenced by rb_file_open_generic(), and rb_io_initialize().
Definition at line 1711 of file io.c.
References rb_io_t::cbuf, rb_io_t::cbuf_capa, rb_io_t::cbuf_len, rb_io_t::cbuf_off, rb_io_t::rb_io_enc_t::enc, rb_io_t::encs, memmove(), NIL_P, OBJ_TAINT, rb_enc_associate(), rb_str_cat(), and rb_str_new().
Referenced by io_getc(), read_all(), and swallow().
static int io_strip_bom | ( | VALUE | io | ) | [static] |
Definition at line 4592 of file io.c.
References FIX2INT, INT2FIX, rb_enc_find_index(), rb_io_getbyte(), rb_io_ungetbyte(), and rb_utf8_encindex().
Referenced by io_set_encoding_by_bom().
Definition at line 359 of file io.c.
References ALLOC_N, IO_RBUF_CAPA_FOR, len, MEMMOVE, NULL, rb_eIOError, rb_raise(), rb_io_t::rbuf, rb_io_t::rbuf_capa, rb_io_t::rbuf_len, rb_io_t::rbuf_off, RSTRING_LEN, and RSTRING_PTR.
Referenced by rb_io_ungetbyte(), and rb_io_ungetc().
static void io_unread | ( | rb_io_t * | fptr | ) | [static] |
Definition at line 337 of file io.c.
References errno, rb_io_t::fd, FMODE_DUPLEX, rb_io_t::mode, off_t, rb_io_check_closed(), rb_io_t::rbuf_len, rb_io_t::rbuf_off, and SEEK_CUR.
Referenced by flush_before_seek(), rb_io_check_writable(), and rb_io_flush().
static long io_writable_length | ( | rb_io_t * | fptr, | |
long | l | |||
) | [static] |
Definition at line 602 of file io.c.
References PIPE_BUF, rb_thread_alone(), and wsplit_p().
Referenced by io_binwrite(), io_binwrite_string(), and io_flush_buffer_sync().
Definition at line 948 of file io.c.
References binwrite_arg::fptr, GetOpenFile, GetWriteIO, id_write, INT2FIX, io_fwrite(), LONG2FIX, NIL_P, rb_io_t::pathv, rb_funcall(), rb_io_check_io(), rb_io_check_writable(), rb_obj_as_string(), rb_secure(), rb_sys_fail_path, and RSTRING_LEN.
Referenced by io_write_m(), and rb_p().
static void make_readconv | ( | rb_io_t * | fptr, | |
int | size | |||
) | [static] |
Definition at line 1604 of file io.c.
References ALLOC_N, rb_io_t::cbuf, rb_io_t::cbuf_capa, rb_io_t::cbuf_len, rb_io_t::cbuf_off, rb_io_t::rb_io_enc_t::ecflags, rb_io_t::rb_io_enc_t::ecopts, rb_io_t::rb_io_enc_t::enc, rb_io_t::rb_io_enc_t::enc2, rb_io_t::encs, IO_CBUF_CAPA_MIN, NEED_NEWLINE_DECORATOR_ON_READ, rb_econv_open_exc(), rb_econv_open_opts(), rb_enc_name, rb_exc_raise(), and rb_io_t::readconv.
Referenced by appendline(), io_getc(), rb_io_each_codepoint(), rb_io_ungetc(), read_all(), and swallow().
static void make_writeconv | ( | rb_io_t * | fptr | ) | [static] |
Definition at line 757 of file io.c.
References rb_io_t::rb_io_enc_t::ecflags, ECONV_ERROR_HANDLER_MASK, ECONV_STATEFUL_DECORATOR_MASK, rb_io_t::rb_io_enc_t::ecopts, rb_io_t::rb_io_enc_t::enc, rb_io_t::rb_io_enc_t::enc2, rb_io_t::encs, NEED_NEWLINE_DECORATOR_ON_WRITE, rb_ascii8bit_encoding(), rb_econv_asciicompat_encoding(), rb_econv_open_exc(), rb_econv_open_opts(), rb_enc_name, rb_exc_raise(), rb_str_new2(), rb_io_t::writeconv, rb_io_t::writeconv_asciicompat, rb_io_t::writeconv_initialized, rb_io_t::writeconv_pre_ecflags, and rb_io_t::writeconv_pre_ecopts.
Referenced by do_writeconv().
static ssize_t maygvl_copy_stream_read | ( | struct copy_stream_struct * | stp, | |
char * | buf, | |||
size_t | len, | |||
off_t | offset | |||
) | [static] |
Definition at line 8175 of file io.c.
References errno, copy_stream_struct::error_no, EWOULDBLOCK, maygvl_copy_stream_wait_read(), copy_stream_struct::notimp, off_t, copy_stream_struct::src_fd, and copy_stream_struct::syserr.
Referenced by copy_stream_fallback_body(), and nogvl_copy_stream_read_write().
static int maygvl_copy_stream_wait_read | ( | struct copy_stream_struct * | stp | ) | [static] |
Definition at line 8031 of file io.c.
References errno, copy_stream_struct::error_no, copy_stream_struct::fds, NULL, rb_fd_max, rb_fd_select, rb_fd_set, rb_fd_zero, copy_stream_struct::src_fd, and copy_stream_struct::syserr.
Referenced by maygvl_copy_stream_read().
static void mode_enc | ( | rb_io_t * | fptr, | |
const char * | estr | |||
) | [static] |
Definition at line 4288 of file io.c.
References clear_codeconv(), rb_io_t::rb_io_enc_t::enc, rb_io_t::rb_io_enc_t::enc2, rb_io_t::encs, NULL, and parse_mode_enc().
Referenced by rb_io_mode_enc().
Definition at line 1701 of file io.c.
References ECONV_AFTER_OUTPUT, fill_cbuf(), MORE_CHAR_FINISHED, MORE_CHAR_SUSPENDED, and rb_exc_raise().
Referenced by appendline(), io_getc(), rb_io_each_codepoint(), and swallow().
Definition at line 6259 of file io.c.
References rb_eTypeError, rb_id2name(), rb_obj_classname(), rb_raise(), and rb_respond_to().
Referenced by stdout_setter().
static VALUE nogvl_copy_stream_func | ( | void * | arg | ) | [static] |
Definition at line 8299 of file io.c.
References nogvl_copy_stream_read_write().
Referenced by copy_stream_body().
static void nogvl_copy_stream_read_write | ( | struct copy_stream_struct * | stp | ) | [static] |
Definition at line 8239 of file io.c.
References buf, copy_stream_struct::close_src, copy_stream_struct::copy_length, errno, copy_stream_struct::error_no, len, maygvl_copy_stream_read(), nogvl_copy_stream_write(), off_t, rb_thread_interrupted(), SEEK_SET, copy_stream_struct::src_fd, copy_stream_struct::src_offset, copy_stream_struct::syserr, and copy_stream_struct::th.
Referenced by nogvl_copy_stream_func().
static int nogvl_copy_stream_wait_write | ( | struct copy_stream_struct * | stp | ) | [static] |
Definition at line 8046 of file io.c.
References copy_stream_struct::dst_fd, errno, copy_stream_struct::error_no, copy_stream_struct::fds, NULL, rb_fd_max, rb_fd_select, rb_fd_set, rb_fd_zero, and copy_stream_struct::syserr.
Referenced by nogvl_copy_stream_write().
static int nogvl_copy_stream_write | ( | struct copy_stream_struct * | stp, | |
char * | buf, | |||
size_t | len | |||
) | [static] |
Definition at line 8215 of file io.c.
References copy_stream_struct::dst_fd, errno, copy_stream_struct::error_no, EWOULDBLOCK, nogvl_copy_stream_wait_write(), copy_stream_struct::syserr, and copy_stream_struct::total.
Referenced by nogvl_copy_stream_read_write().
static void open_key_args | ( | int | argc, | |
VALUE * | argv, | |||
struct foreach_arg * | arg | |||
) | [static] |
Definition at line 7781 of file io.c.
References foreach_arg::argc, foreach_arg::argv, FilePathValue, INT2FIX, INT2NUM(), foreach_arg::io, NIL_P, pop_last_hash(), Qnil, RARRAY_LEN, RARRAY_PTR, rb_ary_clear(), rb_ary_concat(), rb_ary_push(), rb_ary_tmp_new(), rb_convert_type(), rb_eArgError, rb_hash_aref(), rb_io_open(), rb_io_open_with_args(), rb_raise(), sym_open_args, and T_ARRAY.
Referenced by rb_io_s_foreach(), rb_io_s_read(), and rb_io_s_readlines().
static void parse_mode_enc | ( | const char * | estr, | |
rb_encoding ** | enc_p, | |||
rb_encoding ** | enc2_p, | |||
int * | fmode_p | |||
) | [static] |
Definition at line 4218 of file io.c.
References ENCODING_MAXNAMELEN, io_encname_bom_p(), len, Qnil, rb_enc_find_index(), rb_enc_from_index(), rb_io_ext_int_to_encs(), rb_warn(), and strrchr().
Referenced by io_encoding_set(), mode_enc(), rb_file_open_internal(), rb_io_extract_encoding_option(), and rb_io_extract_modeenc().
static void pipe_add_fptr | ( | rb_io_t * | fptr | ) | [static] |
Definition at line 4741 of file io.c.
References ALLOC, pipe_list::fptr, list, and pipe_list::next.
Referenced by io_reopen(), pipe_open(), and rb_io_init_copy().
static void pipe_atexit | ( | void | ) | [static] |
Definition at line 4775 of file io.c.
References pipe_list::fptr, list, pipe_list::next, and rb_io_fptr_finalize().
Referenced by Init_IO().
static void pipe_del_fptr | ( | rb_io_t * | fptr | ) | [static] |
Definition at line 4752 of file io.c.
References pipe_list::fptr, free, list, and pipe_list::next.
Referenced by pipe_finalize().
static void pipe_finalize | ( | rb_io_t * | fptr, | |
int | noraise | |||
) | [static] |
Definition at line 4788 of file io.c.
References rb_io_t::fd, fptr_finalize(), rb_io_t::pid, pipe_del_fptr(), rb_last_status_set(), and rb_io_t::stdio_file.
Referenced by io_reopen(), and rb_io_init_copy().
static VALUE pipe_open | ( | struct rb_exec_arg * | eargp, | |
VALUE | prog, | |||
const char * | modestr, | |||
int | fmode, | |||
convconfig_t * | convconfig | |||
) | [static] |
Definition at line 4913 of file io.c.
References rb_exec_arg::argc, argc, rb_exec_arg::argv, argv, rb_io_t::encs, errno, EWOULDBLOCK, rb_io_t::fd, fileno, rb_io_t::finalize, FIXNUM_MAX, FMODE_DUPLEX, FMODE_READABLE, FMODE_SYNC, FMODE_WRITABLE, INT2FIX, io_alloc(), MakeOpenFile, rb_io_t::mode, NULL, orig_stderr, orig_stdout, rb_io_t::pid, pipe_add_fptr(), Qnil, rb_ary_join(), rb_ary_new4(), rb_cIO, rb_eArgError, rb_exec_arg_addopt(), rb_exec_arg_fixup(), rb_fork(), rb_fork_err(), RB_GC_GUARD, rb_intern, rb_io_synchronized(), rb_ivar_set(), rb_pipe(), rb_raise(), rb_run_exec_options(), rb_str_new2(), rb_str_tmp_new(), rb_sys_fail(), rb_thread_sleep(), rb_w32_aspawn(), rb_w32_spawn(), RFILE, RSTRING_PTR, rb_io_t::stdio_file, StringValueCStr, and rb_io_t::tied_io_for_writing.
Referenced by pipe_open_s(), and pipe_open_v().
static VALUE pipe_open_s | ( | VALUE | prog, | |
const char * | modestr, | |||
int | fmode, | |||
convconfig_t * | convconfig | |||
) | [static] |
Definition at line 5186 of file io.c.
References argc, argv, pipe_open(), rb_eNotImpError, rb_exec_arg_init(), rb_raise(), RSTRING_LEN, RSTRING_PTR, and TRUE.
Referenced by rb_f_backquote(), rb_io_open(), and rb_io_s_popen().
static VALUE pipe_open_v | ( | int | argc, | |
VALUE * | argv, | |||
const char * | modestr, | |||
int | fmode, | |||
convconfig_t * | convconfig | |||
) | [static] |
Definition at line 5177 of file io.c.
References FALSE, pipe_open(), rb_exec_arg::prog, and rb_exec_arg_init().
Referenced by rb_io_s_popen().
Definition at line 7657 of file io.c.
References io_close(), and rb_ensure().
Referenced by rb_io_s_pipe().
Definition at line 5206 of file io.c.
References last, NIL_P, rb_check_convert_type(), and T_HASH.
Referenced by open_key_args(), rb_io_initialize(), rb_io_s_pipe(), rb_io_s_popen(), rb_io_set_encoding(), and rb_scan_open_args().
Definition at line 6276 of file io.c.
References rb_io_t::fd, io_alloc(), io_check_tty(), MakeOpenFile, rb_io_t::mode, O_BINARY, rb_io_t::pathv, rb_obj_freeze(), and rb_str_new_cstr().
Referenced by argf_next_argv(), prep_stdio(), and rb_io_fdopen().
Definition at line 6306 of file io.c.
References fileno, FMODE_PREP, GetOpenFile, prep_io(), and rb_io_t::stdio_file.
Referenced by Init_IO().
static void prepare_getline_args | ( | int | argc, | |
VALUE * | argv, | |||
VALUE * | rsp, | |||
long * | limit, | |||
VALUE | io | |||
) | [static] |
Definition at line 2387 of file io.c.
References ENC_CODERANGE_7BIT, GetOpenFile, io_read_encoding(), NIL_P, NUM2LONG(), rb_check_string_type(), rb_default_rs, rb_eArgError, rb_enc_asciicompat, rb_enc_get(), rb_enc_name, rb_enc_str_coderange(), rb_enc_str_new(), rb_raise(), rb_rs, rb_scan_args(), rb_str_buf_cat_ascii(), RSTRING_LEN, and StringValue.
Referenced by rb_io_each_line(), rb_io_getline(), and rb_io_readlines().
size_t rb_econv_memsize | ( | rb_econv_t * | ) |
Definition at line 1713 of file transcode.c.
References rb_econv_t::elems, rb_econv_t::in_buf_end, rb_econv_t::in_buf_start, rb_econv_t::num_allocated, rb_econv_t::num_trans, rb_econv_elem_t::out_buf_end, rb_econv_elem_t::out_buf_start, rb_transcoding_memsize(), rb_econv_t::replacement_allocated, rb_econv_t::replacement_len, size, and rb_econv_elem_t::tc.
Referenced by rb_io_memsize().
void rb_eof_error | ( | void | ) |
Definition at line 256 of file io.c.
References rb_eEOFError, and rb_raise().
Referenced by argf_readbyte(), argf_readchar(), argf_readline(), argf_readpartial(), copy_stream_fallback_body(), io_read_nonblock(), io_readpartial(), ossl_ssl_read_internal(), r_byte(), rb_io_readbyte(), rb_io_readchar(), rb_io_readline(), rb_io_sysread(), strio_readbyte(), strio_readchar(), strio_readline(), and strio_sysread().
Definition at line 7117 of file io.c.
References FMODE_READABLE, GetOpenFile, NIL_P, NULL, pipe_open_s(), Qnil, rb_io_close(), rb_str_new(), read_all(), remain_size(), result, and SafeStringValue.
Referenced by Init_IO().
Definition at line 6939 of file io.c.
References argf_gets(), rb_funcall2(), and rb_intern.
Definition at line 5597 of file io.c.
References check_pipe_command(), CONST_ID, FilePathValue, io_close(), NIL_P, rb_block_given_p(), rb_cFile, rb_cIO, rb_ensure(), rb_funcall2(), rb_io_s_open(), rb_io_s_popen(), rb_respond_to(), and rb_yield().
Referenced by Init_IO().
Definition at line 6182 of file io.c.
References rb_ary_new4(), rb_io_flush(), rb_p(), rb_stdout, T_FILE, and TYPE.
Referenced by Init_IO().
Definition at line 6004 of file io.c.
References rb_io_print(), and rb_stdout.
Referenced by Init_IO().
Definition at line 5915 of file io.c.
References rb_f_sprintf(), rb_io_write(), rb_stdout, T_STRING, and TYPE.
Referenced by Init_IO().
Definition at line 6050 of file io.c.
References rb_funcall2(), rb_intern, rb_io_putc(), and rb_stdout.
Referenced by Init_IO().
Definition at line 6139 of file io.c.
References rb_funcall2(), rb_intern, rb_io_puts(), and rb_stdout.
Referenced by Init_IO().
Definition at line 7012 of file io.c.
References argf_readline(), rb_funcall2(), and rb_intern.
Referenced by Init_IO().
Definition at line 7065 of file io.c.
References argf_readlines(), rb_funcall2(), and rb_intern.
Referenced by Init_IO().
Definition at line 7304 of file io.c.
References select_args::except, select_args::fdsets, NIL_P, numberof, rb_ensure(), rb_fd_init, rb_scan_args(), rb_time_interval(), select_args::read, select_internal(), select_args::timeout, and select_args::write.
Referenced by Init_IO().
FILE* rb_fdopen | ( | int | fd, | |
const char * | modestr | |||
) |
Definition at line 4543 of file io.c.
References errno, NULL, rb_gc(), rb_sys_fail(), and rb_warn().
Referenced by rb_io_stdio_file().
Definition at line 6500 of file io.c.
References NIL_P, rb_check_convert_type(), rb_eRuntimeError, rb_io_initialize(), rb_open_file(), rb_raise(), RFILE, and T_FIXNUM.
Referenced by Init_IO().
VALUE rb_file_open | ( | const char * | fname, | |
const char * | modestr | |||
) |
Definition at line 4729 of file io.c.
References io_alloc(), rb_cFile, rb_file_open_internal(), and rb_str_new_cstr().
static VALUE rb_file_open_generic | ( | VALUE | io, | |
VALUE | filename, | |||
int | oflags, | |||
int | fmode, | |||
convconfig_t * | convconfig, | |||
mode_t | perm | |||
) | [static] |
Definition at line 4670 of file io.c.
References rb_io_t::encs, rb_io_t::fd, FMODE_SETENC_BY_BOM, io_check_tty(), io_set_encoding_by_bom(), MakeOpenFile, rb_io_t::mode, NULL, rb_io_t::pathv, rb_io_ext_int_to_encs(), rb_str_new_frozen(), rb_sysopen(), and validate_enc_binmode().
Referenced by rb_file_open_internal(), rb_io_open(), and rb_open_file().
Definition at line 4695 of file io.c.
References NULL, parse_mode_enc(), rb_ascii8bit_encoding(), rb_file_open_generic(), rb_io_ext_int_to_encs(), rb_io_fmode_oflags(), rb_io_modestr_fmode(), and strchr().
Referenced by rb_file_open(), and rb_file_open_str().
Definition at line 4722 of file io.c.
References FilePathValue, io_alloc(), rb_cFile, and rb_file_open_internal().
Referenced by iseq_s_compile_file().
VALUE rb_gets | ( | void | ) |
Definition at line 6974 of file io.c.
References ARGF, next_argv, NIL_P, rb_default_rs, rb_f_gets(), rb_io_close(), rb_io_gets(), rb_lastline_set(), and rb_rs.
Definition at line 3932 of file io.c.
References clear_codeconv(), rb_io_t::rb_io_enc_t::ecflags, rb_io_t::rb_io_enc_t::ecopts, rb_io_t::rb_io_enc_t::enc, rb_io_t::rb_io_enc_t::enc2, rb_io_t::encs, GetOpenFile, rb_io_t::mode, rb_ascii8bit_encoding(), rb_econv_close(), rb_io_t::readconv, and rb_io_t::writeconv.
Referenced by argf_binmode_m(), argf_next_argv(), rb_io_binmode_m(), and rsock_init_sock().
Definition at line 6557 of file io.c.
References FMODE_PREP, GetOpenFile, rb_io_t::mode, Qfalse, and rb_secure().
Referenced by Init_IO().
Definition at line 3916 of file io.c.
References ECONV_CRLF_NEWLINE_DECORATOR, ECONV_UNIVERSAL_NEWLINE_DECORATOR, GetOpenFile, rb_io_t::mode, rb_econv_binmode(), rb_io_t::readconv, rb_io_t::writeconv, and rb_io_t::writeconv_pre_ecflags.
Referenced by argf_next_argv(), io_reopen(), rb_io_init_copy(), and seek_before_access().
Definition at line 3971 of file io.c.
References GetWriteIO, and rb_io_ascii8bit_binmode().
Referenced by Init_IO().
Definition at line 3990 of file io.c.
References FMODE_BINMODE, GetOpenFile, rb_io_t::mode, and Qtrue.
Referenced by Init_IO().
void rb_io_check_byte_readable | ( | rb_io_t * | fptr | ) |
Definition at line 432 of file io.c.
References rb_eIOError, rb_io_check_char_readable(), rb_raise(), and READ_CHAR_PENDING.
Referenced by copy_stream_body(), io_getpartial(), io_read(), rb_io_check_readable(), rb_io_each_byte(), rb_io_getbyte(), rb_io_sysread(), and rb_io_ungetbyte().
void rb_io_check_char_readable | ( | rb_io_t * | fptr | ) |
Definition at line 413 of file io.c.
References FMODE_READABLE, GetOpenFile, io_fflush(), rb_io_t::mode, rb_eIOError, rb_io_check_closed(), rb_raise(), rb_sys_fail(), rb_io_t::tied_io_for_writing, and rb_io_t::wbuf_len.
Referenced by io_read(), rb_io_check_byte_readable(), rb_io_each_char(), rb_io_each_codepoint(), rb_io_eof(), rb_io_getc(), rb_io_getline_1(), rb_io_lineno(), rb_io_set_lineno(), and rb_io_ungetc().
void rb_io_check_closed | ( | rb_io_t * | fptr | ) |
Definition at line 279 of file io.c.
References rb_io_t::fd, rb_eIOError, rb_io_check_initialized(), and rb_raise().
Referenced by bsock_getsockopt(), bsock_setsockopt(), io_binwrite(), io_fflush(), io_fread(), io_unread(), io_wait(), rb_file_flock(), rb_io_check_char_readable(), rb_io_check_writable(), rb_io_close_m(), rb_io_sysread(), rb_io_syswrite(), rsock_s_recvfrom(), and rsock_s_recvfrom_nonblock().
void rb_io_check_initialized | ( | rb_io_t * | fptr | ) |
Definition at line 271 of file io.c.
References rb_eIOError, and rb_raise().
Referenced by rb_file_path(), rb_io_check_closed(), rb_io_closed(), rb_io_get_write_io(), and rb_io_synchronized().
Definition at line 296 of file io.c.
References rb_check_convert_type(), and T_FILE.
Referenced by argf_external_encoding(), argf_internal_encoding(), io_write(), rb_io_reopen(), and rb_io_s_try_convert().
void rb_io_check_readable | ( | rb_io_t * | fptr | ) |
Definition at line 441 of file io.c.
References rb_io_check_byte_readable().
Referenced by io_nread(), io_ready_p(), io_wait(), ossl_obj2bio(), and ossl_ssl_setup().
void rb_io_check_writable | ( | rb_io_t * | fptr | ) |
Definition at line 465 of file io.c.
References FMODE_WRITABLE, io_unread(), rb_io_t::mode, rb_eIOError, rb_io_check_closed(), rb_raise(), and rb_io_t::rbuf_len.
Referenced by copy_stream_body(), io_write(), ossl_ssl_setup(), rb_io_syswrite(), and rb_io_write_nonblock().
Definition at line 3551 of file io.c.
References FALSE, rb_io_t::fd, GetWriteIO, rb_io_t::pid, rb_io_fptr_cleanup(), rb_syswait(), rb_thread_fd_close(), RFILE, and TRUE.
Referenced by argf_next_argv(), bsock_close_read(), bsock_close_write(), load_file_internal(), pty_close_pty(), rb_f_backquote(), rb_gets(), rb_io_close_m(), rb_io_close_read(), rb_io_close_write(), rb_io_s_binread(), rb_io_s_foreach(), rb_io_s_pipe(), rb_io_s_read(), and rb_io_s_readlines().
Definition at line 3597 of file io.c.
References OBJ_UNTRUSTED, rb_eSecurityError, rb_io_check_closed(), rb_io_close(), rb_raise(), rb_safe_level, and RFILE.
Referenced by copy_stream_finalize(), and Init_IO().
Definition at line 3677 of file io.c.
References FALSE, rb_io_t::fd, FMODE_WRITABLE, GetOpenFile, GetWriteIO, is_socket, rb_io_t::mode, OBJ_UNTRUSTED, rb_io_t::pathv, rb_eIOError, rb_eSecurityError, rb_io_close(), rb_io_fptr_cleanup(), rb_io_fptr_finalize(), rb_raise(), rb_safe_level, rb_sys_fail_path, RFILE, SHUT_RD, and shutdown.
Referenced by Init_IO().
Definition at line 3735 of file io.c.
References rb_io_t::fd, FMODE_READABLE, GetOpenFile, GetWriteIO, is_socket, rb_io_t::mode, OBJ_UNTRUSTED, rb_io_t::pathv, rb_eIOError, rb_eSecurityError, rb_io_close(), rb_raise(), rb_safe_level, rb_sys_fail_path, SHUT_WR, shutdown, and rb_io_t::tied_io_for_writing.
Referenced by Init_IO().
Definition at line 3639 of file io.c.
References rb_io_t::fd, GetWriteIO, Qfalse, rb_io_check_initialized(), and RFILE.
Referenced by argf_closed(), and Init_IO().
Definition at line 7358 of file io.c.
References F_SETFL, rb_io_t::fd, FIX2LONG, FIXNUM_P, FMODE_WSPLIT_INITIALIZED, GetOpenFile, INT2NUM(), io_cntl(), len, rb_io_t::mode, NIL_P, NUM2LONG(), NUM2ULONG, O_NONBLOCK, rb_io_t::pathv, Qfalse, Qtrue, rb_check_string_type(), rb_eArgError, rb_raise(), rb_secure(), rb_str_modify(), rb_str_resize(), rb_sys_fail_path, RSTRING_LEN, RSTRING_PTR, T_STRING, and TYPE.
Referenced by rb_io_ioctl().
Definition at line 2767 of file io.c.
References errno, GetOpenFile, INT2FIX, io_fillbuf(), rb_io_check_byte_readable(), rb_yield(), rb_io_t::rbuf, rb_io_t::rbuf_len, rb_io_t::rbuf_off, READ_CHECK, and RETURN_ENUMERATOR.
Referenced by Init_IO().
Definition at line 2914 of file io.c.
References GetOpenFile, io_getc(), io_input_encoding(), NIL_P, rb_io_check_char_readable(), rb_yield(), READ_CHECK, and RETURN_ENUMERATOR.
Referenced by Init_IO().
Definition at line 2949 of file io.c.
References rb_io_t::cbuf, rb_io_t::cbuf_capa, rb_io_t::cbuf_len, rb_io_t::cbuf_off, clear_readconv(), rb_io_t::rb_io_enc_t::enc, rb_io_t::encs, GetOpenFile, io_fillbuf(), io_input_encoding(), make_readconv(), MBCLEN_CHARFOUND_LEN, MBCLEN_CHARFOUND_P, MBCLEN_INVALID_P, MBCLEN_NEEDMORE_P, more_char(), MORE_CHAR_FINISHED, NEED_READCONV, ONIGENC_CONSTRUCT_MBCLEN_CHARFOUND, rb_eArgError, rb_eIOError, rb_enc_codepoint, rb_enc_name, rb_enc_precise_mbclen(), rb_io_check_char_readable(), rb_raise(), rb_yield(), rb_io_t::rbuf, rb_io_t::rbuf_len, rb_io_t::rbuf_off, READ_CHECK, RETURN_ENUMERATOR, and UINT2NUM().
Referenced by Init_IO().
Definition at line 2733 of file io.c.
References NIL_P, prepare_getline_args(), rb_io_getline_1(), rb_yield(), and RETURN_ENUMERATOR.
Referenced by Init_IO().
Definition at line 1268 of file io.c.
References binwrite_arg::fptr, GetOpenFile, io_fillbuf(), rb_io_check_char_readable(), READ_CHAR_PENDING, READ_CHECK, and READ_DATA_PENDING.
Referenced by argf_eof(), and Init_IO().
static void rb_io_ext_int_to_encs | ( | rb_encoding * | ext, | |
rb_encoding * | intern, | |||
rb_encoding ** | enc, | |||
rb_encoding ** | enc2 | |||
) | [static] |
Definition at line 4195 of file io.c.
References NULL, Qnil, rb_ascii8bit_encoding(), rb_default_external_encoding(), and rb_default_internal_encoding().
Referenced by io_encoding_set(), parse_mode_enc(), rb_file_open_generic(), rb_file_open_internal(), rb_io_extract_encoding_option(), and rb_io_extract_modeenc().
Definition at line 8583 of file io.c.
References rb_io_t::rb_io_enc_t::enc, rb_io_t::rb_io_enc_t::enc2, rb_io_t::encs, FMODE_WRITABLE, GetOpenFile, io_read_encoding(), rb_io_t::mode, and rb_enc_from_encoding().
Referenced by argf_external_encoding(), and Init_IO().
int rb_io_extract_encoding_option | ( | VALUE | opt, | |
rb_encoding ** | enc_p, | |||
rb_encoding ** | enc2_p, | |||
int * | fmode_p | |||
) |
Definition at line 4305 of file io.c.
References NIL_P, parse_mode_enc(), Qnil, Qundef, rb_check_string_type(), rb_hash_lookup2(), rb_io_ext_int_to_encs(), rb_to_encoding(), rb_warn(), StringValueCStr, sym_encoding, sym_extenc, and sym_intenc.
static void rb_io_extract_modeenc | ( | VALUE * | vmode_p, | |
VALUE * | vperm_p, | |||
VALUE | opthash, | |||
int * | oflags_p, | |||
int * | fmode_p, | |||
convconfig_t * | convconfig_p | |||
) | [static] |
Definition at line 4394 of file io.c.
References extract_binmode(), FMODE_BINMODE, NIL_P, NULL, NUM2INT, parse_mode_enc(), rb_ascii8bit_encoding(), rb_check_to_integer(), rb_eArgError, rb_econv_prepare_opts(), rb_hash_aref(), rb_io_ext_int_to_encs(), rb_io_extract_encoding_option(), rb_io_fmode_oflags(), rb_io_modestr_fmode(), rb_io_oflags_fmode(), rb_raise(), SafeStringValue, strchr(), StringValueCStr, sym_mode, sym_perm, and validate_enc_binmode().
Referenced by rb_io_initialize(), rb_io_open(), rb_io_s_popen(), and rb_scan_open_args().
VALUE rb_io_fdopen | ( | int | fd, | |
int | oflags, | |||
const char * | path | |||
) |
Definition at line 6297 of file io.c.
References prep_io(), rb_cFile, rb_cIO, and rb_io_oflags_fmode().
Referenced by load_file_internal().
Definition at line 1413 of file io.c.
References rb_io_t::fd, GetOpenFile, and INT2FIX.
Referenced by argf_fileno(), and Init_IO().
Definition at line 1044 of file io.c.
References rb_io_t::fd, FMODE_READABLE, FMODE_WRITABLE, binwrite_arg::fptr, fsync, GetOpenFile, GetWriteIO, id_flush, io_fflush(), io_unread(), rb_io_t::mode, rb_funcall(), rb_sys_fail(), T_FILE, and TYPE.
Referenced by Init_IO(), process_options(), rb_f_p(), rb_file_flock(), rb_file_size(), rb_io_getbyte(), rb_io_init_copy(), and rb_io_s_popen().
static const char* rb_io_fmode_modestr | ( | int | fmode | ) | [static] |
Definition at line 3998 of file io.c.
References FMODE_APPEND, FMODE_CREATE, FMODE_READABLE, FMODE_READWRITE, FMODE_WRITABLE, MODE_BTMODE, rb_eArgError, and rb_raise().
Referenced by io_reopen(), and rb_io_reopen().
static int rb_io_fmode_oflags | ( | int | fmode | ) | [static] |
Definition at line 4120 of file io.c.
References FMODE_APPEND, FMODE_BINMODE, FMODE_CREATE, FMODE_READABLE, FMODE_READWRITE, FMODE_TRUNC, and FMODE_WRITABLE.
Referenced by rb_file_open_internal(), rb_io_extract_modeenc(), rb_io_modestr_oflags(), rb_io_reopen(), and rb_io_stdio_file().
static void rb_io_fptr_cleanup | ( | rb_io_t * | fptr, | |
int | noraise | |||
) | [static] |
Definition at line 3475 of file io.c.
References rb_io_t::finalize, and fptr_finalize().
Referenced by rb_io_close(), rb_io_close_read(), and rb_io_fptr_finalize().
int rb_io_fptr_finalize | ( | rb_io_t * | fptr | ) |
Definition at line 3516 of file io.c.
References clear_codeconv(), rb_io_t::fd, free, rb_io_t::pathv, rb_io_fptr_cleanup(), rb_io_t::rbuf, TRUE, rb_io_t::wbuf, and rb_io_t::write_lock.
Referenced by pipe_atexit(), and rb_io_close_read().
Definition at line 290 of file io.c.
References rb_convert_type(), and T_FILE.
Referenced by io_reopen(), rb_io_init_copy(), and select_internal().
Definition at line 302 of file io.c.
References rb_io_check_initialized(), and RFILE.
Definition at line 3091 of file io.c.
References rb_io_t::fd, FMODE_TTY, GetOpenFile, INT2FIX, io_fillbuf(), rb_io_t::mode, rb_io_check_byte_readable(), rb_io_flush(), rb_stdout, rb_io_t::rbuf, rb_io_t::rbuf_len, rb_io_t::rbuf_off, READ_CHECK, T_FILE, and TYPE.
Referenced by argf_getbyte(), Init_IO(), io_strip_bom(), load_file_internal(), and rb_io_readbyte().
Definition at line 3042 of file io.c.
References GetOpenFile, io_getc(), io_input_encoding(), rb_io_check_char_readable(), and READ_CHECK.
Referenced by argf_getc(), argf_readchar(), Init_IO(), and rb_io_readchar().
Definition at line 2541 of file io.c.
References prepare_getline_args(), and rb_io_getline_1().
Referenced by argf_getline(), and rb_io_gets_m().
Definition at line 2432 of file io.c.
References appendline(), ARGF, EOF, GetOpenFile, io_enc_str(), io_read_encoding(), rb_io_t::lineno, MBCLEN_NEEDMORE_P, memcmp(), NEED_READCONV, NIL_P, OBJ_FREEZE, Qnil, rb_default_rs, rb_enc_asciicompat, rb_enc_from_encoding(), rb_enc_left_char_head, rb_enc_precise_mbclen(), rb_enc_str_new(), rb_io_check_char_readable(), rb_io_getline_fast(), rb_str_encode(), rb_usascii_str_new(), read_all(), rscheck(), RSTRING_LEN, RSTRING_PTR, and swallow().
Referenced by rb_io_each_line(), rb_io_getline(), rb_io_gets(), and rb_io_readlines().
static VALUE rb_io_getline_fast | ( | rb_io_t * | fptr, | |
rb_encoding * | enc, | |||
VALUE | io | |||
) | [static] |
Definition at line 2333 of file io.c.
References ARGF, ENC_CODERANGE_BROKEN, ENC_CODERANGE_SET, io_enc_str(), io_fillbuf(), len, rb_io_t::lineno, NIL_P, rb_str_coderange_scan_restartable(), rb_str_new(), rb_str_resize(), rb_io_t::rbuf_len, rb_io_t::rbuf_off, read_buffered_data(), READ_CHECK, READ_DATA_PENDING_COUNT, READ_DATA_PENDING_PTR, and RSTRING_PTR.
Referenced by rb_io_getline_1().
Definition at line 2551 of file io.c.
References rb_default_rs, and rb_io_getline_1().
Referenced by argf_getline(), lex_io_gets(), load_file_internal(), and rb_gets().
Definition at line 2578 of file io.c.
References rb_io_getline(), and rb_lastline_set().
Referenced by Init_IO(), io_s_foreach(), and rb_io_readline().
Definition at line 5842 of file io.c.
References rb_io_t::encs, rb_io_t::fd, rb_io_t::finalize, FMODE_BINMODE, GetOpenFile, GetWriteIO, io_seek, io_tell, rb_io_t::lineno, MakeOpenFile, rb_io_t::mode, NIL_P, off_t, rb_io_t::pathv, rb_io_t::pid, pipe_add_fptr(), pipe_finalize(), rb_intern, rb_io_binmode(), rb_io_flush(), rb_io_get_io(), rb_ivar_set(), rb_obj_dup(), ruby_dup(), SEEK_SET, and rb_io_t::tied_io_for_writing.
Referenced by Init_IO().
Definition at line 6414 of file io.c.
References clear_codeconv(), rb_io_t::encs, fcntl(), rb_io_t::fd, fileno, FMODE_READWRITE, FMODE_SETENC_BY_BOM, fstat, INT2FIX, io_check_tty(), io_set_encoding_by_bom(), MakeOpenFile, rb_io_t::mode, NIL_P, NUM2INT, pop_last_hash(), Qfalse, rb_class_new_instance(), rb_eSystemCallError, rb_exc_raise(), rb_hash_aref(), rb_io_extract_modeenc(), rb_io_oflags_fmode(), rb_scan_args(), rb_secure(), rb_sys_fail(), stat, rb_io_t::stdio_file, sym_autoclose, and UPDATE_MAXFD.
Referenced by Init_IO(), rb_file_initialize(), and rb_io_s_for_fd().
Definition at line 1464 of file io.c.
References rb_io_t::fd, NIL_P, rb_io_t::pathv, rb_any_to_s(), rb_io_taint_check(), rb_obj_classname(), rb_sprintf(), RFILE, RSTRING_PTR, and snprintf.
Referenced by Init_IO().
Definition at line 8608 of file io.c.
References rb_io_t::rb_io_enc_t::enc2, rb_io_t::encs, GetOpenFile, io_read_encoding(), and rb_enc_from_encoding().
Referenced by argf_internal_encoding(), Init_IO(), and io_set_encoding_by_bom().
Definition at line 7441 of file io.c.
References rb_io_ctl(), and rb_scan_args().
Referenced by Init_IO().
Definition at line 3243 of file io.c.
References rb_io_t::fd, and GetOpenFile.
Referenced by Init_IO().
Definition at line 2608 of file io.c.
References GetOpenFile, INT2NUM(), rb_io_t::lineno, and rb_io_check_char_readable().
Referenced by Init_IO().
size_t rb_io_memsize | ( | rb_io_t * | fptr | ) |
Definition at line 3539 of file io.c.
References rb_io_t::cbuf_capa, rb_econv_memsize(), rb_io_t::rbuf_capa, rb_io_t::readconv, size, rb_io_t::wbuf_capa, and rb_io_t::writeconv.
Referenced by memsize_of().
static void rb_io_mode_enc | ( | rb_io_t * | fptr, | |
const char * | modestr | |||
) | [static] |
Definition at line 4296 of file io.c.
References mode_enc(), and strchr().
Referenced by rb_io_reopen().
int rb_io_modestr_fmode | ( | const char * | modestr | ) |
Definition at line 4036 of file io.c.
References FMODE_APPEND, FMODE_BINMODE, FMODE_TEXTMODE, FMODE_TRUNC, FMODE_WRITABLE, io_encname_bom_p(), rb_eArgError, and rb_raise().
Referenced by rb_file_open_internal(), rb_io_extract_modeenc(), rb_io_modestr_oflags(), and rb_io_reopen().
int rb_io_modestr_oflags | ( | const char * | modestr | ) |
Definition at line 4155 of file io.c.
References rb_io_fmode_oflags(), and rb_io_modestr_fmode().
Referenced by check_exec_redirect(), and rb_io_s_sysopen().
int rb_io_oflags_fmode | ( | int | oflags | ) |
Definition at line 4085 of file io.c.
References O_BINARY.
Referenced by rb_io_extract_modeenc(), rb_io_fdopen(), and rb_io_initialize().
static const char* rb_io_oflags_modestr | ( | int | oflags | ) | [static] |
Definition at line 4161 of file io.c.
References MODE_BINARY, rb_eArgError, and rb_raise().
Referenced by rb_io_open(), rb_io_reopen(), rb_io_s_popen(), and rb_io_stdio_file().
Definition at line 5634 of file io.c.
References check_pipe_command(), io_alloc(), mode_t, NIL_P, NUM2UINT, pipe_open_s(), rb_cFile, rb_file_open_generic(), rb_io_extract_modeenc(), and rb_io_oflags_modestr().
Referenced by open_key_args(), and rb_io_s_binread().
Definition at line 5654 of file io.c.
References io_alloc(), rb_cFile, and rb_open_file().
Referenced by open_key_args().
Definition at line 1445 of file io.c.
References GetOpenFile, rb_io_t::pid, and PIDT2NUM.
Referenced by Init_IO().
Definition at line 5956 of file io.c.
References NIL_P, rb_io_write(), rb_lastline_get(), rb_output_fs, and rb_output_rs.
Referenced by Init_IO(), and rb_f_print().
Definition at line 5897 of file io.c.
References rb_f_sprintf(), and rb_io_write().
Referenced by Init_IO().
Definition at line 6029 of file io.c.
References NUM2CHR(), rb_io_write(), and rb_str_new().
Referenced by Init_IO(), and rb_f_putc().
Definition at line 6097 of file io.c.
References io_puts_ary(), NIL_P, rb_check_array_type(), rb_default_rs, rb_exec_recursive(), rb_io_write(), rb_obj_as_string(), RSTRING_LEN, RSTRING_PTR, T_STRING, and TYPE.
Referenced by Init_IO(), io_puts_ary(), rb_f_abort(), and rb_f_puts().
void rb_io_read_check | ( | rb_io_t * | fptr | ) |
Definition at line 494 of file io.c.
References rb_io_t::fd, rb_thread_wait_fd(), and READ_DATA_PENDING.
int rb_io_read_pending | ( | rb_io_t * | fptr | ) |
Definition at line 477 of file io.c.
References READ_CHAR_PENDING, and READ_DATA_PENDING.
Referenced by io_nread(), io_ready_p(), io_wait(), rsock_s_recvfrom(), and rsock_s_recvfrom_nonblock().
Definition at line 3124 of file io.c.
References NIL_P, rb_eof_error(), and rb_io_getbyte().
Referenced by Init_IO().
Definition at line 3068 of file io.c.
References NIL_P, rb_eof_error(), and rb_io_getc().
Referenced by Init_IO().
Definition at line 2656 of file io.c.
References NIL_P, rb_eof_error(), and rb_io_gets_m().
Referenced by Init_IO().
Definition at line 2685 of file io.c.
References NIL_P, prepare_getline_args(), rb_ary_new(), rb_ary_push(), and rb_io_getline_1().
Referenced by Init_IO(), and io_s_readlines().
Definition at line 5768 of file io.c.
References ALLOC, rb_io_t::rb_io_enc_t::ecflags, rb_io_t::rb_io_enc_t::ecopts, rb_io_t::encs, rb_io_t::fd, fileno, FilePathValue, FMODE_READWRITE, FMODE_WRITABLE, io_fflush(), io_reopen(), IS_PREP_STDIO, MEMZERO, rb_io_t::mode, NIL_P, NULL, rb_io_t::pathv, PREP_STDIO_NAME, rb_eArgError, rb_io_check_io(), rb_io_fmode_modestr(), rb_io_fmode_oflags(), rb_io_mode_enc(), rb_io_modestr_fmode(), rb_io_oflags_modestr(), rb_io_taint_check(), rb_raise(), rb_scan_args(), rb_secure(), rb_str_new_frozen(), rb_sys_fail(), rb_sys_fail_path, rb_sysopen(), rb_warn(), rb_io_t::rbuf_len, rb_io_t::rbuf_off, RFILE, RSTRING_PTR, rb_io_t::stdio_file, and StringValueCStr.
Referenced by Init_IO().
Definition at line 1187 of file io.c.
References ARGF, clear_readconv(), errno, binwrite_arg::fptr, GetOpenFile, INT2FIX, io_seek, rb_io_t::lineno, rb_io_t::pathv, rb_sys_fail_path, and rb_io_t::readconv.
Referenced by argf_rewind(), and Init_IO().
Definition at line 7995 of file io.c.
References foreach_arg::argc, foreach_arg::argv, FilePathValue, foreach_arg::io, io_s_read(), NIL_P, NULL, seek_arg::offset, Qnil, rb_ensure(), rb_io_close(), rb_io_open(), rb_io_seek(), rb_scan_args(), rb_str_new_cstr(), and SEEK_SET.
Referenced by Init_IO().
Definition at line 8547 of file io.c.
References copy_stream_struct::copy_length, copy_stream_body(), copy_stream_finalize(), copy_stream_struct::dst, MEMZERO, NIL_P, NUM2OFFT, OFFT2NUM, rb_ensure(), rb_scan_args(), copy_stream_struct::src, and copy_stream_struct::src_offset.
Referenced by Init_IO().
Definition at line 6541 of file io.c.
References rb_io_initialize(), and rb_obj_alloc().
Referenced by Init_IO().
Definition at line 7857 of file io.c.
References foreach_arg::io, io_s_foreach(), NIL_P, NULL, open_key_args(), rb_ensure(), rb_io_close(), rb_scan_args(), and RETURN_ENUMERATOR.
Referenced by Init_IO().
Definition at line 6520 of file io.c.
References rb_block_given_p(), rb_class2name(), rb_class_new_instance(), and rb_warn().
Referenced by Init_IO().
Definition at line 5421 of file io.c.
References io_close(), rb_block_given_p(), rb_class_new_instance(), rb_ensure(), and rb_yield().
Referenced by Init_IO(), and rb_f_open().
Definition at line 7724 of file io.c.
References extract_binmode(), GetOpenFile, INT2FIX, INT2NUM(), io_encoding_set(), io_new_instance(), rb_io_t::mode, NIL_P, pipe_pair_close(), pop_last_hash(), rb_assoc_new(), rb_block_given_p(), rb_ensure(), rb_io_close(), rb_io_synchronized(), rb_jump_tag(), rb_pipe(), rb_protect(), rb_scan_args(), rb_sys_fail(), and rb_yield().
Referenced by Init_IO().
Definition at line 5304 of file io.c.
References io_close(), len, NIL_P, pipe_open_s(), pipe_open_v(), pop_last_hash(), Qnil, RARRAY_LEN, RARRAY_PTR, rb_ary_clear(), rb_ary_dup(), rb_block_given_p(), rb_check_array_type(), rb_eArgError, rb_ensure(), rb_io_extract_modeenc(), rb_io_flush(), rb_io_oflags_modestr(), rb_raise(), rb_scan_args(), rb_stderr, rb_stdout, rb_yield(), RBASIC, and SafeStringValue.
Referenced by Init_IO(), and rb_f_open().
Definition at line 7956 of file io.c.
References foreach_arg::argc, seek_arg::io, foreach_arg::io, io_s_read(), seek_arg::mode, NIL_P, NULL, seek_arg::offset, open_key_args(), rb_ensure(), rb_io_close(), rb_jump_tag(), rb_protect(), rb_scan_args(), and seek_before_access().
Referenced by Init_IO().
Definition at line 7893 of file io.c.
References foreach_arg::io, io_s_readlines(), NIL_P, NULL, open_key_args(), rb_ensure(), rb_io_close(), and rb_scan_args().
Referenced by Init_IO().
Definition at line 5444 of file io.c.
References FilePathValue, INT2NUM(), mode_t, NIL_P, NUM2INT, NUM2UINT, rb_check_to_integer(), RB_GC_GUARD, rb_io_modestr_oflags(), rb_scan_args(), rb_str_new4(), rb_sysopen(), SafeStringValue, and StringValueCStr.
Referenced by Init_IO().
Definition at line 1096 of file io.c.
References errno, binwrite_arg::fptr, GetOpenFile, INT2FIX, io_seek, NUM2OFFT, off_t, rb_io_t::pathv, and rb_sys_fail_path.
Referenced by rb_io_s_binread(), rb_io_seek_m(), and seek_before_access().
Definition at line 1131 of file io.c.
References NUM2INT, binwrite_arg::offset, rb_io_seek(), and rb_scan_args().
Referenced by argf_seek_m(), and Init_IO().
Definition at line 6583 of file io.c.
References GetOpenFile, rb_io_t::mode, rb_secure(), and RTEST.
Referenced by Init_IO().
Definition at line 8637 of file io.c.
References GetOpenFile, io_encoding_set(), pop_last_hash(), and rb_scan_args().
Referenced by argf_set_encoding(), Init_IO(), and rb_stdio_set_default_encoding().
Definition at line 2635 of file io.c.
References GetOpenFile, rb_io_t::lineno, NUM2INT, and rb_io_check_char_readable().
Referenced by Init_IO().
void rb_io_set_nonblock | ( | rb_io_t * | fptr | ) |
Definition at line 1802 of file io.c.
References F_SETFL, fcntl(), rb_io_t::fd, O_NONBLOCK, rb_io_t::pathv, and rb_sys_fail_path.
Referenced by io_getpartial(), rb_io_write_nonblock(), rsock_s_accept_nonblock(), rsock_s_recvfrom_nonblock(), and sock_connect_nonblock().
Definition at line 1155 of file io.c.
References errno, binwrite_arg::fptr, GetOpenFile, io_seek, NUM2OFFT, off_t, OFFT2NUM, rb_io_t::pathv, rb_sys_fail_path, and SEEK_SET.
Referenced by argf_set_pos(), and Init_IO().
Definition at line 1323 of file io.c.
References binwrite_arg::fptr, GetOpenFile, GetWriteIO, rb_io_t::mode, and RTEST.
Referenced by Init_IO().
Definition at line 6318 of file io.c.
References rb_io_t::fd, rb_io_t::mode, rb_fdopen(), rb_io_fmode_oflags(), rb_io_oflags_modestr(), and rb_io_t::stdio_file.
Referenced by rb_dlptr_s_to_ptr(), readline_s_set_input(), and readline_s_set_output().
Definition at line 1298 of file io.c.
References FMODE_SYNC, binwrite_arg::fptr, GetOpenFile, GetWriteIO, rb_io_t::mode, and Qtrue.
Referenced by Init_IO().
void rb_io_synchronized | ( | rb_io_t * | fptr | ) |
Definition at line 4806 of file io.c.
References rb_io_t::mode, and rb_io_check_initialized().
Referenced by pipe_open(), rb_io_s_pipe(), rb_io_unbuffered(), and rsock_init_sock().
Definition at line 3868 of file io.c.
References rb_io_t::fd, GetOpenFile, len, NIL_P, NUM2LONG(), OBJ_TAINT, rb_io_t::pathv, rb_eIOError, rb_eof_error(), rb_io_check_byte_readable(), rb_io_check_closed(), rb_raise(), rb_read_internal(), rb_scan_args(), rb_str_locktmp(), rb_str_modify(), rb_str_new(), rb_str_resize(), rb_str_set_len, rb_str_unlocktmp(), rb_sys_fail_path, rb_thread_wait_fd(), READ_DATA_BUFFERED, RSTRING_PTR, and StringValue.
Referenced by Init_IO().
Definition at line 3784 of file io.c.
References errno, rb_io_t::fd, FMODE_READABLE, FMODE_WRITABLE, GetOpenFile, rb_io_t::mode, NUM2INT, NUM2OFFT, off_t, OFFT2NUM, rb_io_t::pathv, rb_eIOError, rb_raise(), rb_scan_args(), rb_sys_fail_path, rb_warn(), READ_CHAR_PENDING, READ_DATA_BUFFERED, and rb_io_t::wbuf_len.
Referenced by Init_IO().
Definition at line 3824 of file io.c.
References rb_io_t::fd, GetOpenFile, GetWriteIO, LONG2FIX, rb_io_t::pathv, rb_io_check_closed(), rb_io_check_writable(), rb_obj_as_string(), rb_secure(), rb_sys_fail_path, rb_thread_fd_writable(), rb_warn(), RSTRING_LEN, RSTRING_PTR, T_STRING, TYPE, and rb_io_t::wbuf_len.
Referenced by Init_IO().
Definition at line 262 of file io.c.
References OBJ_UNTRUSTED, rb_check_frozen(), rb_eSecurityError, rb_raise(), and rb_safe_level.
Referenced by rb_file_path(), rb_io_inspect(), and rb_io_reopen().
Definition at line 1083 of file io.c.
References errno, binwrite_arg::fptr, GetOpenFile, io_tell, off_t, OFFT2NUM, rb_io_t::pathv, rb_sys_fail_path, and rb_io_t::rbuf_len.
Referenced by argf_tell(), and Init_IO().
void rb_io_unbuffered | ( | rb_io_t * | fptr | ) |
Definition at line 4813 of file io.c.
References rb_io_synchronized().
Definition at line 3152 of file io.c.
References FIX2INT, FIXNUM_P, GetOpenFile, io_ungetbyte(), NIL_P, rb_io_check_byte_readable(), rb_str_new(), and SafeStringValue.
Referenced by Init_IO(), io_strip_bom(), and load_file_internal().
Definition at line 3187 of file io.c.
References buf, rb_io_t::cbuf, rb_io_t::cbuf_capa, rb_io_t::cbuf_len, rb_io_t::cbuf_off, FIX2INT, FIXNUM_P, GetOpenFile, io_read_encoding(), io_ungetbyte(), len, make_readconv(), MEMMOVE, NEED_READCONV, NIL_P, rb_eIOError, rb_enc_mbcput, rb_io_check_char_readable(), rb_raise(), rb_str_new(), RSTRING_LEN, RSTRING_PTR, and SafeStringValue.
Referenced by Init_IO().
int rb_io_wait_readable | ( | int | f | ) |
Definition at line 677 of file io.c.
References errno, EWOULDBLOCK, NULL, rb_eIOError, rb_ensure(), rb_fd_init, rb_fd_ptr, rb_fd_set, rb_fd_term, rb_raise(), rb_thread_select(), and rb_thread_wait_fd().
Referenced by io_fillbuf(), io_fread(), io_getpartial(), ossl_ssl_read_internal(), ossl_ssl_write_internal(), ossl_start_ssl(), rsock_s_accept(), and rsock_s_recvfrom().
int rb_io_wait_writable | ( | int | f | ) |
Definition at line 722 of file io.c.
References errno, EWOULDBLOCK, NULL, rb_eIOError, rb_ensure(), rb_fd_init, rb_fd_ptr, rb_fd_set, rb_fd_term, rb_raise(), rb_thread_fd_writable(), and rb_thread_select().
Referenced by finish_writeconv(), io_binwrite(), io_fflush(), ossl_ssl_read_internal(), ossl_ssl_write_internal(), ossl_start_ssl(), rsock_bsock_send(), and udp_send().
Definition at line 999 of file io.c.
References id_write, and rb_funcall().
Referenced by copy_stream_body(), copy_stream_fallback_body(), gc_profile_report(), marshal_dump(), process_options(), rb_f_printf(), rb_io_addstr(), rb_io_print(), rb_io_printf(), rb_io_putc(), rb_io_puts(), rb_obj_display(), rb_p(), rb_syck_output_handler(), rb_warn_m(), rb_write_error2(), and w_nbyte().
Definition at line 2061 of file io.c.
References errno, EWOULDBLOCK, rb_io_t::fd, GetOpenFile, GetWriteIO, io_fflush(), LONG2FIX, rb_io_t::pathv, rb_io_check_writable(), rb_io_set_nonblock(), rb_mod_sys_fail(), rb_mWaitWritable, rb_obj_as_string(), rb_secure(), rb_sys_fail(), rb_sys_fail_path, RSTRING_LEN, RSTRING_PTR, T_STRING, and TYPE.
Referenced by Init_IO().
Definition at line 6226 of file io.c.
References rb_io_write(), rb_scan_args(), and rb_stdout.
Referenced by Init_IO().
Definition at line 5375 of file io.c.
References mode_t, rb_file_open_generic(), and rb_scan_open_args().
Referenced by rb_file_initialize(), and rb_io_open_with_args().
void rb_p | ( | VALUE | obj | ) |
Definition at line 6148 of file io.c.
References CLASS_OF, id_write, io_write(), rb_default_rs, rb_inspect(), rb_io_write(), rb_method_basic_definition_p(), rb_obj_as_string(), rb_stdout, T_FILE, and TYPE.
Referenced by rb_f_p().
int rb_pipe | ( | int * | pipes | ) |
Definition at line 4819 of file io.c.
References errno, rb_gc(), and UPDATE_MAXFD.
Referenced by pipe_open(), and rb_io_s_pipe().
void rb_read_check | ( | FILE * | fp | ) |
Definition at line 486 of file io.c.
References fileno, rb_thread_wait_fd(), and STDIO_READ_DATA_PENDING.
static ssize_t rb_read_internal | ( | int | fd, | |
void * | buf, | |||
size_t | count | |||
) | [static] |
Definition at line 580 of file io.c.
References io_internal_struct::buf, io_internal_struct::capa, io_internal_struct::fd, internal_read_func(), rb_thread_blocking_region(), and RUBY_UBF_IO.
Referenced by io_fillbuf(), io_fread(), io_getpartial(), and rb_io_sysread().
static void rb_scan_open_args | ( | int | argc, | |
VALUE * | argv, | |||
VALUE * | fname_p, | |||
int * | oflags_p, | |||
int * | fmode_p, | |||
convconfig_t * | convconfig_p, | |||
mode_t * | perm_p | |||
) | [static] |
Definition at line 5352 of file io.c.
References FilePathValue, mode_t, NIL_P, NUM2UINT, pop_last_hash(), rb_io_extract_modeenc(), and rb_scan_args().
Referenced by rb_open_file().
void rb_stdio_set_default_encoding | ( | void | ) |
Definition at line 8650 of file io.c.
References rb_io_set_encoding(), rb_stderr, rb_stdin, and rb_stdout.
Referenced by process_options().
static int rb_sysopen | ( | VALUE | fname, | |
int | oflags, | |||
mode_t | perm | |||
) | [static] |
Definition at line 4516 of file io.c.
References errno, sysopen_struct::fname, sysopen_struct::oflags, sysopen_struct::perm, rb_gc(), rb_str_encode_ospath(), rb_sys_fail(), rb_sysopen_internal(), RSTRING_PTR, and UPDATE_MAXFD.
Referenced by argf_next_argv(), rb_file_open_generic(), rb_io_reopen(), and rb_io_s_sysopen().
static int rb_sysopen_internal | ( | struct sysopen_struct * | data | ) | [inline, static] |
Definition at line 4510 of file io.c.
References rb_thread_blocking_region(), RUBY_UBF_IO, and sysopen_func().
Referenced by rb_sysopen().
Definition at line 2371 of file time.c.
Referenced by io_wait(), rb_f_select(), rb_f_sleep(), and rb_mutex_sleep().
void rb_write_error | ( | const char * | mesg | ) |
Definition at line 6253 of file io.c.
References rb_write_error2().
Referenced by err_append(), rescue_callback(), and warn_printf().
void rb_write_error2 | ( | const char * | mesg, | |
long | len | |||
) |
Definition at line 6242 of file io.c.
References rb_io_t::fd, orig_stderr, rb_io_write(), rb_stderr, rb_str_new(), and RFILE.
Referenced by compile_warn_print(), rb_write_error(), and warn_print().
static ssize_t rb_write_internal | ( | int | fd, | |
void * | buf, | |||
size_t | count | |||
) | [static] |
Definition at line 591 of file io.c.
References io_internal_struct::buf, io_internal_struct::capa, io_internal_struct::fd, internal_write_func(), rb_thread_blocking_region(), and RUBY_UBF_IO.
Referenced by finish_writeconv(), io_binwrite(), and io_binwrite_string().
Definition at line 1738 of file io.c.
References rb_io_t::cbuf_len, clear_readconv(), ENC_CODERANGE_BROKEN, ENC_CODERANGE_SET, fill_cbuf(), io_enc_str(), io_fread(), io_read_encoding(), io_shift_cbuf(), make_readconv(), MORE_CHAR_FINISHED, MORE_CHAR_SUSPENDED, NEED_READCONV, NIL_P, NULL, rb_exc_raise(), rb_str_coderange_scan_restartable(), rb_str_new(), rb_str_resize(), rb_str_set_len, READ_CHECK, and RSTRING_PTR.
Referenced by io_read(), rb_f_backquote(), and rb_io_getline_1().
static long read_buffered_data | ( | char * | ptr, | |
long | len, | |||
rb_io_t * | fptr | |||
) | [static] |
Definition at line 1509 of file io.c.
References MEMMOVE, rb_io_t::rbuf, rb_io_t::rbuf_len, rb_io_t::rbuf_off, and READ_DATA_PENDING_COUNT.
Referenced by appendline(), copy_stream_body(), io_fread(), io_getpartial(), rb_io_getline_fast(), and swallow().
static long remain_size | ( | rb_io_t * | fptr | ) | [static] |
Definition at line 1567 of file io.c.
References rb_io_t::fd, fstat, io_fflush(), LONG_MAX, off_t, rb_eIOError, rb_raise(), rb_sys_fail(), READ_DATA_PENDING_COUNT, S_ISREG, SEEK_CUR, and stat.
Referenced by io_read(), and rb_f_backquote().
static void rscheck | ( | const char * | rsptr, | |
long | rslen, | |||
VALUE | rs | |||
) | [static] |
Definition at line 2197 of file io.c.
References rb_eRuntimeError, rb_raise(), RSTRING_LEN, and RSTRING_PTR.
Referenced by rb_io_getline_1().
static int ruby_dup | ( | int | orig | ) | [static] |
Definition at line 503 of file io.c.
References errno, rb_gc(), rb_sys_fail(), and UPDATE_MAXFD.
Referenced by rb_io_init_copy().
void ruby_set_inplace_mode | ( | const char * | suffix | ) |
Definition at line 7916 of file io.c.
References seek_arg::io, seek_arg::mode, seek_arg::offset, rb_io_binmode(), and rb_io_seek().
Referenced by rb_io_s_read().
static VALUE select_internal | ( | VALUE | read, | |
VALUE | write, | |||
VALUE | except, | |||
struct timeval * | tp, | |||
rb_fdset_t * | fds | |||
) | [static] |
Definition at line 7139 of file io.c.
References Check_Type, rb_io_t::fd, GetOpenFile, GetWriteIO, list, NIL_P, RARRAY_LEN, RARRAY_PTR, rb_ary_entry(), rb_ary_new(), rb_ary_new2(), rb_ary_push(), rb_fd_isset, rb_fd_set, rb_io_get_io(), rb_sys_fail(), rb_thread_fd_select(), READ_CHAR_PENDING, READ_DATA_PENDING, T_ARRAY, timeval::tv_sec, and timeval::tv_usec.
Referenced by rb_f_select().
Definition at line 6269 of file io.c.
References id_write, and must_respond_to().
Referenced by Init_IO().
static int swallow | ( | rb_io_t * | fptr, | |
int | term | |||
) | [inline, static] |
Definition at line 2286 of file io.c.
References buf, cnt, io_fillbuf(), io_read_encoding(), io_shift_cbuf(), make_readconv(), more_char(), MORE_CHAR_FINISHED, NEED_READCONV, NULL, rb_io_t::pathv, rb_enc_ascget(), rb_enc_mbminlen, rb_sys_fail_path, read_buffered_data(), READ_CHAR_PENDING_COUNT, READ_CHAR_PENDING_PTR, READ_CHECK, READ_DATA_PENDING_COUNT, READ_DATA_PENDING_PTR, and TRUE.
Referenced by rb_io_getline_1().
static VALUE sysopen_func | ( | void * | ptr | ) | [static] |
Definition at line 4502 of file io.c.
References sysopen_struct::fname, sysopen_struct::oflags, sysopen_struct::perm, and RSTRING_PTR.
Referenced by rb_sysopen_internal().
static void validate_enc_binmode | ( | int | fmode, | |
rb_encoding * | enc, | |||
rb_encoding * | enc2 | |||
) | [static] |
Definition at line 4367 of file io.c.
References FMODE_BINMODE, FMODE_READABLE, rb_default_external_encoding(), rb_eArgError, rb_enc_asciicompat, and rb_raise().
Referenced by io_encoding_set(), rb_file_open_generic(), and rb_io_extract_modeenc().
static int wsplit_p | ( | rb_io_t * | fptr | ) | [static] |
Definition at line 537 of file io.c.
References fcntl(), rb_io_t::fd, FMODE_WSPLIT_INITIALIZED, fstat, rb_io_t::mode, O_NONBLOCK, S_ISREG, and stat.
Referenced by io_writable_length().
Definition at line 140 of file io.c.
Referenced by Init_IO(), and rb_io_flush().
Definition at line 140 of file io.c.
Referenced by copy_stream_fallback_body(), and Init_IO().
ID id_readpartial [static] |
Definition at line 140 of file io.c.
Referenced by copy_stream_fallback_body(), and Init_IO().
Definition at line 140 of file io.c.
Referenced by Init_IO(), io_write(), rb_io_write(), rb_p(), and stdout_setter().
int max_file_descriptor = NOFILE [static] |
VALUE orig_stderr [static] |
Definition at line 131 of file io.c.
Referenced by Init_IO(), pipe_open(), and rb_write_error2().
VALUE orig_stdout [static] |
Definition at line 131 of file io.c.
Referenced by argf_next_argv(), Init_IO(), and pipe_open().
Definition at line 133 of file io.c.
Referenced by Init_IO(), rb_ary_join_m(), and rb_io_print().
VALUE sym_autoclose [static] |
Definition at line 142 of file io.c.
Referenced by Init_IO(), and rb_io_initialize().
VALUE sym_binmode [static] |
Definition at line 142 of file io.c.
Referenced by extract_binmode(), and Init_IO().
VALUE sym_encoding [static] |
Definition at line 141 of file io.c.
Referenced by Init_IO(), and rb_io_extract_encoding_option().
VALUE sym_extenc [static] |
Definition at line 141 of file io.c.
Referenced by Init_IO(), and rb_io_extract_encoding_option().
VALUE sym_intenc [static] |
Definition at line 141 of file io.c.
Referenced by Init_IO(), and rb_io_extract_encoding_option().
Definition at line 141 of file io.c.
Referenced by Init_IO(), and rb_io_extract_modeenc().
VALUE sym_open_args [static] |
Definition at line 141 of file io.c.
Referenced by Init_IO(), and open_key_args().
Definition at line 141 of file io.c.
Referenced by Init_IO(), and rb_io_extract_modeenc().
VALUE sym_textmode [static] |
Definition at line 142 of file io.c.
Referenced by extract_binmode(), and Init_IO().