Ruby: include/ruby/internal/intern/select/largesize.h Source File

Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)

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#include "ruby/internal/attr/nonnull.h"
59#include "ruby/internal/attr/pure.h"
60#include "ruby/internal/dllexport.h"
61
63#define rb_fd_ptr rb_fd_ptr
64#define rb_fd_max rb_fd_max
67struct timeval;
68
69 typedef struct {
70 int maxfd;
71 fd_set *fdset;
72} rb_fdset_t;
73
74 RBIMPL_SYMBOL_EXPORT_BEGIN()
75void rb_fd_init(rb_fdset_t *);
76 void rb_fd_term(rb_fdset_t *);
77 void rb_fd_zero(rb_fdset_t *);
78 void rb_fd_set(int, rb_fdset_t *);
79 void rb_fd_clr(int, rb_fdset_t *);
80 int rb_fd_isset(int, const rb_fdset_t *);
81 void rb_fd_copy(rb_fdset_t *, const fd_set *, int);
82 void rb_fd_dup(rb_fdset_t *dst, const rb_fdset_t *src);
83 int rb_fd_select(int, rb_fdset_t *, rb_fdset_t *, rb_fdset_t *, struct timeval *);
84 RBIMPL_SYMBOL_EXPORT_END()
85
86 RBIMPL_ATTR_NONNULL(())
87 RBIMPL_ATTR_PURE()
88/* :TODO: can this function be __attribute__((returns_nonnull)) or not? */
89static inline fd_set *
90rb_fd_ptr(const rb_fdset_t *f)
91{
92 return f->fdset;
93}
94
95 RBIMPL_ATTR_NONNULL(())
96 RBIMPL_ATTR_PURE()
97static inline int
98rb_fd_max(const rb_fdset_t *f)
99{
100 return f->maxfd;
101}
102
103#endif /* RBIMPL_INTERN_SELECT_LARGESIZE_H */
dllexport.h
Tewaking visibility of C variables/functions.
RBIMPL_SYMBOL_EXPORT_END
#define RBIMPL_SYMBOL_EXPORT_END()
Counterpart of RBIMPL_SYMBOL_EXPORT_BEGIN.
Definition: dllexport.h:86
RBIMPL_SYMBOL_EXPORT_BEGIN
#define RBIMPL_SYMBOL_EXPORT_BEGIN()
Shortcut macro equivalent to RUBY_SYMBOL_EXPORT_BEGIN extern "C" {.
Definition: dllexport.h:77
rb_fd_copy
void rb_fd_copy(rb_fdset_t *, const fd_set *, int)
rb_fd_dup
void rb_fd_dup(rb_fdset_t *dst, const rb_fdset_t *src)
nonnull.h
Defines RBIMPL_ATTR_NONNULL.
RBIMPL_ATTR_NONNULL
#define RBIMPL_ATTR_NONNULL(list)
Wraps (or simulates) __attribute__((nonnull))
Definition: nonnull.h:29
rb_fd_isset
#define rb_fd_isset
Definition: posix.h:41
rb_fd_select
#define rb_fd_select
Definition: posix.h:43
rb_fd_init
#define rb_fd_init
Definition: posix.h:42
rb_fd_set
#define rb_fd_set
Definition: posix.h:39
rb_fd_zero
#define rb_fd_zero
Definition: posix.h:38
rb_fd_clr
#define rb_fd_clr
Definition: posix.h:40
rb_fd_term
#define rb_fd_term(f)
Definition: posix.h:80
pure.h
Defines RBIMPL_ATTR_PURE.
RBIMPL_ATTR_PURE
#define RBIMPL_ATTR_PURE()
Wraps (or simulates) __attribute__((pure))
Definition: pure.h:33
f
#define f
const
#define const
Definition: strftime.c:108
rb_fdset_t
Definition: largesize.h:69
rb_fdset_t::maxfd
int maxfd
Definition: largesize.h:70
rb_fdset_t::fdset
fd_set * fdset
Definition: largesize.h:71
timeval
Definition: missing.h:51