Ruby: include/ruby/io/buffer.h File Reference

Ruby 3.4.4p34 (2025-05-14 revision a38531fd3f617bf734ef7d6c595325f69985ea1d)

Macros | Enumerations | Functions | Variables
buffer.h File Reference
`#include "ruby/ruby.h"`
`#include "ruby/internal/config.h"`

Go to the source code of this file.

## Macros
#define | RB_IO_BUFFER_EXPERIMENTAL 1
#define | RUBY_IO_BUFFER_VERSION 2

## Enumerations
enum | rb_io_buffer_flags { RB_IO_BUFFER_EXTERNAL = 1 , RB_IO_BUFFER_INTERNAL = 2 , RB_IO_BUFFER_MAPPED = 4 , RB_IO_BUFFER_SHARED = 8 , RB_IO_BUFFER_LOCKED = 32 , RB_IO_BUFFER_PRIVATE = 64 , RB_IO_BUFFER_READONLY = 128 , RB_IO_BUFFER_FILE = 256 }
enum | rb_io_buffer_endian { RB_IO_BUFFER_LITTLE_ENDIAN = 4 , RB_IO_BUFFER_BIG_ENDIAN = 8 , RB_IO_BUFFER_HOST_ENDIAN = RB_IO_BUFFER_LITTLE_ENDIAN , RB_IO_BUFFER_NETWORK_ENDIAN = RB_IO_BUFFER_BIG_ENDIAN }

## Functions
VALUE | rb_io_buffer_new (void *base, size_t size, enum rb_io_buffer_flags flags)
VALUE | rb_io_buffer_map (VALUE io, size_t size, rb_off_t offset, enum rb_io_buffer_flags flags)
VALUE | rb_io_buffer_lock (VALUE self)
VALUE | rb_io_buffer_unlock (VALUE self)
int | rb_io_buffer_try_unlock (VALUE self)
VALUE | rb_io_buffer_free (VALUE self)
VALUE | rb_io_buffer_free_locked (VALUE self)
enum rb_io_buffer_flags | rb_io_buffer_get_bytes (VALUE self, void **base, size_t *size)
void | rb_io_buffer_get_bytes_for_reading (VALUE self, const void **base, size_t *size)
void | rb_io_buffer_get_bytes_for_writing (VALUE self, void **base, size_t *size)
VALUE | rb_io_buffer_transfer (VALUE self)
void | rb_io_buffer_resize (VALUE self, size_t size)
void | rb_io_buffer_clear (VALUE self, uint8_t value, size_t offset, size_t length)
VALUE | rb_io_buffer_read (VALUE self, VALUE io, size_t length, size_t offset)
VALUE | rb_io_buffer_pread (VALUE self, VALUE io, rb_off_t from, size_t length, size_t offset)
VALUE | rb_io_buffer_write (VALUE self, VALUE io, size_t length, size_t offset)
VALUE | rb_io_buffer_pwrite (VALUE self, VALUE io, rb_off_t from, size_t length, size_t offset)

## Variables
VALUE | rb_cIOBuffer
size_t | RUBY_IO_BUFFER_PAGE_SIZE
size_t | RUBY_IO_BUFFER_DEFAULT_SIZE

## Detailed Description

Author
  Samuel Williams

Date
  Fri 2 Jul 2021 16:29:01 NZST

Copyright
  Copyright (C) 2021 Samuel Williams
  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 buffer.h.

## Macro Definition Documentation

## ◆ RB_IO_BUFFER_EXPERIMENTAL

#define RB_IO_BUFFER_EXPERIMENTAL 1

Definition at line 22 of file buffer.h.

## ◆ RUBY_IO_BUFFER_VERSION

#define RUBY_IO_BUFFER_VERSION 2

Definition at line 24 of file buffer.h.

## Enumeration Type Documentation

## ◆ rb_io_buffer_endian

enum rb_io_buffer_endian

Definition at line 67 of file buffer.h.

## ◆ rb_io_buffer_flags

enum rb_io_buffer_flags

Definition at line 38 of file buffer.h.

## Function Documentation

## ◆ rb_io_buffer_clear()

void rb_io_buffer_clear | ( | VALUE | self,
|  | uint8_t | value,
|  | size_t | offset,
|  | size_t | length )

