Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)
posix.h
Go to the documentation of this file.
1#ifndef RBIMPL_INTERN_SELECT_POSIX_H /*-*-C++-*-vi:se ft=cpp:*/
2#define RBIMPL_INTERN_SELECT_POSIX_H
24
25#ifdef HAVE_SYS_SELECT_H
26# include <sys/select.h> /* for select(2) (modern POSIX) */
27#endif
28
29#ifdef HAVE_UNISTD_H
30# include <unistd.h> /* for select(2) (archaic UNIX) */
31#endif
32
35
36typedef fd_set rb_fdset_t;
37
38#define rb_fd_zero FD_ZERO
39#define rb_fd_set FD_SET
40#define rb_fd_clr FD_CLR
41#define rb_fd_isset FD_ISSET
42#define rb_fd_init FD_ZERO
43#define rb_fd_select select
45#define rb_fd_copy rb_fd_copy
46#define rb_fd_dup rb_fd_dup
47#define rb_fd_ptr rb_fd_ptr
48#define rb_fd_max rb_fd_max
51static inline void
52rb_fd_copy(rb_fdset_t *dst, const fd_set *src, int n)
53{
54 *dst = *src;
55}
56
57static inline void
58rb_fd_dup(rb_fdset_t *dst, const fd_set *src)
59{
60 *dst = *src;
61}
62
64/* :TODO: can this function be __attribute__((returns_nonnull)) or not? */
65static inline fd_set *
66rb_fd_ptr(rb_fdset_t *f)
67{
68 return f;
69}
70
72static inline int
73rb_fd_max(const rb_fdset_t *f)
74{
75 return FD_SETSIZE;
76}
77
78/* :FIXME: What are these? They don't exist for shibling implementations. */
79#define rb_fd_init_copy(d, s) (*(d) = *(s))
80#define rb_fd_term(f) ((void)(f))
81
82#endif /* RBIMPL_INTERN_SELECT_POSIX_H */
Defines RBIMPL_ATTR_CONST.
#define RBIMPL_ATTR_CONST()
Wraps (or simulates) __attribute__((const))
Definition: const.h:36
Thin wrapper to ruby/config.h.
void rb_fd_copy(rb_fdset_t *, const fd_set *, int)
void rb_fd_dup(rb_fdset_t *dst, const rb_fdset_t *src)
fd_set rb_fdset_t
Definition: posix.h:36
Defines RBIMPL_ATTR_PURE.
#define RBIMPL_ATTR_PURE()
Wraps (or simulates) __attribute__((pure))
Definition: pure.h:33
#define f
#define const
Definition: strftime.c:108