Ruby: internal/io.h File Reference

Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)

Macros | Functions
io.h File Reference

Internal header for IO. More...

`#include "ruby/ruby.h"`
`#include "ruby/io.h"`

Go to the source code of this file.

## Macros
#define | rb_io_fptr_finalize rb_io_fptr_finalize_internal

## Functions
void | ruby_set_inplace_mode (const char *)
void | rb_stdio_set_default_encoding (void)
VALUE | rb_io_flush_raw (VALUE, int)
size_t | rb_io_memsize (const rb_io_t *)
int | rb_stderr_tty_p (void)
void | rb_io_fptr_finalize_internal (void *ptr)
VALUE | rb_io_popen (VALUE pname, VALUE pmode, VALUE env, VALUE opt)
void | rb_maygvl_fd_fix_cloexec (int fd)
int | rb_gc_for_fd (int err)
void | rb_write_error_str (VALUE mesg)

## Detailed Description

Internal header for IO.

Author
  Ruby developers ruby-.nosp@m.core.nosp@m.@ruby.nosp@m.-lan.nosp@m.g.org

Copyright
  This file is a part of the programming language Ruby. Permission is hereby granted, to either redistribute and/or modify this file, provided that the conditions mentioned in the file COPYING are met. Consult the file for details.

Definition in file io.h.

## Macro Definition Documentation

## ◆ rb_io_fptr_finalize

#define rb_io_fptr_finalize rb_io_fptr_finalize_internal

Definition at line 25 of file io.h.

## Function Documentation

## ◆ rb_gc_for_fd()

int rb_gc_for_fd | ( | int | err | ) |

Definition at line 1010 of file io.c.

References err, and rb_gc().

Referenced by rb_fdopen(), rb_pipe(), and rsock_socket().

## ◆ rb_io_flush_raw()

VALUE rb_io_flush_raw | ( | VALUE | io,
|  | int | sync
| ) |  |

Definition at line 2013 of file io.c.

References FMODE_READABLE, FMODE_WRITABLE, GetOpenFile, GetWriteIO, rb_io_t::mode, rb_funcall(), rb_sys_fail_on_write, and T_FILE.

Referenced by rb_io_flush().

## ◆ rb_io_fptr_finalize_internal()

void rb_io_fptr_finalize_internal | ( | void * | ptr | ) |

Definition at line 4845 of file io.c.

References rb_io_t::fd, finish_writeconv_arg::fptr, free, rb_io_t::pathv, ptr, Qnil, rb_io_t::rbuf, TRUE, rb_io_t::wbuf, and rb_io_t::write_lock.

Referenced by rb_io_fptr_finalize().

## ◆ rb_io_memsize()

size_t rb_io_memsize | ( | const rb_io_t * | fptr | ) |

Definition at line 4875 of file io.c.

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

## ◆ rb_io_popen()

VALUE rb_io_popen | ( | VALUE | pname,
|  | VALUE | pmode,
|  | VALUE | env,
|  | VALUE | opt
| ) |  |

Definition at line 7040 of file io.c.

References env, FALSE, fmode, len, NIL_P, Qnil, RARRAY_CONST_PTR, RARRAY_LEN, rb_check_array_type(), rb_eArgError, rb_execarg_extract_options(), rb_execarg_new(), rb_execarg_setenv(), RB_GC_GUARD, rb_io_extract_modeenc, rb_raise(), SafeStringValue, and TRUE.

## ◆ rb_maygvl_fd_fix_cloexec()

void rb_maygvl_fd_fix_cloexec | ( | int | fd | ) |

Definition at line 260 of file io.c.

References F_GETFD, F_SETFD, fcntl(), FD_CLOEXEC, rb_bug(), and strerror().

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

## ◆ rb_stderr_tty_p()

int rb_stderr_tty_p | ( | void |  | ) |

Definition at line 8105 of file io.c.

References fileno.

Referenced by rb_error_write().

## ◆ rb_stdio_set_default_encoding()

void rb_stdio_set_default_encoding | ( | void |  | ) |

Definition at line 12002 of file io.c.

References Qnil, rb_stderr, rb_stdin, and rb_stdout.

## ◆ rb_write_error_str()

void rb_write_error_str | ( | VALUE | mesg | ) |

Definition at line 8083 of file io.c.

## ◆ ruby_set_inplace_mode()

void ruby_set_inplace_mode | ( | const char * | suffix | ) |

Definition at line 13050 of file io.c.

References ARGF, Qfalse, Qnil, rb_str_new, strlen(), and suffix.