Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)
Macros | Functions | Variables
io.h File Reference

Public APIs related to rb_cIO. More...

#include "ruby/internal/dllexport.h"
#include "ruby/internal/value.h"

Go to the source code of this file.

Macros

#define rb_defout   rb_stdout
 
#define RB_RESERVED_FD_P(fd)   rb_reserved_fd_p(fd)
 

Functions

VALUE rb_io_write (VALUE, VALUE)
 
VALUE rb_io_gets (VALUE)
 
VALUE rb_io_getbyte (VALUE)
 
VALUE rb_io_ungetc (VALUE, VALUE)
 
VALUE rb_io_ungetbyte (VALUE, VALUE)
 
VALUE rb_io_close (VALUE)
 
VALUE rb_io_flush (VALUE)
 
VALUE rb_io_eof (VALUE)
 
VALUE rb_io_binmode (VALUE)
 
VALUE rb_io_ascii8bit_binmode (VALUE)
 
VALUE rb_io_addstr (VALUE, VALUE)
 
VALUE rb_io_printf (int, const VALUE *, VALUE)
 
VALUE rb_io_print (int, const VALUE *, VALUE)
 
VALUE rb_io_puts (int, const VALUE *, VALUE)
 
VALUE rb_io_fdopen (int, int, const char *)
 
VALUE rb_io_get_io (VALUE)
 
VALUE rb_file_open (const char *, const char *)
 
VALUE rb_file_open_str (VALUE, const char *)
 
VALUE rb_gets (void)
 
void rb_write_error (const char *)
 
void rb_write_error2 (const char *, long)
 
void rb_close_before_exec (int lowfd, int maxhint, VALUE noclose_fds)
 
int rb_pipe (int *pipes)
 
int rb_reserved_fd_p (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)
 
void rb_update_max_fd (int fd)
 
void rb_fd_fix_cloexec (int fd)
 

Variables

VALUE rb_fs
 
VALUE rb_output_fs
 
VALUE rb_rs
 
VALUE rb_default_rs
 
VALUE rb_output_rs
 

Detailed Description

Public APIs related to rb_cIO.

Author
Ruby developers ruby-.nosp@m.core.nosp@m.@ruby.nosp@m.-lan.nosp@m.g.org
Warning
Symbols prefixed with either RBIMPL or rbimpl are implementation details. Don't take them as canon. They could rapidly appear then vanish. The name (path) of this header file is also an implementation detail. Do not expect it to persist at the place it is now. Developers are free to move it anywhere anytime at will.
Note
To ruby-core: remember that this header can be possibly recursively included from extension libraries written in C++. Do not expect for instance __VA_ARGS__ is always available. We assume C99 for ruby itself but we don't assume languages of extension libraries. They could be written in C++98.

Definition in file io.h.

Macro Definition Documentation

◆ rb_defout

#define rb_defout   rb_stdout

Definition at line 29 of file io.h.

◆ RB_RESERVED_FD_P

#define RB_RESERVED_FD_P (   fd)    rb_reserved_fd_p(fd)

Definition at line 64 of file io.h.

Function Documentation

◆ rb_cloexec_dup()

int rb_cloexec_dup ( int  oldfd)

Definition at line 346 of file io.c.

References rb_cloexec_fcntl_dupfd().

◆ rb_cloexec_dup2()

int rb_cloexec_dup2 ( int  oldfd,
int  newfd 
)

Definition at line 353 of file io.c.

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

◆ rb_cloexec_fcntl_dupfd()

int rb_cloexec_fcntl_dupfd ( int  fd,
int  minfd 
)

◆ rb_cloexec_open()

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

Definition at line 307 of file io.c.

References EWOULDBLOCK, O_CLOEXEC, and rb_maygvl_fd_fix_cloexec().

Referenced by rb_file_load_ok().

◆ rb_cloexec_pipe()

int rb_cloexec_pipe ( int  fildes[2])

Definition at line 406 of file io.c.

References O_CLOEXEC, O_NONBLOCK, and rb_maygvl_fd_fix_cloexec().

Referenced by rb_pipe().

◆ rb_close_before_exec()

void rb_close_before_exec ( int  lowfd,
int  maxhint,
VALUE  noclose_fds 
)

Referenced by rb_execarg_run_options().

◆ rb_fd_fix_cloexec()

void rb_fd_fix_cloexec ( int  fd)

Definition at line 283 of file io.c.

References rb_maygvl_fd_fix_cloexec(), and rb_update_max_fd().

