Ruby  3.1.4p223 (2023-03-30 revision HEAD)
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
67 struct timeval;
68 
74 typedef struct {
75  int maxfd;
76  fd_set *fdset;
77 } rb_fdset_t;
78 
89 
100 
109 
118 void rb_fd_set(int fd, rb_fdset_t *f);
119 
128 void rb_fd_clr(int fd, rb_fdset_t *f);
129 
141 int rb_fd_isset(int fd, const rb_fdset_t *f);
142 
151 void rb_fd_copy(rb_fdset_t *dst, const fd_set *src, int max);
152 
161 void rb_fd_dup(rb_fdset_t *dst, const rb_fdset_t *src);
162 
180 int rb_fd_select(int nfds, rb_fdset_t *rfds, rb_fdset_t *wfds, rb_fdset_t *efds, struct timeval *timeout);
182 
197 static inline fd_set *
199 {
200  return f->fdset;
201 }
202 
211 static 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
static fd_set * rb_fd_ptr(const rb_fdset_t *f)
Raw pointer to fd_set.
Definition: largesize.h:198
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.
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).
Definition: largesize.h:74
int maxfd
Maximum allowed number of FDs.
Definition: largesize.h:75
fd_set * fdset
File descriptors buffer.
Definition: largesize.h:76