io-event 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/ext/mkmf.log ADDED
@@ -0,0 +1,275 @@
1
+ have_func: checking for rb_ext_ractor_safe()... -------------------- yes
2
+
3
+ "clang -fdeclspec -o conftest -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0/arm64-darwin21 -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0/ruby/backward -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0 -I. -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens -pipe -Wall conftest.c -L. -L/Users/samuel/.rubies/ruby-3.0.3/lib -L/opt/local/lib -L. -fstack-protector-strong -L/opt/local/lib -m64 -lruby.3.0-static -framework Security -framework Foundation -lpthread -lgmp -ldl -lobjc "
4
+ checked program was:
5
+ /* begin */
6
+ 1: #include "ruby.h"
7
+ 2:
8
+ 3: int main(int argc, char **argv)
9
+ 4: {
10
+ 5: return !!argv[argc];
11
+ 6: }
12
+ /* end */
13
+
14
+ "clang -fdeclspec -o conftest -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0/arm64-darwin21 -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0/ruby/backward -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0 -I. -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens -pipe -Wall conftest.c -L. -L/Users/samuel/.rubies/ruby-3.0.3/lib -L/opt/local/lib -L. -fstack-protector-strong -L/opt/local/lib -m64 -lruby.3.0-static -framework Security -framework Foundation -lpthread -lgmp -ldl -lobjc "
15
+ checked program was:
16
+ /* begin */
17
+ 1: #include "ruby.h"
18
+ 2:
19
+ 3: /*top*/
20
+ 4: extern int t(void);
21
+ 5: int main(int argc, char **argv)
22
+ 6: {
23
+ 7: if (argc > 1000000) {
24
+ 8: int (* volatile tp)(void)=(int (*)(void))&t;
25
+ 9: printf("%d", (*tp)());
26
+ 10: }
27
+ 11:
28
+ 12: return !!argv[argc];
29
+ 13: }
30
+ 14: int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_ext_ractor_safe; return !p; }
31
+ /* end */
32
+
33
+ --------------------
34
+
35
+ have_func: checking for &rb_fiber_transfer()... -------------------- no
36
+
37
+ "clang -fdeclspec -o conftest -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0/arm64-darwin21 -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0/ruby/backward -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0 -I. -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens -pipe -Wall conftest.c -L. -L/Users/samuel/.rubies/ruby-3.0.3/lib -L/opt/local/lib -L. -fstack-protector-strong -L/opt/local/lib -m64 -lruby.3.0-static -framework Security -framework Foundation -lpthread -lgmp -ldl -lobjc "
38
+ conftest.c:14:76: error: use of undeclared identifier 'rb_fiber_transfer'
39
+ int t(void) { const volatile void *volatile p; p = (const volatile void *)&rb_fiber_transfer; return !p; }
40
+ ^
41
+ 1 error generated.
42
+ checked program was:
43
+ /* begin */
44
+ 1: #include "ruby.h"
45
+ 2:
46
+ 3: /*top*/
47
+ 4: extern int t(void);
48
+ 5: int main(int argc, char **argv)
49
+ 6: {
50
+ 7: if (argc > 1000000) {
51
+ 8: int (* volatile tp)(void)=(int (*)(void))&t;
52
+ 9: printf("%d", (*tp)());
53
+ 10: }
54
+ 11:
55
+ 12: return !!argv[argc];
56
+ 13: }
57
+ 14: int t(void) { const volatile void *volatile p; p = (const volatile void *)&rb_fiber_transfer; return !p; }
58
+ /* end */
59
+
60
+ --------------------
61
+
62
+ have_library: checking for -luring... -------------------- no
63
+
64
+ "clang -fdeclspec -o conftest -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0/arm64-darwin21 -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0/ruby/backward -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0 -I. -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens -pipe -Wall conftest.c -L. -L/Users/samuel/.rubies/ruby-3.0.3/lib -L/opt/local/lib -L. -fstack-protector-strong -L/opt/local/lib -m64 -lruby.3.0-static -framework Security -framework Foundation -lpthread -lgmp -ldl -lobjc -luring "
65
+ ld: library not found for -luring
66
+ clang: error: linker command failed with exit code 1 (use -v to see invocation)
67
+ checked program was:
68
+ /* begin */
69
+ 1: #include "ruby.h"
70
+ 2:
71
+ 3: /*top*/
72
+ 4: extern int t(void);
73
+ 5: int main(int argc, char **argv)
74
+ 6: {
75
+ 7: if (argc > 1000000) {
76
+ 8: int (* volatile tp)(void)=(int (*)(void))&t;
77
+ 9: printf("%d", (*tp)());
78
+ 10: }
79
+ 11:
80
+ 12: return !!argv[argc];
81
+ 13: }
82
+ 14:
83
+ 15: int t(void) { ; return 0; }
84
+ /* end */
85
+
86
+ --------------------
87
+
88
+ have_header: checking for sys/epoll.h... -------------------- no
89
+
90
+ "clang -E -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0/arm64-darwin21 -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0/ruby/backward -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0 -I. -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens -pipe -Wall conftest.c -o conftest.i"
91
+ conftest.c:3:10: fatal error: 'sys/epoll.h' file not found
92
+ #include <sys/epoll.h>
93
+ ^~~~~~~~~~~~~
94
+ 1 error generated.
95
+ checked program was:
96
+ /* begin */
97
+ 1: #include "ruby.h"
98
+ 2:
99
+ 3: #include <sys/epoll.h>
100
+ /* end */
101
+
102
+ --------------------
103
+
104
+ have_header: checking for sys/event.h... -------------------- yes
105
+
106
+ "clang -E -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0/arm64-darwin21 -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0/ruby/backward -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0 -I. -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens -pipe -Wall conftest.c -o conftest.i"
107
+ checked program was:
108
+ /* begin */
109
+ 1: #include "ruby.h"
110
+ 2:
111
+ 3: #include <sys/event.h>
112
+ /* end */
113
+
114
+ --------------------
115
+
116
+ have_func: checking for rb_io_descriptor()... -------------------- no
117
+
118
+ "clang -fdeclspec -o conftest -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0/arm64-darwin21 -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0/ruby/backward -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0 -I. -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens -pipe -Wall conftest.c -L. -L/Users/samuel/.rubies/ruby-3.0.3/lib -L/opt/local/lib -L. -fstack-protector-strong -L/opt/local/lib -m64 -lruby.3.0-static -framework Security -framework Foundation -lpthread -lgmp -ldl -lobjc "
119
+ conftest.c:14:57: error: use of undeclared identifier 'rb_io_descriptor'
120
+ int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_io_descriptor; return !p; }
121
+ ^
122
+ 1 error generated.
123
+ checked program was:
124
+ /* begin */
125
+ 1: #include "ruby.h"
126
+ 2:
127
+ 3: /*top*/
128
+ 4: extern int t(void);
129
+ 5: int main(int argc, char **argv)
130
+ 6: {
131
+ 7: if (argc > 1000000) {
132
+ 8: int (* volatile tp)(void)=(int (*)(void))&t;
133
+ 9: printf("%d", (*tp)());
134
+ 10: }
135
+ 11:
136
+ 12: return !!argv[argc];
137
+ 13: }
138
+ 14: int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_io_descriptor; return !p; }
139
+ /* end */
140
+
141
+ "clang -fdeclspec -o conftest -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0/arm64-darwin21 -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0/ruby/backward -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0 -I. -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens -pipe -Wall conftest.c -L. -L/Users/samuel/.rubies/ruby-3.0.3/lib -L/opt/local/lib -L. -fstack-protector-strong -L/opt/local/lib -m64 -lruby.3.0-static -framework Security -framework Foundation -lpthread -lgmp -ldl -lobjc "
142
+ Undefined symbols for architecture arm64:
143
+ "_rb_io_descriptor", referenced from:
144
+ _t in conftest-3f9e69.o
145
+ ld: symbol(s) not found for architecture arm64
146
+ clang: error: linker command failed with exit code 1 (use -v to see invocation)
147
+ checked program was:
148
+ /* begin */
149
+ 1: #include "ruby.h"
150
+ 2:
151
+ 3: /*top*/
152
+ 4: extern int t(void);
153
+ 5: int main(int argc, char **argv)
154
+ 6: {
155
+ 7: if (argc > 1000000) {
156
+ 8: int (* volatile tp)(void)=(int (*)(void))&t;
157
+ 9: printf("%d", (*tp)());
158
+ 10: }
159
+ 11:
160
+ 12: return !!argv[argc];
161
+ 13: }
162
+ 14: extern void rb_io_descriptor();
163
+ 15: int t(void) { rb_io_descriptor(); return 0; }
164
+ /* end */
165
+
166
+ --------------------
167
+
168
+ have_func: checking for &rb_process_status_wait()... -------------------- no
169
+
170
+ "clang -fdeclspec -o conftest -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0/arm64-darwin21 -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0/ruby/backward -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0 -I. -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens -pipe -Wall conftest.c -L. -L/Users/samuel/.rubies/ruby-3.0.3/lib -L/opt/local/lib -L. -fstack-protector-strong -L/opt/local/lib -m64 -lruby.3.0-static -framework Security -framework Foundation -lpthread -lgmp -ldl -lobjc "
171
+ conftest.c:14:76: error: use of undeclared identifier 'rb_process_status_wait'
172
+ int t(void) { const volatile void *volatile p; p = (const volatile void *)&rb_process_status_wait; return !p; }
173
+ ^
174
+ 1 error generated.
175
+ checked program was:
176
+ /* begin */
177
+ 1: #include "ruby.h"
178
+ 2:
179
+ 3: /*top*/
180
+ 4: extern int t(void);
181
+ 5: int main(int argc, char **argv)
182
+ 6: {
183
+ 7: if (argc > 1000000) {
184
+ 8: int (* volatile tp)(void)=(int (*)(void))&t;
185
+ 9: printf("%d", (*tp)());
186
+ 10: }
187
+ 11:
188
+ 12: return !!argv[argc];
189
+ 13: }
190
+ 14: int t(void) { const volatile void *volatile p; p = (const volatile void *)&rb_process_status_wait; return !p; }
191
+ /* end */
192
+
193
+ --------------------
194
+
195
+ have_func: checking for rb_fiber_current()... -------------------- yes
196
+
197
+ "clang -fdeclspec -o conftest -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0/arm64-darwin21 -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0/ruby/backward -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0 -I. -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens -pipe -Wall conftest.c -L. -L/Users/samuel/.rubies/ruby-3.0.3/lib -L/opt/local/lib -L. -fstack-protector-strong -L/opt/local/lib -m64 -lruby.3.0-static -framework Security -framework Foundation -lpthread -lgmp -ldl -lobjc "
198
+ checked program was:
199
+ /* begin */
200
+ 1: #include "ruby.h"
201
+ 2:
202
+ 3: /*top*/
203
+ 4: extern int t(void);
204
+ 5: int main(int argc, char **argv)
205
+ 6: {
206
+ 7: if (argc > 1000000) {
207
+ 8: int (* volatile tp)(void)=(int (*)(void))&t;
208
+ 9: printf("%d", (*tp)());
209
+ 10: }
210
+ 11:
211
+ 12: return !!argv[argc];
212
+ 13: }
213
+ 14: int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_fiber_current; return !p; }
214
+ /* end */
215
+
216
+ --------------------
217
+
218
+ have_func: checking for &rb_fiber_raise()... -------------------- no
219
+
220
+ "clang -fdeclspec -o conftest -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0/arm64-darwin21 -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0/ruby/backward -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0 -I. -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens -pipe -Wall conftest.c -L. -L/Users/samuel/.rubies/ruby-3.0.3/lib -L/opt/local/lib -L. -fstack-protector-strong -L/opt/local/lib -m64 -lruby.3.0-static -framework Security -framework Foundation -lpthread -lgmp -ldl -lobjc "
221
+ conftest.c:14:76: error: use of undeclared identifier 'rb_fiber_raise'; did you mean 'rb_fiber_resume'?
222
+ int t(void) { const volatile void *volatile p; p = (const volatile void *)&rb_fiber_raise; return !p; }
223
+ ^~~~~~~~~~~~~~
224
+ rb_fiber_resume
225
+ /Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0/ruby/internal/intern/cont.h:32:7: note: 'rb_fiber_resume' declared here
226
+ VALUE rb_fiber_resume(VALUE fib, int argc, const VALUE *argv);
227
+ ^
228
+ 1 error generated.
229
+ checked program was:
230
+ /* begin */
231
+ 1: #include "ruby.h"
232
+ 2:
233
+ 3: /*top*/
234
+ 4: extern int t(void);
235
+ 5: int main(int argc, char **argv)
236
+ 6: {
237
+ 7: if (argc > 1000000) {
238
+ 8: int (* volatile tp)(void)=(int (*)(void))&t;
239
+ 9: printf("%d", (*tp)());
240
+ 10: }
241
+ 11:
242
+ 12: return !!argv[argc];
243
+ 13: }
244
+ 14: int t(void) { const volatile void *volatile p; p = (const volatile void *)&rb_fiber_raise; return !p; }
245
+ /* end */
246
+
247
+ --------------------
248
+
249
+ have_header: checking for ruby/io/buffer.h... -------------------- no
250
+
251
+ "clang -E -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0/arm64-darwin21 -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0/ruby/backward -I/Users/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0 -I. -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens -pipe -Wall conftest.c -o conftest.i"
252
+ conftest.c:3:10: fatal error: 'ruby/io/buffer.h' file not found
253
+ #include <ruby/io/buffer.h>
254
+ ^~~~~~~~~~~~~~~~~~
255
+ conftest.c:3:10: note: did not find header 'io/buffer.h' in framework 'ruby' (loaded from '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks')
256
+ 1 error generated.
257
+ checked program was:
258
+ /* begin */
259
+ 1: #include "ruby.h"
260
+ 2:
261
+ 3: #include <ruby/io/buffer.h>
262
+ /* end */
263
+
264
+ --------------------
265
+
266
+ extconf.h is:
267
+ /* begin */
268
+ 1: #ifndef EXTCONF_H
269
+ 2: #define EXTCONF_H
270
+ 3: #define HAVE_RB_EXT_RACTOR_SAFE 1
271
+ 4: #define HAVE_SYS_EVENT_H 1
272
+ 5: #define HAVE_RB_FIBER_CURRENT 1
273
+ 6: #endif
274
+ /* end */
275
+
data/ext/selector.o ADDED
Binary file
@@ -0,0 +1,149 @@
1
+ # Copyright, 2021, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ # THE SOFTWARE.
20
+
21
+ module IO::Event
22
+ module Debug
23
+ # Enforces the selector interface and delegates operations to a wrapped selector instance.
24
+ class Selector
25
+ def initialize(selector)
26
+ @selector = selector
27
+
28
+ @readable = {}
29
+ @writable = {}
30
+ @priority = {}
31
+ end
32
+
33
+ def close
34
+ if @selector.nil?
35
+ raise "Selector already closed!"
36
+ end
37
+
38
+ @selector.close
39
+ @selector = nil
40
+ end
41
+
42
+ def transfer(fiber, *arguments)
43
+ @selector.transfer(fiber, *arguments)
44
+ end
45
+
46
+ def transfer(*arguments)
47
+ @selector.transfer(*arguments)
48
+ end
49
+
50
+ def resume(*arguments)
51
+ @selector.resume(*arguments)
52
+ end
53
+
54
+ def yield
55
+ @selector.yield
56
+ end
57
+
58
+ def push(fiber)
59
+ @selector.push(fiber)
60
+ end
61
+
62
+ def raise(fiber, *arguments)
63
+ @selector.raise(fiber, *arguments)
64
+ end
65
+
66
+ def ready?
67
+ @selector.ready?
68
+ end
69
+
70
+ def process_wait(*arguments)
71
+ @selector.process_wait(*arguments)
72
+ end
73
+
74
+ def io_wait(fiber, io, events)
75
+ register_readable(fiber, io, events)
76
+ end
77
+
78
+ if IO.const_defined?(:Buffer)
79
+ def io_read(fiber, io, buffer, length)
80
+ @selector.io_read(fiber, io, buffer, length)
81
+ end
82
+
83
+ def io_write(fiber, io, buffer, length)
84
+ @selector.io_write(fiber, io, buffer, length)
85
+ end
86
+ end
87
+
88
+ def select(duration = nil)
89
+ @selector.select(duration)
90
+ end
91
+
92
+ private
93
+
94
+ def register_readable(fiber, io, events)
95
+ if (events & READABLE) > 0
96
+ if @readable.key?(io)
97
+ raise "Cannot wait for #{io} to become readable from multiple fibers."
98
+ end
99
+
100
+ begin
101
+ @readable[io] = fiber
102
+
103
+ register_writable(fiber, io, events)
104
+ ensure
105
+ @readable.delete(io)
106
+ end
107
+ else
108
+ register_writable(fiber, io, events)
109
+ end
110
+ end
111
+
112
+ def register_writable(fiber, io, events)
113
+ if (events & WRITABLE) > 0
114
+ if @writable.key?(io)
115
+ raise "Cannot wait for #{io} to become writable from multiple fibers."
116
+ end
117
+
118
+ begin
119
+ @writable[io] = fiber
120
+
121
+ register_priority(fiber, io, events)
122
+ ensure
123
+ @writable.delete(io)
124
+ end
125
+ else
126
+ register_priority(fiber, io, events)
127
+ end
128
+ end
129
+
130
+ def register_priority(fiber, io, events)
131
+ if (events & PRIORITY) > 0
132
+ if @priority.key?(io)
133
+ raise "Cannot wait for #{io} to become priority from multiple fibers."
134
+ end
135
+
136
+ begin
137
+ @priority[io] = fiber
138
+
139
+ @selector.io_wait(fiber, io, events)
140
+ ensure
141
+ @priority.delete(io)
142
+ end
143
+ else
144
+ @selector.io_wait(fiber, io, events)
145
+ end
146
+ end
147
+ end
148
+ end
149
+ end
@@ -0,0 +1,219 @@
1
+ # Copyright, 2021, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ # THE SOFTWARE.
20
+
21
+ module IO::Event
22
+ module Selector
23
+ class Select
24
+ def initialize(loop)
25
+ @loop = loop
26
+
27
+ @readable = {}
28
+ @writable = {}
29
+
30
+ @ready = Queue.new
31
+ end
32
+
33
+ def close
34
+ @loop = nil
35
+ @readable = nil
36
+ @writable = nil
37
+ end
38
+
39
+ Optional = Struct.new(:fiber) do
40
+ def transfer(*arguments)
41
+ fiber&.transfer(*arguments)
42
+ end
43
+
44
+ def alive?
45
+ fiber&.alive?
46
+ end
47
+
48
+ def nullify
49
+ self.fiber = nil
50
+ end
51
+ end
52
+
53
+ # Transfer from the current fiber to the event loop.
54
+ def transfer
55
+ @loop.transfer
56
+ end
57
+
58
+ # Transfer from the current fiber to the specified fiber. Put the current fiber into the ready list.
59
+ def resume(fiber, *arguments)
60
+ optional = Optional.new(Fiber.current)
61
+ @ready.push(optional)
62
+
63
+ fiber.transfer(*arguments)
64
+ ensure
65
+ optional.nullify
66
+ end
67
+
68
+ # Yield from the current fiber back to the event loop. Put the current fiber into the ready list.
69
+ def yield
70
+ optional = Optional.new(Fiber.current)
71
+ @ready.push(optional)
72
+
73
+ @loop.transfer
74
+ ensure
75
+ optional.nullify
76
+ end
77
+
78
+ # Append the given fiber into the ready list.
79
+ def push(fiber)
80
+ @ready.push(fiber)
81
+ end
82
+
83
+ # Transfer to the given fiber and raise an exception. Put the current fiber into the ready list.
84
+ def raise(fiber, *arguments)
85
+ optional = Optional.new(Fiber.current)
86
+ @ready.push(optional)
87
+
88
+ fiber.raise(*arguments)
89
+ ensure
90
+ optional.nullify
91
+ end
92
+
93
+ def ready?
94
+ !@ready.empty?
95
+ end
96
+
97
+ def io_wait(fiber, io, events)
98
+ remove_readable = remove_writable = false
99
+
100
+ if (events & READABLE) > 0 or (events & PRIORITY) > 0
101
+ @readable[io] = fiber
102
+ remove_readable = true
103
+ end
104
+
105
+ if (events & WRITABLE) > 0
106
+ @writable[io] = fiber
107
+ remove_writable = true
108
+ end
109
+
110
+ @loop.transfer
111
+ ensure
112
+ @readable.delete(io) if remove_readable
113
+ @writable.delete(io) if remove_writable
114
+ end
115
+
116
+ if IO.const_defined?(:Buffer)
117
+ def io_read(fiber, io, buffer, length)
118
+ offset = 0
119
+
120
+ while length > 0
121
+ # The maximum size we can read:
122
+ maximum_size = buffer.size - offset
123
+
124
+ case result = io.read_nonblock(maximum_size, exception: false)
125
+ when :wait_readable
126
+ self.io_wait(fiber, io, READABLE)
127
+ when :wait_writable
128
+ self.io_wait(fiber, io, WRITABLE)
129
+ else
130
+ break unless result
131
+
132
+ buffer.copy(result, offset)
133
+
134
+ offset += result.bytesize
135
+ length -= result.bytesize
136
+ end
137
+ end
138
+
139
+ return offset
140
+ end
141
+
142
+ def io_write(fiber, io, buffer, length)
143
+ offset = 0
144
+
145
+ while length > 0
146
+ # From offset until the end:
147
+ chunk = buffer.to_str(offset, length)
148
+ case result = io.write_nonblock(chunk, exception: false)
149
+ when :wait_readable
150
+ self.io_wait(fiber, io, READABLE)
151
+ when :wait_writable
152
+ self.io_wait(fiber, io, WRITABLE)
153
+ else
154
+ offset += result
155
+ length -= result
156
+ end
157
+ end
158
+
159
+ return offset
160
+ end
161
+ end
162
+
163
+ def process_wait(fiber, pid, flags)
164
+ r, w = IO.pipe
165
+
166
+ thread = Thread.new do
167
+ Process::Status.wait(pid, flags)
168
+ ensure
169
+ w.close
170
+ end
171
+
172
+ self.io_wait(fiber, r, READABLE)
173
+
174
+ return thread.value
175
+ ensure
176
+ r.close
177
+ w.close
178
+ thread&.kill
179
+ end
180
+
181
+ private def pop_ready
182
+ unless @ready.empty?
183
+ count = @ready.size
184
+
185
+ count.times do
186
+ fiber = @ready.pop
187
+ fiber.transfer if fiber.alive?
188
+ end
189
+
190
+ return true
191
+ end
192
+ end
193
+
194
+ def select(duration = nil)
195
+ if pop_ready
196
+ duration = 0
197
+ end
198
+
199
+ readable, writable, _ = ::IO.select(@readable.keys, @writable.keys, nil, duration)
200
+
201
+ ready = Hash.new(0)
202
+
203
+ readable&.each do |io|
204
+ fiber = @readable.delete(io)
205
+ ready[fiber] |= READABLE
206
+ end
207
+
208
+ writable&.each do |io|
209
+ fiber = @writable.delete(io)
210
+ ready[fiber] |= WRITABLE
211
+ end
212
+
213
+ ready.each do |fiber, events|
214
+ fiber.transfer(events) if fiber.alive?
215
+ end
216
+ end
217
+ end
218
+ end
219
+ end