Ruby  3.4.0dev (2024-11-22 revision 0989400a925cd201defdca9eb28eb87200b30785)
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
58 
60 #define rb_fd_ptr rb_fd_ptr
61 #define rb_fd_max rb_fd_max
64 struct timeval;
65 
71 typedef struct {
72  int maxfd;
73  fd_set *fdset;
74 } rb_fdset_t;
75 
86 
97 
106 
115 void rb_fd_set(int fd, rb_fdset_t *f);
116 
125 void rb_fd_clr(int fd, rb_fdset_t *f);
126 
138 int rb_fd_isset(int fd, const rb_fdset_t *f);
139 
148 void rb_fd_copy(rb_fdset_t *dst, const fd_set *src, int max);
149 
158 void rb_fd_dup(rb_fdset_t *dst, const rb_fdset_t *src);
159 
177 int rb_fd_select(int nfds, rb_fdset_t *rfds, rb_fdset_t *wfds, rb_fdset_t *efds, struct timeval *timeout);
179 
194 static inline fd_set *
196 {
197  return f->fdset;
198 }
199 
208 static inline int
210 {
211  return f->maxfd;
212 }
213 
214 #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:74
#define RBIMPL_SYMBOL_EXPORT_BEGIN()
Shortcut macro equivalent to RUBY_SYMBOL_EXPORT_BEGIN extern "C" {.
Definition: dllexport.h:65
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:209
static fd_set * rb_fd_ptr(const rb_fdset_t *f)
Raw pointer to fd_set.
Definition: largesize.h:195
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
#define inline
Old Visual Studio versions do not support the inline keyword, so we need to define it to be __inline.
Definition: defines.h:88
Defines RBIMPL_ATTR_PURE.
The data structure which wraps the fd_set bitmap used by select(2).
Definition: largesize.h:71
int maxfd
Maximum allowed number of FDs.
Definition: largesize.h:72
fd_set * fdset
File descriptors buffer.
Definition: largesize.h:73