io-event 0.2.2 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/IO_Event.bundle +0 -0
- data/ext/Makefile +36 -34
- data/ext/event.o +0 -0
- data/ext/extconf.h +5 -3
- data/ext/interrupt.o +0 -0
- data/ext/io/event/interrupt.c +28 -4
- data/ext/io/event/selector/epoll.c +20 -10
- data/ext/io/event/selector/kqueue.c +18 -20
- data/ext/io/event/selector/uring.c +15 -8
- data/ext/kqueue.o +0 -0
- data/ext/mkmf.log +52 -93
- data/ext/selector.o +0 -0
- data/lib/io/event/selector/select.rb +6 -2
- data/lib/io/event/version.rb +1 -1
- metadata +5 -6
- data/ext/IO_Event.so +0 -0
- data/ext/epoll.o +0 -0
- data/ext/uring.o +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ac87cae13b6195eaa78351aff579000e12c3d9ed982d8202af4d745996a7a76
|
4
|
+
data.tar.gz: 1289b6e2f4c72ec34d5cdcb1565f5a9a96135a271a33370ac57ad958e4574da1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ecfb2339742c8f6bcfcdb1d263a3355a6a28d417d626a37c1ba20f68425b8cb4fe597a04b7b3464a09fd201192d0e23957393fc7975f09a29399eb9429096b74
|
7
|
+
data.tar.gz: 9690bdf7559834e9e3c5345c42fa8447188c5f2ee6a65983371432f3ffc69c1e5837f0364b57040e5e7a32f582b1d19580eb6c01d710951fa794953a2fc41079
|
data/ext/IO_Event.bundle
ADDED
Binary file
|
data/ext/Makefile
CHANGED
@@ -3,6 +3,7 @@ SHELL = /bin/sh
|
|
3
3
|
|
4
4
|
# V=0 quiet, V=1 verbose. other values don't work.
|
5
5
|
V = 0
|
6
|
+
V0 = $(V:0=)
|
6
7
|
Q1 = $(V:1=)
|
7
8
|
Q = $(Q1:0=@)
|
8
9
|
ECHO1 = $(V:1=@ :)
|
@@ -12,12 +13,12 @@ NULLCMD = :
|
|
12
13
|
#### Start of system configuration section. ####
|
13
14
|
|
14
15
|
srcdir = .
|
15
|
-
topdir = /
|
16
|
+
topdir = /Users/samuel/.rubies/ruby-head/include/ruby-3.1.0
|
16
17
|
hdrdir = $(topdir)
|
17
|
-
arch_hdrdir = /
|
18
|
+
arch_hdrdir = /Users/samuel/.rubies/ruby-head/include/ruby-3.1.0/arm64-darwin21
|
18
19
|
PATH_SEPARATOR = :
|
19
20
|
VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby:$(srcdir)/io/event:$(srcdir)/io/event/selector
|
20
|
-
prefix = $(DESTDIR)/
|
21
|
+
prefix = $(DESTDIR)/Users/samuel/.rubies/ruby-head
|
21
22
|
rubysitearchprefix = $(rubylibprefix)/$(sitearch)
|
22
23
|
rubyarchprefix = $(rubylibprefix)/$(arch)
|
23
24
|
rubylibprefix = $(libdir)/$(RUBY_BASE_NAME)
|
@@ -51,7 +52,7 @@ htmldir = $(docdir)
|
|
51
52
|
infodir = $(datarootdir)/info
|
52
53
|
docdir = $(datarootdir)/doc/$(PACKAGE)
|
53
54
|
oldincludedir = $(DESTDIR)/usr/include
|
54
|
-
includedir = $(prefix)/include
|
55
|
+
includedir = $(SDKROOT)$(prefix)/include
|
55
56
|
runstatedir = $(localstatedir)/run
|
56
57
|
localstatedir = $(prefix)/var
|
57
58
|
sharedstatedir = $(prefix)/com
|
@@ -65,58 +66,58 @@ archdir = $(rubyarchdir)
|
|
65
66
|
|
66
67
|
|
67
68
|
CC_WRAPPER =
|
68
|
-
CC =
|
69
|
-
CXX =
|
69
|
+
CC = clang
|
70
|
+
CXX = clang++
|
70
71
|
LIBRUBY = $(LIBRUBY_A)
|
71
72
|
LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
|
72
|
-
LIBRUBYARG_SHARED =
|
73
|
-
LIBRUBYARG_STATIC = -
|
73
|
+
LIBRUBYARG_SHARED =
|
74
|
+
LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static -framework CoreFoundation $(MAINLIBS)
|
74
75
|
empty =
|
75
76
|
OUTFLAG = -o $(empty)
|
76
77
|
COUTFLAG = -o $(empty)
|
77
78
|
CSRCFLAG = $(empty)
|
78
79
|
|
79
80
|
RUBY_EXTCONF_H = extconf.h
|
80
|
-
cflags = $(optflags) $(debugflags) $(warnflags)
|
81
|
+
cflags = -fdeclspec $(optflags) $(debugflags) $(warnflags)
|
81
82
|
cxxflags =
|
82
|
-
optflags = -O3
|
83
|
+
optflags = -O3 -fno-fast-math
|
83
84
|
debugflags = -ggdb3
|
84
|
-
warnflags = -Wall -Wextra -Wdeprecated-declarations -
|
85
|
+
warnflags = -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -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 -Wundef
|
85
86
|
cppflags =
|
86
|
-
CCDLFLAGS = -
|
87
|
-
CFLAGS = $(CCDLFLAGS) $(cflags) -Wall $(ARCH_FLAG)
|
87
|
+
CCDLFLAGS = -fno-common
|
88
|
+
CFLAGS = $(CCDLFLAGS) $(cflags) -pipe -Wall $(ARCH_FLAG)
|
88
89
|
INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir)
|
89
90
|
DEFS =
|
90
|
-
CPPFLAGS = -DRUBY_EXTCONF_H=\"$(RUBY_EXTCONF_H)\"
|
91
|
-
CXXFLAGS = $(CCDLFLAGS)
|
92
|
-
ldflags = -L. -fstack-protector-strong
|
93
|
-
dldflags = -Wl
|
91
|
+
CPPFLAGS = -DRUBY_EXTCONF_H=\"$(RUBY_EXTCONF_H)\" -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT $(DEFS) $(cppflags)
|
92
|
+
CXXFLAGS = $(CCDLFLAGS) -fdeclspec $(ARCH_FLAG)
|
93
|
+
ldflags = -L. -fstack-protector-strong
|
94
|
+
dldflags = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress
|
94
95
|
ARCH_FLAG =
|
95
96
|
DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG)
|
96
|
-
LDSHARED = $(CC) -
|
97
|
-
LDSHAREDXX = $(CXX) -
|
98
|
-
AR =
|
97
|
+
LDSHARED = $(CC) -dynamic -bundle
|
98
|
+
LDSHAREDXX = $(CXX) -dynamic -bundle
|
99
|
+
AR = ar
|
99
100
|
EXEEXT =
|
100
101
|
|
101
102
|
RUBY_INSTALL_NAME = $(RUBY_BASE_NAME)
|
102
|
-
RUBY_SO_NAME = ruby
|
103
|
+
RUBY_SO_NAME = ruby.3.1
|
103
104
|
RUBYW_INSTALL_NAME =
|
104
105
|
RUBY_VERSION_NAME = $(RUBY_BASE_NAME)-$(ruby_version)
|
105
106
|
RUBYW_BASE_NAME = rubyw
|
106
107
|
RUBY_BASE_NAME = ruby
|
107
108
|
|
108
|
-
arch =
|
109
|
+
arch = arm64-darwin21
|
109
110
|
sitearch = $(arch)
|
110
|
-
ruby_version = 3.
|
111
|
+
ruby_version = 3.1.0
|
111
112
|
ruby = $(bindir)/$(RUBY_BASE_NAME)
|
112
113
|
RUBY = $(ruby)
|
113
114
|
ruby_headers = $(hdrdir)/ruby.h $(hdrdir)/ruby/backward.h $(hdrdir)/ruby/ruby.h $(hdrdir)/ruby/defines.h $(hdrdir)/ruby/missing.h $(hdrdir)/ruby/intern.h $(hdrdir)/ruby/st.h $(hdrdir)/ruby/subst.h $(arch_hdrdir)/ruby/config.h $(RUBY_EXTCONF_H)
|
114
115
|
|
115
116
|
RM = rm -f
|
116
|
-
RM_RF =
|
117
|
-
RMDIRS = rmdir
|
118
|
-
MAKEDIRS = /
|
119
|
-
INSTALL = /
|
117
|
+
RM_RF = rm -fr
|
118
|
+
RMDIRS = rmdir -p
|
119
|
+
MAKEDIRS = /opt/local/bin/gmkdir -p
|
120
|
+
INSTALL = /opt/local/bin/ginstall -c
|
120
121
|
INSTALL_PROG = $(INSTALL) -m 0755
|
121
122
|
INSTALL_DATA = $(INSTALL) -m 644
|
122
123
|
COPY = cp
|
@@ -126,7 +127,7 @@ TOUCH = exit >
|
|
126
127
|
|
127
128
|
preload =
|
128
129
|
libpath = . $(libdir)
|
129
|
-
LIBPATH = -L. -L$(libdir)
|
130
|
+
LIBPATH = -L. -L$(libdir)
|
130
131
|
DEFFILE =
|
131
132
|
|
132
133
|
CLEANFILES = mkmf.log
|
@@ -137,16 +138,16 @@ extout =
|
|
137
138
|
extout_prefix =
|
138
139
|
target_prefix =
|
139
140
|
LOCAL_LIBS =
|
140
|
-
LIBS =
|
141
|
+
LIBS =
|
141
142
|
ORIG_SRCS =
|
142
|
-
SRCS = $(ORIG_SRCS) event.c selector.c
|
143
|
-
OBJS = event.o selector.o
|
143
|
+
SRCS = $(ORIG_SRCS) event.c selector.c kqueue.c interrupt.c
|
144
|
+
OBJS = event.o selector.o kqueue.o interrupt.o
|
144
145
|
HDRS = $(srcdir)/extconf.h
|
145
146
|
LOCAL_HDRS =
|
146
147
|
TARGET = IO_Event
|
147
148
|
TARGET_NAME = IO_Event
|
148
149
|
TARGET_ENTRY = Init_$(TARGET_NAME)
|
149
|
-
DLLIB = $(TARGET).
|
150
|
+
DLLIB = $(TARGET).bundle
|
150
151
|
EXTSTATIC =
|
151
152
|
STATIC_LIB =
|
152
153
|
|
@@ -159,7 +160,7 @@ HDRDIR = $(sitehdrdir)$(target_prefix)
|
|
159
160
|
ARCHHDRDIR = $(sitearchhdrdir)$(target_prefix)
|
160
161
|
TARGET_SO_DIR =
|
161
162
|
TARGET_SO = $(TARGET_SO_DIR)$(DLLIB)
|
162
|
-
CLEANLIBS = $(TARGET_SO)
|
163
|
+
CLEANLIBS = $(TARGET_SO) $(TARGET_SO).dSYM
|
163
164
|
CLEANOBJS = *.o *.bak
|
164
165
|
|
165
166
|
all: $(DLLIB)
|
@@ -172,7 +173,7 @@ clean-rb-default::
|
|
172
173
|
clean-rb::
|
173
174
|
clean-so::
|
174
175
|
clean: clean-so clean-static clean-rb-default clean-rb
|
175
|
-
-$(Q)$(
|
176
|
+
-$(Q)$(RM_RF) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES) .*.time
|
176
177
|
|
177
178
|
distclean-rb-default::
|
178
179
|
distclean-rb::
|
@@ -260,6 +261,7 @@ $(TARGET_SO): $(OBJS) Makefile
|
|
260
261
|
$(ECHO) linking shared-object $(DLLIB)
|
261
262
|
-$(Q)$(RM) $(@)
|
262
263
|
$(Q) $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
|
264
|
+
$(Q) $(POSTLINK)
|
263
265
|
|
264
266
|
|
265
267
|
|
data/ext/event.o
CHANGED
Binary file
|
data/ext/extconf.h
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
#ifndef EXTCONF_H
|
2
2
|
#define EXTCONF_H
|
3
3
|
#define HAVE_RB_EXT_RACTOR_SAFE 1
|
4
|
-
#define
|
5
|
-
#define
|
6
|
-
#define
|
4
|
+
#define HAVE__RB_FIBER_TRANSFER 1
|
5
|
+
#define HAVE_SYS_EVENT_H 1
|
6
|
+
#define HAVE_RB_IO_DESCRIPTOR 1
|
7
7
|
#define HAVE_RB_FIBER_CURRENT 1
|
8
|
+
#define HAVE__RB_FIBER_RAISE 1
|
9
|
+
#define HAVE_RUBY_IO_BUFFER_H 1
|
8
10
|
#endif
|
data/ext/interrupt.o
CHANGED
Binary file
|
data/ext/io/event/interrupt.c
CHANGED
@@ -42,13 +42,25 @@ void IO_Event_Interrupt_close(struct IO_Event_Interrupt *interrupt)
|
|
42
42
|
void IO_Event_Interrupt_signal(struct IO_Event_Interrupt *interrupt)
|
43
43
|
{
|
44
44
|
uint64_t value = 1;
|
45
|
-
write(interrupt->descriptor, &value, sizeof(value));
|
45
|
+
ssize_t result = write(interrupt->descriptor, &value, sizeof(value));
|
46
|
+
|
47
|
+
if (result == -1) {
|
48
|
+
if (errno == EAGAIN || errno == EWOULDBLOCK) return;
|
49
|
+
|
50
|
+
rb_sys_fail("IO_Event_Interrupt_signal:write");
|
51
|
+
}
|
46
52
|
}
|
47
53
|
|
48
54
|
void IO_Event_Interrupt_clear(struct IO_Event_Interrupt *interrupt)
|
49
55
|
{
|
50
56
|
uint64_t value = 0;
|
51
|
-
read(interrupt->descriptor, &value, sizeof(value));
|
57
|
+
ssize_t result = read(interrupt->descriptor, &value, sizeof(value));
|
58
|
+
|
59
|
+
if (result == -1) {
|
60
|
+
if (errno == EAGAIN || errno == EWOULDBLOCK) return;
|
61
|
+
|
62
|
+
rb_sys_fail("IO_Event_Interrupt_clear:read");
|
63
|
+
}
|
52
64
|
}
|
53
65
|
#else
|
54
66
|
void IO_Event_Interrupt_open(struct IO_Event_Interrupt *interrupt)
|
@@ -73,12 +85,24 @@ void IO_Event_Interrupt_close(struct IO_Event_Interrupt *interrupt)
|
|
73
85
|
|
74
86
|
void IO_Event_Interrupt_signal(struct IO_Event_Interrupt *interrupt)
|
75
87
|
{
|
76
|
-
write(interrupt->descriptor[1], ".", 1);
|
88
|
+
ssize_t result = write(interrupt->descriptor[1], ".", 1);
|
89
|
+
|
90
|
+
if (result == -1) {
|
91
|
+
if (errno == EAGAIN || errno == EWOULDBLOCK) return;
|
92
|
+
|
93
|
+
rb_sys_fail("IO_Event_Interrupt_signal:write");
|
94
|
+
}
|
77
95
|
}
|
78
96
|
|
79
97
|
void IO_Event_Interrupt_clear(struct IO_Event_Interrupt *interrupt)
|
80
98
|
{
|
81
99
|
char buffer[128];
|
82
|
-
read(interrupt->descriptor[0], buffer, sizeof(buffer));
|
100
|
+
ssize_t result = read(interrupt->descriptor[0], buffer, sizeof(buffer));
|
101
|
+
|
102
|
+
if (result == -1) {
|
103
|
+
if (errno == EAGAIN || errno == EWOULDBLOCK) return;
|
104
|
+
|
105
|
+
rb_sys_fail("IO_Event_Interrupt_clear:read");
|
106
|
+
}
|
83
107
|
}
|
84
108
|
#endif
|
@@ -103,7 +103,7 @@ void IO_Event_Interrupt_add(struct IO_Event_Interrupt *interrupt, struct IO_Even
|
|
103
103
|
int result = epoll_ctl(data->descriptor, EPOLL_CTL_ADD, descriptor, &event);
|
104
104
|
|
105
105
|
if (result == -1) {
|
106
|
-
rb_sys_fail("
|
106
|
+
rb_sys_fail("IO_Event_Interrupt_add:epoll_ctl");
|
107
107
|
}
|
108
108
|
}
|
109
109
|
|
@@ -115,7 +115,7 @@ VALUE IO_Event_Selector_EPoll_initialize(VALUE self, VALUE loop) {
|
|
115
115
|
int result = epoll_create1(EPOLL_CLOEXEC);
|
116
116
|
|
117
117
|
if (result == -1) {
|
118
|
-
rb_sys_fail("epoll_create");
|
118
|
+
rb_sys_fail("IO_Event_Selector_EPoll_initialize:epoll_create");
|
119
119
|
} else {
|
120
120
|
data->descriptor = result;
|
121
121
|
|
@@ -241,7 +241,7 @@ VALUE IO_Event_Selector_EPoll_process_wait(VALUE self, VALUE fiber, VALUE pid, V
|
|
241
241
|
int result = epoll_ctl(data->descriptor, EPOLL_CTL_ADD, process_wait_arguments.descriptor, &event);
|
242
242
|
|
243
243
|
if (result == -1) {
|
244
|
-
rb_sys_fail("epoll_ctl
|
244
|
+
rb_sys_fail("IO_Event_Selector_EPoll_process_wait:epoll_ctl");
|
245
245
|
}
|
246
246
|
|
247
247
|
return rb_ensure(process_wait_transfer, (VALUE)&process_wait_arguments, process_wait_ensure, (VALUE)&process_wait_arguments);
|
@@ -326,13 +326,13 @@ VALUE IO_Event_Selector_EPoll_io_wait(VALUE self, VALUE fiber, VALUE io, VALUE e
|
|
326
326
|
rb_update_max_fd(duplicate);
|
327
327
|
|
328
328
|
if (descriptor == -1)
|
329
|
-
rb_sys_fail("dup");
|
329
|
+
rb_sys_fail("IO_Event_Selector_EPoll_io_wait:dup");
|
330
330
|
|
331
331
|
result = epoll_ctl(data->descriptor, EPOLL_CTL_ADD, descriptor, &event);
|
332
332
|
}
|
333
333
|
|
334
334
|
if (result == -1) {
|
335
|
-
rb_sys_fail("epoll_ctl");
|
335
|
+
rb_sys_fail("IO_Event_Selector_EPoll_io_wait:epoll_ctl");
|
336
336
|
}
|
337
337
|
|
338
338
|
struct io_wait_arguments io_wait_arguments = {
|
@@ -378,11 +378,15 @@ VALUE io_read_loop(VALUE _arguments) {
|
|
378
378
|
break;
|
379
379
|
} else if (result > 0) {
|
380
380
|
offset += result;
|
381
|
-
|
381
|
+
|
382
|
+
// Ensure we don't underflow length:
|
383
|
+
if ((size_t)result < length)
|
384
|
+
length -= result;
|
385
|
+
else break;
|
382
386
|
} else if (errno == EAGAIN || errno == EWOULDBLOCK) {
|
383
387
|
IO_Event_Selector_EPoll_io_wait(arguments->self, arguments->fiber, arguments->io, RB_INT2NUM(IO_EVENT_READABLE));
|
384
388
|
} else {
|
385
|
-
rb_sys_fail("IO_Event_Selector_EPoll_io_read");
|
389
|
+
rb_sys_fail("IO_Event_Selector_EPoll_io_read:read");
|
386
390
|
}
|
387
391
|
}
|
388
392
|
|
@@ -450,11 +454,13 @@ VALUE io_write_loop(VALUE _arguments) {
|
|
450
454
|
|
451
455
|
if (result >= 0) {
|
452
456
|
offset += result;
|
457
|
+
|
458
|
+
// Result must always be <= than length:
|
453
459
|
length -= result;
|
454
460
|
} else if (errno == EAGAIN || errno == EWOULDBLOCK) {
|
455
461
|
IO_Event_Selector_EPoll_io_wait(arguments->self, arguments->fiber, arguments->io, RB_INT2NUM(IO_EVENT_WRITABLE));
|
456
462
|
} else {
|
457
|
-
rb_sys_fail("IO_Event_Selector_EPoll_io_write");
|
463
|
+
rb_sys_fail("IO_Event_Selector_EPoll_io_write:write");
|
458
464
|
}
|
459
465
|
}
|
460
466
|
|
@@ -562,8 +568,12 @@ VALUE IO_Event_Selector_EPoll_select(VALUE self, VALUE duration) {
|
|
562
568
|
// Process any currently pending events:
|
563
569
|
select_internal_with_gvl(&arguments);
|
564
570
|
|
565
|
-
// If
|
566
|
-
|
571
|
+
// If we:
|
572
|
+
// 1. Didn't process any ready fibers, and
|
573
|
+
// 2. Didn't process any events from non-blocking select (above), and
|
574
|
+
// 3. There are no items in the ready list,
|
575
|
+
// then we can perform a blocking select.
|
576
|
+
if (!ready && !arguments.count && !data->backend.ready) {
|
567
577
|
arguments.timeout = make_timeout(duration);
|
568
578
|
|
569
579
|
if (arguments.timeout != 0) {
|
@@ -35,7 +35,6 @@ struct IO_Event_Selector_KQueue {
|
|
35
35
|
int descriptor;
|
36
36
|
|
37
37
|
int blocked;
|
38
|
-
int wakeup;
|
39
38
|
};
|
40
39
|
|
41
40
|
void IO_Event_Selector_KQueue_Type_mark(void *_data)
|
@@ -96,7 +95,7 @@ VALUE IO_Event_Selector_KQueue_initialize(VALUE self, VALUE loop) {
|
|
96
95
|
int result = kqueue();
|
97
96
|
|
98
97
|
if (result == -1) {
|
99
|
-
rb_sys_fail("kqueue");
|
98
|
+
rb_sys_fail("IO_Event_Selector_KQueue_initialize:kqueue");
|
100
99
|
} else {
|
101
100
|
ioctl(result, FIOCLEX);
|
102
101
|
data->descriptor = result;
|
@@ -196,7 +195,7 @@ int process_add_filters(int descriptor, int ident, VALUE fiber) {
|
|
196
195
|
return 0;
|
197
196
|
}
|
198
197
|
|
199
|
-
rb_sys_fail("kevent
|
198
|
+
rb_sys_fail("process_add_filters:kevent");
|
200
199
|
}
|
201
200
|
|
202
201
|
return 1;
|
@@ -290,7 +289,7 @@ int io_add_filters(int descriptor, int ident, int events, VALUE fiber) {
|
|
290
289
|
int result = kevent(descriptor, kevents, count, NULL, 0, NULL);
|
291
290
|
|
292
291
|
if (result == -1) {
|
293
|
-
rb_sys_fail("kevent
|
292
|
+
rb_sys_fail("io_add_filters:kevent");
|
294
293
|
}
|
295
294
|
|
296
295
|
return events;
|
@@ -401,11 +400,15 @@ VALUE io_read_loop(VALUE _arguments) {
|
|
401
400
|
break;
|
402
401
|
} else if (result > 0) {
|
403
402
|
offset += result;
|
404
|
-
|
403
|
+
|
404
|
+
// Ensure we don't underflow length:
|
405
|
+
if ((size_t)result < length)
|
406
|
+
length -= result;
|
407
|
+
else break;
|
405
408
|
} else if (errno == EAGAIN || errno == EWOULDBLOCK) {
|
406
409
|
IO_Event_Selector_KQueue_io_wait(arguments->self, arguments->fiber, arguments->io, RB_INT2NUM(IO_EVENT_READABLE));
|
407
410
|
} else {
|
408
|
-
rb_sys_fail("IO_Event_Selector_KQueue_io_read");
|
411
|
+
rb_sys_fail("IO_Event_Selector_KQueue_io_read:read");
|
409
412
|
}
|
410
413
|
}
|
411
414
|
|
@@ -476,11 +479,13 @@ VALUE io_write_loop(VALUE _arguments) {
|
|
476
479
|
|
477
480
|
if (result >= 0) {
|
478
481
|
offset += result;
|
482
|
+
|
483
|
+
// Result must always be <= than length:
|
479
484
|
length -= result;
|
480
485
|
} else if (errno == EAGAIN || errno == EWOULDBLOCK) {
|
481
486
|
IO_Event_Selector_KQueue_io_wait(arguments->self, arguments->fiber, arguments->io, RB_INT2NUM(IO_EVENT_WRITABLE));
|
482
487
|
} else {
|
483
|
-
rb_sys_fail("IO_Event_Selector_KQueue_io_write");
|
488
|
+
rb_sys_fail("IO_Event_Selector_KQueue_io_write:write");
|
484
489
|
}
|
485
490
|
}
|
486
491
|
|
@@ -574,12 +579,6 @@ static
|
|
574
579
|
void select_internal_without_gvl(struct select_arguments *arguments) {
|
575
580
|
arguments->data->blocked = 1;
|
576
581
|
|
577
|
-
if (arguments->data->wakeup) {
|
578
|
-
arguments->data->wakeup = 0;
|
579
|
-
arguments->count = 0;
|
580
|
-
return;
|
581
|
-
}
|
582
|
-
|
583
582
|
rb_thread_call_without_gvl(select_internal, (void *)arguments, RUBY_UBF_IO, 0);
|
584
583
|
arguments->data->blocked = 0;
|
585
584
|
|
@@ -623,8 +622,12 @@ VALUE IO_Event_Selector_KQueue_select(VALUE self, VALUE duration) {
|
|
623
622
|
// First do the syscall with no timeout to get any immediately available events:
|
624
623
|
select_internal_with_gvl(&arguments);
|
625
624
|
|
626
|
-
// If
|
627
|
-
|
625
|
+
// If we:
|
626
|
+
// 1. Didn't process any ready fibers, and
|
627
|
+
// 2. Didn't process any events from non-blocking select (above), and
|
628
|
+
// 3. There are no items in the ready list,
|
629
|
+
// then we can perform a blocking select.
|
630
|
+
if (!ready && !arguments.count && !data->backend.ready) {
|
628
631
|
arguments.timeout = make_timeout(duration, &arguments.storage);
|
629
632
|
|
630
633
|
if (!timeout_nonblocking(arguments.timeout)) {
|
@@ -650,11 +653,6 @@ VALUE IO_Event_Selector_KQueue_wakeup(VALUE self) {
|
|
650
653
|
struct IO_Event_Selector_KQueue *data = NULL;
|
651
654
|
TypedData_Get_Struct(self, struct IO_Event_Selector_KQueue, &IO_Event_Selector_KQueue_Type, data);
|
652
655
|
|
653
|
-
// If we are already schduled to wake up, don't bother doing it again!
|
654
|
-
if (data->wakeup) return Qfalse;
|
655
|
-
|
656
|
-
data->wakeup = 1;
|
657
|
-
|
658
656
|
if (data->blocked) {
|
659
657
|
struct kevent trigger = {0};
|
660
658
|
|
@@ -100,7 +100,7 @@ VALUE IO_Event_Selector_URing_initialize(VALUE self, VALUE loop) {
|
|
100
100
|
int result = io_uring_queue_init(URING_ENTRIES, &data->ring, 0);
|
101
101
|
|
102
102
|
if (result < 0) {
|
103
|
-
rb_syserr_fail(-result, "io_uring_queue_init");
|
103
|
+
rb_syserr_fail(-result, "IO_Event_Selector_URing_initialize:io_uring_queue_init");
|
104
104
|
}
|
105
105
|
|
106
106
|
rb_update_max_fd(data->ring.ring_fd);
|
@@ -186,7 +186,7 @@ int io_uring_submit_flush(struct IO_Event_Selector_URing *data) {
|
|
186
186
|
// If it was submitted, reset pending count:
|
187
187
|
data->pending = 0;
|
188
188
|
} else if (result != -EBUSY && result != -EAGAIN) {
|
189
|
-
rb_syserr_fail(-result, "io_uring_submit_flush");
|
189
|
+
rb_syserr_fail(-result, "io_uring_submit_flush:io_uring_submit");
|
190
190
|
}
|
191
191
|
|
192
192
|
return result;
|
@@ -208,7 +208,7 @@ int io_uring_submit_now(struct IO_Event_Selector_URing *data) {
|
|
208
208
|
if (result == -EBUSY || result == -EAGAIN) {
|
209
209
|
IO_Event_Selector_yield(&data->backend);
|
210
210
|
} else {
|
211
|
-
rb_syserr_fail(-result, "io_uring_submit_now");
|
211
|
+
rb_syserr_fail(-result, "io_uring_submit_now:io_uring_submit");
|
212
212
|
}
|
213
213
|
}
|
214
214
|
}
|
@@ -404,8 +404,11 @@ VALUE IO_Event_Selector_URing_io_read(VALUE self, VALUE fiber, VALUE io, VALUE b
|
|
404
404
|
break;
|
405
405
|
} else if (result > 0) {
|
406
406
|
offset += result;
|
407
|
-
|
408
|
-
|
407
|
+
|
408
|
+
// Ensure we don't underflow length:
|
409
|
+
if ((size_t)result < length)
|
410
|
+
length -= result;
|
411
|
+
else break;
|
409
412
|
} else if (-result == EAGAIN || -result == EWOULDBLOCK) {
|
410
413
|
IO_Event_Selector_URing_io_wait(self, fiber, io, RB_INT2NUM(IO_EVENT_READABLE));
|
411
414
|
} else {
|
@@ -551,7 +554,7 @@ int select_internal_without_gvl(struct select_arguments *arguments) {
|
|
551
554
|
if (arguments->result == -ETIME) {
|
552
555
|
arguments->result = 0;
|
553
556
|
} else if (arguments->result < 0) {
|
554
|
-
rb_syserr_fail(-arguments->result, "select_internal_without_gvl:
|
557
|
+
rb_syserr_fail(-arguments->result, "select_internal_without_gvl:io_uring_wait_cqe_timeout");
|
555
558
|
} else {
|
556
559
|
// At least 1 event is waiting:
|
557
560
|
arguments->result = 1;
|
@@ -606,8 +609,12 @@ VALUE IO_Event_Selector_URing_select(VALUE self, VALUE duration) {
|
|
606
609
|
|
607
610
|
int result = select_process_completions(&data->ring);
|
608
611
|
|
609
|
-
// If
|
610
|
-
|
612
|
+
// If we:
|
613
|
+
// 1. Didn't process any ready fibers, and
|
614
|
+
// 2. Didn't process any events from non-blocking select (above), and
|
615
|
+
// 3. There are no items in the ready list,
|
616
|
+
// then we can perform a blocking select.
|
617
|
+
if (!ready && !result && !data->backend.ready) {
|
611
618
|
// We might need to wait for events:
|
612
619
|
struct select_arguments arguments = {
|
613
620
|
.data = data,
|
data/ext/kqueue.o
ADDED
Binary file
|
data/ext/mkmf.log
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
have_func: checking for rb_ext_ractor_safe()... -------------------- yes
|
2
2
|
|
3
|
-
"
|
3
|
+
DYLD_FALLBACK_LIBRARY_PATH=.:/Users/samuel/.rubies/ruby-head/lib "clang -o conftest -I/Users/samuel/.rubies/ruby-head/include/ruby-3.1.0/arm64-darwin21 -I/Users/samuel/.rubies/ruby-head/include/ruby-3.1.0/ruby/backward -I/Users/samuel/.rubies/ruby-head/include/ruby-3.1.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -fdeclspec -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -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 -Wundef -pipe -Wall conftest.c -L. -L/Users/samuel/.rubies/ruby-head/lib -L. -fstack-protector-strong -lruby.3.1-static -framework CoreFoundation -lpthread -ldl -lobjc "
|
4
4
|
checked program was:
|
5
5
|
/* begin */
|
6
6
|
1: #include "ruby.h"
|
@@ -11,7 +11,7 @@ checked program was:
|
|
11
11
|
6: }
|
12
12
|
/* end */
|
13
13
|
|
14
|
-
"
|
14
|
+
DYLD_FALLBACK_LIBRARY_PATH=.:/Users/samuel/.rubies/ruby-head/lib "clang -o conftest -I/Users/samuel/.rubies/ruby-head/include/ruby-3.1.0/arm64-darwin21 -I/Users/samuel/.rubies/ruby-head/include/ruby-3.1.0/ruby/backward -I/Users/samuel/.rubies/ruby-head/include/ruby-3.1.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -fdeclspec -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -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 -Wundef -pipe -Wall conftest.c -L. -L/Users/samuel/.rubies/ruby-head/lib -L. -fstack-protector-strong -lruby.3.1-static -framework CoreFoundation -lpthread -ldl -lobjc "
|
15
15
|
checked program was:
|
16
16
|
/* begin */
|
17
17
|
1: #include "ruby.h"
|
@@ -32,19 +32,9 @@ checked program was:
|
|
32
32
|
|
33
33
|
--------------------
|
34
34
|
|
35
|
-
have_func: checking for &rb_fiber_transfer()... --------------------
|
36
|
-
|
37
|
-
"
|
38
|
-
conftest.c: In function ‘t’:
|
39
|
-
conftest.c:14:76: error: ‘rb_fiber_transfer’ undeclared (first use in this function); did you mean ‘rb_fiber_resume’?
|
40
|
-
14 | int t(void) { const volatile void *volatile p; p = (const volatile void *)&rb_fiber_transfer; return !p; }
|
41
|
-
| ^~~~~~~~~~~~~~~~~
|
42
|
-
| rb_fiber_resume
|
43
|
-
conftest.c:14:76: note: each undeclared identifier is reported only once for each function it appears in
|
44
|
-
conftest.c: At top level:
|
45
|
-
cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics
|
46
|
-
cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics
|
47
|
-
cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics
|
35
|
+
have_func: checking for &rb_fiber_transfer()... -------------------- yes
|
36
|
+
|
37
|
+
DYLD_FALLBACK_LIBRARY_PATH=.:/Users/samuel/.rubies/ruby-head/lib "clang -o conftest -I/Users/samuel/.rubies/ruby-head/include/ruby-3.1.0/arm64-darwin21 -I/Users/samuel/.rubies/ruby-head/include/ruby-3.1.0/ruby/backward -I/Users/samuel/.rubies/ruby-head/include/ruby-3.1.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -fdeclspec -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -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 -Wundef -pipe -Wall conftest.c -L. -L/Users/samuel/.rubies/ruby-head/lib -L. -fstack-protector-strong -lruby.3.1-static -framework CoreFoundation -lpthread -ldl -lobjc "
|
48
38
|
checked program was:
|
49
39
|
/* begin */
|
50
40
|
1: #include "ruby.h"
|
@@ -65,9 +55,11 @@ checked program was:
|
|
65
55
|
|
66
56
|
--------------------
|
67
57
|
|
68
|
-
have_library: checking for -luring... --------------------
|
58
|
+
have_library: checking for -luring... -------------------- no
|
69
59
|
|
70
|
-
"
|
60
|
+
DYLD_FALLBACK_LIBRARY_PATH=.:/Users/samuel/.rubies/ruby-head/lib "clang -o conftest -I/Users/samuel/.rubies/ruby-head/include/ruby-3.1.0/arm64-darwin21 -I/Users/samuel/.rubies/ruby-head/include/ruby-3.1.0/ruby/backward -I/Users/samuel/.rubies/ruby-head/include/ruby-3.1.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -fdeclspec -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -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 -Wundef -pipe -Wall conftest.c -L. -L/Users/samuel/.rubies/ruby-head/lib -L. -fstack-protector-strong -lruby.3.1-static -framework CoreFoundation -lpthread -ldl -lobjc -luring "
|
61
|
+
ld: library not found for -luring
|
62
|
+
clang: error: linker command failed with exit code 1 (use -v to see invocation)
|
71
63
|
checked program was:
|
72
64
|
/* begin */
|
73
65
|
1: #include "ruby.h"
|
@@ -89,21 +81,13 @@ checked program was:
|
|
89
81
|
|
90
82
|
--------------------
|
91
83
|
|
92
|
-
have_header: checking for
|
93
|
-
|
94
|
-
"gcc -E -I/home/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0/x86_64-linux -I/home/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0/ruby/backward -I/home/samuel/.rubies/ruby-3.0.3/include/ruby-3.0.0 -I. -O3 -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wwrite-strings -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wall conftest.c -o conftest.i"
|
95
|
-
checked program was:
|
96
|
-
/* begin */
|
97
|
-
1: #include "ruby.h"
|
98
|
-
2:
|
99
|
-
3: #include <liburing.h>
|
100
|
-
/* end */
|
101
|
-
|
102
|
-
--------------------
|
103
|
-
|
104
|
-
have_header: checking for sys/epoll.h... -------------------- yes
|
84
|
+
have_header: checking for sys/epoll.h... -------------------- no
|
105
85
|
|
106
|
-
"
|
86
|
+
DYLD_FALLBACK_LIBRARY_PATH=.:/Users/samuel/.rubies/ruby-head/lib "clang -I/Users/samuel/.rubies/ruby-head/include/ruby-3.1.0/arm64-darwin21 -I/Users/samuel/.rubies/ruby-head/include/ruby-3.1.0/ruby/backward -I/Users/samuel/.rubies/ruby-head/include/ruby-3.1.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -fdeclspec -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -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 -Wundef -pipe -Wall -c conftest.c"
|
87
|
+
conftest.c:3:10: fatal error: 'sys/epoll.h' file not found
|
88
|
+
#include <sys/epoll.h>
|
89
|
+
^~~~~~~~~~~~~
|
90
|
+
1 error generated.
|
107
91
|
checked program was:
|
108
92
|
/* begin */
|
109
93
|
1: #include "ruby.h"
|
@@ -113,13 +97,9 @@ checked program was:
|
|
113
97
|
|
114
98
|
--------------------
|
115
99
|
|
116
|
-
have_header: checking for sys/event.h... --------------------
|
100
|
+
have_header: checking for sys/event.h... -------------------- yes
|
117
101
|
|
118
|
-
"
|
119
|
-
conftest.c:3:10: fatal error: sys/event.h: No such file or directory
|
120
|
-
3 | #include <sys/event.h>
|
121
|
-
| ^~~~~~~~~~~~~
|
122
|
-
compilation terminated.
|
102
|
+
DYLD_FALLBACK_LIBRARY_PATH=.:/Users/samuel/.rubies/ruby-head/lib "clang -I/Users/samuel/.rubies/ruby-head/include/ruby-3.1.0/arm64-darwin21 -I/Users/samuel/.rubies/ruby-head/include/ruby-3.1.0/ruby/backward -I/Users/samuel/.rubies/ruby-head/include/ruby-3.1.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -fdeclspec -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -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 -Wundef -pipe -Wall -c conftest.c"
|
123
103
|
checked program was:
|
124
104
|
/* begin */
|
125
105
|
1: #include "ruby.h"
|
@@ -129,9 +109,13 @@ checked program was:
|
|
129
109
|
|
130
110
|
--------------------
|
131
111
|
|
132
|
-
have_header: checking for sys/eventfd.h... --------------------
|
112
|
+
have_header: checking for sys/eventfd.h... -------------------- no
|
133
113
|
|
134
|
-
"
|
114
|
+
DYLD_FALLBACK_LIBRARY_PATH=.:/Users/samuel/.rubies/ruby-head/lib "clang -I/Users/samuel/.rubies/ruby-head/include/ruby-3.1.0/arm64-darwin21 -I/Users/samuel/.rubies/ruby-head/include/ruby-3.1.0/ruby/backward -I/Users/samuel/.rubies/ruby-head/include/ruby-3.1.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -fdeclspec -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -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 -Wundef -pipe -Wall -c conftest.c"
|
115
|
+
conftest.c:3:10: fatal error: 'sys/eventfd.h' file not found
|
116
|
+
#include <sys/eventfd.h>
|
117
|
+
^~~~~~~~~~~~~~~
|
118
|
+
1 error generated.
|
135
119
|
checked program was:
|
136
120
|
/* begin */
|
137
121
|
1: #include "ruby.h"
|
@@ -141,18 +125,13 @@ checked program was:
|
|
141
125
|
|
142
126
|
--------------------
|
143
127
|
|
144
|
-
have_func: checking for rb_io_descriptor()... --------------------
|
145
|
-
|
146
|
-
"
|
147
|
-
conftest.c:
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
conftest.c:14:57: note: each undeclared identifier is reported only once for each function it appears in
|
152
|
-
conftest.c: At top level:
|
153
|
-
cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics
|
154
|
-
cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics
|
155
|
-
cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics
|
128
|
+
have_func: checking for rb_io_descriptor()... -------------------- yes
|
129
|
+
|
130
|
+
DYLD_FALLBACK_LIBRARY_PATH=.:/Users/samuel/.rubies/ruby-head/lib "clang -o conftest -I/Users/samuel/.rubies/ruby-head/include/ruby-3.1.0/arm64-darwin21 -I/Users/samuel/.rubies/ruby-head/include/ruby-3.1.0/ruby/backward -I/Users/samuel/.rubies/ruby-head/include/ruby-3.1.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -fdeclspec -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -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 -Wundef -pipe -Wall conftest.c -L. -L/Users/samuel/.rubies/ruby-head/lib -L. -fstack-protector-strong -lruby.3.1-static -framework CoreFoundation -lpthread -ldl -lobjc "
|
131
|
+
conftest.c:14:57: error: use of undeclared identifier 'rb_io_descriptor'
|
132
|
+
int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_io_descriptor; return !p; }
|
133
|
+
^
|
134
|
+
1 error generated.
|
156
135
|
checked program was:
|
157
136
|
/* begin */
|
158
137
|
1: #include "ruby.h"
|
@@ -171,10 +150,7 @@ checked program was:
|
|
171
150
|
14: int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_io_descriptor; return !p; }
|
172
151
|
/* end */
|
173
152
|
|
174
|
-
"
|
175
|
-
/usr/bin/ld: /tmp/cc0gnp4R.o: in function `t':
|
176
|
-
/home/samuel/Projects/socketry/io-event/ext/conftest.c:15: undefined reference to `rb_io_descriptor'
|
177
|
-
collect2: error: ld returned 1 exit status
|
153
|
+
DYLD_FALLBACK_LIBRARY_PATH=.:/Users/samuel/.rubies/ruby-head/lib "clang -o conftest -I/Users/samuel/.rubies/ruby-head/include/ruby-3.1.0/arm64-darwin21 -I/Users/samuel/.rubies/ruby-head/include/ruby-3.1.0/ruby/backward -I/Users/samuel/.rubies/ruby-head/include/ruby-3.1.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -fdeclspec -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -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 -Wundef -pipe -Wall conftest.c -L. -L/Users/samuel/.rubies/ruby-head/lib -L. -fstack-protector-strong -lruby.3.1-static -framework CoreFoundation -lpthread -ldl -lobjc "
|
178
154
|
checked program was:
|
179
155
|
/* begin */
|
180
156
|
1: #include "ruby.h"
|
@@ -198,16 +174,11 @@ checked program was:
|
|
198
174
|
|
199
175
|
have_func: checking for &rb_process_status_wait()... -------------------- no
|
200
176
|
|
201
|
-
"
|
202
|
-
conftest.c:
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
conftest.c:14:76: note: each undeclared identifier is reported only once for each function it appears in
|
207
|
-
conftest.c: At top level:
|
208
|
-
cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics
|
209
|
-
cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics
|
210
|
-
cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics
|
177
|
+
DYLD_FALLBACK_LIBRARY_PATH=.:/Users/samuel/.rubies/ruby-head/lib "clang -o conftest -I/Users/samuel/.rubies/ruby-head/include/ruby-3.1.0/arm64-darwin21 -I/Users/samuel/.rubies/ruby-head/include/ruby-3.1.0/ruby/backward -I/Users/samuel/.rubies/ruby-head/include/ruby-3.1.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -fdeclspec -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -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 -Wundef -pipe -Wall conftest.c -L. -L/Users/samuel/.rubies/ruby-head/lib -L. -fstack-protector-strong -lruby.3.1-static -framework CoreFoundation -lpthread -ldl -lobjc "
|
178
|
+
conftest.c:14:76: error: use of undeclared identifier 'rb_process_status_wait'
|
179
|
+
int t(void) { const volatile void *volatile p; p = (const volatile void *)&rb_process_status_wait; return !p; }
|
180
|
+
^
|
181
|
+
1 error generated.
|
211
182
|
checked program was:
|
212
183
|
/* begin */
|
213
184
|
1: #include "ruby.h"
|
@@ -230,7 +201,7 @@ checked program was:
|
|
230
201
|
|
231
202
|
have_func: checking for rb_fiber_current()... -------------------- yes
|
232
203
|
|
233
|
-
"
|
204
|
+
DYLD_FALLBACK_LIBRARY_PATH=.:/Users/samuel/.rubies/ruby-head/lib "clang -o conftest -I/Users/samuel/.rubies/ruby-head/include/ruby-3.1.0/arm64-darwin21 -I/Users/samuel/.rubies/ruby-head/include/ruby-3.1.0/ruby/backward -I/Users/samuel/.rubies/ruby-head/include/ruby-3.1.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -fdeclspec -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -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 -Wundef -pipe -Wall conftest.c -L. -L/Users/samuel/.rubies/ruby-head/lib -L. -fstack-protector-strong -lruby.3.1-static -framework CoreFoundation -lpthread -ldl -lobjc "
|
234
205
|
checked program was:
|
235
206
|
/* begin */
|
236
207
|
1: #include "ruby.h"
|
@@ -251,19 +222,9 @@ checked program was:
|
|
251
222
|
|
252
223
|
--------------------
|
253
224
|
|
254
|
-
have_func: checking for &rb_fiber_raise()... --------------------
|
255
|
-
|
256
|
-
"
|
257
|
-
conftest.c: In function ‘t’:
|
258
|
-
conftest.c:14:76: error: ‘rb_fiber_raise’ undeclared (first use in this function); did you mean ‘rb_fiber_resume’?
|
259
|
-
14 | int t(void) { const volatile void *volatile p; p = (const volatile void *)&rb_fiber_raise; return !p; }
|
260
|
-
| ^~~~~~~~~~~~~~
|
261
|
-
| rb_fiber_resume
|
262
|
-
conftest.c:14:76: note: each undeclared identifier is reported only once for each function it appears in
|
263
|
-
conftest.c: At top level:
|
264
|
-
cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics
|
265
|
-
cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics
|
266
|
-
cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics
|
225
|
+
have_func: checking for &rb_fiber_raise()... -------------------- yes
|
226
|
+
|
227
|
+
DYLD_FALLBACK_LIBRARY_PATH=.:/Users/samuel/.rubies/ruby-head/lib "clang -o conftest -I/Users/samuel/.rubies/ruby-head/include/ruby-3.1.0/arm64-darwin21 -I/Users/samuel/.rubies/ruby-head/include/ruby-3.1.0/ruby/backward -I/Users/samuel/.rubies/ruby-head/include/ruby-3.1.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -fdeclspec -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -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 -Wundef -pipe -Wall conftest.c -L. -L/Users/samuel/.rubies/ruby-head/lib -L. -fstack-protector-strong -lruby.3.1-static -framework CoreFoundation -lpthread -ldl -lobjc "
|
267
228
|
checked program was:
|
268
229
|
/* begin */
|
269
230
|
1: #include "ruby.h"
|
@@ -284,13 +245,9 @@ checked program was:
|
|
284
245
|
|
285
246
|
--------------------
|
286
247
|
|
287
|
-
have_header: checking for ruby/io/buffer.h... --------------------
|
248
|
+
have_header: checking for ruby/io/buffer.h... -------------------- yes
|
288
249
|
|
289
|
-
"
|
290
|
-
conftest.c:3:10: fatal error: ruby/io/buffer.h: No such file or directory
|
291
|
-
3 | #include <ruby/io/buffer.h>
|
292
|
-
| ^~~~~~~~~~~~~~~~~~
|
293
|
-
compilation terminated.
|
250
|
+
DYLD_FALLBACK_LIBRARY_PATH=.:/Users/samuel/.rubies/ruby-head/lib "clang -I/Users/samuel/.rubies/ruby-head/include/ruby-3.1.0/arm64-darwin21 -I/Users/samuel/.rubies/ruby-head/include/ruby-3.1.0/ruby/backward -I/Users/samuel/.rubies/ruby-head/include/ruby-3.1.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -fdeclspec -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -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 -Wundef -pipe -Wall -c conftest.c"
|
294
251
|
checked program was:
|
295
252
|
/* begin */
|
296
253
|
1: #include "ruby.h"
|
@@ -302,13 +259,15 @@ checked program was:
|
|
302
259
|
|
303
260
|
extconf.h is:
|
304
261
|
/* begin */
|
305
|
-
1: #ifndef EXTCONF_H
|
306
|
-
2: #define EXTCONF_H
|
307
|
-
3: #define HAVE_RB_EXT_RACTOR_SAFE 1
|
308
|
-
4: #define
|
309
|
-
5: #define
|
310
|
-
6: #define
|
311
|
-
7: #define HAVE_RB_FIBER_CURRENT 1
|
312
|
-
8: #
|
262
|
+
1: #ifndef EXTCONF_H
|
263
|
+
2: #define EXTCONF_H
|
264
|
+
3: #define HAVE_RB_EXT_RACTOR_SAFE 1
|
265
|
+
4: #define HAVE__RB_FIBER_TRANSFER 1
|
266
|
+
5: #define HAVE_SYS_EVENT_H 1
|
267
|
+
6: #define HAVE_RB_IO_DESCRIPTOR 1
|
268
|
+
7: #define HAVE_RB_FIBER_CURRENT 1
|
269
|
+
8: #define HAVE__RB_FIBER_RAISE 1
|
270
|
+
9: #define HAVE_RUBY_IO_BUFFER_H 1
|
271
|
+
10: #endif
|
313
272
|
/* end */
|
314
273
|
|
data/ext/selector.o
CHANGED
Binary file
|
@@ -141,7 +141,7 @@ module IO::Event
|
|
141
141
|
# The maximum size we can read:
|
142
142
|
maximum_size = buffer.size - offset
|
143
143
|
|
144
|
-
case result = io.read_nonblock(maximum_size, exception: false)
|
144
|
+
case result = blocking{io.read_nonblock(maximum_size, exception: false)}
|
145
145
|
when :wait_readable
|
146
146
|
self.io_wait(fiber, io, IO::READABLE)
|
147
147
|
when :wait_writable
|
@@ -165,7 +165,7 @@ module IO::Event
|
|
165
165
|
while length > 0
|
166
166
|
# From offset until the end:
|
167
167
|
chunk = buffer.to_str(offset, length)
|
168
|
-
case result = io.write_nonblock(chunk, exception: false)
|
168
|
+
case result = blocking{io.write_nonblock(chunk, exception: false)}
|
169
169
|
when :wait_readable
|
170
170
|
self.io_wait(fiber, io, IO::READABLE)
|
171
171
|
when :wait_writable
|
@@ -240,6 +240,10 @@ module IO::Event
|
|
240
240
|
|
241
241
|
return ready.size
|
242
242
|
end
|
243
|
+
|
244
|
+
private def blocking(&block)
|
245
|
+
Fiber.new(blocking: true, &block).resume
|
246
|
+
end
|
243
247
|
end
|
244
248
|
end
|
245
249
|
end
|
data/lib/io/event/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: io-event
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-12-
|
11
|
+
date: 2021-12-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bake
|
@@ -73,9 +73,8 @@ extensions:
|
|
73
73
|
- ext/extconf.rb
|
74
74
|
extra_rdoc_files: []
|
75
75
|
files:
|
76
|
-
- ext/IO_Event.
|
76
|
+
- ext/IO_Event.bundle
|
77
77
|
- ext/Makefile
|
78
|
-
- ext/epoll.o
|
79
78
|
- ext/event.o
|
80
79
|
- ext/extconf.h
|
81
80
|
- ext/extconf.rb
|
@@ -93,9 +92,9 @@ files:
|
|
93
92
|
- ext/io/event/selector/selector.h
|
94
93
|
- ext/io/event/selector/uring.c
|
95
94
|
- ext/io/event/selector/uring.h
|
95
|
+
- ext/kqueue.o
|
96
96
|
- ext/mkmf.log
|
97
97
|
- ext/selector.o
|
98
|
-
- ext/uring.o
|
99
98
|
- lib/io/event.rb
|
100
99
|
- lib/io/event/debug/selector.rb
|
101
100
|
- lib/io/event/interrupt.rb
|
@@ -121,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
120
|
- !ruby/object:Gem::Version
|
122
121
|
version: '0'
|
123
122
|
requirements: []
|
124
|
-
rubygems_version: 3.
|
123
|
+
rubygems_version: 3.3.0.dev
|
125
124
|
signing_key:
|
126
125
|
specification_version: 4
|
127
126
|
summary: An event loop.
|
data/ext/IO_Event.so
DELETED
Binary file
|
data/ext/epoll.o
DELETED
Binary file
|
data/ext/uring.o
DELETED
Binary file
|