Definition at line 2622 of file io_buffer.c.

## ◆ rb_io_buffer_free()

VALUE rb_io_buffer_free | ( | VALUE | self | ) |

Definition at line 1453 of file io_buffer.c.

## ◆ rb_io_buffer_free_locked()

VALUE rb_io_buffer_free_locked | ( | VALUE | self | ) |

Definition at line 1467 of file io_buffer.c.

## ◆ rb_io_buffer_get_bytes()

enum rb_io_buffer_flags rb_io_buffer_get_bytes | ( | VALUE | self,
|  | void ** | base,
|  | size_t * | size )

Definition at line 827 of file io_buffer.c.

## ◆ rb_io_buffer_get_bytes_for_reading()

void rb_io_buffer_get_bytes_for_reading | ( | VALUE | self,
|  | const void ** | base,
|  | size_t * | size )

Definition at line 895 of file io_buffer.c.

## ◆ rb_io_buffer_get_bytes_for_writing()

void rb_io_buffer_get_bytes_for_writing | ( | VALUE | self,
|  | void ** | base,
|  | size_t * | size )

Definition at line 870 of file io_buffer.c.

## ◆ rb_io_buffer_lock()

VALUE rb_io_buffer_lock | ( | VALUE | self | ) |

Definition at line 1333 of file io_buffer.c.

## ◆ rb_io_buffer_map()

VALUE rb_io_buffer_map | ( | VALUE | io,
|  | size_t | size,
|  | rb_off_t | offset,
|  | enum rb_io_buffer_flags | flags )

Definition at line 623 of file io_buffer.c.

## ◆ rb_io_buffer_new()

VALUE rb_io_buffer_new | ( | void * | base,
|  | size_t | size,
|  | enum rb_io_buffer_flags | flags )

Definition at line 610 of file io_buffer.c.

## ◆ rb_io_buffer_pread()

VALUE rb_io_buffer_pread | ( | VALUE | self,
|  | VALUE | io,
|  | rb_off_t | from,
|  | size_t | length,
|  | size_t | offset )

Definition at line 2918 of file io_buffer.c.

## ◆ rb_io_buffer_pwrite()

VALUE rb_io_buffer_pwrite | ( | VALUE | self,
|  | VALUE | io,
|  | rb_off_t | from,
|  | size_t | length,
|  | size_t | offset )

Definition at line 3147 of file io_buffer.c.

## ◆ rb_io_buffer_read()

VALUE rb_io_buffer_read | ( | VALUE | self,
|  | VALUE | io,
|  | size_t | length,
|  | size_t | offset )

Definition at line 2801 of file io_buffer.c.

## ◆ rb_io_buffer_resize()

void rb_io_buffer_resize | ( | VALUE | self,
|  | size_t | size )

Definition at line 1683 of file io_buffer.c.

## ◆ rb_io_buffer_transfer()

VALUE rb_io_buffer_transfer | ( | VALUE | self | ) |

Definition at line 1636 of file io_buffer.c.

## ◆ rb_io_buffer_try_unlock()

int rb_io_buffer_try_unlock | ( | VALUE | self | ) |

Definition at line 1365 of file io_buffer.c.

## ◆ rb_io_buffer_unlock()

VALUE rb_io_buffer_unlock | ( | VALUE | self | ) |

Definition at line 1354 of file io_buffer.c.

## ◆ rb_io_buffer_write()

VALUE rb_io_buffer_write | ( | VALUE | self,
|  | VALUE | io,
|  | size_t | length,
|  | size_t | offset )

Definition at line 3038 of file io_buffer.c.

## Variable Documentation

## ◆ rb_cIOBuffer

VALUE rb_cIOBuffer
| extern

Definition at line 24 of file io_buffer.c.

## ◆ RUBY_IO_BUFFER_DEFAULT_SIZE

size_t RUBY_IO_BUFFER_DEFAULT_SIZE
| extern

Definition at line 32 of file io_buffer.c.

## ◆ RUBY_IO_BUFFER_PAGE_SIZE

size_t RUBY_IO_BUFFER_PAGE_SIZE
| extern

Definition at line 31 of file io_buffer.c.