Ruby  3.4.0dev (2024-12-06 revision 892c46283a5ea4179500d951c9d4866c0051f27b)
Macros | Typedefs | Functions
posix.h File Reference

(892c46283a5ea4179500d951c9d4866c0051f27b)

Public APIs to provide rb_fd_select(). More...

#include "ruby/internal/config.h"
#include "ruby/internal/attr/const.h"
#include "ruby/internal/attr/noalias.h"
#include "ruby/internal/attr/nonnull.h"
#include "ruby/internal/attr/pure.h"
Include dependency graph for posix.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define rb_fd_zero   FD_ZERO
 Clears the given rb_fdset_t. More...
 
#define rb_fd_set   FD_SET
 Sets the given fd to the rb_fdset_t. More...
 
#define rb_fd_clr   FD_CLR
 Unsets the given fd from the rb_fdset_t. More...
 
#define rb_fd_isset   FD_ISSET
 Queries if the given fd is in the rb_fdset_t. More...
 
#define rb_fd_init   FD_ZERO
 Initialises the :given :rb_fdset_t. More...
 
#define rb_fd_select   select
 Waits for multiple file descriptors at once. More...
 

Typedefs

typedef fd_set rb_fdset_t
 The data structure which wraps the fd_set bitmap used by select(2). More...
 

Functions

static void rb_fd_copy (rb_fdset_t *dst, const fd_set *src, int n)
 Destructively overwrites an fdset with another. More...
 
static void rb_fd_dup (rb_fdset_t *dst, const fd_set *src)
 Destructively overwrites an fdset with another. More...
 
static fd_set * rb_fd_ptr (rb_fdset_t *f)
 Raw pointer to fd_set. More...
 
static int rb_fd_max (const rb_fdset_t *f)
 It seems this function has no use. More...
 

Detailed Description

Public APIs to provide rb_fd_select().

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 posix.h.

Macro Definition Documentation

◆ rb_fd_clr

#define rb_fd_clr   FD_CLR

Unsets the given fd from the rb_fdset_t.

Definition at line 57 of file posix.h.

◆ rb_fd_init

#define rb_fd_init   FD_ZERO

Initialises the :given :rb_fdset_t.

Definition at line 63 of file posix.h.

◆ rb_fd_isset

#define rb_fd_isset   FD_ISSET

Queries if the given fd is in the rb_fdset_t.

Definition at line 60 of file posix.h.

◆ rb_fd_select

#define rb_fd_select   select

Waits for multiple file descriptors at once.

Definition at line 66 of file posix.h.

◆ rb_fd_set

#define rb_fd_set   FD_SET

Sets the given fd to the rb_fdset_t.

Definition at line 54 of file posix.h.

◆ rb_fd_zero

#define rb_fd_zero   FD_ZERO

Clears the given rb_fdset_t.

Definition at line 51 of file posix.h.

Typedef Documentation

◆ rb_fdset_t

typedef fd_set rb_fdset_t

The data structure which wraps the fd_set bitmap used by select(2).

This allows Ruby to use FD sets larger than what has been historically allowed on modern platforms.

Definition at line 48 of file posix.h.

Function Documentation

◆ rb_fd_copy()

static void rb_fd_copy ( rb_fdset_t dst,
const fd_set *  src,
int  n 
)
inlinestatic

Destructively overwrites an fdset with another.

Parameters
[out]dstTarget fdset.
[in]srcSource fdset.
[in]nUnused parameter.
Postcondition
dst is a copy of src.

Definition at line 86 of file posix.h.

◆ rb_fd_dup()

static void rb_fd_dup ( rb_fdset_t dst,
const fd_set *  src 
)
inlinestatic

Destructively overwrites an fdset with another.

Parameters
[out]dstTarget fdset.
[in]srcSource fdset.
Postcondition
dst is a copy of src.

Definition at line 101 of file posix.h.

◆ rb_fd_max()

static int rb_fd_max ( const rb_fdset_t f)
inlinestatic

It seems this function has no use.

Maybe just remove?

Parameters
[in]fA set.
Returns
Number of file descriptors stored.

Definition at line 133 of file posix.h.

◆ rb_fd_ptr()

static fd_set* rb_fd_ptr ( rb_fdset_t f)
inlinestatic

Raw pointer to fd_set.

Parameters
[in]fTarget fdset.
Returns
Underlying fd_set.

Definition at line 120 of file posix.h.