io.c File Reference

#include "ruby/ruby.h"
#include "ruby/io.h"
#include "ruby/thread.h"
#include "dln.h"
#include "internal.h"
#include "id.h"
#include <ctype.h>
#include <errno.h>
#include "ruby_atomic.h"
#include <sys/types.h>
#include <sys/stat.h>
#include "ruby/util.h"

Go to the source code of this file.

Data Structures

struct  argf
struct  io_internal_read_struct
struct  io_internal_write_struct
struct  binwrite_arg
struct  write_arg
struct  bufread_arg
struct  read_internal_arg
struct  finish_writeconv_arg
struct  sysopen_struct
struct  pipe_list
struct  rb_f_p_arg
struct  select_args
struct  ioctl_arg
struct  foreach_arg
struct  seek_arg
struct  copy_stream_struct
struct  argf_call_arg

Defines

#define free(x)   xfree(x)
#define off_t   long
#define NOFILE   64
#define O_ACCMODE   (O_RDONLY | O_WRONLY | O_RDWR)
#define PIPE_BUF   512
#define EWOULDBLOCK   EAGAIN
#define IO_RBUF_CAPA_MIN   8192
#define IO_CBUF_CAPA_MIN   (128*1024)
#define IO_RBUF_CAPA_FOR(fptr)   (NEED_READCONV(fptr) ? IO_CBUF_CAPA_MIN : IO_RBUF_CAPA_MIN)
#define IO_WBUF_CAPA_MIN   8192
#define argf_of(obj)   (*(struct argf *)DATA_PTR(obj))
#define ARGF   argf_of(argf)
#define STDIO_READ_DATA_PENDING(fp)   (!feof(fp))
#define GetWriteIO(io)   rb_io_get_write_io(io)
#define READ_DATA_PENDING(fptr)   ((fptr)->rbuf.len)
#define READ_DATA_PENDING_COUNT(fptr)   ((fptr)->rbuf.len)
#define READ_DATA_PENDING_PTR(fptr)   ((fptr)->rbuf.ptr+(fptr)->rbuf.off)
#define READ_DATA_BUFFERED(fptr)   READ_DATA_PENDING(fptr)
#define READ_CHAR_PENDING(fptr)   ((fptr)->cbuf.len)
#define READ_CHAR_PENDING_COUNT(fptr)   ((fptr)->cbuf.len)
#define READ_CHAR_PENDING_PTR(fptr)   ((fptr)->cbuf.ptr+(fptr)->cbuf.off)
#define WAIT_FD_IN_WIN32(fptr)
#define READ_CHECK(fptr)
#define NEED_NEWLINE_DECORATOR_ON_READ(fptr)   ((fptr)->mode & FMODE_TEXTMODE)
#define NEED_NEWLINE_DECORATOR_ON_WRITE(fptr)   ((fptr)->mode & FMODE_TEXTMODE)
#define DEFAULT_TEXTMODE   0
#define NEED_READCONV(fptr)   ((fptr)->encs.enc2 != NULL || NEED_NEWLINE_DECORATOR_ON_READ(fptr))
#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)))
#define SET_BINARY_MODE(fptr)   (void)(fptr)
#define NEED_NEWLINE_DECORATOR_ON_READ_CHECK(fptr)   (void)(fptr)
#define SET_UNIVERSAL_NEWLINE_DECORATOR_IF_ENC2(enc2, ecflags)   ((void)(enc2), (void)(ecflags))
#define SET_BINARY_MODE_WITH_SEEK_CUR(fptr)   (void)(fptr)
#define shutdown(a, b)   0
#define is_socket(fd, path)   0
#define io_seek(fptr, ofs, whence)   (errno = 0, lseek(flush_before_seek(fptr)->fd, (ofs), (whence)))
#define io_tell(fptr)   lseek(flush_before_seek(fptr)->fd, 0, SEEK_CUR)
#define SEEK_SET   0
#define SEEK_CUR   1
#define SEEK_END   2
#define S_ISREG(m)   (((m) & S_IFMT) == S_IFREG)
#define MODE_BTMODE(a, b, c)
#define fmode   (fptr->mode)
#define rb_io_fsync   rb_f_notimplement
#define rb_io_sync   rb_f_notimplement
#define rb_io_fdatasync   rb_io_fsync
#define SMALLBUF   100
#define MORE_CHAR_SUSPENDED   Qtrue
#define MORE_CHAR_FINISHED   Qnil
#define rb_io_close_on_exec_p   rb_f_notimplement
#define rb_io_set_close_on_exec   rb_f_notimplement
#define FMODE_PREP   (1<<16)
#define IS_PREP_STDIO(f)   ((f)->mode & FMODE_PREP)
#define PREP_STDIO_NAME(f)   (RSTRING_PTR((f)->pathv))
#define SHUT_RD   0
#define SHUT_WR   1
#define MODE_BINARY(a, b)   (a)
#define next_argv()   argf_next_argv(argf)
#define ARGF_GENERIC_INPUT_P()   (ARGF.current_file == rb_stdin && !RB_TYPE_P(ARGF.current_file, T_FILE))
#define ARGF_FORWARD(argc, argv)
#define NEXT_ARGF_FORWARD(argc, argv)
#define NUM2IOCTLREQ(num)   NUM2INT(num)
#define DEFULT_IOCTL_NARG_LEN   (256)
#define rb_io_fcntl   rb_f_notimplement
#define rb_f_syscall   rb_f_notimplement
#define FOREACH_ARGF()   while (next_argv())
#define rb_intern(str)   rb_intern_const(str)

Typedefs

typedef rb_io_enc_t convconfig_t
typedef int ioctl_req_t

Functions

void rb_update_max_fd (int fd)
void rb_maygvl_fd_fix_cloexec (int fd)
void rb_fd_fix_cloexec (int fd)
int rb_cloexec_open (const char *pathname, int flags, mode_t mode)
int rb_cloexec_dup (int oldfd)
int rb_cloexec_dup2 (int oldfd, int newfd)
int rb_cloexec_pipe (int fildes[2])
int rb_cloexec_fcntl_dupfd (int fd, int minfd)
static int io_fflush (rb_io_t *)
static rb_io_tflush_before_seek (rb_io_t *fptr)
void rb_eof_error (void)
VALUE rb_io_taint_check (VALUE io)
void rb_io_check_initialized (rb_io_t *fptr)
void rb_io_check_closed (rb_io_t *fptr)
VALUE rb_io_get_io (VALUE io)
VALUE rb_io_check_io (VALUE io)
VALUE rb_io_get_write_io (VALUE io)
VALUE rb_io_set_write_io (VALUE io, VALUE w)
static VALUE rb_io_s_try_convert (VALUE dummy, VALUE io)
static void io_unread (rb_io_t *fptr)
static rb_encodingio_input_encoding (rb_io_t *fptr)
static void io_ungetbyte (VALUE str, rb_io_t *fptr)
void rb_io_check_char_readable (rb_io_t *fptr)
void rb_io_check_byte_readable (rb_io_t *fptr)
void rb_io_check_readable (rb_io_t *fptr)
static rb_encodingio_read_encoding (rb_io_t *fptr)
void rb_io_check_writable (rb_io_t *fptr)
int rb_io_read_pending (rb_io_t *fptr)
void rb_read_check (FILE *fp)
void rb_io_read_check (rb_io_t *fptr)
static int ruby_dup (int orig)
static VALUE io_alloc (VALUE klass)
static int wsplit_p (rb_io_t *fptr)
static VALUE internal_read_func (void *ptr)
static VALUE internal_write_func (void *ptr)
static void * internal_write_func2 (void *ptr)
static ssize_t rb_read_internal (int fd, void *buf, size_t count)
static ssize_t rb_write_internal (int fd, const void *buf, size_t count)
static ssize_t rb_write_internal2 (int fd, const void *buf, size_t count)
static long io_writable_length (rb_io_t *fptr, long l)
static VALUE io_flush_buffer_sync (void *arg)
static void * io_flush_buffer_sync2 (void *arg)
static VALUE io_flush_buffer_async (VALUE arg)
static VALUE io_flush_buffer_async2 (VALUE arg)
static int io_flush_buffer (rb_io_t *fptr)
int rb_io_wait_readable (int f)
int rb_io_wait_writable (int f)
static void make_writeconv (rb_io_t *fptr)
static VALUE io_binwrite_string (VALUE arg)
static long io_binwrite (VALUE str, const char *ptr, long len, rb_io_t *fptr, int nosync)
static VALUE do_writeconv (VALUE str, rb_io_t *fptr)
static long io_fwrite (VALUE str, rb_io_t *fptr, int nosync)
ssize_t rb_io_bufwrite (VALUE io, const void *buf, size_t size)
static VALUE io_write (VALUE io, VALUE str, int nosync)
static VALUE io_write_m (VALUE io, VALUE str)
VALUE rb_io_write (VALUE io, VALUE str)
VALUE rb_io_addstr (VALUE io, VALUE str)
VALUE rb_io_flush_raw (VALUE io, int sync)
VALUE rb_io_flush (VALUE io)
static VALUE rb_io_tell (VALUE io)
static VALUE rb_io_seek (VALUE io, VALUE offset, int whence)
static int interpret_seek_whence (VALUE vwhence)
static VALUE rb_io_seek_m (int argc, VALUE *argv, VALUE io)
static VALUE rb_io_set_pos (VALUE io, VALUE offset)
static void clear_readconv (rb_io_t *fptr)
static VALUE rb_io_rewind (VALUE io)
static int io_fillbuf (rb_io_t *fptr)
VALUE rb_io_eof (VALUE io)
static VALUE rb_io_sync (VALUE io)
static VALUE rb_io_set_sync (VALUE io, VALUE sync)
static VALUE rb_io_fileno (VALUE io)
static VALUE rb_io_pid (VALUE io)
static VALUE rb_io_inspect (VALUE obj)
static VALUE rb_io_to_io (VALUE io)
static long read_buffered_data (char *ptr, long len, rb_io_t *fptr)
static long io_bufread (char *ptr, long len, rb_io_t *fptr)
static void io_setstrbuf (VALUE *str, long len)
static VALUE bufread_call (VALUE arg)
static long io_fread (VALUE str, long offset, long size, rb_io_t *fptr)
ssize_t rb_io_bufread (VALUE io, void *buf, size_t size)
static long remain_size (rb_io_t *fptr)
static VALUE io_enc_str (VALUE str, rb_io_t *fptr)
static void make_readconv (rb_io_t *fptr, int size)
static VALUE fill_cbuf (rb_io_t *fptr, int ec_flags)
static VALUE more_char (rb_io_t *fptr)
static VALUE io_shift_cbuf (rb_io_t *fptr, int len, VALUE *strp)
static void io_set_read_length (VALUE str, long n)
static VALUE read_all (rb_io_t *fptr, long siz, VALUE str)
void rb_io_set_nonblock (rb_io_t *fptr)
void rb_readwrite_sys_fail (int writable, const char *mesg)
static VALUE read_internal_call (VALUE arg)
static VALUE io_getpartial (int argc, VALUE *argv, VALUE io, int nonblock, int no_exception)
static VALUE io_readpartial (int argc, VALUE *argv, VALUE io)
static VALUE io_read_nonblock (int argc, VALUE *argv, VALUE io)
static VALUE io_write_nonblock (VALUE io, VALUE str, int no_exception)
static VALUE rb_io_write_nonblock (int argc, VALUE *argv, VALUE io)
static VALUE io_read (int argc, VALUE *argv, VALUE io)
static void rscheck (const char *rsptr, long rslen, VALUE rs)
static int appendline (rb_io_t *fptr, int delim, VALUE *strp, long *lp)
static int swallow (rb_io_t *fptr, int term)
static VALUE rb_io_getline_fast (rb_io_t *fptr, rb_encoding *enc, VALUE io)
static void prepare_getline_args (int argc, VALUE *argv, VALUE *rsp, long *limit, VALUE io)
static VALUE rb_io_getline_1 (VALUE rs, long limit, VALUE io)
static VALUE rb_io_getline (int argc, VALUE *argv, VALUE io)
VALUE rb_io_gets (VALUE io)
static VALUE rb_io_gets_m (int argc, VALUE *argv, VALUE io)
static VALUE rb_io_lineno (VALUE io)
static VALUE rb_io_set_lineno (VALUE io, VALUE lineno)
static VALUE rb_io_readline (int argc, VALUE *argv, VALUE io)
static VALUE rb_io_readlines (int argc, VALUE *argv, VALUE io)
static VALUE rb_io_each_line (int argc, VALUE *argv, VALUE io)
static VALUE rb_io_lines (int argc, VALUE *argv, VALUE io)
static VALUE rb_io_each_byte (VALUE io)
static VALUE rb_io_bytes (VALUE io)
static VALUE io_getc (rb_io_t *fptr, rb_encoding *enc)
static VALUE rb_io_each_char (VALUE io)
static VALUE rb_io_chars (VALUE io)
static VALUE rb_io_each_codepoint (VALUE io)
static VALUE rb_io_codepoints (VALUE io)
static VALUE rb_io_getc (VALUE io)
static VALUE rb_io_readchar (VALUE io)
VALUE rb_io_getbyte (VALUE io)
static VALUE rb_io_readbyte (VALUE io)
VALUE rb_io_ungetbyte (VALUE io, VALUE b)
VALUE rb_io_ungetc (VALUE io, VALUE c)
static VALUE rb_io_isatty (VALUE io)
static VALUE finish_writeconv (rb_io_t *fptr, int noalloc)
static VALUE finish_writeconv_sync (VALUE arg)
static void * nogvl_close (void *ptr)
static int maygvl_close (int fd, int keepgvl)
static void * nogvl_fclose (void *ptr)
static int maygvl_fclose (FILE *file, int keepgvl)
static void fptr_finalize (rb_io_t *fptr, int noraise)
static void rb_io_fptr_cleanup (rb_io_t *fptr, int noraise)
static void clear_writeconv (rb_io_t *fptr)
static void clear_codeconv (rb_io_t *fptr)
int rb_io_fptr_finalize (rb_io_t *fptr)
size_t rb_econv_memsize (rb_econv_t *)
RUBY_FUNC_EXPORTED size_t rb_io_memsize (const rb_io_t *fptr)
VALUE rb_io_close (VALUE io)
static VALUE rb_io_close_m (VALUE io)
static VALUE io_call_close (VALUE io)
static VALUE ignore_closed_stream (VALUE io, VALUE exc)
static VALUE io_close (VALUE io)
static VALUE rb_io_closed (VALUE io)
static VALUE rb_io_close_read (VALUE io)
static VALUE rb_io_close_write (VALUE io)
static VALUE rb_io_sysseek (int argc, VALUE *argv, VALUE io)
static VALUE rb_io_syswrite (VALUE io, VALUE str)
static VALUE rb_io_sysread (int argc, VALUE *argv, VALUE io)
VALUE rb_io_binmode (VALUE io)
static void io_ascii8bit_binmode (rb_io_t *fptr)
VALUE rb_io_ascii8bit_binmode (VALUE io)
static VALUE rb_io_binmode_m (VALUE io)
static VALUE rb_io_binmode_p (VALUE io)
static const char * rb_io_fmode_modestr (int fmode)
static int io_encname_bom_p (const char *name, long len)
int rb_io_modestr_fmode (const char *modestr)
int rb_io_oflags_fmode (int oflags)
static int rb_io_fmode_oflags (int fmode)
int rb_io_modestr_oflags (const char *modestr)
static const char * rb_io_oflags_modestr (int oflags)
static void rb_io_ext_int_to_encs (rb_encoding *ext, rb_encoding *intern, rb_encoding **enc, rb_encoding **enc2, int fmode)
static void unsupported_encoding (const char *name)
static void parse_mode_enc (const char *estr, rb_encoding **enc_p, rb_encoding **enc2_p, int *fmode_p)
int rb_io_extract_encoding_option (VALUE opt, rb_encoding **enc_p, rb_encoding **enc2_p, int *fmode_p)
static void validate_enc_binmode (int *fmode_p, int ecflags, rb_encoding *enc, rb_encoding *enc2)
static void extract_binmode (VALUE opthash, int *fmode)
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 void * sysopen_func (void *ptr)
static int rb_sysopen_internal (struct sysopen_struct *data)
static int rb_sysopen (VALUE fname, int oflags, mode_t perm)
FILErb_fdopen (int fd, const char *modestr)
static void io_check_tty (rb_io_t *fptr)
static VALUE rb_io_internal_encoding (VALUE)
static void io_encoding_set (rb_io_t *, VALUE, VALUE, VALUE)
static int io_strip_bom (VALUE io)
static void io_set_encoding_by_bom (VALUE io)
static VALUE rb_file_open_generic (VALUE io, VALUE filename, int oflags, int fmode, convconfig_t *convconfig, mode_t perm)
static VALUE rb_file_open_internal (VALUE io, VALUE filename, const char *modestr)
VALUE rb_file_open_str (VALUE fname, const char *modestr)
VALUE rb_file_open (const char *fname, const char *modestr)
static void pipe_add_fptr (rb_io_t *fptr)
static void pipe_del_fptr (rb_io_t *fptr)
static void pipe_atexit (void)
static void pipe_finalize (rb_io_t *fptr, int noraise)
void rb_io_synchronized (rb_io_t *fptr)
void rb_io_unbuffered (rb_io_t *fptr)
int rb_pipe (int *pipes)
static VALUE pipe_open (VALUE execarg_obj, const char *modestr, int fmode, convconfig_t *convconfig)
static int is_popen_fork (VALUE prog)
static VALUE pipe_open_s (VALUE prog, const char *modestr, int fmode, convconfig_t *convconfig)
static VALUE rb_io_s_popen (int argc, VALUE *argv, VALUE klass)
static void rb_scan_open_args (int argc, const VALUE *argv, VALUE *fname_p, int *oflags_p, int *fmode_p, convconfig_t *convconfig_p, mode_t *perm_p)
static VALUE rb_open_file (int argc, const VALUE *argv, VALUE io)
static VALUE rb_io_s_open (int argc, VALUE *argv, VALUE klass)
static VALUE rb_io_s_sysopen (int argc, VALUE *argv)
static VALUE check_pipe_command (VALUE filename_or_command)
static VALUE rb_f_open (int argc, VALUE *argv)
static VALUE rb_io_open (VALUE filename, VALUE vmode, VALUE vperm, VALUE opt)
static VALUE rb_io_open_with_args (int argc, const VALUE *argv)
static VALUE io_reopen (VALUE io, VALUE nfile)
static VALUE rb_io_reopen (int argc, VALUE *argv, VALUE file)
static VALUE rb_io_init_copy (VALUE dest, VALUE io)
VALUE rb_io_printf (int argc, VALUE *argv, VALUE out)
static VALUE rb_f_printf (int argc, VALUE *argv)
VALUE rb_io_print (int argc, VALUE *argv, VALUE out)
static VALUE rb_f_print (int argc, VALUE *argv)
static VALUE rb_io_putc (VALUE io, VALUE ch)
static VALUE rb_f_putc (VALUE recv, VALUE ch)
static int str_end_with_asciichar (VALUE str, int c)
static VALUE io_puts_ary (VALUE ary, VALUE out, int recur)
VALUE rb_io_puts (int argc, VALUE *argv, VALUE out)
static VALUE rb_f_puts (int argc, VALUE *argv, VALUE recv)
void rb_p (VALUE obj)
static VALUE rb_f_p_internal (VALUE arg)
static VALUE rb_f_p (int argc, VALUE *argv, VALUE self)
static VALUE rb_obj_display (int argc, VALUE *argv, VALUE self)
void rb_write_error2 (const char *mesg, long len)
void rb_write_error (const char *mesg)
void rb_write_error_str (VALUE mesg)
static void must_respond_to (ID mid, VALUE val, ID id)
static void stdout_setter (VALUE val, ID id, VALUE *variable)
static VALUE prep_io (int fd, int fmode, VALUE klass, const char *path)
VALUE rb_io_fdopen (int fd, int oflags, const char *path)
static VALUE prep_stdio (FILE *f, int fmode, VALUE klass, const char *path)
FILErb_io_stdio_file (rb_io_t *fptr)
static VALUE rb_io_initialize (int argc, VALUE *argv, VALUE io)
static VALUE rb_file_initialize (int argc, VALUE *argv, VALUE io)
static VALUE rb_io_s_new (int argc, VALUE *argv, VALUE klass)
static VALUE rb_io_s_for_fd (int argc, VALUE *argv, VALUE klass)
static VALUE rb_io_autoclose_p (VALUE io)
static VALUE rb_io_set_autoclose (VALUE io, VALUE autoclose)
static void argf_mark (void *ptr)
static void argf_free (void *ptr)
static size_t argf_memsize (const void *ptr)
static void argf_init (struct argf *p, VALUE v)
static VALUE argf_alloc (VALUE klass)
static VALUE argf_initialize (VALUE argf, VALUE argv)
static VALUE argf_initialize_copy (VALUE argf, VALUE orig)
static VALUE argf_set_lineno (VALUE argf, VALUE val)
static VALUE argf_lineno (VALUE argf)
static VALUE argf_forward (int argc, VALUE *argv, VALUE argf)
static void argf_close (VALUE argf)
static int argf_next_argv (VALUE argf)
static VALUE argf_getline (int argc, VALUE *argv, VALUE argf)
static VALUE argf_lineno_getter (ID id, VALUE *var)
static void argf_lineno_setter (VALUE val, ID id, VALUE *var)
static VALUE argf_gets (int, VALUE *, VALUE)
static VALUE rb_f_gets (int argc, VALUE *argv, VALUE recv)
VALUE rb_gets (void)
static VALUE argf_readline (int, VALUE *, VALUE)
static VALUE rb_f_readline (int argc, VALUE *argv, VALUE recv)
static VALUE argf_readlines (int, VALUE *, VALUE)
static VALUE rb_f_readlines (int argc, VALUE *argv, VALUE recv)
static VALUE rb_f_backquote (VALUE obj, VALUE str)
static VALUE select_internal (VALUE read, VALUE write, VALUE except, struct timeval *tp, rb_fdset_t *fds)
static VALUE select_call (VALUE arg)
static VALUE select_end (VALUE arg)
static void advice_arg_check (VALUE advice)
static VALUE rb_io_advise (int argc, VALUE *argv, VALUE io)
static VALUE rb_f_select (int argc, VALUE *argv, VALUE obj)
static VALUE nogvl_ioctl (void *ptr)
static int do_ioctl (int fd, ioctl_req_t cmd, long narg)
static long ioctl_narg_len (ioctl_req_t cmd)
static long fcntl_narg_len (int cmd)
static long setup_narg (ioctl_req_t cmd, VALUE *argp, int io_p)
static VALUE rb_ioctl (VALUE io, VALUE req, VALUE arg)
static VALUE rb_io_ioctl (int argc, VALUE *argv, VALUE io)
static VALUE io_new_instance (VALUE args)
static rb_encodingfind_encoding (VALUE v)
static VALUE pipe_pair_close (VALUE rw)
static VALUE rb_io_s_pipe (int argc, VALUE *argv, VALUE klass)
static void open_key_args (int argc, VALUE *argv, VALUE opt, struct foreach_arg *arg)
static VALUE io_s_foreach (struct foreach_arg *arg)
static VALUE rb_io_s_foreach (int argc, VALUE *argv, VALUE self)
static VALUE io_s_readlines (struct foreach_arg *arg)
static VALUE rb_io_s_readlines (int argc, VALUE *argv, VALUE io)
static VALUE io_s_read (struct foreach_arg *arg)
static VALUE seek_before_access (VALUE argp)
static VALUE rb_io_s_read (int argc, VALUE *argv, VALUE io)
static VALUE rb_io_s_binread (int argc, VALUE *argv, VALUE io)
static VALUE io_s_write0 (struct write_arg *arg)
static VALUE io_s_write (int argc, VALUE *argv, int binary)
static VALUE rb_io_s_write (int argc, VALUE *argv, VALUE io)
static VALUE rb_io_s_binwrite (int argc, VALUE *argv, VALUE io)
static void * exec_interrupts (void *arg)
static int maygvl_copy_stream_continue_p (int has_gvl, struct copy_stream_struct *stp)
static int maygvl_select (int has_gvl, int n, rb_fdset_t *rfds, rb_fdset_t *wfds, rb_fdset_t *efds, struct timeval *timeout)
static int maygvl_copy_stream_wait_read (int has_gvl, struct copy_stream_struct *stp)
static int nogvl_copy_stream_wait_write (struct copy_stream_struct *stp)
static ssize_t maygvl_read (int has_gvl, int fd, void *buf, size_t count)
static ssize_t maygvl_copy_stream_read (int has_gvl, struct copy_stream_struct *stp, char *buf, size_t len, off_t offset)
static int nogvl_copy_stream_write (struct copy_stream_struct *stp, char *buf, size_t len)
static void nogvl_copy_stream_read_write (struct copy_stream_struct *stp)
static void * nogvl_copy_stream_func (void *arg)
static VALUE copy_stream_fallback_body (VALUE arg)
static VALUE copy_stream_fallback (struct copy_stream_struct *stp)
static VALUE copy_stream_body (VALUE arg)
static VALUE copy_stream_finalize (VALUE arg)
static VALUE rb_io_s_copy_stream (int argc, VALUE *argv, VALUE io)
static VALUE rb_io_external_encoding (VALUE io)
static VALUE rb_io_set_encoding (int argc, VALUE *argv, VALUE io)
void rb_stdio_set_default_encoding (void)
static VALUE argf_external_encoding (VALUE argf)
static VALUE argf_internal_encoding (VALUE argf)
static VALUE argf_set_encoding (int argc, VALUE *argv, VALUE argf)
static VALUE argf_tell (VALUE argf)
static VALUE argf_seek_m (int argc, VALUE *argv, VALUE argf)
static VALUE argf_set_pos (VALUE argf, VALUE offset)
static VALUE argf_rewind (VALUE argf)
static VALUE argf_fileno (VALUE argf)
static VALUE argf_to_io (VALUE argf)
static VALUE argf_eof (VALUE argf)
static VALUE argf_read (int argc, VALUE *argv, VALUE argf)
static VALUE argf_forward_call (VALUE arg)
static VALUE argf_getpartial (int argc, VALUE *argv, VALUE argf, int nonblock)
static VALUE argf_readpartial (int argc, VALUE *argv, VALUE argf)
static VALUE argf_read_nonblock (int argc, VALUE *argv, VALUE argf)
static VALUE argf_getc (VALUE argf)
static VALUE argf_getbyte (VALUE argf)
static VALUE argf_readchar (VALUE argf)
static VALUE argf_readbyte (VALUE argf)
static VALUE argf_block_call_i (RB_BLOCK_CALL_FUNC_ARGLIST(i, argf))
static void argf_block_call (ID mid, int argc, VALUE *argv, VALUE argf)
static VALUE argf_each_line (int argc, VALUE *argv, VALUE argf)
static VALUE argf_lines (int argc, VALUE *argv, VALUE argf)
static VALUE argf_each_byte (VALUE argf)
static VALUE argf_bytes (VALUE argf)
static VALUE argf_each_char (VALUE argf)
static VALUE argf_chars (VALUE argf)
static VALUE argf_each_codepoint (VALUE argf)
static VALUE argf_codepoints (VALUE argf)
static VALUE argf_filename (VALUE argf)
static VALUE argf_filename_getter (ID id, VALUE *var)
static VALUE argf_file (VALUE argf)
static VALUE argf_binmode_m (VALUE argf)
static VALUE argf_binmode_p (VALUE argf)
static VALUE argf_skip (VALUE argf)
static VALUE argf_close_m (VALUE argf)
static VALUE argf_closed (VALUE argf)
static VALUE argf_to_s (VALUE argf)
static VALUE argf_inplace_mode_get (VALUE argf)
static VALUE opt_i_get (ID id, VALUE *var)
static VALUE argf_inplace_mode_set (VALUE argf, VALUE val)
static void opt_i_set (VALUE val, ID id, VALUE *var)
const char * ruby_get_inplace_mode (void)
void ruby_set_inplace_mode (const char *suffix)
static VALUE argf_argv (VALUE argf)
static VALUE argf_argv_getter (ID id, VALUE *var)
VALUE rb_get_argv (void)
static VALUE argf_write_io (VALUE argf)
static VALUE argf_write (VALUE argf, VALUE str)
void Init_IO (void)