◆ rb_file_open()

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

Definition at line 6389 of file io.c.

References sysopen_struct::fname, rb_cFile, and rb_str_new_cstr.

◆ rb_file_open_str()

VALUE rb_file_open_str ( VALUE  fname,
const char *  modestr 
)

Definition at line 6382 of file io.c.

References FilePathValue, sysopen_struct::fname, and rb_cFile.

◆ rb_gets()

VALUE rb_gets ( void  )

Definition at line 9104 of file io.c.

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

◆ rb_io_addstr()

VALUE rb_io_addstr ( VALUE  io,
VALUE  str 
)

Definition at line 1992 of file io.c.

References rb_io_write(), and str.

Referenced by Init_IO().

◆ rb_io_ascii8bit_binmode()

VALUE rb_io_ascii8bit_binmode ( VALUE  io)

Definition at line 5495 of file io.c.

References GetOpenFile.

Referenced by rsock_init_sock().

◆ rb_io_binmode()

VALUE rb_io_binmode ( VALUE  io)

◆ rb_io_close()

VALUE rb_io_close ( VALUE  io)

Definition at line 4935 of file io.c.

References Qnil.

Referenced by rb_gets(), and rb_io_make_open_file().

◆ rb_io_eof()

VALUE rb_io_eof ( VALUE  io)

◆ rb_io_fdopen()

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

Definition at line 8183 of file io.c.

References rb_cFile, rb_cIO, and rb_io_oflags_fmode().

◆ rb_io_flush()

VALUE rb_io_flush ( VALUE  io)

Definition at line 2052 of file io.c.

References rb_io_flush_raw().

Referenced by Init_IO(), and rb_io_getbyte().

◆ rb_io_get_io()

VALUE rb_io_get_io ( VALUE  io)

Definition at line 790 of file io.c.

References rb_convert_type_with_id(), and T_FILE.

◆ rb_io_getbyte()

VALUE rb_io_getbyte ( VALUE  io)

◆ rb_io_gets()

VALUE rb_io_gets ( VALUE  io)

Definition at line 3738 of file io.c.

References FALSE, getline_arg::io, and rb_default_rs.

Referenced by rb_gets().

◆ rb_io_print()

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

◆ rb_io_printf()

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

Definition at line 7649 of file io.c.

References argc, argv, out, Qnil, rb_f_sprintf(), and rb_io_write().

Referenced by Init_IO().

◆ rb_io_puts()

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

◆ rb_io_ungetbyte()

VALUE rb_io_ungetbyte ( VALUE  io,
VALUE  b 
)

◆ rb_io_ungetc()

VALUE rb_io_ungetc ( VALUE  io,
VALUE  c 
)

◆ rb_io_write()

VALUE rb_io_write ( VALUE  io,
VALUE  str 
)

◆ rb_pipe()

int rb_pipe ( int pipes)

Definition at line 6499 of file io.c.

References rb_cloexec_pipe(), rb_gc_for_fd(), and rb_update_max_fd().

◆ rb_reserved_fd_p()

int rb_reserved_fd_p ( int  fd)

Referenced by rsock_init_sock().

◆ rb_update_max_fd()

void rb_update_max_fd ( int  fd)

◆ rb_write_error()

void rb_write_error ( const char *  mesg)

Definition at line 8077 of file io.c.

References rb_write_error2(), and strlen().

◆ rb_write_error2()

void rb_write_error2 ( const char *  mesg,
long  len 
)

Definition at line 8058 of file io.c.

References fileno, len, rb_io_write(), rb_ractor_stderr(), rb_str_new, and rb_w32_write_console().

Referenced by rb_write_error().

Variable Documentation

◆ rb_default_rs

VALUE rb_default_rs
extern

Definition at line 202 of file io.c.

Referenced by Init_IO(), rb_gets(), rb_io_gets(), rb_io_gets_internal(), and rb_io_puts().

◆ rb_fs

VALUE rb_fs
extern

Definition at line 502 of file string.c.

Referenced by Init_String().

◆ rb_output_fs

VALUE rb_output_fs
extern

Definition at line 199 of file io.c.

Referenced by Init_IO(), and rb_io_print().

◆ rb_output_rs

VALUE rb_output_rs
extern

Definition at line 201 of file io.c.

Referenced by Init_IO(), and rb_io_print().

◆ rb_rs

VALUE rb_rs
extern

Definition at line 200 of file io.c.

Referenced by Init_IO(), and rb_gets().