Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)
|
#include "ruby/internal/config.h"
#include <stdio.h>
#include "ruby/encoding.h"
#include <errno.h>
#include "ruby/internal/dllexport.h"
Go to the source code of this file.
Data Structures | |
struct | rb_io_t |
struct | rb_io_t::rb_io_enc_t |
Macros | |
#define | RB_WAITFD_IN 0x001 |
#define | RB_WAITFD_PRI 0x002 |
#define | RB_WAITFD_OUT 0x004 |
#define | HAVE_RB_IO_T 1 |
#define | FMODE_READABLE 0x00000001 |
#define | FMODE_WRITABLE 0x00000002 |
#define | FMODE_READWRITE (FMODE_READABLE|FMODE_WRITABLE) |
#define | FMODE_BINMODE 0x00000004 |
#define | FMODE_SYNC 0x00000008 |
#define | FMODE_TTY 0x00000010 |
#define | FMODE_DUPLEX 0x00000020 |
#define | FMODE_APPEND 0x00000040 |
#define | FMODE_CREATE 0x00000080 |
#define | FMODE_EXCL 0x00000400 |
#define | FMODE_TRUNC 0x00000800 |
#define | FMODE_TEXTMODE 0x00001000 |
#define | FMODE_SETENC_BY_BOM 0x00100000 |
#define | RB_IO_POINTER(obj, fp) rb_io_check_closed((fp) = RFILE(rb_io_taint_check(obj))->fptr) |
#define | GetOpenFile RB_IO_POINTER |
#define | RB_IO_OPEN(obj, fp) |
#define | MakeOpenFile RB_IO_OPEN |
#define | rb_io_mode_flags(modestr) [<"rb_io_mode_flags() is obsolete; use rb_io_modestr_fmode()">] |
#define | rb_io_modenum_flags(oflags) [<"rb_io_modenum_flags() is obsolete; use rb_io_oflags_fmode()">] |
Typedefs | |
typedef struct rb_io_buffer_t | rb_io_buffer_t |
typedef struct rb_io_t | rb_io_t |
typedef struct rb_io_enc_t | rb_io_enc_t |
Enumerations | |
enum | rb_io_event_t { RUBY_IO_READABLE = RB_WAITFD_IN , RUBY_IO_WRITABLE = RB_WAITFD_OUT , RUBY_IO_PRIORITY = RB_WAITFD_PRI } |
Definition in file io.h.
#define FMODE_READWRITE (FMODE_READABLE|FMODE_WRITABLE) |
#define GetOpenFile RB_IO_POINTER |
#define MakeOpenFile RB_IO_OPEN |
#define rb_io_mode_flags | ( | modestr | ) | [<"rb_io_mode_flags() is obsolete; use rb_io_modestr_fmode()">] |
#define rb_io_modenum_flags | ( | oflags | ) | [<"rb_io_modenum_flags() is obsolete; use rb_io_oflags_fmode()">] |
#define RB_IO_OPEN | ( | obj, | |
fp | |||
) |
#define RB_IO_POINTER | ( | obj, | |
fp | |||
) | rb_io_check_closed((fp) = RFILE(rb_io_taint_check(obj))->fptr) |
typedef struct rb_io_buffer_t rb_io_buffer_t |
typedef struct rb_io_enc_t rb_io_enc_t |
enum rb_io_event_t |
void rb_eof_error | ( | void | ) |
Definition at line 754 of file io.c.
References rb_eEOFError, and rb_raise().
Definition at line 6183 of file io.c.
References fdopen, NULL, rb_gc(), rb_gc_for_fd(), rb_syserr_fail(), and rb_warn().
Referenced by rb_io_stdio_file().
Definition at line 1698 of file io.c.
References binwrite_arg::fptr, GetOpenFile, and rb_io_check_writable().
void rb_io_check_byte_readable | ( | rb_io_t * | fptr | ) |
Definition at line 947 of file io.c.
References rb_eIOError, rb_io_check_char_readable(), rb_raise(), and READ_CHAR_PENDING.
Referenced by rb_io_check_readable(), rb_io_getbyte(), and rb_io_ungetbyte().
void rb_io_check_char_readable | ( | rb_io_t * | fptr | ) |
Definition at line 928 of file io.c.
References FMODE_READABLE, GetOpenFile, rb_io_t::mode, rb_eIOError, rb_io_check_closed(), rb_raise(), rb_sys_fail_on_write, rb_io_t::tied_io_for_writing, and rb_io_t::wbuf.
Referenced by rb_io_check_byte_readable(), rb_io_eof(), and rb_io_ungetc().
void rb_io_check_closed | ( | rb_io_t * | fptr | ) |
Definition at line 775 of file io.c.
References rb_io_t::fd, and rb_io_check_initialized().
Referenced by rb_io_check_char_readable(), rb_io_check_writable(), rb_io_wait(), rsock_s_recvfrom(), and rsock_s_recvfrom_nonblock().
void rb_io_check_initialized | ( | rb_io_t * | fptr | ) |
Definition at line 767 of file io.c.
References rb_eIOError, and rb_raise().
Referenced by rb_io_check_closed(), and rb_io_synchronized().
Definition at line 796 of file io.c.
References rb_check_convert_type_with_id(), and T_FILE.
void rb_io_check_readable | ( | rb_io_t * | fptr | ) |
Definition at line 956 of file io.c.
References rb_io_check_byte_readable().
void rb_io_check_writable | ( | rb_io_t * | fptr | ) |
Definition at line 980 of file io.c.
References FMODE_WRITABLE, rb_io_t::mode, rb_eIOError, rb_io_check_closed(), rb_raise(), and rb_io_t::rbuf.
Referenced by rb_io_bufwrite().
int rb_io_extract_encoding_option | ( | VALUE | opt, |
rb_encoding ** | enc_p, | ||
rb_encoding ** | enc2_p, | ||
int * | fmode_p | ||
) |
Definition at line 5862 of file io.c.
References NIL_P, NULL, PRIsVALUE, Qnil, Qundef, rb_check_string_type(), rb_enc_from_encoding(), rb_enc_from_index(), rb_enc_get(), rb_hash_lookup2(), rb_to_encoding(), rb_to_encoding_index(), rb_warn(), ruby_verbose, and StringValueCStr.
Referenced by rb_io_extract_modeenc().
void rb_io_extract_modeenc | ( | VALUE * | vmode_p, |
VALUE * | vperm_p, | ||
VALUE | opthash, | ||
int * | oflags_p, | ||
int * | fmode_p, | ||
rb_io_enc_t * | convconfig_p | ||
) |
Definition at line 5989 of file io.c.
References DEFAULT_TEXTMODE, ECONV_DEFAULT_NEWLINE_DECORATOR, ECONV_UNIVERSAL_NEWLINE_DECORATOR, fmode, FMODE_BINMODE, FMODE_READABLE, FMODE_WRITABLE, INT2NUM, MODE_BTMODE, NIL_P, NULL, NUM2INT, O_BINARY, Qnil, rb_ascii8bit_encoding(), rb_check_to_integer(), rb_eArgError, rb_econv_prepare_options(), rb_enc_get(), rb_hash_aref(), rb_io_extract_encoding_option(), rb_io_modestr_fmode(), rb_io_oflags_fmode(), rb_raise(), rb_to_int(), SafeStringValue, SET_UNIVERSAL_NEWLINE_DECORATOR_IF_ENC2, strchr(), and StringValueCStr.
Definition at line 4862 of file io.c.
References finish_writeconv_arg::fptr, and rb_io_fptr_finalize_internal().
Definition at line 802 of file io.c.
References rb_io_t::tied_io_for_writing.
Definition at line 8278 of file io.c.
References rb_io_close(), rb_io_fptr_finalize, RFILE, rb_io_t::self, and T_FILE.
Definition at line 5580 of file io.c.
References error(), fmode, FMODE_APPEND, FMODE_BINMODE, FMODE_CREATE, FMODE_EXCL, FMODE_READABLE, FMODE_READWRITE, FMODE_SETENC_BY_BOM, FMODE_TEXTMODE, FMODE_TRUNC, FMODE_WRITABLE, NULL, Qundef, rb_eArgError, rb_raise(), strchr(), strlen(), and UNREACHABLE_RETURN.
Referenced by rb_io_extract_modeenc(), and rb_io_modestr_oflags().
Definition at line 5713 of file io.c.
References rb_io_modestr_fmode().
Definition at line 5637 of file io.c.
References fmode, FMODE_APPEND, FMODE_BINMODE, FMODE_CREATE, FMODE_EXCL, FMODE_READABLE, FMODE_READWRITE, FMODE_TRUNC, FMODE_WRITABLE, O_ACCMODE, and O_BINARY.
Referenced by rb_io_extract_modeenc(), and rb_io_fdopen().
void rb_io_read_check | ( | rb_io_t * | fptr | ) |
Definition at line 1001 of file io.c.
References rb_io_t::fd, rb_thread_wait_fd(), and READ_DATA_PENDING.
Definition at line 992 of file io.c.
References READ_CHAR_PENDING, and READ_DATA_PENDING.
Referenced by rsock_s_recvfrom(), and rsock_s_recvfrom_nonblock().
void rb_io_set_nonblock | ( | rb_io_t * | fptr | ) |
Definition at line 2942 of file io.c.
References rb_io_t::fd, rb_io_t::pathv, and rb_sys_fail_path.
Referenced by rsock_s_accept_nonblock(), and rsock_s_recvfrom_nonblock().
Definition at line 813 of file io.c.
References GetWriteIO, Qnil, RTEST, and rb_io_t::tied_io_for_writing.
Definition at line 8229 of file io.c.
References rb_io_t::fd, rb_io_t::mode, rb_fdopen(), and rb_io_t::stdio_file.
void rb_io_synchronized | ( | rb_io_t * | fptr | ) |
Definition at line 6486 of file io.c.
References FMODE_SYNC, rb_io_t::mode, and rb_io_check_initialized().
Referenced by rb_io_unbuffered(), and rsock_init_sock().
Definition at line 760 of file io.c.
References rb_check_frozen.
Definition at line 1265 of file io.c.
References rb_io_t::fd, NULL, Qfalse, Qnil, RB_INT2NUM, rb_io_check_closed(), RB_IO_POINTER, RB_NUM2INT, rb_scheduler_current(), rb_scheduler_io_wait(), rb_sys_fail(), rb_thread_wait_for_single_fd(), and rb_time_interval().
Definition at line 1307 of file io.c.
References EWOULDBLOCK, f, FALSE, Qnil, rb_scheduler_current(), rb_scheduler_io_wait_readable(), rb_thread_check_ints(), rb_thread_wait_fd(), RTEST, and TRUE.
Referenced by rsock_s_accept(), and rsock_s_recvfrom().
Definition at line 1341 of file io.c.
References EWOULDBLOCK, f, FALSE, Qnil, rb_scheduler_current(), rb_scheduler_io_wait_writable(), rb_thread_check_ints(), rb_thread_fd_writable(), RTEST, and TRUE.
Referenced by rsock_bsock_send().
Definition at line 1384 of file io.c.
References Qnil, RB_INT2NUM, rb_scheduler_current(), rb_scheduler_io_wait(), rb_scheduler_timeout(), rb_thread_wait_for_single_fd(), and RTEST.