Variables

VALUE rb_cIO
VALUE rb_eEOFError
VALUE rb_eIOError
VALUE rb_mWaitReadable
VALUE rb_mWaitWritable
VALUE rb_eEAGAIN
VALUE rb_eEWOULDBLOCK
VALUE rb_eEINPROGRESS
static VALUE rb_eEAGAINWaitReadable
static VALUE rb_eEAGAINWaitWritable
static VALUE rb_eEWOULDBLOCKWaitReadable
static VALUE rb_eEWOULDBLOCKWaitWritable
static VALUE rb_eEINPROGRESSWaitWritable
static VALUE rb_eEINPROGRESSWaitReadable
VALUE rb_stdin
VALUE rb_stdout
VALUE rb_stderr
VALUE rb_deferr
static VALUE orig_stdout
static VALUE orig_stderr
VALUE rb_output_fs
VALUE rb_rs
VALUE rb_output_rs
VALUE rb_default_rs
static VALUE argf
static ID id_write
static ID id_read
static ID id_getc
static ID id_flush
static ID id_readpartial
static ID id_set_encoding
static VALUE sym_mode
static VALUE sym_perm
static VALUE sym_extenc
static VALUE sym_intenc
static VALUE sym_encoding
static VALUE sym_open_args
static VALUE sym_textmode
static VALUE sym_binmode
static VALUE sym_autoclose
static VALUE sym_exception
static VALUE sym_SET
static VALUE sym_CUR
static VALUE sym_END
static rb_atomic_t max_file_descriptor = NOFILE
static const char closed_stream [] = "closed stream"
static const rb_data_type_t argf_type
static VALUE sym_normal
static VALUE sym_sequential
static VALUE sym_random
static VALUE sym_willneed
static VALUE sym_dontneed
static VALUE sym_noreuse


Define Documentation

#define ARGF   argf_of(argf)

Definition at line 366 of file io.c.

Referenced by argf_argv(), argf_binmode_m(), argf_binmode_p(), argf_block_call(), argf_block_call_i(), argf_close(), argf_close_m(), argf_closed(), argf_eof(), argf_external_encoding(), argf_file(), argf_filename(), argf_fileno(), argf_forward(), argf_getbyte(), argf_getc(), argf_getline(), argf_getpartial(), 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_readlines(), argf_rewind(), argf_seek_m(), argf_set_encoding(), argf_set_lineno(), argf_set_pos(), argf_skip(), argf_tell(), argf_to_io(), argf_write_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().

#define ARGF_FORWARD ( argc,
argv   ) 

Value:

do {\
    if (ARGF_GENERIC_INPUT_P())\
        return argf_forward((argc), (argv), argf);\
} while (0)

Definition at line 7710 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 && !RB_TYPE_P(ARGF.current_file, T_FILE))

Definition at line 7708 of file io.c.

Referenced by argf_getc(), argf_getline(), argf_getpartial(), argf_read(), and argf_readlines().

#define argf_of ( obj   )     (*(struct argf *)DATA_PTR(obj))

Definition at line 365 of file io.c.

Referenced by argf_initialize_copy().

#define DEFAULT_TEXTMODE   0

Definition at line 565 of file io.c.

Referenced by argf_next_argv(), do_writeconv(), prep_stdio(), rb_f_backquote(), rb_io_extract_modeenc(), and validate_enc_binmode().

#define DEFULT_IOCTL_NARG_LEN   (256)

Definition at line 8715 of file io.c.

Referenced by ioctl_narg_len().

#define EWOULDBLOCK   EAGAIN

Definition at line 114 of file io.c.

#define fmode   (fptr->mode)

Referenced by argf_next_argv(), parse_mode_enc(), rb_file_open_internal(), rb_io_extract_modeenc(), rb_io_initialize(), rb_io_modestr_fmode(), rb_io_oflags_fmode(), rb_io_open(), rb_io_reopen(), rb_io_s_pipe(), rb_io_s_popen(), rb_open_file(), rb_scan_open_args(), and validate_enc_binmode().

#define FMODE_PREP   (1<<16)

Definition at line 4035 of file io.c.

Referenced by io_reopen(), prep_stdio(), rb_io_autoclose_p(), rb_io_init_copy(), rb_io_initialize(), and rb_io_set_autoclose().

 
#define FOREACH_ARGF (  )     while (next_argv())

Definition at line 11152 of file io.c.

Referenced by argf_each_byte(), argf_each_char(), argf_each_codepoint(), and argf_each_line().

#define free (  )     xfree(x)

Definition at line 24 of file io.c.

#define GetWriteIO ( io   )     rb_io_get_write_io(io)

Definition at line 384 of file io.c.

Referenced by argf_write_io(), copy_stream_body(), io_write(), io_write_nonblock(), rb_io_advise(), rb_io_binmode_m(), rb_io_close(), rb_io_close_read(), rb_io_close_write(), rb_io_closed(), rb_io_flush_raw(), rb_io_init_copy(), rb_io_set_write_io(), rb_io_sync(), rb_io_syswrite(), and select_internal().

#define IO_CBUF_CAPA_MIN   (128*1024)

Definition at line 123 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 124 of file io.c.

Referenced by io_fillbuf(), and io_ungetbyte().

#define IO_RBUF_CAPA_MIN   8192

Definition at line 122 of file io.c.

#define io_seek ( fptr,
ofs,
whence   )     (errno = 0, lseek(flush_before_seek(fptr)->fd, (ofs), (whence)))

Definition at line 756 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 757 of file io.c.

Referenced by io_reopen(), rb_io_init_copy(), and rb_io_tell().

#define IO_WBUF_CAPA_MIN   8192

Definition at line 125 of file io.c.

Referenced by io_binwrite().

#define IS_PREP_STDIO (  )     ((f)->mode & FMODE_PREP)

Definition at line 4036 of file io.c.

Referenced by fptr_finalize(), io_reopen(), and rb_io_reopen().

#define is_socket ( fd,
path   )     0

Definition at line 581 of file io.c.

Referenced by fcntl(), is_not_socket(), rb_io_close_read(), rb_io_close_write(), rb_w32_close(), rb_w32_fclose(), rb_w32_io_cancelable_p(), rb_w32_is_socket(), rb_w32_read(), rb_w32_unwrap_io_handle(), and rb_w32_write().

#define MODE_BINARY ( a,
 )     (a)

Referenced by rb_io_oflags_modestr().

#define MODE_BTMODE ( a,
b,
 ) 

Value:

((fmode & FMODE_BINMODE) ? (b) : \
                             (fmode & FMODE_TEXTMODE) ? (c) : (a))

Definition at line 1293 of file io.c.

Referenced by do_writeconv(), rb_io_extract_modeenc(), and rb_io_fmode_modestr().

#define MORE_CHAR_FINISHED   Qnil

Definition at line 2170 of file io.c.

Referenced by appendline(), fill_cbuf(), io_getc(), more_char(), rb_io_each_codepoint(), read_all(), and swallow().

#define MORE_CHAR_SUSPENDED   Qtrue

Definition at line 2169 of file io.c.

Referenced by fill_cbuf(), more_char(), and read_all().

#define NEED_NEWLINE_DECORATOR_ON_READ ( fptr   )     ((fptr)->mode & FMODE_TEXTMODE)

Definition at line 426 of file io.c.

Referenced by pipe_open(), and rb_io_eof().

#define NEED_NEWLINE_DECORATOR_ON_READ_CHECK ( fptr   )     (void)(fptr)

Definition at line 569 of file io.c.

Referenced by appendline(), io_getc(), rb_io_getline_1(), rb_io_ungetc(), read_all(), and swallow().

#define NEED_NEWLINE_DECORATOR_ON_WRITE ( fptr   )     ((fptr)->mode & FMODE_TEXTMODE)

Definition at line 427 of file io.c.

Referenced by pipe_open().

#define NEED_READCONV ( fptr   )     ((fptr)->encs.enc2 != NULL || NEED_NEWLINE_DECORATOR_ON_READ(fptr))

Definition at line 566 of file io.c.

Referenced by appendline(), io_getc(), rb_io_each_codepoint(), rb_io_eof(), 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 567 of file io.c.

Referenced by do_writeconv().

#define NEXT_ARGF_FORWARD ( argc,
argv   ) 

Value:

do {\
    if (!next_argv()) return Qnil;\
    ARGF_FORWARD((argc), (argv));\
} while (0)

Definition at line 7714 of file io.c.

Referenced by argf_readbyte().

 
#define next_argv (  )     argf_next_argv(argf)

Definition at line 7707 of file io.c.

Referenced by argf_binmode_m(), argf_close_m(), argf_closed(), argf_eof(), argf_file(), argf_filename(), argf_fileno(), argf_getbyte(), argf_getc(), argf_getline(), argf_getpartial(), argf_read(), argf_readchar(), argf_readline(), argf_readlines(), argf_rewind(), argf_seek_m(), argf_set_encoding(), argf_set_pos(), argf_tell(), argf_to_io(), and rb_gets().

#define NOFILE   64

Definition at line 76 of file io.c.

#define NUM2IOCTLREQ ( num   )     NUM2INT(num)

Definition at line 8683 of file io.c.

Referenced by rb_ioctl().

#define O_ACCMODE   (O_RDONLY | O_WRONLY | O_RDWR)

Definition at line 98 of file io.c.

Referenced by Init_fcntl().

#define off_t   long

Definition at line 65 of file io.c.

Referenced by copy_stream_body(), copy_stream_fallback(), copy_stream_fallback_body(), Init_sizeof(), io_reopen(), io_unread(), maygvl_copy_stream_read(), nogvl_copy_stream_read_write(), rb_io_advise(), rb_io_init_copy(), rb_io_s_copy_stream(), 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 109 of file io.c.

#define PREP_STDIO_NAME (  )     (RSTRING_PTR((f)->pathv))

Definition at line 4037 of file io.c.

Referenced by io_reopen(), and rb_io_reopen().

#define rb_f_syscall   rb_f_notimplement

Definition at line 9237 of file io.c.

Referenced by Init_IO().

#define rb_intern ( str   )     rb_intern_const(str)

#define rb_io_close_on_exec_p   rb_f_notimplement

Definition at line 3974 of file io.c.

Referenced by Init_IO().

#define rb_io_fcntl   rb_f_notimplement

Definition at line 9077 of file io.c.

Referenced by Init_IO().

#define rb_io_fdatasync   rb_io_fsync

Definition at line 1901 of file io.c.

Referenced by Init_IO().

#define rb_io_fsync   rb_f_notimplement

Definition at line 1853 of file io.c.

Referenced by Init_IO().

#define rb_io_set_close_on_exec   rb_f_notimplement

Definition at line 4032 of file io.c.

Referenced by Init_IO().

#define rb_io_sync   rb_f_notimplement

Definition at line 1854 of file io.c.

Referenced by Init_IO().

#define READ_CHAR_PENDING ( fptr   )     ((fptr)->cbuf.len)

Definition at line 391 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)

Definition at line 392 of file io.c.

Referenced by appendline(), and swallow().

#define READ_CHAR_PENDING_PTR ( fptr   )     ((fptr)->cbuf.ptr+(fptr)->cbuf.off)

Definition at line 393 of file io.c.

Referenced by appendline(), and swallow().

#define READ_CHECK ( fptr   ) 

Value:

do {\
    if (!READ_DATA_PENDING(fptr)) {\
        WAIT_FD_IN_WIN32(fptr);\
        rb_io_check_closed(fptr);\
     }\
} while(0)

Definition at line 402 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 389 of file io.c.

Referenced by rb_io_sysread(), and rb_io_sysseek().

#define READ_DATA_PENDING ( fptr   )     ((fptr)->rbuf.len)

Definition at line 386 of file io.c.

Referenced by io_bufread(), 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 387 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.ptr+(fptr)->rbuf.off)

Definition at line 388 of file io.c.

Referenced by appendline(), rb_io_getline_fast(), and swallow().

#define S_ISREG (  )     (((m) & S_IFMT) == S_IFREG)

Definition at line 885 of file io.c.

#define SEEK_CUR   1

Definition at line 761 of file io.c.

Referenced by Init_IO(), interpret_seek_whence(), io_unread(), rb_chsize(), and remain_size().

#define SEEK_END   2

Definition at line 762 of file io.c.

Referenced by Init_IO(), interpret_seek_whence(), and makroom().

#define SEEK_SET   0

Definition at line 760 of file io.c.

Referenced by getdbit(), getnext(), getpage(), Init_IO(), interpret_seek_whence(), io_reopen(), io_s_write(), makroom(), nogvl_copy_stream_read_write(), rb_chsize(), rb_io_init_copy(), rb_io_s_binread(), rb_io_s_read(), rb_io_seek_m(), rb_io_set_pos(), rb_io_sysseek(), sdbm_delete(), sdbm_firstkey(), sdbm_store(), and setdbit().

#define SET_BINARY_MODE ( fptr   )     (void)(fptr)

Definition at line 568 of file io.c.

Referenced by appendline(), do_writeconv(), io_getc(), rb_io_each_codepoint(), rb_io_getline_1(), rb_io_ungetc(), read_all(), and swallow().

