Ruby 3.1.3p185 (2022-11-24 revision 1a6b16756e0ba6b95ab71a441357ed5484e33498)
largesize.h
Go to the documentation of this file.
1#ifndef RBIMPL_INTERN_SELECT_LARGESIZE_H /*-*-C++-*-vi:se ft=cpp:*/
2#define RBIMPL_INTERN_SELECT_LARGESIZE_H
61
63#define rb_fd_ptr rb_fd_ptr
64#define rb_fd_max rb_fd_max
67struct timeval;
68
74typedef struct {
75 int maxfd;
76 fd_set *fdset;
78
89
100
109
118void rb_fd_set(int fd, rb_fdset_t *f);
119
128void rb_fd_clr(int fd, rb_fdset_t *f);
129
141int rb_fd_isset(int fd, const rb_fdset_t *f);
142
151void rb_fd_copy(rb_fdset_t *dst, const fd_set *src, int max);
152
161void rb_fd_dup(rb_fdset_t *dst, const rb_fdset_t *src);
162
180int rb_fd_select(int nfds, rb_fdset_t *rfds, rb_fdset_t *wfds, rb_fdset_t *efds, struct timeval *timeout);
182
197static inline fd_set *
199{
200 return f->fdset;
201}
202
211static inline int
213{
214 return f->maxfd;
215}
216
217#endif /* RBIMPL_INTERN_SELECT_LARGESIZE_H */
Tweaking visibility of C variables/functions.
#define RBIMPL_SYMBOL_EXPORT_END()
Counterpart of RBIMPL_SYMBOL_EXPORT_BEGIN.
Definition: dllexport.h:106
#define RBIMPL_SYMBOL_EXPORT_BEGIN()
Shortcut macro equivalent to RUBY_SYMBOL_EXPORT_BEGIN extern "C" {.
Definition: dllexport.h:97
RBIMPL_ATTR_PURE() int rb_io_read_pending(rb_io_t *fptr)
Queries if the passed IO has any pending reads.
void rb_fd_set(int fd, rb_fdset_t *f)
Sets an fd to a fdset.
static int rb_fd_max(const rb_fdset_t *f)
It seems this function has no use.
Definition: largesize.h:212
int rb_fd_select(int nfds, rb_fdset_t *rfds, rb_fdset_t *wfds, rb_fdset_t *efds, struct timeval *timeout)
Waits for multiple file descriptors at once.
int rb_fd_isset(int fd, const rb_fdset_t *f)
Queries if the given FD is in the given set.
void rb_fd_clr(int fd, rb_fdset_t *f)
Releases a specific FD from the given fdset.
void rb_fd_init(rb_fdset_t *f)
(Re-)initialises a fdset.
void rb_fd_copy(rb_fdset_t *dst, const fd_set *src, int max)
Destructively overwrites an fdset with another.
void rb_fd_dup(rb_fdset_t *dst, const rb_fdset_t *src)
Identical to rb_fd_copy(), except it copies unlimited number of file descriptors.
void rb_fd_term(rb_fdset_t *f)
Destroys the rb_fdset_t, releasing any memory and resources it used.
void rb_fd_zero(rb_fdset_t *f)
Wipes out the current set of FDs.
static fd_set * rb_fd_ptr(const rb_fdset_t *f)
Raw pointer to fd_set.
Definition: largesize.h:198
Defines RBIMPL_ATTR_NONNULL.
#define RBIMPL_ATTR_NONNULL(list)
Wraps (or simulates) __attribute__((nonnull))
Definition: nonnull.h:27
fd_set rb_fdset_t
The data structure which wraps the fd_set bitmap used by select(2).
Definition: posix.h:48
Defines RBIMPL_ATTR_PURE.
The data structure which wraps the fd_set bitmap used by select(2).