#define SET_BINARY_MODE_WITH_SEEK_CUR ( fptr   )     (void)(fptr)

Definition at line 571 of file io.c.

Referenced by copy_stream_body(), io_ascii8bit_binmode(), and rb_io_binmode().

#define SET_UNIVERSAL_NEWLINE_DECORATOR_IF_ENC2 ( enc2,
ecflags   )     ((void)(enc2), (void)(ecflags))

Definition at line 570 of file io.c.

Referenced by io_encoding_set(), and rb_io_extract_modeenc().

#define SHUT_RD   0

#define SHUT_WR   1

#define shutdown ( a,
 )     0

Definition at line 575 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 SMALLBUF   100

Definition at line 2103 of file io.c.

#define STDIO_READ_DATA_PENDING ( fp   )     (!feof(fp))

Definition at line 381 of file io.c.

Referenced by rb_read_check().

#define WAIT_FD_IN_WIN32 ( fptr   ) 

Definition at line 399 of file io.c.


Typedef Documentation

typedef struct rb_io_enc_t convconfig_t

Definition at line 5143 of file io.c.

typedef int ioctl_req_t

Definition at line 8682 of file io.c.


Function Documentation

static void advice_arg_check ( VALUE  advice  )  [static]

Definition at line 8428 of file io.c.

References rb_eNotImpError, rb_eTypeError, rb_inspect(), rb_raise(), StringValuePtr, SYMBOL_P, and VALUE.

Referenced by rb_io_advise().

static int appendline ( rb_io_t fptr,
int  delim,
VALUE *  strp,
long *  lp 
) [static]

Definition at line 2844 of file io.c.

References clear_readconv(), EOF, io_fillbuf(), last, len, make_readconv(), more_char(), MORE_CHAR_FINISHED, NEED_NEWLINE_DECORATOR_ON_READ_CHECK, 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_CHAR_PENDING_COUNT, READ_CHAR_PENDING_PTR, READ_CHECK, READ_DATA_PENDING_COUNT, READ_DATA_PENDING_PTR, RSTRING_LEN, RSTRING_PTR, SET_BINARY_MODE, and VALUE.

Referenced by rb_io_getline_1().

static VALUE argf_alloc ( VALUE  klass  )  [static]

Definition at line 7620 of file io.c.

References argf_init(), argf_type, Qnil, TypedData_Make_Struct, and VALUE.

Referenced by Init_IO().

static VALUE argf_argv ( VALUE  argf  )  [static]

Definition at line 11628 of file io.c.

References ARGF.

Referenced by argf_argv_getter(), and Init_IO().

static VALUE argf_argv_getter ( ID  id,
VALUE *  var 
) [static]

Definition at line 11634 of file io.c.

References argf_argv().

Referenced by Init_IO().

static VALUE argf_binmode_m ( VALUE  argf  )  [static]

Definition at line 11424 of file io.c.

References ARGF, ARGF_FORWARD, next_argv, and rb_io_ascii8bit_binmode().

Referenced by Init_IO().

static VALUE argf_binmode_p ( VALUE  argf  )  [static]

Definition at line 11447 of file io.c.

References ARGF, Qfalse, and Qtrue.

Referenced by Init_IO().

static void argf_block_call ( ID  mid,
int  argc,
VALUE *  argv,
VALUE  argf 
) [static]

Definition at line 11166 of file io.c.

References ARGF, argf_block_call_i(), Qundef, and rb_block_call().

Referenced by argf_each_byte(), argf_each_char(), argf_each_codepoint(), and argf_each_line().

static VALUE argf_block_call_i ( RB_BLOCK_CALL_FUNC_ARGLIST(i, argf  )  [static]

Definition at line 11155 of file io.c.

References argc, ARGF, argv, Qnil, Qundef, rb_iter_break_value(), and rb_yield_values2().

Referenced by argf_block_call().

static VALUE argf_bytes ( VALUE  argf  )  [static]

Definition at line 11266 of file io.c.

References argf_each_byte(), ID2SYM, rb_block_given_p(), rb_enumeratorize(), rb_intern, and rb_warn().

Referenced by Init_IO().

static VALUE argf_chars ( VALUE  argf  )  [static]

Definition at line 11305 of file io.c.

References argf_each_char(), ID2SYM, rb_block_given_p(), rb_enumeratorize(), rb_intern, and rb_warn().

Referenced by Init_IO().

static void argf_close ( VALUE  argf  )  [static]

Definition at line 7720 of file io.c.

References ARGF, Qnil, rb_funcall3, rb_intern, rb_io_set_write_io(), rb_stdin, RB_TYPE_P, T_FILE, and VALUE.

Referenced by argf_close_m(), argf_getbyte(), argf_getc(), argf_getline(), argf_getpartial(), argf_read(), argf_readchar(), argf_readlines(), and argf_skip().

static VALUE argf_close_m ( VALUE  argf  )  [static]

Definition at line 11495 of file io.c.

References ARGF, argf_close(), and next_argv.

Referenced by Init_IO().

static VALUE argf_closed ( VALUE  argf  )  [static]

Definition at line 11514 of file io.c.

References ARGF, ARGF_FORWARD, next_argv, and rb_io_closed().

Referenced by Init_IO().

static VALUE argf_codepoints ( VALUE  argf  )  [static]

Definition at line 11344 of file io.c.

References argf_each_codepoint(), ID2SYM, rb_block_given_p(), rb_enumeratorize(), rb_intern, and rb_warn().

Referenced by Init_IO().

static VALUE argf_each_byte ( VALUE  argf  )  [static]

Definition at line 11252 of file io.c.

References argf_block_call(), FOREACH_ARGF, rb_intern, and RETURN_ENUMERATOR.

Referenced by argf_bytes(), and Init_IO().

static VALUE argf_each_char ( VALUE  argf  )  [static]

Definition at line 11291 of file io.c.

References argf_block_call(), FOREACH_ARGF, rb_intern, and RETURN_ENUMERATOR.

Referenced by argf_chars(), and Init_IO().

static VALUE argf_each_codepoint ( VALUE  argf  )  [static]

Definition at line 11330 of file io.c.

References argf_block_call(), FOREACH_ARGF, rb_intern, and RETURN_ENUMERATOR.

Referenced by argf_codepoints(), and Init_IO().

static VALUE argf_each_line ( int  argc,
VALUE *  argv,
VALUE  argf 
) [static]

Definition at line 11205 of file io.c.

References argf_block_call(), FOREACH_ARGF, rb_intern, and RETURN_ENUMERATOR.

Referenced by argf_lines(), and Init_IO().

static VALUE argf_eof ( VALUE  argf  )  [static]

Definition at line 10801 of file io.c.

References ARGF, ARGF_FORWARD, next_argv, Qfalse, Qtrue, rb_io_eof(), and RTEST.

Referenced by Init_IO().

static VALUE argf_external_encoding ( VALUE  argf  )  [static]

Definition at line 10585 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().

static VALUE argf_file ( VALUE  argf  )  [static]

Definition at line 11406 of file io.c.

References ARGF, and next_argv.

Referenced by Init_IO().

static VALUE argf_filename ( VALUE  argf  )  [static]

Definition at line 11375 of file io.c.

References ARGF, and next_argv.

Referenced by argf_filename_getter(), and Init_IO().

static VALUE argf_filename_getter ( ID  id,
VALUE *  var 
) [static]

Definition at line 11382 of file io.c.

References argf_filename().

Referenced by Init_IO().

static VALUE argf_fileno ( VALUE  argf  )  [static]

Definition at line 10753 of file io.c.

References ARGF, ARGF_FORWARD, next_argv, rb_eArgError, rb_io_fileno(), and rb_raise().

Referenced by Init_IO().

static VALUE argf_forward ( int  argc,
VALUE *  argv,
VALUE  argf 
) [static]

Definition at line 7702 of file io.c.

References ARGF, rb_frame_this_func(), and rb_funcall3.

Referenced by argf_forward_call(), and argf_read().

static VALUE argf_forward_call ( VALUE  arg  )  [static]

Definition at line 10906 of file io.c.

References argf_call_arg::argc, argf_call_arg::argf, argf_forward(), argf_call_arg::argv, and Qnil.

Referenced by argf_getpartial().

static void argf_free ( void *  ptr  )  [static]

Definition at line 7587 of file io.c.

References argf::inplace, and xfree.

static VALUE argf_getbyte ( VALUE  argf  )  [static]

Definition at line 11060 of file io.c.

References ARGF, argf_close(), next_argv, NIL_P, Qnil, rb_funcall3, rb_intern, rb_io_getbyte(), RB_TYPE_P, and T_FILE.

Referenced by argf_readbyte(), and Init_IO().

static VALUE argf_getc ( VALUE  argf  )  [static]

Definition at line 11020 of file io.c.

References ARGF, argf_close(), ARGF_GENERIC_INPUT_P, next_argv, NIL_P, Qnil, rb_funcall3, rb_intern, and rb_io_getc().

Referenced by Init_IO().

static VALUE argf_getline ( int  argc,
VALUE *  argv,
VALUE  argf 
) [static]

Definition at line 7898 of file io.c.

References ARGF, argf_close(), ARGF_GENERIC_INPUT_P, next_argv, NIL_P, Qnil, rb_default_rs, rb_funcall3, rb_io_getline(), rb_io_gets(), rb_rs, and VALUE.

Referenced by argf_gets().

static VALUE argf_getpartial ( int  argc,
VALUE *  argv,
VALUE  argf,
int  nonblock 
) [static]

Definition at line 10956 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 argf_read_nonblock(), and argf_readpartial().

static VALUE argf_gets ( int  ,
VALUE *  ,
VALUE   
) [static]

Definition at line 8003 of file io.c.

References argf_getline(), rb_lastline_set(), and VALUE.

Referenced by argf_readline(), Init_IO(), and rb_f_gets().

static void argf_init ( struct argf p,
VALUE  v 
) [inline, static]

Definition at line 7611 of file io.c.

References argf::argv, argf::current_file, argf::filename, argf::lineno, and Qnil.

Referenced by argf_alloc(), and argf_initialize().

static VALUE argf_initialize ( VALUE  argf,
VALUE  argv 
) [static]

Definition at line 7633 of file io.c.

References ARGF, and argf_init().

Referenced by Init_IO().

static VALUE argf_initialize_copy ( VALUE  argf,
VALUE  orig 
) [static]

Definition at line 7643 of file io.c.

References ARGF, argf_of, argf::inplace, OBJ_INIT_COPY, rb_obj_dup(), and ruby_strdup().

Referenced by Init_IO().

static VALUE argf_inplace_mode_get ( VALUE  argf  )  [static]

Definition at line 11542 of file io.c.

References ARGF, Qnil, and rb_str_new2.

Referenced by Init_IO(), and opt_i_get().

static VALUE argf_inplace_mode_set ( VALUE  argf,
VALUE  val 
) [static]

Definition at line 11575 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().

static VALUE argf_internal_encoding ( VALUE  argf  )  [static]

Definition at line 10607 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 VALUE argf_lineno ( VALUE  argf  )  [static]

Definition at line 7696 of file io.c.

References ARGF, and INT2FIX.

Referenced by Init_IO().

static VALUE argf_lineno_getter ( ID  id,
VALUE *  var 
) [static]

Definition at line 7929 of file io.c.

References ARGF, INT2FIX, and VALUE.

Referenced by Init_IO().

static void argf_lineno_setter ( VALUE  val,
ID  id,
VALUE *  var 
) [static]

Definition at line 7936 of file io.c.

References ARGF, NUM2INT, and VALUE.

Referenced by Init_IO().

static VALUE argf_lines ( int  argc,
VALUE *  argv,
VALUE  argf 
) [static]

Definition at line 11219 of file io.c.

References argf_each_line(), ID2SYM, rb_block_given_p(), rb_enumeratorize(), rb_intern, and rb_warn().

Referenced by Init_IO().

static void argf_mark ( void *  ptr  )  [static]

Definition at line 7577 of file io.c.

References argf::argv, argf::current_file, argf::encs, argf::filename, and rb_gc_mark().

static size_t argf_memsize ( const void *  ptr  )  [static]

Definition at line 7595 of file io.c.

References argf::inplace, size, and strlen().

static int argf_next_argv ( VALUE  argf  )  [static]

Definition at line 7732 of file io.c.

References ARGF, chown(), clear_codeconv(), DEFAULT_TEXTMODE, rb_io_t::rb_io_enc_t::ecflags, ECONV_DEFAULT_NEWLINE_DECORATOR, ECONV_NEWLINE_DECORATOR_MASK, rb_io_t::encs, err, errno, FALSE, fmode, FMODE_BINMODE, FMODE_READABLE, FMODE_WRITABLE, fstat, GetOpenFile, getuid(), rb_io_t::mode, NIL_P, orig_stdout, prep_io(), Qnil, RARRAY_LEN, rb_ary_shift(), rb_cFile, rb_fatal(), rb_io_ascii8bit_binmode(), rb_io_binmode(), rb_io_close(), rb_io_set_write_io(), rb_stdin, rb_stdout, rb_str_cat2(), rb_str_new2, rb_sysopen(), RB_TYPE_P, rb_warn(), RSTRING_PTR, stat, strerror(), StringValueCStr, strlen(), T_FILE, TRUE, and VALUE.

static VALUE argf_read ( int  argc,
VALUE *  argv,
VALUE  argf 
) [static]

Definition at line 10855 of file io.c.

References ARGF, argf_close(), argf_forward(), ARGF_GENERIC_INPUT_P, INT2NUM, io_read(), next_argv, NIL_P, NUM2LONG, Qnil, rb_scan_args(), rb_str_append(), rb_str_resize(), RSTRING_LEN, and StringValue.

Referenced by Init_IO().

static VALUE argf_read_nonblock ( int  argc,
VALUE *  argv,
VALUE  argf 
) [static]

Definition at line 10950 of file io.c.

References argf_getpartial().

Referenced by Init_IO().

static VALUE argf_readbyte ( VALUE  argf  )  [static]

Definition at line 11140 of file io.c.

References argf_getbyte(), NEXT_ARGF_FORWARD, NIL_P, and rb_eof_error().

Referenced by Init_IO().

static VALUE argf_readchar ( VALUE  argf  )  [static]

Definition at line 11100 of file io.c.

References ARGF, argf_close(), next_argv, NIL_P, rb_eof_error(), rb_funcall3, rb_intern, rb_io_getc(), RB_TYPE_P, and T_FILE.

Referenced by Init_IO().

static VALUE argf_readline ( int  ,
VALUE *  ,
VALUE   
) [static]

Definition at line 8078 of file io.c.

References ARGF_FORWARD, argf_gets(), next_argv, NIL_P, rb_eof_error(), and VALUE.

Referenced by Init_IO(), and rb_f_readline().

static VALUE argf_readlines ( int  ,
VALUE *  ,
VALUE   
) [static]

Definition at line 8130 of file io.c.

References ARGF, argf_close(), ARGF_GENERIC_INPUT_P, next_argv, RARRAY_LEN, rb_ary_concat(), rb_ary_new(), rb_funcall3, rb_intern, rb_io_readlines(), and VALUE.

Referenced by Init_IO(), and rb_f_readlines().

static VALUE argf_readpartial ( int  argc,
VALUE *  argv,
VALUE  argf 
) [static]

Definition at line 10936 of file io.c.

References argf_getpartial().

Referenced by Init_IO().

static VALUE argf_rewind ( VALUE  argf  )  [static]

Definition at line 10733 of file io.c.

References ARGF, ARGF_FORWARD, next_argv, rb_eArgError, rb_io_rewind(), and rb_raise().

Referenced by Init_IO().

static VALUE argf_seek_m ( int  argc,
VALUE *  argv,
VALUE  argf 
) [static]

Definition at line 10690 of file io.c.

References ARGF, ARGF_FORWARD, next_argv, rb_eArgError, rb_io_seek_m(), and rb_raise().

Referenced by Init_IO().

static VALUE argf_set_encoding ( int  argc,
VALUE *  argv,
VALUE  argf 
) [static]

Definition at line 10647 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().

static VALUE argf_set_lineno ( VALUE  argf,
VALUE  val 
) [static]

Definition at line 7675 of file io.c.

References ARGF, NUM2INT, and Qnil.

Referenced by Init_IO().

static VALUE argf_set_pos ( VALUE  argf,
VALUE  offset 
) [static]

Definition at line 10711 of file io.c.

References ARGF, ARGF_FORWARD, next_argv, rb_eArgError, rb_io_set_pos(), and rb_raise().

Referenced by Init_IO().

static VALUE argf_skip ( VALUE  argf  )  [static]

Definition at line 11467 of file io.c.

References ARGF, and argf_close().

Referenced by Init_IO().

static VALUE argf_tell ( VALUE  argf  )  [static]

Definition at line 10673 of file io.c.

References ARGF, ARGF_FORWARD, next_argv, rb_eArgError, rb_io_tell(), and rb_raise().

Referenced by Init_IO().

static VALUE argf_to_io ( VALUE  argf  )  [static]

Definition at line 10775 of file io.c.

References ARGF, ARGF_FORWARD, and next_argv.

Referenced by Init_IO().

static VALUE argf_to_s ( VALUE  argf  )  [static]

Definition at line 11528 of file io.c.

References rb_str_new2.

Referenced by Init_IO().

static VALUE argf_write ( VALUE  argf,
VALUE  str 
) [static]

Definition at line 11668 of file io.c.

References argf_write_io(), and rb_io_write().

Referenced by Init_IO().

static VALUE argf_write_io ( VALUE  argf  )  [static]

Definition at line 11653 of file io.c.

References ARGF, GetWriteIO, rb_eIOError, rb_raise(), and RTEST.

Referenced by argf_write(), and Init_IO().

static VALUE bufread_call ( VALUE  arg  )  [static]

Definition at line 2070 of file io.c.

References bufread_arg::fptr, io_bufread(), bufread_arg::len, Qundef, and bufread_arg::str_ptr.

Referenced by io_fread().

static VALUE check_pipe_command ( VALUE  filename_or_command  )  [static]

Definition at line 6332 of file io.c.

References rb_execarg::cmd, OBJ_INFECT, Qnil, rb_enc_ascget(), rb_enc_get(), rb_str_new(), RSTRING_LEN, RSTRING_PTR, and VALUE.

Referenced by rb_f_open(), and rb_io_open().

static void clear_codeconv ( rb_io_t fptr  )  [static]

Definition at line 4250 of file io.c.

References clear_readconv(), clear_writeconv(), and finish_writeconv_arg::fptr.

Referenced by argf_next_argv(), io_ascii8bit_binmode(), io_encoding_set(), rb_io_fptr_finalize(), and rb_io_initialize().

static void clear_readconv ( rb_io_t fptr  )  [static]

Definition at line 4227 of file io.c.

References rb_io_t::cbuf, finish_writeconv_arg::fptr, free, NULL, rb_io_buffer_t::ptr, 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 4240 of file io.c.

References finish_writeconv_arg::fptr, NULL, rb_econv_close(), rb_io_t::writeconv, and rb_io_t::writeconv_initialized.

Referenced by clear_codeconv().

static VALUE copy_stream_body ( VALUE  arg  )  [static]

Definition at line 10291 of file io.c.

References args, 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_ascii8bit_binmode(), io_binwrite(), io_fflush(), nogvl_copy_stream_func(), off_t, Qnil, rb_cFile, rb_class_new_instance(), rb_eIOError, 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_call_without_gvl(), rb_thread_current(), RB_TYPE_P, read_buffered_data(), RSTRING_LEN, RSTRING_PTR, RUBY_UBF_IO, SET_BINARY_MODE_WITH_SEEK_CUR, copy_stream_struct::src, copy_stream_struct::src_fd, copy_stream_struct::src_offset, T_FILE, T_STRING, copy_stream_struct::th, and copy_stream_struct::total.

Referenced by rb_io_s_copy_stream().

static VALUE copy_stream_fallback ( struct copy_stream_struct stp  )  [static]

Definition at line 10279 of file io.c.

References ANYARGS, copy_stream_fallback_body(), off_t, Qnil, rb_eArgError, rb_eEOFError, rb_raise(), rb_rescue2(), copy_stream_struct::src_fd, and copy_stream_struct::src_offset.

Referenced by copy_stream_body().

static VALUE copy_stream_fallback_body ( VALUE  arg  )  [static]

Definition at line 10221 of file io.c.

References copy_stream_struct::copy_length, copy_stream_struct::dst, id_read, id_readpartial, INT2FIX, long, maygvl_copy_stream_read(), NIL_P, NUM2LONG, off_t, Qnil, rb_eof_error(), rb_funcall(), rb_io_write(), rb_respond_to(), rb_str_buf_new(), rb_str_resize(), 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().

static VALUE copy_stream_finalize ( VALUE  arg  )  [static]

Definition at line 10402 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, Qnil, 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().

static int do_ioctl ( int  fd,
ioctl_req_t  cmd,
long  narg 
) [static]

Definition at line 8701 of file io.c.

References ioctl_arg::cmd, ioctl_arg::fd, ioctl_arg::narg, nogvl_ioctl(), and rb_thread_io_blocking_region().

Referenced by rb_ioctl().

static VALUE do_writeconv ( VALUE  str,
rb_io_t fptr 
) [static]

Definition at line 1296 of file io.c.

References DEFAULT_TEXTMODE, rb_io_t::rb_io_enc_t::ecflags, ECONV_NEWLINE_DECORATOR_MASK, ECONV_PARTIAL_INPUT, rb_io_t::rb_io_enc_t::enc, rb_io_t::rb_io_enc_t::enc2, rb_io_t::encs, rb_io_t::fd, FMODE_READABLE, binwrite_arg::fptr, make_writeconv(), rb_io_t::mode, MODE_BTMODE, NEED_WRITECONV, NIL_P, O_BINARY, Qnil, 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(), SET_BINARY_MODE, VALUE, 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* exec_interrupts ( void *  arg  )  [static]

Definition at line 9828 of file io.c.

References NULL, and rb_thread_execute_interrupts().

Referenced by maygvl_copy_stream_continue_p().

static void extract_binmode ( VALUE  opthash,
int *  fmode 
) [static]

Definition at line 5170 of file io.c.

References FMODE_BINMODE, FMODE_TEXTMODE, NIL_P, rb_eArgError, rb_hash_aref(), rb_raise(), RTEST, sym_binmode, sym_textmode, and VALUE.

Referenced by rb_io_extract_modeenc(), and rb_io_s_pipe().

static long fcntl_narg_len ( int  cmd  )  [static]

Definition at line 8889 of file io.c.

Referenced by setup_narg().

static VALUE fill_cbuf ( rb_io_t fptr,
int  ec_flags 
) [static]

Definition at line 2172 of file io.c.

References rb_io_buffer_t::capa, rb_io_t::cbuf, dp, econv_finished, ECONV_PARTIAL_INPUT, econv_source_buffer_empty, io_fillbuf(), rb_io_buffer_t::len, memmove(), MORE_CHAR_FINISHED, MORE_CHAR_SUSPENDED, NIL_P, NULL, rb_io_buffer_t::off, rb_io_buffer_t::ptr, rb_econv_check_error(), rb_econv_convert(), rb_econv_make_exception(), rb_econv_putback(), rb_econv_putbackable(), rb_io_t::rbuf, READ_CHECK, rb_io_t::readconv, and VALUE.

Referenced by more_char(), and read_all().

static rb_encoding* find_encoding ( VALUE  v  )  [static]

Definition at line 9247 of file io.c.

References rb_find_encoding(), StringValueCStr, and unsupported_encoding().

Referenced by io_encoding_set().

static VALUE finish_writeconv ( rb_io_t fptr,
int  noalloc 
) [static]

Definition at line 4040 of file io.c.

References buf, rb_io_buffer_t::capa, dp, econv_destination_buffer_full, econv_incomplete_input, econv_invalid_byte_sequence, econv_undefined_conversion, errno, rb_io_t::fd, INT2NUM, io_fflush(), rb_io_buffer_t::len, NULL, rb_io_buffer_t::off, rb_io_buffer_t::ptr, Qnil, Qtrue, rb_econv_convert(), rb_econv_make_exception(), rb_eIOError, rb_exc_new3, rb_io_wait_writable(), rb_mutex_owned_p(), rb_str_new_cstr(), rb_write_internal(), rb_write_internal2(), rb_io_t::wbuf, rb_io_t::write_lock, and rb_io_t::writeconv.

Referenced by finish_writeconv_sync(), and fptr_finalize().

static VALUE finish_writeconv_sync ( VALUE  arg  )  [static]

Definition at line 4108 of file io.c.

References finish_writeconv(), finish_writeconv_arg::fptr, and finish_writeconv_arg::noalloc.

Referenced by fptr_finalize().

static rb_io_t * flush_before_seek ( rb_io_t fptr  )  [static]

Definition at line 747 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 4153 of file io.c.

References err, errno, rb_io_t::fd, finish_writeconv(), finish_writeconv_sync(), FMODE_READABLE, FMODE_WRITABLE, finish_writeconv_arg::fptr, INT2NUM, io_fflush(), io_flush_buffer_sync(), IS_PREP_STDIO, rb_io_buffer_t::len, maygvl_close(), maygvl_fclose(), rb_io_t::mode, NIL_P, finish_writeconv_arg::noalloc, NUM2INT, rb_io_t::pathv, Qnil, Qtrue, rb_exc_raise(), rb_mutex_synchronize(), rb_sys_fail_path, rb_io_t::stdio_file, T_BIGNUM, T_FIXNUM, TYPE, VALUE, rb_io_t::wbuf, rb_io_t::write_lock, and rb_io_t::writeconv.

Referenced by pipe_finalize(), and rb_io_fptr_cleanup().

static VALUE ignore_closed_stream ( VALUE  io,
VALUE  exc 
) [static]

Definition at line 4354 of file io.c.

References memcmp(), rb_attr_get(), rb_exc_raise(), rb_intern, RB_TYPE_P, RSTRING_LEN, RSTRING_PTR, T_STRING, and VALUE.

Referenced by io_close().

void Init_IO ( void   ) 

Definition at line 11874 of file io.c.

References ARGF, argf_alloc(), argf_argv(), argf_argv_getter(), argf_binmode_m(), argf_binmode_p(), argf_bytes(), argf_chars(), argf_close_m(), argf_closed(), argf_codepoints(), argf_each_byte(), argf_each_char(), argf_each_codepoint(), 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_lines(), argf_read(), argf_read_nonblock(), 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(), argf_write(), argf_write_io(), FMODE_READABLE, FMODE_SYNC, FMODE_WRITABLE, ID2SYM, id_flush, id_getc, id_read, id_readpartial, id_set_encoding, id_write, Init_File(), INT2FIX, io_alloc(), io_read(), io_read_nonblock(), io_readpartial(), io_write_m(), NULL, O_BINARY, OBJ_FREEZE, opt_i_get(), opt_i_set(), orig_stderr, orig_stdout, pipe_atexit(), prep_stdio(), Qnil, 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_class_under(), 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_eEAGAIN, rb_eEAGAINWaitReadable, rb_eEAGAINWaitWritable, rb_eEINPROGRESS, rb_eEINPROGRESSWaitReadable, rb_eEINPROGRESSWaitWritable, rb_eEOFError, rb_eEWOULDBLOCK, rb_eEWOULDBLOCKWaitReadable, rb_eEWOULDBLOCKWaitWritable, 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_initialize(), rb_gc_register_mark_object(), rb_gvar_readonly_setter(), rb_include_module(), rb_intern, rb_io_addstr(), rb_io_advise(), rb_io_autoclose_p(), rb_io_binmode_m(), rb_io_binmode_p(), rb_io_bytes(), rb_io_chars(), rb_io_close_m(), rb_io_close_on_exec_p, rb_io_close_read(), rb_io_close_write(), rb_io_closed(), rb_io_codepoints(), 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_lines(), 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_binwrite(), 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_s_write(), 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_CUR, sym_encoding, sym_END, sym_exception, sym_extenc, sym_intenc, sym_mode, sym_open_args, sym_perm, sym_SET, and sym_textmode.

static VALUE internal_read_func ( void *  ptr  )  [static]

Definition at line 924 of file io.c.

References io_internal_read_struct::buf, io_internal_read_struct::capa, and io_internal_read_struct::fd.

Referenced by rb_read_internal().

static VALUE internal_write_func ( void *  ptr  )  [static]

Definition at line 931 of file io.c.

References io_internal_write_struct::buf, io_internal_write_struct::capa, and io_internal_write_struct::fd.

Referenced by rb_write_internal().

static void* internal_write_func2 ( void *  ptr  )  [static]

Definition at line 938 of file io.c.

References io_internal_write_struct::buf, io_internal_write_struct::capa, and io_internal_write_struct::fd.

Referenced by rb_write_internal2().

static int interpret_seek_whence ( VALUE  vwhence  )  [static]

Definition at line 1556 of file io.c.

References NUM2INT, SEEK_CUR, SEEK_END, SEEK_SET, sym_CUR, sym_END, and sym_SET.

Referenced by rb_io_seek_m(), and rb_io_sysseek().

static VALUE io_alloc ( VALUE  klass  )  [static]

Definition at line 875 of file io.c.

References NEWOBJ_OF, T_FILE, and VALUE.

Referenced by Init_IO(), pipe_open(), prep_io(), rb_file_open(), rb_file_open_str(), rb_io_open(), and rb_io_open_with_args().

static void io_ascii8bit_binmode ( rb_io_t fptr  )  [static]

Definition at line 4703 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, FMODE_BINMODE, FMODE_TEXTMODE, rb_io_t::mode, NULL, Qnil, rb_ascii8bit_encoding(), rb_econv_close(), rb_io_t::readconv, SET_BINARY_MODE_WITH_SEEK_CUR, and rb_io_t::writeconv.

Referenced by copy_stream_body(), and rb_io_ascii8bit_binmode().

static long io_binwrite ( VALUE  str,
const char *  ptr,
long  len,
rb_io_t fptr,
int  nosync 
) [static]

Definition at line 1215 of file io.c.

References ALLOC_N, rb_io_buffer_t::capa, errno, rb_io_t::fd, FMODE_SYNC, FMODE_TTY, binwrite_arg::fptr, io_binwrite_string(), io_fflush(), IO_WBUF_CAPA_MIN, io_writable_length(), rb_io_buffer_t::len, binwrite_arg::length, MEMMOVE, rb_io_t::mode, NULL, rb_io_buffer_t::off, binwrite_arg::ptr, rb_io_buffer_t::ptr, rb_io_check_closed(), rb_io_wait_writable(), rb_mutex_allow_trap(), rb_mutex_new(), rb_mutex_synchronize(), rb_thread_check_ints(), rb_write_internal(), binwrite_arg::str, VALUE, rb_io_t::wbuf, and rb_io_t::write_lock.

Referenced by copy_stream_body(), io_fwrite(), and rb_io_bufwrite().

static VALUE io_binwrite_string ( VALUE  arg  )  [static]

Definition at line 1207 of file io.c.

References rb_io_t::fd, binwrite_arg::fptr, io_writable_length(), binwrite_arg::length, binwrite_arg::ptr, and rb_write_internal2().

Referenced by io_binwrite().

static long io_bufread ( char *  ptr,
long  len,
rb_io_t fptr 
) [static]

Definition at line 2025 of file io.c.

References rb_io_t::fd, binwrite_arg::fptr, io_fillbuf(), rb_io_check_closed(), rb_io_wait_readable(), rb_read_internal(), read_buffered_data(), and READ_DATA_PENDING.

Referenced by bufread_call(), and rb_io_bufread().

static VALUE io_call_close ( VALUE  io  )  [static]

Definition at line 4347 of file io.c.

References rb_check_funcall(), and rb_intern.

Referenced by io_close().

static void io_check_tty ( rb_io_t fptr  )  [static]

Definition at line 5412 of file io.c.

References rb_io_t::fd, FMODE_DUPLEX, FMODE_TTY, and rb_io_t::mode.

Referenced by prep_io(), rb_file_open_generic(), and rb_io_initialize().

static VALUE io_close ( VALUE  io  )  [static]

Definition at line 4367 of file io.c.

References ignore_closed_stream(), io_call_close(), Qundef, rb_check_funcall(), rb_eIOError, rb_intern, rb_rescue2(), RTEST, and VALUE.

Referenced by pipe_pair_close(), rb_f_open(), rb_io_s_open(), and rb_io_s_popen().

static VALUE io_enc_str ( VALUE  str,
rb_io_t fptr 
) [static]

Definition at line 2135 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 4800 of file io.c.

References long, strchr(), strlen(), and STRNCASECMP.

Referenced by parse_mode_enc(), and rb_io_modestr_fmode().

static void io_encoding_set ( rb_io_t ,
VALUE  ,
VALUE  ,
VALUE   
) [static]

Definition at line 9255 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, find_encoding(), rb_io_t::mode, NIL_P, NULL, parse_mode_enc(), Qnil, rb_check_string_type(), rb_econv_prepare_options(), rb_enc_asciicompat, rb_enc_get(), rb_io_ext_int_to_encs(), RSTRING_LEN, RSTRING_PTR, SET_UNIVERSAL_NEWLINE_DECORATOR_IF_ENC2, 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  )  [static]

Definition at line 1062 of file io.c.

References rb_io_t::fd, io_flush_buffer(), rb_io_buffer_t::len, rb_io_check_closed(), rb_io_wait_writable(), and rb_io_t::wbuf.

Referenced by copy_stream_body(), finish_writeconv(), flush_before_seek(), fptr_finalize(), io_binwrite(), io_reopen(), io_write_nonblock(), rb_io_check_char_readable(), rb_io_flush_raw(), rb_io_reopen(), and remain_size().

static int io_fillbuf ( rb_io_t fptr  )  [static]

Definition at line 1673 of file io.c.

References ALLOC_N, rb_io_buffer_t::capa, rb_io_t::fd, binwrite_arg::fptr, IO_RBUF_CAPA_FOR, rb_io_buffer_t::len, NIL_P, NULL, rb_io_buffer_t::off, rb_io_t::pathv, rb_io_buffer_t::ptr, rb_io_wait_readable(), rb_read_internal(), rb_sprintf(), rb_str_append(), rb_sys_fail_path, rb_io_t::rbuf, and VALUE.

Referenced by appendline(), fill_cbuf(), io_bufread(), io_getc(), rb_io_each_byte(), 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 1048 of file io.c.

References io_flush_buffer_async(), io_flush_buffer_async2(), rb_mutex_owned_p(), rb_mutex_synchronize(), VALUE, and rb_io_t::write_lock.

Referenced by io_fflush().

static VALUE io_flush_buffer_async ( VALUE  arg  )  [static]

Definition at line 1022 of file io.c.

References rb_io_t::fd, io_flush_buffer_sync(), and rb_thread_io_blocking_region().

Referenced by io_flush_buffer().

static VALUE io_flush_buffer_async2 ( VALUE  arg  )  [static]

Definition at line 1029 of file io.c.

References errno, io_flush_buffer_sync2(), NULL, rb_thread_call_without_gvl2(), RUBY_UBF_IO, and VALUE.

Referenced by io_flush_buffer().

static VALUE io_flush_buffer_sync ( void *  arg  )  [static]

Definition at line 990 of file io.c.

References errno, rb_io_t::fd, io_writable_length(), rb_io_buffer_t::len, rb_io_buffer_t::off, rb_io_buffer_t::ptr, VALUE, and rb_io_t::wbuf.

Referenced by fptr_finalize(), io_flush_buffer_async(), and io_flush_buffer_sync2().

static void* io_flush_buffer_sync2 ( void *  arg  )  [static]

Definition at line 1010 of file io.c.

References io_flush_buffer_sync(), result, and VALUE.

Referenced by io_flush_buffer_async2().

static long io_fread ( VALUE  str,
long  offset,
long  size,
rb_io_t fptr 
) [static]

Definition at line 2078 of file io.c.

References bufread_call(), bufread_arg::fptr, io_setstrbuf(), bufread_arg::len, len, rb_io_t::pathv, rb_str_locktmp_ensure(), rb_sys_fail_path, RSTRING_PTR, bufread_arg::str_ptr, and VALUE.

Referenced by io_read(), and read_all().

static long io_fwrite ( VALUE  str,
rb_io_t fptr,
int  nosync 
) [static]

Definition at line 1351 of file io.c.

References do_writeconv(), rb_io_t::fd, FMODE_TTY, binwrite_arg::fptr, io_binwrite(), len, rb_io_t::mode, rb_w32_write_console(), RSTRING_LEN, and RSTRING_PTR.

Referenced by io_write().

static VALUE io_getc ( rb_io_t fptr,
rb_encoding enc 
) [static]

Definition at line 3449 of file io.c.

References rb_io_buffer_t::capa, rb_io_t::cbuf, clear_readconv(), ENC_CODERANGE_7BIT, ENC_CODERANGE_BROKEN, ENC_CODERANGE_SET, ENC_CODERANGE_VALID, io_enc_str(), io_fillbuf(), io_read_encoding(), io_shift_cbuf(), ISASCII, rb_io_buffer_t::len, make_readconv(), MBCLEN_CHARFOUND_LEN, MBCLEN_CHARFOUND_P, MBCLEN_INVALID_P, MBCLEN_NEEDMORE_P, more_char(), MORE_CHAR_FINISHED, NEED_NEWLINE_DECORATOR_ON_READ_CHECK, NEED_READCONV, rb_io_buffer_t::off, rb_io_buffer_t::ptr, Qnil, 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, RSTRING_LEN, RSTRING_PTR, SET_BINARY_MODE, and VALUE.

Referenced by rb_io_each_char(), and rb_io_getc().

static VALUE io_getpartial ( int  argc,
VALUE *  argv,
VALUE  io,
int  nonblock,
int  no_exception 
) [static]

Definition at line 2415 of file io.c.

References errno, EWOULDBLOCK, read_internal_arg::fd, GetOpenFile, ID2SYM, io_set_read_length(), io_setstrbuf(), read_internal_arg::len, len, NULL, NUM2LONG, OBJ_TAINT, Qnil, rb_eArgError, rb_intern, rb_io_check_byte_readable(), rb_io_set_nonblock(), RB_IO_WAIT_READABLE, rb_io_wait_readable(), rb_raise(), rb_readwrite_sys_fail(), rb_scan_args(), rb_str_locktmp_ensure(), rb_sys_fail_path, read_buffered_data(), READ_CHECK, read_internal_call(), RSTRING_PTR, read_internal_arg::str_ptr, and VALUE.

Referenced by argf_getpartial(), io_read_nonblock(), and io_readpartial().

static rb_encoding * io_input_encoding ( rb_io_t fptr  )  [static]

Definition at line 809 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(), and rb_io_getc().

static VALUE io_new_instance ( VALUE  args  )  [static]

Definition at line 9241 of file io.c.

References rb_class_new_instance().

Referenced by rb_io_s_pipe().

static VALUE io_puts_ary ( VALUE  ary,
VALUE  out,
int  recur 
) [static]

Definition at line 6943 of file io.c.

References NIL_P, Qfalse, Qtrue, RARRAY_AREF, RARRAY_LEN, rb_check_array_type(), rb_io_puts(), rb_str_new2, and VALUE.

Referenced by rb_io_puts().

static VALUE io_read ( int  argc,
VALUE *  argv,
VALUE  io 
) [static]

Definition at line 2788 of file io.c.

References rb_io_t::fd, GetOpenFile, io_fread(), io_set_read_length(), io_setstrbuf(), len, NIL_P, NUM2LONG, OBJ_TAINT, Qnil, rb_eArgError, rb_io_check_byte_readable(), rb_io_check_char_readable(), rb_raise(), rb_scan_args(), read_all(), READ_CHECK, remain_size(), and VALUE.

Referenced by argf_read(), Init_IO(), and io_s_read().

static rb_encoding* io_read_encoding ( rb_io_t fptr  )  [static]

Definition at line 800 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().

static VALUE io_read_nonblock ( int  argc,
VALUE *  argv,
VALUE  io 
) [static]

Definition at line 2593 of file io.c.

References io_getpartial(), NIL_P, NULL, Qfalse, Qnil, rb_eof_error(), rb_hash_aref(), rb_scan_args(), sym_exception, and VALUE.

Referenced by Init_IO().

static VALUE io_readpartial ( int  argc,
VALUE *  argv,
VALUE  io 
) [static]

Definition at line 2531 of file io.c.

References io_getpartial(), NIL_P, rb_eof_error(), and VALUE.

Referenced by Init_IO().

static VALUE io_reopen ( VALUE  io,
VALUE  nfile 
) [static]

Definition at line 6513 of file io.c.

References errno, rb_io_t::fd, rb_io_t::finalize, FMODE_BINMODE, FMODE_PREP, FMODE_READABLE, FMODE_WRITABLE, GetOpenFile, io_fflush(), io_seek, io_tell, IS_PREP_STDIO, rb_io_t::lineno, rb_io_t::mode, off_t, rb_io_t::pathv, rb_io_t::pid, pipe_add_fptr(), pipe_finalize(), PREP_STDIO_NAME, Qnil, rb_cloexec_dup2(), rb_eArgError, rb_io_binmode(), rb_io_fmode_modestr(), rb_io_get_io(), rb_obj_class(), rb_raise(), rb_sys_fail(), rb_sys_fail_path, rb_thread_fd_close(), rb_update_max_fd(), RBASIC_SET_CLASS, 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 9495 of file io.c.

References foreach_arg::argc, foreach_arg::argv, foreach_arg::io, NIL_P, Qnil, 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 9582 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 9546 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 VALUE io_s_write ( int  argc,
VALUE *  argv,
int  binary 
) [static]

Definition at line 9701 of file io.c.

References INT2NUM, write_arg::io, seek_arg::io, foreach_arg::io, io_s_write0(), seek_arg::mode, NIL_P, write_arg::nosync, NULL, O_BINARY, seek_arg::offset, open_key_args(), Qnil, rb_ensure(), rb_hash_aref(), rb_hash_aset(), rb_hash_dup(), rb_hash_new(), rb_io_binmode_m(), rb_io_close(), rb_jump_tag(), rb_protect(), rb_scan_args(), seek_before_access(), SEEK_SET, write_arg::str, and sym_mode.

Referenced by rb_io_s_binwrite(), and rb_io_s_write().

static VALUE io_s_write0 ( struct write_arg arg  )  [static]

Definition at line 9695 of file io.c.

References write_arg::io, io_write(), write_arg::nosync, and write_arg::str.

Referenced by io_s_write().

static void io_set_encoding_by_bom ( VALUE  io  )  [static]

Definition at line 5485 of file io.c.

References rb_io_t::rb_io_enc_t::enc2, rb_io_t::encs, GetOpenFile, io_encoding_set(), io_strip_bom(), NULL, Qnil, rb_enc_from_encoding(), rb_enc_from_index(), and rb_io_internal_encoding().

Referenced by rb_file_open_generic(), and rb_io_initialize().

static void io_set_read_length ( VALUE  str,
long  n 
) [static]

Definition at line 2304 of file io.c.

References rb_str_modify(), rb_str_set_len(), and RSTRING_LEN.

Referenced by io_getpartial(), io_read(), and rb_io_sysread().

static void io_setstrbuf ( VALUE *  str,
long  len 
) [static]

Definition at line 2283 of file io.c.

References NIL_P, rb_str_modify(), rb_str_modify_expand(), rb_str_new(), RSTRING_LEN, StringValue, and VALUE.

Referenced by io_fread(), io_getpartial(), io_read(), rb_io_sysread(), and read_all().

static VALUE io_shift_cbuf ( rb_io_t fptr,
int  len,
VALUE *  strp 
) [static]

Definition at line 2256 of file io.c.

References rb_io_buffer_t::capa, rb_io_t::cbuf, rb_io_t::rb_io_enc_t::enc, rb_io_t::encs, rb_io_buffer_t::len, memmove(), NIL_P, OBJ_TAINT, rb_io_buffer_t::off, rb_io_buffer_t::ptr, Qnil, rb_enc_associate(), rb_str_cat(), rb_str_new(), and VALUE.

Referenced by io_getc(), read_all(), and swallow().

static int io_strip_bom ( VALUE  io  )  [static]

Definition at line 5422 of file io.c.

References INT2FIX, NIL_P, rb_io_getbyte(), rb_io_ungetbyte(), rb_utf8_encindex, and VALUE.

Referenced by io_set_encoding_by_bom().

static void io_ungetbyte ( VALUE  str,
rb_io_t fptr 
) [static]

Definition at line 714 of file io.c.

References ALLOC_N, rb_io_buffer_t::capa, IO_RBUF_CAPA_FOR, rb_io_buffer_t::len, len, MEMMOVE, NULL, rb_io_buffer_t::off, rb_io_buffer_t::ptr, rb_eIOError, rb_raise(), rb_io_t::rbuf, 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 691 of file io.c.

References errno, rb_io_t::fd, FMODE_DUPLEX, rb_io_buffer_t::len, rb_io_t::mode, rb_io_buffer_t::off, off_t, rb_io_check_closed(), rb_io_t::rbuf, and SEEK_CUR.

Referenced by flush_before_seek(), rb_io_check_writable(), and rb_io_flush_raw().

static long io_writable_length ( rb_io_t fptr,
long  l 
) [static]

Definition at line 979 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().

static VALUE io_write ( VALUE  io,
VALUE  str,
int  nosync 
) [static]

Definition at line 1375 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_str_new_frozen(), rb_sys_fail_path, RSTRING_LEN, and VALUE.

Referenced by io_s_write0(), io_write_m(), and rb_p().

static VALUE io_write_m ( VALUE  io,
VALUE  str 
) [static]

Definition at line 1421 of file io.c.

References io_write().

Referenced by Init_IO().

static VALUE io_write_nonblock ( VALUE  io,
VALUE  str,
int  no_exception 
) [static]

Definition at line 2616 of file io.c.

References errno, EWOULDBLOCK, rb_io_t::fd, GetOpenFile, GetWriteIO, ID2SYM, io_fflush(), LONG2FIX, rb_io_t::pathv, rb_intern, rb_io_check_writable(), rb_io_set_nonblock(), RB_IO_WAIT_WRITABLE, rb_obj_as_string(), rb_readwrite_sys_fail(), rb_sys_fail(), rb_sys_fail_path, RB_TYPE_P, RSTRING_LEN, RSTRING_PTR, and T_STRING.

Referenced by rb_io_write_nonblock().

static long ioctl_narg_len ( ioctl_req_t  cmd  )  [static]

Definition at line 8739 of file io.c.

References DEFULT_IOCTL_NARG_LEN.

Referenced by setup_narg().

static int is_popen_fork ( VALUE  prog  )  [static]

Definition at line 6027 of file io.c.

References FALSE, rb_eNotImpError, rb_raise(), RSTRING_LEN, RSTRING_PTR, and TRUE.

Referenced by pipe_open_s(), and rb_io_s_popen().

static void make_readconv ( rb_io_t fptr,
int  size 
) [static]

Definition at line 2143 of file io.c.

References ALLOC_N, rb_io_buffer_t::capa, rb_io_t::cbuf, rb_io_t::rb_io_enc_t::ecflags, ECONV_NEWLINE_DECORATOR_WRITE_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, IO_CBUF_CAPA_MIN, rb_io_buffer_t::len, rb_io_buffer_t::off, rb_io_buffer_t::ptr, rb_econv_open_exc(), rb_econv_open_opts(), rb_enc_name, rb_exc_raise(), rb_io_t::readconv, and VALUE.

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 1138 of file io.c.

References rb_io_t::rb_io_enc_t::ecflags, ECONV_ERROR_HANDLER_MASK, ECONV_NEWLINE_DECORATOR_READ_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, NULL, Qnil, rb_ascii8bit_encoding(), rb_econv_asciicompat_encoding(), rb_econv_open_exc(), rb_econv_open_opts(), rb_enc_name, rb_exc_raise(), rb_str_new2, VALUE, 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 int maygvl_close ( int  fd,
int  keepgvl 
) [static]

Definition at line 4123 of file io.c.

References nogvl_close(), rb_thread_call_without_gvl(), and RUBY_UBF_IO.

Referenced by fptr_finalize().

static int maygvl_copy_stream_continue_p ( int  has_gvl,
struct copy_stream_struct stp 
) [static]

Definition at line 9841 of file io.c.

References errno, exec_interrupts(), FALSE, rb_thread_call_with_gvl(), rb_thread_execute_interrupts(), rb_thread_interrupted(), copy_stream_struct::th, and TRUE.

Referenced by maygvl_copy_stream_read(), maygvl_copy_stream_wait_read(), nogvl_copy_stream_wait_write(), and nogvl_copy_stream_write().

static ssize_t maygvl_copy_stream_read ( int  has_gvl,
struct copy_stream_struct stp,
char *  buf,
size_t  len,
off_t  offset 
) [static]

Definition at line 10073 of file io.c.

References errno, copy_stream_struct::error_no, EWOULDBLOCK, maygvl_copy_stream_continue_p(), maygvl_copy_stream_wait_read(), maygvl_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 ( int  has_gvl,
struct copy_stream_struct stp 
) [static]

Definition at line 9869 of file io.c.

References errno, copy_stream_struct::error_no, copy_stream_struct::fds, maygvl_copy_stream_continue_p(), maygvl_select(), NULL, rb_fd_max, rb_fd_set, rb_fd_zero, copy_stream_struct::src_fd, and copy_stream_struct::syserr.

Referenced by maygvl_copy_stream_read().

static int maygvl_fclose ( FILE file,
int  keepgvl 
) [static]

Definition at line 4144 of file io.c.

References nogvl_fclose(), rb_thread_call_without_gvl(), and RUBY_UBF_IO.

Referenced by fptr_finalize().

static ssize_t maygvl_read ( int  has_gvl,
int  fd,
void *  buf,
size_t  count 
) [static]

Definition at line 10064 of file io.c.

References rb_read_internal().

Referenced by maygvl_copy_stream_read().

static int maygvl_select ( int  has_gvl,
int  n,
rb_fdset_t rfds,
rb_fdset_t wfds,
rb_fdset_t efds,
struct timeval timeout 
) [static]

Definition at line 9860 of file io.c.

References rb_fd_select, and rb_thread_fd_select().

Referenced by maygvl_copy_stream_wait_read().

static VALUE more_char ( rb_io_t fptr  )  [static]

Definition at line 2246 of file io.c.

References ECONV_AFTER_OUTPUT, fill_cbuf(), MORE_CHAR_FINISHED, MORE_CHAR_SUSPENDED, rb_exc_raise(), and VALUE.

Referenced by appendline(), io_getc(), rb_io_each_codepoint(), and swallow().

static void must_respond_to ( ID  mid,
VALUE  val,
ID  id 
) [static]

Definition at line 7180 of file io.c.

References rb_eTypeError, rb_id2name(), rb_obj_classname(), rb_raise(), and rb_respond_to().

Referenced by stdout_setter().

static void* nogvl_close ( void *  ptr  )  [static]

Definition at line 4115 of file io.c.

Referenced by maygvl_close().

static void* nogvl_copy_stream_func ( void *  arg  )  [static]

Definition at line 10199 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 10142 of file io.c.

References copy_stream_struct::close_src, copy_stream_struct::copy_length, errno, copy_stream_struct::error_no, maygvl_copy_stream_read(), nogvl_copy_stream_write(), off_t, SEEK_SET, copy_stream_struct::src_fd, copy_stream_struct::src_offset, and copy_stream_struct::syserr.

Referenced by nogvl_copy_stream_func().

static int nogvl_copy_stream_wait_write ( struct copy_stream_struct stp  )  [static]

Definition at line 9888 of file io.c.

References copy_stream_struct::dst_fd, errno, copy_stream_struct::error_no, copy_stream_struct::fds, maygvl_copy_stream_continue_p(), 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 10116 of file io.c.

References copy_stream_struct::dst_fd, errno, copy_stream_struct::error_no, EWOULDBLOCK, maygvl_copy_stream_continue_p(), nogvl_copy_stream_wait_write(), copy_stream_struct::syserr, and copy_stream_struct::total.

Referenced by nogvl_copy_stream_read_write().

static void* nogvl_fclose ( void *  ptr  )  [static]

Definition at line 4136 of file io.c.

Referenced by maygvl_fclose().

static VALUE nogvl_ioctl ( void *  ptr  )  [static]

Definition at line 8693 of file io.c.

References ioctl_arg::cmd, ioctl_arg::fd, ioctl(), ioctl_arg::narg, and VALUE.

Referenced by do_ioctl().

static void open_key_args ( int  argc,
VALUE *  argv,
VALUE  opt,
struct foreach_arg arg 
) [static]

Definition at line 9458 of file io.c.

References foreach_arg::argc, args, foreach_arg::argv, FilePathValue, INT2FIX, INT2NUM, foreach_arg::io, NIL_P, Qnil, RARRAY_CONST_PTR, RARRAY_LEN, 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 io_s_write(), rb_io_s_foreach(), rb_io_s_read(), and rb_io_s_readlines().

static VALUE opt_i_get ( ID  id,
VALUE *  var 
) [static]

Definition at line 11549 of file io.c.

References argf_inplace_mode_get().

Referenced by Init_IO().

static void opt_i_set ( VALUE  val,
ID  id,
VALUE *  var 
) [static]

Definition at line 11594 of file io.c.

References argf_inplace_mode_set().

Referenced by Init_IO().

static void parse_mode_enc ( const char *  estr,
rb_encoding **  enc_p,
rb_encoding **  enc2_p,
int *  fmode_p 
) [static]

Definition at line 5005 of file io.c.

References ENCODING_MAXNAMELEN, fmode, FMODE_SETENC_BY_BOM, io_encname_bom_p(), len, NULL, Qnil, rb_enc_find_index(), rb_enc_from_index(), rb_io_ext_int_to_encs(), strlen(), strrchr(), and unsupported_encoding().

Referenced by io_encoding_set(), 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 5573 of file io.c.

References ALLOC, pipe_list::fptr, and list.

Referenced by io_reopen(), pipe_open(), and rb_io_init_copy().

static void pipe_atexit ( void   )  [static]

Definition at line 5607 of file io.c.

References list, and rb_io_fptr_finalize().

Referenced by Init_IO().

static void pipe_del_fptr ( rb_io_t fptr  )  [static]

Definition at line 5584 of file io.c.

References pipe_list::fptr, free, and list.

Referenced by pipe_finalize().

static void pipe_finalize ( rb_io_t fptr,
int  noraise 
) [static]

Definition at line 5620 of file io.c.

References rb_io_t::fd, pipe_list::fptr, fptr_finalize(), rb_io_t::pid, pipe_del_fptr(), rb_last_status_set(), and rb_io_t::stdio_file.

Referenced by io_reopen(), pipe_open(), and rb_io_init_copy().

static VALUE pipe_open ( VALUE  execarg_obj,
const char *  modestr,
int  fmode,
convconfig_t convconfig 
) [static]

Definition at line 5803 of file io.c.

References argc, args, argv, ARGVSTR2ARGV, rb_execarg::cmd, rb_io_t::rb_io_enc_t::ecflags, ECONV_DEFAULT_NEWLINE_DECORATOR, ECONV_UNIVERSAL_NEWLINE_DECORATOR, rb_io_t::encs, rb_execarg::envp_str, errno, EWOULDBLOCK, rb_io_t::fd, fileno, rb_io_t::finalize, FMODE_DUPLEX, FMODE_READABLE, FMODE_SYNC, FMODE_WRITABLE, INT2FIX, rb_execarg::invoke, io_alloc(), MakeOpenFile, rb_io_t::mode, NEED_NEWLINE_DECORATOR_ON_READ, NEED_NEWLINE_DECORATOR_ON_WRITE, NIL_P, NULL, orig_stderr, orig_stdout, rb_io_t::pid, pipe_add_fptr(), pipe_finalize(), Qfalse, Qnil, rb_ary_join(), rb_ary_new4, rb_cIO, rb_execarg_addopt(), rb_execarg_fixup(), rb_execarg_get(), rb_execarg_run_options(), rb_fork_async_signal_safe(), rb_fork_ruby(), rb_intern, rb_io_synchronized(), rb_ivar_set(), rb_notimplement(), rb_pid_t, rb_pipe(), rb_str_new2, rb_sys_fail(), rb_sys_fail_path, rb_sys_fail_str(), rb_thread_atfork(), rb_thread_sleep(), RFILE, RSTRING_PTR, rb_execarg::sh, rb_io_t::stdio_file, StringValueCStr, rb_io_t::tied_io_for_writing, rb_execarg::use_shell, and VALUE.

Referenced by pipe_open_s(), and rb_io_s_popen().

static VALUE pipe_open_s ( VALUE  prog,
const char *  modestr,
int  fmode,
convconfig_t convconfig 
) [static]

Definition at line 6041 of file io.c.

References argc, argv, is_popen_fork(), pipe_open(), Qnil, rb_execarg_new(), TRUE, and VALUE.

Referenced by rb_f_backquote(), and rb_io_open().

static VALUE pipe_pair_close ( VALUE  rw  )  [static]

Definition at line 9318 of file io.c.

References io_close(), and rb_ensure().

Referenced by rb_io_s_pipe().

static VALUE prep_io ( int  fd,
int  fmode,
VALUE  klass,
const char *  path 
) [static]

Definition at line 7197 of file io.c.

References rb_io_t::fd, FMODE_BINMODE, io_alloc(), io_check_tty(), MakeOpenFile, rb_io_t::mode, O_BINARY, rb_io_t::pathv, rb_obj_freeze(), rb_str_new_cstr(), rb_update_max_fd(), and VALUE.

Referenced by argf_next_argv(), prep_stdio(), and rb_io_fdopen().

static VALUE prep_stdio ( FILE f,
int  fmode,
VALUE  klass,
const char *  path 
) [static]

Definition at line 7228 of file io.c.

References DEFAULT_TEXTMODE, rb_io_t::rb_io_enc_t::ecflags, ECONV_DEFAULT_NEWLINE_DECORATOR, ECONV_UNIVERSAL_NEWLINE_DECORATOR, rb_io_t::encs, fileno, FMODE_PREP, FMODE_READABLE, GetOpenFile, prep_io(), rb_io_t::stdio_file, and VALUE.

Referenced by Init_IO().

static void prepare_getline_args ( int  argc,
VALUE *  argv,
VALUE *  rsp,
long *  limit,
VALUE  io 
) [static]

Definition at line 3026 of file io.c.

References ENC_CODERANGE_7BIT, GetOpenFile, io_read_encoding(), NIL_P, NUM2LONG, Qnil, 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, StringValue, and VALUE.

Referenced by rb_io_each_line(), rb_io_getline(), and rb_io_readlines().

int rb_cloexec_dup ( int  oldfd  ) 

Definition at line 244 of file io.c.

References rb_cloexec_fcntl_dupfd().

Referenced by ossl_obj2bio(), pty_getpty(), readline_s_set_input(), readline_s_set_output(), and ruby_dup().

int rb_cloexec_dup2 ( int  oldfd,
int  newfd 
)

Definition at line 251 of file io.c.

References dup2(), errno, O_CLOEXEC, and rb_maygvl_fd_fix_cloexec().

Referenced by io_reopen(), and rb_io_reopen().

int rb_cloexec_fcntl_dupfd ( int  fd,
int  minfd 
)

Definition at line 323 of file io.c.

References errno, F_DUPFD, fcntl(), rb_cloexec_fcntl_dupfd(), and rb_maygvl_fd_fix_cloexec().

Referenced by rb_cloexec_dup(), and rb_cloexec_fcntl_dupfd().

int rb_cloexec_open ( const char *  pathname,
int  flags,
mode_t  mode 
)

Definition at line 228 of file io.c.

References O_CLOEXEC, and rb_maygvl_fd_fix_cloexec().

Referenced by chfunc(), console_dev(), fill_random_seed(), get_device_once(), load_file_internal(), rb_file_load_ok(), and sysopen_func().

int rb_cloexec_pipe ( int  fildes[2]  ) 

Definition at line 286 of file io.c.

References errno, O_CLOEXEC, and rb_maygvl_fd_fix_cloexec().

Referenced by rb_pipe().

size_t rb_econv_memsize ( rb_econv_t  ) 

Definition at line 1720 of file transcode.c.

References rb_econv_t::elems, if(), 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 596 of file io.c.

References rb_eEOFError, and rb_raise().

Referenced by argf_getpartial(), argf_readbyte(), argf_readchar(), argf_readline(), 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_read_nonblock(), strio_readbyte(), strio_readchar(), strio_readline(), and strio_sysread().

static VALUE rb_f_backquote ( VALUE  obj,
VALUE  str 
) [static]

Definition at line 8168 of file io.c.

References DEFAULT_TEXTMODE, FMODE_READABLE, GetOpenFile, NIL_P, NULL, pipe_open_s(), Qnil, rb_io_close(), rb_last_status_clear(), rb_str_new(), read_all(), remain_size(), result, SafeStringValue, and VALUE.

Referenced by Init_IO().

static VALUE rb_f_gets ( int  argc,
VALUE *  argv,
VALUE  recv 
) [static]

Definition at line 7979 of file io.c.

References argf_gets(), and rb_funcall2.

Referenced by Init_IO(), and rb_gets().

static VALUE rb_f_open ( int  argc,
VALUE *  argv 
) [static]

Definition at line 6446 of file io.c.

References check_pipe_command(), rb_execarg::cmd, CONST_ID, FALSE, 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(), rb_yield(), TRUE, and VALUE.

Referenced by Init_IO().

static VALUE rb_f_p ( int  argc,
VALUE *  argv,
VALUE  self 
) [static]

Definition at line 7094 of file io.c.

References rb_f_p_arg::argc, rb_f_p_arg::argv, rb_f_p_internal(), rb_uninterruptible(), and VALUE.

Referenced by Init_IO().

static VALUE rb_f_p_internal ( VALUE  arg  )  [static]

Definition at line 7052 of file io.c.

References rb_f_p_arg::argc, argc, rb_f_p_arg::argv, argv, Qnil, rb_ary_new4, rb_io_flush(), rb_p(), rb_stdout, RB_TYPE_P, T_FILE, and VALUE.

Referenced by rb_f_p().

static VALUE rb_f_print ( int  argc,
VALUE *  argv 
) [static]

Definition at line 6866 of file io.c.

References Qnil, rb_io_print(), and rb_stdout.

Referenced by Init_IO().

static VALUE rb_f_printf ( int  argc,
VALUE *  argv 
) [static]

Definition at line 6777 of file io.c.

References Qnil, rb_f_sprintf(), rb_io_write(), rb_stdout, RB_TYPE_P, T_STRING, and VALUE.

Referenced by Init_IO().

static VALUE rb_f_putc ( VALUE  recv,
VALUE  ch 
) [static]

Definition at line 6918 of file io.c.

References rb_funcall2, rb_intern, rb_io_putc(), and rb_stdout.

Referenced by Init_IO().

static VALUE rb_f_puts ( int  argc,
VALUE *  argv,
VALUE  recv 
) [static]

Definition at line 7023 of file io.c.

References rb_funcall2, rb_intern, rb_io_puts(), and rb_stdout.

Referenced by Init_IO().

static VALUE rb_f_readline ( int  argc,
VALUE *  argv,
VALUE  recv 
) [static]

Definition at line 8052 of file io.c.

References argf_readline(), rb_funcall2, and rb_intern.

Referenced by Init_IO().

static VALUE rb_f_readlines ( int  argc,
VALUE *  argv,
VALUE  recv 
) [static]

Definition at line 8105 of file io.c.

References argf_readlines(), rb_funcall2, and rb_intern.

Referenced by Init_IO().

static VALUE rb_f_select ( int  argc,
VALUE *  argv,
VALUE  obj 
) [static]

Definition at line 8656 of file io.c.

References args, NIL_P, numberof, rb_ensure(), rb_fd_init, rb_scan_args(), rb_time_interval(), select_call(), select_end(), and VALUE.

Referenced by Init_IO().

void rb_fd_fix_cloexec ( int  fd  ) 

Definition at line 221 of file io.c.

References rb_maygvl_fd_fix_cloexec(), and rb_update_max_fd().

Referenced by fdbm_initialize(), fgdbm_initialize(), fgdbm_reorganize(), get_device_once(), ossl_pkey_new_from_file(), ossl_x509_new_from_file(), rb_io_reopen(), and rsock_socket0().

FILE* rb_fdopen ( int  fd,
const char *  modestr 
)

Definition at line 5373 of file io.c.

References errno, NULL, rb_gc(), rb_sys_fail(), and rb_warn().

Referenced by rb_io_stdio_file().

static VALUE rb_file_initialize ( int  argc,
VALUE *  argv,
VALUE  io 
) [static]

Definition at line 7483 of file io.c.

References NIL_P, rb_check_convert_type(), rb_eRuntimeError, rb_io_initialize(), rb_open_file(), rb_raise(), RFILE, T_FIXNUM, and VALUE.

Referenced by Init_IO().

VALUE rb_file_open ( const char *  fname,
const char *  modestr 
)

Definition at line 5561 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 5501 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, Qnil, 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().

static VALUE rb_file_open_internal ( VALUE  io,
VALUE  filename,
const char *  modestr 
) [static]

Definition at line 5527 of file io.c.

References fmode, FMODE_BINMODE, NULL, parse_mode_enc(), Qnil, 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().

VALUE rb_file_open_str ( VALUE  fname,
const char *  modestr 
)

Definition at line 5554 of file io.c.

References FilePathValue, io_alloc(), rb_cFile, and rb_file_open_internal().

Referenced by gzfile_s_open(), and iseq_s_compile_file().

VALUE rb_get_argv ( void   ) 

Definition at line 11640 of file io.c.

References ARGF.

VALUE rb_gets ( void   ) 

Definition at line 8014 of file io.c.

References ARGF, next_argv, NIL_P, Qnil, rb_default_rs, rb_f_gets(), rb_io_close(), rb_io_gets(), rb_lastline_set(), rb_rs, and VALUE.

VALUE rb_io_addstr ( VALUE  io,
VALUE  str 
)

Definition at line 1449 of file io.c.

References rb_io_write().

Referenced by Init_IO().

static VALUE rb_io_advise ( int  argc,
VALUE *  argv,
VALUE  io 
) [static]

Definition at line 8488 of file io.c.

References advice_arg_check(), GetOpenFile, GetWriteIO, NIL_P, NUM2OFFT, off_t, Qnil, rb_scan_args(), and VALUE.

Referenced by Init_IO().

VALUE rb_io_ascii8bit_binmode ( VALUE  io  ) 

Definition at line 4725 of file io.c.

References GetOpenFile, and io_ascii8bit_binmode().

Referenced by argf_binmode_m(), argf_next_argv(), rb_io_binmode_m(), and rsock_init_sock().

static VALUE rb_io_autoclose_p ( VALUE  io  )  [static]

Definition at line 7540 of file io.c.

References FMODE_PREP, rb_io_t::mode, Qfalse, Qtrue, rb_io_check_closed(), and RFILE.

Referenced by Init_IO().

VALUE rb_io_binmode ( VALUE  io  ) 

Definition at line 4679 of file io.c.

References ECONV_NEWLINE_DECORATOR_MASK, rb_io_t::fd, FMODE_BINMODE, FMODE_TEXTMODE, GetOpenFile, rb_io_t::mode, O_BINARY, rb_econv_binmode(), rb_io_t::readconv, SET_BINARY_MODE_WITH_SEEK_CUR, 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().

static VALUE rb_io_binmode_m ( VALUE  io  )  [static]

Definition at line 4749 of file io.c.

References GetWriteIO, rb_io_ascii8bit_binmode(), and VALUE.

Referenced by Init_IO(), and io_s_write().

static VALUE rb_io_binmode_p ( VALUE  io  )  [static]

Definition at line 4768 of file io.c.

References FMODE_BINMODE, GetOpenFile, rb_io_t::mode, Qfalse, and Qtrue.

Referenced by Init_IO().

ssize_t rb_io_bufread ( VALUE  io,
void *  buf,
size_t  size 
)

Definition at line 2094 of file io.c.

References bufread_arg::fptr, GetOpenFile, io_bufread(), and rb_io_check_readable().

ssize_t rb_io_bufwrite ( VALUE  io,
const void *  buf,
size_t  size 
)

Definition at line 1365 of file io.c.

References binwrite_arg::fptr, GetOpenFile, io_binwrite(), and rb_io_check_writable().

static VALUE rb_io_bytes ( VALUE  io  )  [static]

Definition at line 3440 of file io.c.

References ID2SYM, rb_block_given_p(), rb_enumeratorize(), rb_intern, rb_io_each_byte(), and rb_warn().

Referenced by Init_IO().

static VALUE rb_io_chars ( VALUE  io  )  [static]

Definition at line 3594 of file io.c.

References ID2SYM, rb_block_given_p(), rb_enumeratorize(), rb_intern, rb_io_each_char(), and rb_warn().

Referenced by Init_IO().

void rb_io_check_byte_readable ( rb_io_t fptr  ) 

Definition at line 785 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 766 of file io.c.

References FMODE_READABLE, GetOpenFile, io_fflush(), rb_io_buffer_t::len, 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.

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 617 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_bufread(), io_fflush(), io_unread(), io_wait_readable(), io_wait_writable(), rb_file_flock(), rb_io_autoclose_p(), rb_io_check_char_readable(), rb_io_check_writable(), rb_io_close_m(), rb_io_fileno(), rb_io_sysread(), rsock_s_recvfrom(), and rsock_s_recvfrom_nonblock().

void rb_io_check_initialized ( rb_io_t fptr  ) 

Definition at line 609 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(), rb_io_set_write_io(), rb_io_synchronized(), and readline_readline().

VALUE rb_io_check_io ( VALUE  io  ) 

Definition at line 633 of file io.c.

References rb_check_convert_type(), and T_FILE.

Referenced by argf_external_encoding(), argf_internal_encoding(), check_exec_redirect(), dump_output(), io_write(), rb_io_reopen(), and rb_io_s_try_convert().

void rb_io_check_readable ( rb_io_t fptr  ) 

Definition at line 794 of file io.c.

References rb_io_check_byte_readable().

Referenced by io_nread(), io_ready_p(), io_wait_readable(), ossl_obj2bio(), ossl_ssl_setup(), and rb_io_bufread().

void rb_io_check_writable ( rb_io_t fptr  ) 

Definition at line 818 of file io.c.

References FMODE_WRITABLE, io_unread(), rb_io_buffer_t::len, rb_io_t::mode, rb_eIOError, rb_io_check_closed(), rb_raise(), and rb_io_t::rbuf.

Referenced by copy_stream_body(), io_wait_writable(), io_write(), io_write_nonblock(), ossl_ssl_setup(), rb_io_bufwrite(), and rb_io_syswrite().

VALUE rb_io_close ( VALUE  io  ) 

Definition at line 4292 of file io.c.

References FALSE, rb_io_t::fd, finish_writeconv_arg::fptr, GetWriteIO, rb_io_t::pid, Qnil, rb_io_fptr_cleanup(), rb_last_status_clear(), rb_syswait(), rb_thread_fd_close(), RFILE, TRUE, and VALUE.

Referenced by argf_next_argv(), bsock_close_read(), bsock_close_write(), console_dev(), gzfile_wrap(), io_s_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().

static VALUE rb_io_close_m ( VALUE  io  )  [static]

Definition at line 4339 of file io.c.

References finish_writeconv_arg::fptr, Qnil, rb_io_check_closed(), rb_io_close(), and RFILE.

Referenced by copy_stream_finalize(), and Init_IO().

static VALUE rb_io_close_read ( VALUE  io  )  [static]

Definition at line 4434 of file io.c.

References FALSE, rb_io_t::fd, FMODE_DUPLEX, FMODE_READABLE, FMODE_WRITABLE, finish_writeconv_arg::fptr, GetOpenFile, GetWriteIO, is_socket, rb_io_t::mode, rb_io_t::pathv, rb_io_t::pid, Qnil, rb_eIOError, rb_io_close(), rb_io_fptr_cleanup(), rb_raise(), rb_sys_fail_path, RFILE, SHUT_RD, shutdown, rb_io_t::tied_io_for_writing, and VALUE.

Referenced by Init_IO().

static VALUE rb_io_close_write ( VALUE  io  )  [static]

Definition at line 4494 of file io.c.

References rb_io_t::fd, FMODE_DUPLEX, FMODE_READABLE, FMODE_WRITABLE, finish_writeconv_arg::fptr, GetOpenFile, GetWriteIO, is_socket, rb_io_t::mode, rb_io_t::pathv, Qnil, rb_eIOError, rb_io_close(), rb_raise(), rb_sys_fail_path, SHUT_WR, shutdown, rb_io_t::tied_io_for_writing, and VALUE.

Referenced by Init_IO().

static VALUE rb_io_closed ( VALUE  io  )  [static]

Definition at line 4396 of file io.c.

References rb_io_t::fd, finish_writeconv_arg::fptr, GetWriteIO, Qfalse, Qtrue, rb_io_check_initialized(), RFILE, and VALUE.

Referenced by argf_closed(), and Init_IO().

static VALUE rb_io_codepoints ( VALUE  io  )  [static]

Definition at line 3701 of file io.c.

References ID2SYM, rb_block_given_p(), rb_enumeratorize(), rb_intern, rb_io_each_codepoint(), and rb_warn().

Referenced by Init_IO().

static VALUE rb_io_each_byte ( VALUE  io  )  [static]

Definition at line 3415 of file io.c.

References errno, GetOpenFile, INT2FIX, io_fillbuf(), rb_io_buffer_t::len, rb_io_buffer_t::off, rb_io_buffer_t::ptr, rb_io_check_byte_readable(), rb_yield(), rb_io_t::rbuf, READ_CHECK, and RETURN_ENUMERATOR.

Referenced by Init_IO(), and rb_io_bytes().

static VALUE rb_io_each_char ( VALUE  io  )  [static]

Definition at line 3571 of file io.c.

References GetOpenFile, io_getc(), io_input_encoding(), NIL_P, rb_io_check_char_readable(), rb_yield(), READ_CHECK, RETURN_ENUMERATOR, and VALUE.

Referenced by Init_IO(), and rb_io_chars().

static VALUE rb_io_each_codepoint ( VALUE  io  )  [static]

Definition at line 3619 of file io.c.

References rb_io_t::cbuf, clear_readconv(), rb_io_t::rb_io_enc_t::enc, rb_io_t::encs, GetOpenFile, if(), rb_io_buffer_t::len, make_readconv(), MBCLEN_CHARFOUND_LEN, MBCLEN_INVALID_P, MBCLEN_NEEDMORE_P, more_char(), MORE_CHAR_FINISHED, NEED_READCONV, rb_io_buffer_t::off, ONIGENC_CONSTRUCT_MBCLEN_CHARFOUND, rb_io_buffer_t::ptr, rb_eArgError, rb_eIOError, rb_enc_codepoint, rb_enc_name, rb_enc_precise_mbclen(), rb_io_check_char_readable(), rb_raise(), rb_yield(), READ_CHECK, RETURN_ENUMERATOR, SET_BINARY_MODE, and UINT2NUM.

Referenced by Init_IO(), and rb_io_codepoints().

static VALUE rb_io_each_line ( int  argc,
VALUE *  argv,
VALUE  io 
) [static]

Definition at line 3369 of file io.c.

References NIL_P, prepare_getline_args(), rb_eArgError, rb_io_getline_1(), rb_raise(), rb_yield(), RETURN_ENUMERATOR, and VALUE.

Referenced by Init_IO(), and rb_io_lines().

VALUE rb_io_eof ( VALUE  io  ) 

Definition at line 1745 of file io.c.

References rb_io_t::fd, binwrite_arg::fptr, GetOpenFile, io_fillbuf(), NEED_NEWLINE_DECORATOR_ON_READ, NEED_READCONV, Qfalse, Qtrue, 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,
int  fmode 
) [static]

Definition at line 4971 of file io.c.

References FMODE_SETENC_BY_BOM, 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().

static VALUE rb_io_external_encoding ( VALUE  io  )  [static]

Definition at line 10488 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, Qnil, 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 5076 of file io.c.

References NIL_P, NULL, parse_mode_enc(), Qnil, Qundef, rb_check_string_type(), rb_enc_from_index(), rb_enc_name, rb_hash_lookup2(), rb_io_ext_int_to_encs(), rb_to_encoding(), rb_to_encoding_index(), rb_warn(), ruby_verbose, StringValueCStr, sym_encoding, sym_extenc, sym_intenc, and VALUE.

Referenced by rb_gzfile_ecopts(), and rb_io_extract_modeenc().

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 5199 of file io.c.

References DEFAULT_TEXTMODE, ECONV_DEFAULT_NEWLINE_DECORATOR, ECONV_UNIVERSAL_NEWLINE_DECORATOR, extract_binmode(), fmode, FMODE_BINMODE, FMODE_READABLE, FMODE_WRITABLE, MODE_BTMODE, NIL_P, NULL, NUM2INT, O_BINARY, parse_mode_enc(), Qnil, rb_ascii8bit_encoding(), rb_check_to_integer(), rb_eArgError, rb_econv_prepare_options(), 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, SET_UNIVERSAL_NEWLINE_DECORATOR_IF_ENC2, strchr(), StringValueCStr, sym_mode, sym_perm, validate_enc_binmode(), and VALUE.

Referenced by rb_io_initialize(), rb_io_open(), rb_io_reopen(), rb_io_s_popen(), and rb_scan_open_args().

VALUE rb_io_fdopen ( int  fd,
int  oflags,
const char *  path 
)

Definition at line 7219 of file io.c.

References prep_io(), rb_cFile, rb_cIO, rb_io_oflags_fmode(), and VALUE.

Referenced by load_file_internal().

static VALUE rb_io_fileno ( VALUE  io  )  [static]

Definition at line 1917 of file io.c.

References rb_io_t::fd, binwrite_arg::fptr, INT2FIX, rb_io_check_closed(), and RFILE.

Referenced by argf_fileno(), and Init_IO().

VALUE rb_io_flush ( VALUE  io  ) 

Definition at line 1510 of file io.c.

References rb_io_flush_raw().

Referenced by dump_output(), dump_result(), Init_IO(), rb_f_p_internal(), rb_io_getbyte(), rb_io_init_copy(), and rb_io_s_popen().

VALUE rb_io_flush_raw ( VALUE  io,
int  sync 
)

Definition at line 1466 of file io.c.

References FMODE_READABLE, FMODE_WRITABLE, binwrite_arg::fptr, GetOpenFile, GetWriteIO, id_flush, io_fflush(), io_unread(), rb_io_t::mode, rb_funcall(), rb_sys_fail(), rb_thread_io_blocking_region(), RB_TYPE_P, rb_w32_get_osfhandle(), and T_FILE.

Referenced by rb_file_flock(), rb_file_size(), and rb_io_flush().

static const char* rb_io_fmode_modestr ( int  fmode  )  [static]

Definition at line 4776 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 4896 of file io.c.

References FMODE_APPEND, FMODE_BINMODE, FMODE_CREATE, FMODE_READABLE, FMODE_READWRITE, FMODE_TRUNC, FMODE_WRITABLE, and O_BINARY.

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 4216 of file io.c.

References rb_io_t::finalize, finish_writeconv_arg::fptr, 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 4257 of file io.c.

References clear_codeconv(), rb_io_t::fd, finish_writeconv_arg::fptr, free, rb_io_t::pathv, rb_io_buffer_t::ptr, Qnil, rb_io_fptr_cleanup(), rb_io_t::rbuf, TRUE, rb_io_t::wbuf, and rb_io_t::write_lock.

Referenced by make_io_deferred(), and pipe_atexit().

VALUE rb_io_get_io ( VALUE  io  ) 

Definition at line 627 of file io.c.

References rb_convert_type(), and T_FILE.

VALUE rb_io_get_write_io ( VALUE  io  ) 

Definition at line 639 of file io.c.

References rb_io_check_initialized(), RFILE, and VALUE.

Referenced by dump_output().

VALUE rb_io_getbyte ( VALUE  io  ) 

Definition at line 3772 of file io.c.

References rb_io_t::fd, FMODE_TTY, GetOpenFile, INT2FIX, io_fillbuf(), rb_io_buffer_t::len, rb_io_t::mode, rb_io_buffer_t::off, rb_io_buffer_t::ptr, Qnil, rb_io_check_byte_readable(), rb_io_flush(), rb_stdout, RB_TYPE_P, rb_io_t::rbuf, READ_CHECK, and T_FILE.

Referenced by argf_getbyte(), Init_IO(), io_strip_bom(), load_file_internal(), and rb_io_readbyte().

static VALUE rb_io_getc ( VALUE  io  )  [static]

Definition at line 3723 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().

static VALUE rb_io_getline ( int  argc,
VALUE *  argv,
VALUE  io 
) [static]

Definition at line 3177 of file io.c.

References prepare_getline_args(), rb_io_getline_1(), and VALUE.

Referenced by argf_getline(), and rb_io_gets_m().

static VALUE rb_io_getline_1 ( VALUE  rs,
long  limit,
VALUE  io 
) [static]

Definition at line 3071 of file io.c.

References appendline(), ARGF, EOF, GetOpenFile, io_enc_str(), io_read_encoding(), rb_io_t::lineno, MBCLEN_NEEDMORE_P, memcmp(), NEED_NEWLINE_DECORATOR_ON_READ_CHECK, 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_END, RSTRING_LEN, RSTRING_PTR, SET_BINARY_MODE, swallow(), and VALUE.

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 2975 of file io.c.

References ARGF, ENC_CODERANGE_BROKEN, ENC_CODERANGE_SET, io_enc_str(), io_fillbuf(), rb_io_buffer_t::len, len, rb_io_t::lineno, NIL_P, rb_io_buffer_t::off, Qnil, rb_str_coderange_scan_restartable(), rb_str_new(), rb_str_resize(), rb_io_t::rbuf, read_buffered_data(), READ_CHECK, READ_DATA_PENDING_COUNT, READ_DATA_PENDING_PTR, RSTRING_PTR, and VALUE.

Referenced by rb_io_getline_1().

VALUE rb_io_gets ( VALUE  io  ) 

Definition at line 3187 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().

static VALUE rb_io_gets_m ( int  argc,
VALUE *  argv,
VALUE  io 
) [static]

Definition at line 3214 of file io.c.

References rb_io_getline(), rb_lastline_set(), and VALUE.

Referenced by Init_IO(), io_s_foreach(), and rb_io_readline().

static VALUE rb_io_init_copy ( VALUE  dest,
VALUE  io 
) [static]

Definition at line 6704 of file io.c.

References rb_io_t::encs, rb_io_t::fd, rb_io_t::finalize, FMODE_BINMODE, FMODE_PREP, GetOpenFile, GetWriteIO, io_seek, io_tell, rb_io_t::lineno, MakeOpenFile, rb_io_t::mode, NIL_P, OBJ_INIT_COPY, 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 VALUE.

Referenced by Init_IO().

static VALUE rb_io_initialize ( int  argc,
VALUE *  argv,
VALUE  io 
) [static]

Definition at line 7403 of file io.c.

References clear_codeconv(), rb_io_t::encs, fcntl(), rb_io_t::fd, fileno, fmode, FMODE_PREP, FMODE_READWRITE, FMODE_SETENC_BY_BOM, fstat, INT2FIX, io_check_tty(), io_set_encoding_by_bom(), MakeOpenFile, rb_io_t::mode, NIL_P, NUM2INT, Qfalse, rb_class_new_instance(), rb_eArgError, rb_eSystemCallError, rb_exc_raise(), rb_hash_aref(), rb_io_extract_modeenc(), rb_io_oflags_fmode(), rb_raise(), rb_reserved_fd_p(), rb_scan_args(), rb_sys_fail(), rb_update_max_fd(), stat, rb_io_t::stdio_file, sym_autoclose, and VALUE.

Referenced by Init_IO(), rb_file_initialize(), and rb_io_s_for_fd().

static VALUE rb_io_inspect ( VALUE  obj  )  [static]

Definition at line 1968 of file io.c.

References CLASS_OF, rb_io_t::fd, binwrite_arg::fptr, NIL_P, rb_io_t::pathv, rb_any_to_s(), rb_class_name(), rb_str_append(), rb_str_cat(), rb_str_cat2(), rb_str_catf(), rb_str_new_cstr(), result, RFILE, strlen(), and VALUE.

Referenced by Init_IO().

static VALUE rb_io_internal_encoding ( VALUE   )  [static]

Definition at line 10513 of file io.c.

References rb_io_t::rb_io_enc_t::enc2, rb_io_t::encs, GetOpenFile, io_read_encoding(), Qnil, and rb_enc_from_encoding().

Referenced by argf_internal_encoding(), Init_IO(), and io_set_encoding_by_bom().

static VALUE rb_io_ioctl ( int  argc,
VALUE *  argv,
VALUE  io 
) [static]

Definition at line 8975 of file io.c.

References rb_ioctl(), rb_scan_args(), and VALUE.

Referenced by Init_IO().

static VALUE rb_io_isatty ( VALUE  io  )  [static]

Definition at line 3925 of file io.c.

References rb_io_t::fd, GetOpenFile, Qfalse, and Qtrue.

Referenced by Init_IO().

static VALUE rb_io_lineno ( VALUE  io  )  [static]

Definition at line 3247 of file io.c.

References GetOpenFile, INT2NUM, rb_io_t::lineno, and rb_io_check_char_readable().

Referenced by Init_IO().

static VALUE rb_io_lines ( int  argc,
VALUE *  argv,
VALUE  io 
) [static]

Definition at line 3389 of file io.c.

References ID2SYM, rb_block_given_p(), rb_enumeratorize(), rb_intern, rb_io_each_line(), and rb_warn().

Referenced by Init_IO().

RUBY_FUNC_EXPORTED size_t rb_io_memsize ( const rb_io_t fptr  ) 

Definition at line 4280 of file io.c.

References rb_io_buffer_t::capa, rb_io_t::cbuf, finish_writeconv_arg::fptr, rb_econv_memsize(), rb_io_t::rbuf, rb_io_t::readconv, size, rb_io_t::wbuf, and rb_io_t::writeconv.

Referenced by obj_memsize_of().

int rb_io_modestr_fmode ( const char *  modestr  ) 

Definition at line 4812 of file io.c.

References fmode, FMODE_APPEND, FMODE_BINMODE, FMODE_CREATE, FMODE_READABLE, FMODE_READWRITE, FMODE_SETENC_BY_BOM, FMODE_TEXTMODE, FMODE_TRUNC, FMODE_WRITABLE, io_encname_bom_p(), NULL, rb_eArgError, and rb_raise().

Referenced by rb_file_open_internal(), rb_io_extract_modeenc(), and rb_io_modestr_oflags().

int rb_io_modestr_oflags ( const char *  modestr  ) 

Definition at line 4931 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 4861 of file io.c.

References fmode, FMODE_APPEND, FMODE_BINMODE, FMODE_CREATE, FMODE_READABLE, FMODE_READWRITE, FMODE_TRUNC, FMODE_WRITABLE, and 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 4937 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().

static VALUE rb_io_open ( VALUE  filename,
VALUE  vmode,
VALUE  vperm,
VALUE  opt 
) [static]

Definition at line 6483 of file io.c.

References check_pipe_command(), rb_execarg::cmd, fmode, io_alloc(), mode_t, NIL_P, NUM2MODET, pipe_open_s(), rb_cFile, rb_file_open_generic(), rb_io_extract_modeenc(), rb_io_oflags_modestr(), and VALUE.

Referenced by open_key_args(), and rb_io_s_binread().

static VALUE rb_io_open_with_args ( int  argc,
const VALUE *  argv 
) [static]

Definition at line 6503 of file io.c.

References io_alloc(), rb_cFile, rb_open_file(), and VALUE.

Referenced by open_key_args().

static VALUE rb_io_pid ( VALUE  io  )  [static]

Definition at line 1949 of file io.c.

References binwrite_arg::fptr, GetOpenFile, rb_io_t::pid, PIDT2NUM, and Qnil.

Referenced by Init_IO().

VALUE rb_io_print ( int  argc,
VALUE *  argv,
VALUE  out 
)

Definition at line 6818 of file io.c.

References NIL_P, Qnil, rb_io_write(), rb_lastline_get(), rb_output_fs, rb_output_rs, and VALUE.

Referenced by Init_IO(), and rb_f_print().

VALUE rb_io_printf ( int  argc,
VALUE *  argv,
VALUE  out 
)

Definition at line 6759 of file io.c.

References Qnil, rb_f_sprintf(), and rb_io_write().

Referenced by Init_IO().

static VALUE rb_io_putc ( VALUE  io,
VALUE  ch 
) [static]

Definition at line 6891 of file io.c.

References NUM2CHR, rb_io_write(), rb_str_new(), rb_str_substr(), RB_TYPE_P, T_STRING, and VALUE.

Referenced by Init_IO(), and rb_f_putc().

VALUE rb_io_puts ( int  argc,
VALUE *  argv,
VALUE  out 
)

Definition at line 6983 of file io.c.

References io_puts_ary(), Qnil, rb_default_rs, rb_exec_recursive(), rb_io_write(), rb_obj_as_string(), RB_TYPE_P, RSTRING_LEN, str_end_with_asciichar(), T_STRING, and VALUE.

Referenced by Init_IO(), io_puts_ary(), rb_f_abort(), rb_f_puts(), and rb_warn_m().

void rb_io_read_check ( rb_io_t fptr  ) 

Definition at line 847 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 830 of file io.c.

References READ_CHAR_PENDING, and READ_DATA_PENDING.

Referenced by io_nread(), io_ready_p(), io_wait_readable(), rsock_s_recvfrom(), and rsock_s_recvfrom_nonblock().

static VALUE rb_io_readbyte ( VALUE  io  )  [static]

Definition at line 3805 of file io.c.

References NIL_P, rb_eof_error(), rb_io_getbyte(), and VALUE.

Referenced by Init_IO().

static VALUE rb_io_readchar ( VALUE  io  )  [static]

Definition at line 3749 of file io.c.

References NIL_P, rb_eof_error(), rb_io_getc(), and VALUE.

Referenced by Init_IO().

static VALUE rb_io_readline ( int  argc,
VALUE *  argv,
VALUE  io 
) [static]

Definition at line 3295 of file io.c.

References NIL_P, rb_eof_error(), rb_io_gets_m(), and VALUE.

Referenced by Init_IO().

static VALUE rb_io_readlines ( int  argc,
VALUE *  argv,
VALUE  io 
) [static]

Definition at line 3324 of file io.c.

References NIL_P, prepare_getline_args(), rb_ary_new(), rb_ary_push(), rb_eArgError, rb_io_getline_1(), rb_raise(), and VALUE.

Referenced by argf_readlines(), Init_IO(), and io_s_readlines().

static VALUE rb_io_reopen ( int  argc,
VALUE *  argv,
VALUE  file 
) [static]

Definition at line 6615 of file io.c.

References ALLOC, rb_io_t::encs, err, errno, rb_io_t::fd, fileno, FilePathValue, fmode, FMODE_READWRITE, FMODE_WRITABLE, io_fflush(), io_reopen(), IS_PREP_STDIO, rb_io_buffer_t::len, MEMZERO, rb_io_t::mode, NIL_P, NULL, rb_io_buffer_t::off, rb_io_t::pathv, PREP_STDIO_NAME, PRIsVALUE, rb_cloexec_dup2(), rb_eArgError, rb_fd_fix_cloexec(), rb_io_check_io(), rb_io_extract_modeenc(), rb_io_fmode_modestr(), rb_io_fmode_oflags(), rb_io_oflags_modestr(), rb_io_taint_check(), rb_raise(), rb_scan_args(), rb_str_new_frozen(), rb_sys_fail(), rb_sys_fail_path, rb_syserr_fail_path, rb_sysopen(), rb_warn(), rb_io_t::rbuf, RFILE, RSTRING_PTR, rb_io_t::stdio_file, and VALUE.

Referenced by Init_IO().

static VALUE rb_io_rewind ( VALUE  io  )  [static]

Definition at line 1655 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().

static VALUE rb_io_s_binread ( int  argc,
VALUE *  argv,
VALUE  io 
) [static]

Definition at line 9677 of file io.c.

References foreach_arg::argc, foreach_arg::argv, FilePathValue, foreach_arg::io, io_s_read(), NIL_P, NULL, 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().

static VALUE rb_io_s_binwrite ( int  argc,
VALUE *  argv,
VALUE  io 
) [static]

Definition at line 9804 of file io.c.

References io_s_write().

Referenced by Init_IO().

static VALUE rb_io_s_copy_stream ( int  argc,
VALUE *  argv,
VALUE  io 
) [static]

Definition at line 10451 of file io.c.

References copy_stream_struct::copy_length, copy_stream_body(), copy_stream_finalize(), copy_stream_struct::dst, copy_stream_struct::fds, MEMZERO, NIL_P, NUM2OFFT, off_t, OFFT2NUM, rb_ensure(), rb_fd_init, rb_scan_args(), copy_stream_struct::src, and copy_stream_struct::src_offset.

Referenced by Init_IO().

static VALUE rb_io_s_for_fd ( int  argc,
VALUE *  argv,
VALUE  klass 
) [static]

Definition at line 7524 of file io.c.

References rb_io_initialize(), rb_obj_alloc(), and VALUE.

Referenced by Init_IO().

static VALUE rb_io_s_foreach ( int  argc,
VALUE *  argv,
VALUE  self 
) [static]

Definition at line 9532 of file io.c.

References foreach_arg::io, io_s_foreach(), NIL_P, NULL, open_key_args(), Qnil, rb_ensure(), rb_io_close(), rb_scan_args(), and RETURN_ENUMERATOR.

Referenced by Init_IO().

static VALUE rb_io_s_new ( int  argc,
VALUE *  argv,
VALUE  klass 
) [static]

Definition at line 7503 of file io.c.

References rb_block_given_p(), rb_class2name(), rb_class_new_instance(), and rb_warn().

Referenced by Init_IO().

static VALUE rb_io_s_open ( int  argc,
VALUE *  argv,
VALUE  klass 
) [static]

Definition at line 6283 of file io.c.

References io_close(), rb_block_given_p(), rb_class_new_instance(), rb_ensure(), rb_yield(), and VALUE.

Referenced by Init_IO(), and rb_f_open().

static VALUE rb_io_s_pipe ( int  argc,
VALUE *  argv,
VALUE  klass 
) [static]

Definition at line 9385 of file io.c.

References args, rb_io_t::rb_io_enc_t::ecflags, ECONV_DEFAULT_NEWLINE_DECORATOR, ECONV_UNIVERSAL_NEWLINE_DECORATOR, rb_io_t::encs, extract_binmode(), rb_io_t::fd, fmode, FMODE_BINMODE, FMODE_TEXTMODE, GetOpenFile, INT2FIX, INT2NUM, io_encoding_set(), io_new_instance(), rb_io_t::mode, NIL_P, O_BINARY, pipe_pair_close(), 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().

static VALUE rb_io_s_popen ( int  argc,
VALUE *  argv,
VALUE  klass 
) [static]

Definition at line 6141 of file io.c.

References env, FALSE, fmode, io_close(), is_popen_fork(), len, NIL_P, pipe_open(), Qnil, RARRAY_LEN, RARRAY_PTR, rb_ary_clear(), rb_ary_dup(), rb_block_given_p(), rb_check_array_type(), rb_check_hash_type(), rb_eArgError, rb_ensure(), rb_error_arity(), rb_execarg_extract_options(), rb_execarg_new(), rb_execarg_setenv(), rb_io_extract_modeenc(), rb_io_flush(), rb_io_oflags_modestr(), rb_raise(), rb_stderr, rb_stdout, rb_yield(), RBASIC_CLEAR_CLASS, RBASIC_SET_CLASS, SafeStringValue, TRUE, and VALUE.

Referenced by Init_IO(), and rb_f_open().

static VALUE rb_io_s_read ( int  argc,
VALUE *  argv,
VALUE  io 
) [static]

Definition at line 9638 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(), Qnil, rb_ensure(), rb_io_close(), rb_jump_tag(), rb_protect(), rb_scan_args(), seek_before_access(), and SEEK_SET.

Referenced by Init_IO().

static VALUE rb_io_s_readlines ( int  argc,
VALUE *  argv,
VALUE  io 
) [static]

Definition at line 9570 of file io.c.

References foreach_arg::io, io_s_readlines(), NIL_P, NULL, open_key_args(), Qnil, rb_ensure(), rb_io_close(), and rb_scan_args().

Referenced by Init_IO().

static VALUE rb_io_s_sysopen ( int  argc,
VALUE *  argv 
) [static]

Definition at line 6305 of file io.c.

References FilePathValue, INT2NUM, mode_t, NIL_P, NUM2INT, NUM2MODET, rb_check_to_integer(), RB_GC_GUARD, rb_io_modestr_oflags(), rb_scan_args(), rb_str_new4, rb_sysopen(), SafeStringValue, StringValueCStr, and VALUE.

Referenced by Init_IO().

static VALUE rb_io_s_try_convert ( VALUE  dummy,
VALUE  io 
) [static]

Definition at line 684 of file io.c.

References rb_io_check_io().

Referenced by Init_IO().

static VALUE rb_io_s_write ( int  argc,
VALUE *  argv,
VALUE  io 
) [static]

Definition at line 9788 of file io.c.

References io_s_write().

Referenced by Init_IO().

static VALUE rb_io_seek ( VALUE  io,
VALUE  offset,
int  whence 
) [static]

Definition at line 1542 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().

static VALUE rb_io_seek_m ( int  argc,
VALUE *  argv,
VALUE  io 
) [static]

Definition at line 1597 of file io.c.

References interpret_seek_whence(), rb_io_seek(), rb_scan_args(), SEEK_SET, and VALUE.

Referenced by argf_seek_m(), and Init_IO().

static VALUE rb_io_set_autoclose ( VALUE  io,
VALUE  autoclose 
) [static]

Definition at line 7565 of file io.c.

References FMODE_PREP, GetOpenFile, rb_io_t::mode, and RTEST.

Referenced by Init_IO().

static VALUE rb_io_set_encoding ( int  argc,
VALUE *  argv,
VALUE  io 
) [static]

Definition at line 10542 of file io.c.

References GetOpenFile, id_set_encoding, io_encoding_set(), rb_funcall2, rb_scan_args(), RB_TYPE_P, and T_FILE.

Referenced by argf_set_encoding(), Init_IO(), and rb_stdio_set_default_encoding().

static VALUE rb_io_set_lineno ( VALUE  io,
VALUE  lineno 
) [static]

Definition at line 3274 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 2378 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(), io_write_nonblock(), rsock_s_accept_nonblock(), rsock_s_recvfrom_nonblock(), and sock_connect_nonblock().

static VALUE rb_io_set_pos ( VALUE  io,
VALUE  offset 
) [static]

Definition at line 1623 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().

static VALUE rb_io_set_sync ( VALUE  io,
VALUE  sync 
) [static]

Definition at line 1856 of file io.c.

References rb_notimplement(), and UNREACHABLE.

Referenced by Init_IO().

VALUE rb_io_set_write_io ( VALUE  io,
VALUE  w 
)

Definition at line 651 of file io.c.

References GetWriteIO, Qnil, rb_io_check_initialized(), RFILE, RTEST, and VALUE.

Referenced by argf_close(), and argf_next_argv().

FILE* rb_io_stdio_file ( rb_io_t fptr  ) 

Definition at line 7247 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 dump_output(), rb_dlptr_s_to_ptr(), and rb_fiddle_ptr_s_to_ptr().

static VALUE rb_io_sync ( VALUE  io  )  [static]

Definition at line 1780 of file io.c.

References FMODE_SYNC, binwrite_arg::fptr, GetOpenFile, GetWriteIO, rb_io_t::mode, Qfalse, and Qtrue.

void rb_io_synchronized ( rb_io_t fptr  ) 

Definition at line 5638 of file io.c.

References FMODE_SYNC, pipe_list::fptr, rb_io_t::mode, and rb_io_check_initialized().

Referenced by pipe_open(), rb_io_s_pipe(), rb_io_unbuffered(), and rsock_init_sock().

static VALUE rb_io_sysread ( int  argc,
VALUE *  argv,
VALUE  io 
) [static]

Definition at line 4625 of file io.c.

References read_internal_arg::fd, rb_io_t::fd, finish_writeconv_arg::fptr, GetOpenFile, io_set_read_length(), io_setstrbuf(), read_internal_arg::len, len, NUM2LONG, OBJ_TAINT, rb_io_t::pathv, rb_eIOError, rb_ensure(), rb_eof_error(), rb_io_check_byte_readable(), rb_io_check_closed(), rb_raise(), rb_scan_args(), rb_str_locktmp(), rb_str_unlocktmp(), rb_sys_fail_path, rb_thread_wait_fd(), READ_DATA_BUFFERED, read_internal_call(), RSTRING_PTR, read_internal_arg::str_ptr, and VALUE.

Referenced by Init_IO().

static VALUE rb_io_sysseek ( int  argc,
VALUE *  argv,
VALUE  io 
) [static]

Definition at line 4540 of file io.c.

References errno, rb_io_t::fd, FMODE_READABLE, FMODE_WRITABLE, finish_writeconv_arg::fptr, GetOpenFile, interpret_seek_whence(), rb_io_buffer_t::len, rb_io_t::mode, 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, SEEK_SET, VALUE, and rb_io_t::wbuf.

Referenced by Init_IO().

static VALUE rb_io_syswrite ( VALUE  io,
VALUE  str 
) [static]

Definition at line 4580 of file io.c.

References rb_io_t::fd, finish_writeconv_arg::fptr, GetOpenFile, GetWriteIO, rb_io_buffer_t::len, LONG2FIX, rb_io_t::pathv, RB_GC_GUARD, rb_io_check_writable(), rb_obj_as_string(), rb_str_new_frozen(), rb_sys_fail_path, RB_TYPE_P, rb_warn(), rb_write_internal(), RSTRING_LEN, RSTRING_PTR, T_STRING, and rb_io_t::wbuf.

Referenced by Init_IO().

VALUE rb_io_taint_check ( VALUE  io  ) 

Definition at line 602 of file io.c.

References rb_check_frozen.

Referenced by get_strio(), rb_file_path(), rb_io_reopen(), readline_readline(), strio_reopen(), and strio_set_string().

static VALUE rb_io_tell ( VALUE  io  )  [static]

Definition at line 1529 of file io.c.

References errno, binwrite_arg::fptr, GetOpenFile, io_tell, rb_io_buffer_t::len, off_t, OFFT2NUM, rb_io_t::pathv, rb_sys_fail_path, and rb_io_t::rbuf.

Referenced by argf_tell(), and Init_IO().

static VALUE rb_io_to_io ( VALUE  io  )  [static]

Definition at line 2004 of file io.c.

Referenced by Init_IO().

void rb_io_unbuffered ( rb_io_t fptr  ) 

Definition at line 5645 of file io.c.

References pipe_list::fptr, and rb_io_synchronized().

VALUE rb_io_ungetbyte ( VALUE  io,
VALUE  b 
)

Definition at line 3833 of file io.c.

References FIX2INT, FIXNUM_P, GetOpenFile, io_ungetbyte(), NIL_P, Qnil, rb_io_check_byte_readable(), rb_str_new(), and SafeStringValue.

Referenced by Init_IO(), io_strip_bom(), and load_file_internal().

VALUE rb_io_ungetc ( VALUE  io,
VALUE  c 
)

Definition at line 3868 of file io.c.

References FIX2UINT, FIXNUM_P, GetOpenFile, io_read_encoding(), io_ungetbyte(), len, make_readconv(), MEMMOVE, NEED_NEWLINE_DECORATOR_ON_READ_CHECK, NEED_READCONV, NIL_P, NUM2UINT, Qnil, rb_eIOError, rb_enc_uint_chr(), rb_io_check_char_readable(), rb_raise(), RB_TYPE_P, RSTRING_LEN, RSTRING_PTR, SafeStringValue, SET_BINARY_MODE, and T_BIGNUM.

Referenced by Init_IO().

int rb_io_wait_readable ( int  f  ) 

Definition at line 1077 of file io.c.

References errno, EWOULDBLOCK, FALSE, rb_eIOError, rb_raise(), rb_thread_check_ints(), rb_thread_wait_fd(), and TRUE.

Referenced by io_bufread(), io_fillbuf(), 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 1103 of file io.c.

References errno, EWOULDBLOCK, FALSE, rb_eIOError, rb_raise(), rb_thread_check_ints(), rb_thread_fd_writable(), and TRUE.

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().

VALUE rb_io_write ( VALUE  io,
VALUE  str 
)

Definition at line 1427 of file io.c.

References id_write, and rb_funcallv().

Referenced by argf_write(), copy_stream_body(), copy_stream_fallback_body(), gc_profile_report(), marshal_dump(), oldbt_print_to(), rb_f_printf(), rb_io_addstr(), rb_io_print(), rb_io_printf(), rb_io_putc(), rb_io_puts(), rb_obj_display(), rb_p(), rb_write_error2(), rb_write_error_str(), and w_nbyte().

static VALUE rb_io_write_nonblock ( int  argc,
VALUE *  argv,
VALUE  io 
) [static]

Definition at line 2707 of file io.c.

References io_write_nonblock(), NIL_P, Qfalse, Qnil, rb_hash_aref(), rb_scan_args(), sym_exception, and VALUE.

Referenced by Init_IO().

static VALUE rb_ioctl ( VALUE  io,
VALUE  req,
VALUE  arg 
) [static]

Definition at line 8940 of file io.c.

References do_ioctl(), rb_io_t::fd, GetOpenFile, INT2NUM, NUM2IOCTLREQ, rb_io_t::pathv, rb_eArgError, rb_raise(), rb_secure(), rb_sys_fail_path, RB_TYPE_P, RSTRING_LEN, RSTRING_PTR, setup_narg(), and T_STRING.

Referenced by rb_io_ioctl().

void rb_maygvl_fd_fix_cloexec ( int  fd  ) 

Definition at line 198 of file io.c.

References errno, fcntl(), rb_bug(), and strerror().

Referenced by cloexec_accept(), rb_cloexec_dup2(), rb_cloexec_fcntl_dupfd(), rb_cloexec_open(), rb_cloexec_pipe(), and rb_fd_fix_cloexec().

static VALUE rb_obj_display ( int  argc,
VALUE *  argv,
VALUE  self 
) [static]

Definition at line 7127 of file io.c.

References Qnil, rb_io_write(), rb_scan_args(), rb_stdout, and VALUE.

Referenced by Init_IO().

static VALUE rb_open_file ( int  argc,
const VALUE *  argv,
VALUE  io 
) [static]

Definition at line 6232 of file io.c.

References fmode, mode_t, rb_file_open_generic(), rb_scan_open_args(), and VALUE.

Referenced by rb_file_initialize(), and rb_io_open_with_args().

void rb_p ( VALUE  obj  ) 

Definition at line 7032 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, RB_TYPE_P, T_FILE, and VALUE.

Referenced by rb_f_p_internal().

int rb_pipe ( int *  pipes  ) 

Definition at line 5651 of file io.c.

References errno, rb_cloexec_pipe(), rb_gc(), and rb_update_max_fd().

Referenced by pipe_open(), and rb_io_s_pipe().

void rb_read_check ( FILE fp  ) 

Definition at line 839 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 945 of file io.c.

References io_internal_read_struct::buf, io_internal_read_struct::capa, io_internal_read_struct::fd, internal_read_func(), and rb_thread_io_blocking_region().

Referenced by io_bufread(), io_fillbuf(), maygvl_read(), and read_internal_call().

void rb_readwrite_sys_fail ( int  writable,
const char *  mesg 
)

Definition at line 11674 of file io.c.

References EINPROGRESS, errno, EWOULDBLOCK, Qnil, rb_bug(), rb_class_new_instance(), rb_eEAGAINWaitReadable, rb_eEAGAINWaitWritable, rb_eEINPROGRESSWaitReadable, rb_eEINPROGRESSWaitWritable, rb_eEWOULDBLOCKWaitReadable, rb_eEWOULDBLOCKWaitWritable, rb_exc_raise(), RB_IO_WAIT_READABLE, RB_IO_WAIT_WRITABLE, rb_mod_sys_fail_str(), rb_mWaitReadable, rb_mWaitWritable, and rb_str_new2.

Referenced by io_getpartial(), io_write_nonblock(), rsock_s_accept_nonblock(), rsock_s_recvfrom_nonblock(), and sock_connect_nonblock().

static void rb_scan_open_args ( int  argc,
const VALUE *  argv,
VALUE *  fname_p,
int *  oflags_p,
int *  fmode_p,
convconfig_t convconfig_p,
mode_t *  perm_p 
) [static]

Definition at line 6210 of file io.c.

References FilePathValue, fmode, mode_t, NIL_P, NUM2MODET, rb_io_extract_modeenc(), rb_scan_args(), and VALUE.

Referenced by rb_open_file().

void rb_stdio_set_default_encoding ( void   ) 

Definition at line 10558 of file io.c.

References Qnil, rb_io_set_encoding(), rb_stderr, rb_stdin, rb_stdout, and val.

static int rb_sysopen ( VALUE  fname,
int  oflags,
mode_t  perm 
) [static]

Definition at line 5350 of file io.c.

References errno, sysopen_struct::fname, sysopen_struct::oflags, sysopen_struct::perm, rb_gc(), rb_str_encode_ospath(), rb_sys_fail_path, and rb_sysopen_internal().

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 5340 of file io.c.

References rb_thread_call_without_gvl(), rb_update_max_fd(), RUBY_UBF_IO, sysopen_func(), and VALUE.

Referenced by rb_sysopen().

void rb_update_max_fd ( int  fd  ) 

Definition at line 183 of file io.c.

References ATOMIC_CAS, errno, fstat, max_file_descriptor, rb_bug(), and stat.

Referenced by chfunc(), console_dev(), fill_random_seed(), get_device_once(), io_reopen(), load_file_internal(), ossl_obj2bio(), prep_io(), pty_getpty(), rb_fd_fix_cloexec(), rb_file_load_ok(), rb_io_initialize(), rb_pipe(), rb_sysopen_internal(), rsock_init_sock(), rsock_s_accept(), rsock_s_accept_nonblock(), rsock_socket(), ruby_dup(), run_exec_dup2(), run_exec_dup2_child(), run_exec_open(), and save_redirect_fd().

void rb_write_error ( const char *  mesg  ) 

Definition at line 7157 of file io.c.

References rb_write_error2(), and strlen().

Referenced by rescue_callback().

void rb_write_error2 ( const char *  mesg,
long  len 
)

Definition at line 7143 of file io.c.

References rb_io_t::fd, orig_stderr, rb_io_write(), rb_stderr, rb_str_new(), and RFILE.

Referenced by rb_write_error().

void rb_write_error_str ( VALUE  mesg  ) 

Definition at line 7163 of file io.c.

References rb_io_t::fd, len, orig_stderr, RB_GC_GUARD, rb_io_write(), rb_stderr, RFILE, RSTRING_LEN, and RSTRING_PTR.

Referenced by compile_err_append(), compile_warn_print(), warn_print(), and warn_printf().

static ssize_t rb_write_internal ( int  fd,
const void *  buf,
size_t  count 
) [static]

Definition at line 956 of file io.c.

References io_internal_write_struct::buf, io_internal_write_struct::capa, io_internal_write_struct::fd, internal_write_func(), and rb_thread_io_blocking_region().

Referenced by finish_writeconv(), io_binwrite(), and rb_io_syswrite().

static ssize_t rb_write_internal2 ( int  fd,
const void *  buf,
size_t  count 
) [static]

Definition at line 967 of file io.c.

References io_internal_write_struct::buf, io_internal_write_struct::capa, io_internal_write_struct::fd, internal_write_func2(), NULL, rb_thread_call_without_gvl2(), and RUBY_UBF_IO.

Referenced by finish_writeconv(), and io_binwrite_string().

static VALUE read_all ( rb_io_t fptr,
long  siz,
VALUE  str 
) [static]

Definition at line 2313 of file io.c.

References rb_io_t::cbuf, clear_readconv(), ENC_CODERANGE_BROKEN, ENC_CODERANGE_SET, fill_cbuf(), io_enc_str(), io_fread(), io_read_encoding(), io_setstrbuf(), io_shift_cbuf(), rb_io_buffer_t::len, make_readconv(), MORE_CHAR_FINISHED, MORE_CHAR_SUSPENDED, NEED_NEWLINE_DECORATOR_ON_READ_CHECK, NEED_READCONV, NIL_P, rb_exc_raise(), rb_str_coderange_scan_restartable(), rb_str_modify_expand(), rb_str_set_len(), READ_CHECK, RSTRING_PTR, SET_BINARY_MODE, and VALUE.

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 2011 of file io.c.

References binwrite_arg::fptr, rb_io_buffer_t::len, MEMMOVE, rb_io_buffer_t::off, rb_io_buffer_t::ptr, rb_io_t::rbuf, and READ_DATA_PENDING_COUNT.

Referenced by appendline(), copy_stream_body(), io_bufread(), io_getpartial(), rb_io_getline_fast(), and swallow().

static VALUE read_internal_call ( VALUE  arg  )  [static]

Definition at line 2407 of file io.c.

References read_internal_arg::fd, read_internal_arg::len, Qundef, rb_read_internal(), and read_internal_arg::str_ptr.

Referenced by io_getpartial(), and rb_io_sysread().

static long remain_size ( rb_io_t fptr  )  [static]

Definition at line 2106 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 2836 of file io.c.

References rb_eRuntimeError, rb_raise(), RSTRING_LEN, and RSTRING_PTR.

static int ruby_dup ( int  orig  )  [static]

Definition at line 856 of file io.c.

References errno, rb_cloexec_dup(), rb_gc(), rb_sys_fail(), and rb_update_max_fd().

Referenced by rb_io_init_copy().

const char* ruby_get_inplace_mode ( void   ) 

Definition at line 11600 of file io.c.

References ARGF.

void ruby_set_inplace_mode ( const char *  suffix  ) 

Definition at line 11606 of file io.c.

References ARGF, free, and strdup.

Referenced by proc_options().

static VALUE seek_before_access ( VALUE  argp  )  [static]

Definition at line 9594 of file io.c.

References seek_arg::io, seek_arg::mode, seek_arg::offset, rb_io_binmode(), and rb_io_seek().

Referenced by io_s_write(), and rb_io_s_read().

static VALUE select_call ( VALUE  arg  )  [static]

Definition at line 8322 of file io.c.

References select_args::except, select_args::fdsets, select_args::read, select_internal(), select_args::timeout, and select_args::write.

Referenced by rb_f_select().

static VALUE select_end ( VALUE  arg  )  [static]

Definition at line 8330 of file io.c.

References select_args::fdsets, numberof, Qnil, and rb_fd_term.

Referenced by rb_f_select().

static VALUE select_internal ( VALUE  read,
VALUE  write,
VALUE  except,
struct timeval tp,
rb_fdset_t fds 
) [static]

Definition at line 8191 of file io.c.

References Check_Type, rb_io_t::fd, GetOpenFile, GetWriteIO, list, NIL_P, Qnil, RARRAY_AREF, RARRAY_LEN, 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, timeval::tv_usec, and VALUE.

Referenced by select_call().

static long setup_narg ( ioctl_req_t  cmd,
VALUE *  argp,
int  io_p 
) [static]

Definition at line 8896 of file io.c.

References fcntl_narg_len(), FIX2LONG, FIXNUM_P, ioctl_narg_len(), long, NIL_P, NUM2LONG, Qfalse, Qtrue, rb_check_string_type(), rb_str_modify(), rb_str_resize(), RSTRING_LEN, RSTRING_PTR, SIGNED_VALUE, and VALUE.

Referenced by rb_ioctl().

static void stdout_setter ( VALUE  val,
ID  id,
VALUE *  variable 
) [static]

Definition at line 7190 of file io.c.

References id_write, and must_respond_to().

Referenced by Init_IO().

static int str_end_with_asciichar ( VALUE  str,
int  c 
) [static]

Definition at line 6928 of file io.c.

References ENCODING_GET, len, rb_enc_ascget(), rb_enc_from_index(), rb_enc_mbminlen, RSTRING_LEN, and RSTRING_PTR.

Referenced by rb_io_puts().

static int swallow ( rb_io_t fptr,
int  term 
) [inline, static]

Definition at line 2926 of file io.c.

References buf, cnt, FALSE, io_fillbuf(), io_read_encoding(), io_shift_cbuf(), make_readconv(), more_char(), MORE_CHAR_FINISHED, NEED_NEWLINE_DECORATOR_ON_READ_CHECK, 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, SET_BINARY_MODE, and TRUE.

Referenced by rb_io_getline_1().

static void* sysopen_func ( void *  ptr  )  [static]

Definition at line 5332 of file io.c.

References sysopen_struct::fname, sysopen_struct::oflags, sysopen_struct::perm, rb_cloexec_open(), RSTRING_PTR, and VALUE.

Referenced by rb_sysopen_internal().

static void unsupported_encoding ( const char *  name  )  [static]

Definition at line 4999 of file io.c.

References rb_warn().

Referenced by find_encoding(), and parse_mode_enc().

static void validate_enc_binmode ( int *  fmode_p,
int  ecflags,
rb_encoding enc,
rb_encoding enc2 
) [static]

Definition at line 5146 of file io.c.

References DEFAULT_TEXTMODE, ECONV_NEWLINE_DECORATOR_MASK, fmode, FMODE_BINMODE, FMODE_READABLE, FMODE_TEXTMODE, 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 889 of file io.c.

References fcntl(), rb_io_t::fd, FMODE_WSPLIT, FMODE_WSPLIT_INITIALIZED, fstat, HAVE_FCNTL, rb_io_t::mode, O_NONBLOCK, S_ISREG, and stat.

Referenced by io_writable_length().


Variable Documentation

VALUE argf [static]

Definition at line 158 of file io.c.

const rb_data_type_t argf_type [static]

Initial value:

Definition at line 7604 of file io.c.

Referenced by argf_alloc().

const char closed_stream[] = "closed stream" [static]

Definition at line 593 of file io.c.

ID id_flush [static]

Definition at line 160 of file io.c.

ID id_getc [static]

Definition at line 160 of file io.c.

ID id_read [static]

Definition at line 160 of file io.c.

ID id_readpartial [static]

Definition at line 160 of file io.c.

ID id_set_encoding [static]

Definition at line 160 of file io.c.

Referenced by Init_IO(), and rb_io_set_encoding().

ID id_write [static]

Definition at line 160 of file io.c.

rb_atomic_t max_file_descriptor = NOFILE [static]

Definition at line 181 of file io.c.

Referenced by rb_update_max_fd().

VALUE orig_stderr [static]

Definition at line 151 of file io.c.

Referenced by Init_IO(), pipe_open(), rb_write_error2(), and rb_write_error_str().

VALUE orig_stdout [static]

Definition at line 151 of file io.c.

Referenced by argf_next_argv(), Init_IO(), and pipe_open().

VALUE rb_cIO

Definition at line 133 of file io.c.

VALUE rb_default_rs

Definition at line 156 of file io.c.

VALUE rb_deferr

Definition at line 150 of file io.c.

Referenced by Init_IO().

VALUE rb_eEAGAIN

Definition at line 40 of file error.c.

Referenced by Init_IO(), and set_syserr().

VALUE rb_eEAGAINWaitReadable [static]

Definition at line 142 of file io.c.

Referenced by Init_IO(), and rb_readwrite_sys_fail().

VALUE rb_eEAGAINWaitWritable [static]

Definition at line 143 of file io.c.

Referenced by Init_IO(), and rb_readwrite_sys_fail().

VALUE rb_eEINPROGRESS

Definition at line 42 of file error.c.

Referenced by Init_IO(), and set_syserr().

VALUE rb_eEINPROGRESSWaitReadable [static]

Definition at line 147 of file io.c.

Referenced by Init_IO(), and rb_readwrite_sys_fail().

VALUE rb_eEINPROGRESSWaitWritable [static]

Definition at line 146 of file io.c.

Referenced by Init_IO(), and rb_readwrite_sys_fail().

VALUE rb_eEOFError

Definition at line 134 of file io.c.

VALUE rb_eEWOULDBLOCK

Definition at line 41 of file error.c.

Referenced by Init_IO(), and set_syserr().

VALUE rb_eEWOULDBLOCKWaitReadable [static]

Definition at line 144 of file io.c.

Referenced by Init_IO(), and rb_readwrite_sys_fail().

VALUE rb_eEWOULDBLOCKWaitWritable [static]

Definition at line 145 of file io.c.

Referenced by Init_IO(), and rb_readwrite_sys_fail().

VALUE rb_eIOError

Definition at line 135 of file io.c.

VALUE rb_mWaitReadable

Definition at line 136 of file io.c.

VALUE rb_mWaitWritable

Definition at line 137 of file io.c.

VALUE rb_output_fs

Definition at line 153 of file io.c.

Referenced by Init_IO(), rb_ary_join_m(), and rb_io_print().

VALUE rb_output_rs

Definition at line 155 of file io.c.

VALUE rb_rs

Definition at line 154 of file io.c.

VALUE rb_stderr

Definition at line 149 of file io.c.

VALUE rb_stdin

Definition at line 149 of file io.c.

VALUE rb_stdout

Definition at line 149 of file io.c.

VALUE sym_autoclose [static]

Definition at line 162 of file io.c.

Referenced by Init_IO(), and rb_io_initialize().

VALUE sym_binmode [static]

Definition at line 162 of file io.c.

Referenced by extract_binmode(), and Init_IO().

VALUE sym_CUR [static]

Definition at line 163 of file io.c.

Referenced by Init_IO(), and interpret_seek_whence().

VALUE sym_dontneed [static]

Definition at line 8340 of file io.c.

VALUE sym_encoding [static]

Definition at line 161 of file io.c.

Referenced by Init_IO(), Init_String(), and rb_io_extract_encoding_option().

VALUE sym_END [static]

Definition at line 163 of file io.c.

Referenced by Init_IO(), and interpret_seek_whence().

VALUE sym_exception [static]

Definition at line 162 of file io.c.

VALUE sym_extenc [static]

Definition at line 161 of file io.c.

Referenced by Init_IO(), and rb_io_extract_encoding_option().

VALUE sym_intenc [static]

Definition at line 161 of file io.c.

Referenced by Init_IO(), and rb_io_extract_encoding_option().

VALUE sym_mode [static]

Definition at line 161 of file io.c.

Referenced by Init_IO(), io_s_write(), and rb_io_extract_modeenc().

VALUE sym_noreuse [static]

Definition at line 8340 of file io.c.

VALUE sym_normal [static]

Definition at line 8340 of file io.c.

VALUE sym_open_args [static]

Definition at line 161 of file io.c.

Referenced by Init_IO(), and open_key_args().

VALUE sym_perm [static]

Definition at line 161 of file io.c.

Referenced by Init_IO(), and rb_io_extract_modeenc().

VALUE sym_random [static]

Definition at line 8340 of file io.c.

VALUE sym_sequential [static]

Definition at line 8340 of file io.c.

VALUE sym_SET [static]

Definition at line 163 of file io.c.

Referenced by Init_IO(), and interpret_seek_whence().

VALUE sym_textmode [static]

Definition at line 162 of file io.c.

Referenced by extract_binmode(), and Init_IO().

VALUE sym_willneed [static]

Definition at line 8340 of file io.c.


Generated on 19 Jul 2016 for Ruby by  doxygen 1.4.7