io-event 0.2.4 → 0.3.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4082e35d4449813886e1f44ffd9f6825a48b69c5207b1bb7685d6fd920a6e7a0
4
- data.tar.gz: c312e74c8e0c458e86215110cb5cd21f431709c4a120db4c37c670bb227528d8
3
+ metadata.gz: dd0859ac56f4bcd713026e8e7faa0547ec57d195c35abe8d6bcfa77dda89f25d
4
+ data.tar.gz: 1d6c6debea4d7a822f383e5d3b7c1ed0698b5928b2637ad65069b0798ea557d8
5
5
  SHA512:
6
- metadata.gz: 795d6a27a0d074d7045c727ae241ea3c5fb3f14bed0e9541ee7d29f92f474896eb57a12b5e09838725e120b46ee084f3ebe4373a9f30915b46551a586d67d0a5
7
- data.tar.gz: 5eb59147bd4c6f66678e962e3df79b876668fb3c6ac4d60aa27859080c7e6cf6c0eb3f25a4200552f0e829501337e5465f9994aa92c662b6a81afdacbb622990
6
+ metadata.gz: 2edfbfddcecac51db0093e30df9b04ac49fceb2cef189b8d46cfecc564ac47f3ef4c1680632cfb4ab0266e6529472764dc6ac81b0ae715f0b4a7707e8c4d9acd
7
+ data.tar.gz: a2bb38d0bf5a7cde138c94f2cd799be2a184b035c70e88e24f32dca91e20051473594fea7883c223ceb612e71beb499f9d81ef6335e4469f313b0de6fd31947b
data/ext/IO_Event.bundle CHANGED
Binary file
data/ext/Makefile CHANGED
@@ -85,7 +85,7 @@ debugflags = -ggdb3
85
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
86
86
  cppflags =
87
87
  CCDLFLAGS = -fno-common
88
- CFLAGS = $(CCDLFLAGS) $(cflags) -pipe -Wall $(ARCH_FLAG)
88
+ CFLAGS = $(CCDLFLAGS) $(cflags) -pipe -Wall -std=c99 $(ARCH_FLAG)
89
89
  INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir)
90
90
  DEFS =
91
91
  CPPFLAGS = -DRUBY_EXTCONF_H=\"$(RUBY_EXTCONF_H)\" -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT $(DEFS) $(cppflags)
data/ext/event.o CHANGED
Binary file
data/ext/extconf.rb CHANGED
@@ -27,7 +27,7 @@ extension_name = 'IO_Event'
27
27
 
28
28
  # dir_config(extension_name)
29
29
 
30
- $CFLAGS << " -Wall"
30
+ $CFLAGS << " -Wall -std=c99"
31
31
 
32
32
  $srcs = ["io/event/event.c", "io/event/selector/selector.c"]
33
33
  $VPATH << "$(srcdir)/io/event"
data/ext/interrupt.o CHANGED
Binary file
@@ -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(process_wait)");
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 = {
@@ -370,27 +370,24 @@ VALUE io_read_loop(VALUE _arguments) {
370
370
  size_t offset = 0;
371
371
  size_t length = arguments->length;
372
372
 
373
- while (length > 0) {
373
+ while (true) {
374
374
  size_t maximum_size = size - offset;
375
375
  ssize_t result = read(arguments->descriptor, (char*)base+offset, maximum_size);
376
376
 
377
- if (result == 0) {
378
- break;
379
- } else if (result > 0) {
377
+ if (result > 0) {
380
378
  offset += result;
381
-
382
- // Ensure we don't underflow length:
383
- if ((size_t)result < length)
384
- length -= result;
385
- else break;
386
- } else if (errno == EAGAIN || errno == EWOULDBLOCK) {
379
+ if ((size_t)result >= length) break;
380
+ length -= result;
381
+ } else if (result == 0) {
382
+ break;
383
+ } else if (length > 0 && IO_Event_try_again(-result)) {
387
384
  IO_Event_Selector_EPoll_io_wait(arguments->self, arguments->fiber, arguments->io, RB_INT2NUM(IO_EVENT_READABLE));
388
385
  } else {
389
- rb_sys_fail("IO_Event_Selector_EPoll_io_read");
386
+ return rb_fiber_scheduler_io_result(-1, -result);
390
387
  }
391
388
  }
392
389
 
393
- return SIZET2NUM(offset);
390
+ return rb_fiber_scheduler_io_result(offset, 0);
394
391
  }
395
392
 
396
393
  static
@@ -449,22 +446,24 @@ VALUE io_write_loop(VALUE _arguments) {
449
446
  rb_raise(rb_eRuntimeError, "Length exceeds size of buffer!");
450
447
  }
451
448
 
452
- while (length > 0) {
453
- ssize_t result = write(arguments->descriptor, (char*)base+offset, length);
449
+ while (true) {
450
+ size_t maximum_size = size - offset;
451
+ ssize_t result = write(arguments->descriptor, (char*)base+offset, maximum_size);
454
452
 
455
- if (result >= 0) {
453
+ if (result > 0) {
456
454
  offset += result;
457
-
458
- // Result must always be <= than length:
455
+ if ((size_t)result >= length) break;
459
456
  length -= result;
460
- } else if (errno == EAGAIN || errno == EWOULDBLOCK) {
457
+ } else if (result == 0) {
458
+ break;
459
+ } else if (length > 0 && IO_Event_try_again(errno)) {
461
460
  IO_Event_Selector_EPoll_io_wait(arguments->self, arguments->fiber, arguments->io, RB_INT2NUM(IO_EVENT_WRITABLE));
462
461
  } else {
463
- rb_sys_fail("IO_Event_Selector_EPoll_io_write");
462
+ return rb_fiber_scheduler_io_result(-1, errno);
464
463
  }
465
464
  }
466
465
 
467
- return SIZET2NUM(offset);
466
+ return rb_fiber_scheduler_io_result(offset, 0);
468
467
  };
469
468
 
470
469
  static
@@ -26,6 +26,13 @@
26
26
  #include <time.h>
27
27
  #include <errno.h>
28
28
 
29
+ enum {
30
+ DEBUG = 0,
31
+ DEBUG_IO_READ = 0,
32
+ DEBUG_IO_WRITE = 0,
33
+ DEBUG_IO_WAIT = 0
34
+ };
35
+
29
36
  static VALUE IO_Event_Selector_KQueue = Qnil;
30
37
 
31
38
  enum {KQUEUE_MAX_EVENTS = 64};
@@ -95,7 +102,7 @@ VALUE IO_Event_Selector_KQueue_initialize(VALUE self, VALUE loop) {
95
102
  int result = kqueue();
96
103
 
97
104
  if (result == -1) {
98
- rb_sys_fail("kqueue");
105
+ rb_sys_fail("IO_Event_Selector_KQueue_initialize:kqueue");
99
106
  } else {
100
107
  ioctl(result, FIOCLEX);
101
108
  data->descriptor = result;
@@ -195,7 +202,7 @@ int process_add_filters(int descriptor, int ident, VALUE fiber) {
195
202
  return 0;
196
203
  }
197
204
 
198
- rb_sys_fail("kevent(process_add_filters)");
205
+ rb_sys_fail("process_add_filters:kevent");
199
206
  }
200
207
 
201
208
  return 1;
@@ -289,7 +296,7 @@ int io_add_filters(int descriptor, int ident, int events, VALUE fiber) {
289
296
  int result = kevent(descriptor, kevents, count, NULL, 0, NULL);
290
297
 
291
298
  if (result == -1) {
292
- rb_sys_fail("kevent(io_add_filters)");
299
+ rb_sys_fail("io_add_filters:kevent");
293
300
  }
294
301
 
295
302
  return events;
@@ -363,6 +370,8 @@ VALUE IO_Event_Selector_KQueue_io_wait(VALUE self, VALUE fiber, VALUE io, VALUE
363
370
  .descriptor = descriptor,
364
371
  };
365
372
 
373
+ if (DEBUG_IO_WAIT) fprintf(stderr, "IO_Event_Selector_KQueue_io_wait descriptor=%d\n", descriptor);
374
+
366
375
  return rb_rescue(io_wait_transfer, (VALUE)&io_wait_arguments, io_wait_rescue, (VALUE)&io_wait_arguments);
367
376
  }
368
377
 
@@ -392,27 +401,31 @@ VALUE io_read_loop(VALUE _arguments) {
392
401
  size_t offset = 0;
393
402
  size_t length = arguments->length;
394
403
 
395
- while (length > 0) {
404
+ if (DEBUG_IO_READ) fprintf(stderr, "io_read_loop(fd=%d, length=%zu)\n", arguments->descriptor, length);
405
+
406
+ while (true) {
396
407
  size_t maximum_size = size - offset;
408
+ if (DEBUG_IO_READ) fprintf(stderr, "read(%d, +%ld, %ld)\n", arguments->descriptor, offset, maximum_size);
397
409
  ssize_t result = read(arguments->descriptor, (char*)base+offset, maximum_size);
410
+ if (DEBUG_IO_READ) fprintf(stderr, "read(%d, +%ld, %ld) -> %zd\n", arguments->descriptor, offset, maximum_size, result);
398
411
 
399
- if (result == 0) {
400
- break;
401
- } else if (result > 0) {
412
+ if (result > 0) {
402
413
  offset += result;
403
-
404
- // Ensure we don't underflow length:
405
- if ((size_t)result < length)
406
- length -= result;
407
- else break;
408
- } else if (errno == EAGAIN || errno == EWOULDBLOCK) {
414
+ if ((size_t)result >= length) break;
415
+ length -= result;
416
+ } else if (result == 0) {
417
+ break;
418
+ } else if (length > 0 && IO_Event_try_again(errno)) {
419
+ if (DEBUG_IO_READ) fprintf(stderr, "IO_Event_Selector_KQueue_io_wait(fd=%d, length=%zu)\n", arguments->descriptor, length);
409
420
  IO_Event_Selector_KQueue_io_wait(arguments->self, arguments->fiber, arguments->io, RB_INT2NUM(IO_EVENT_READABLE));
410
421
  } else {
411
- rb_sys_fail("IO_Event_Selector_KQueue_io_read");
422
+ if (DEBUG_IO_READ) fprintf(stderr, "io_read_loop(fd=%d, length=%zu) -> errno=%d\n", arguments->descriptor, length, errno);
423
+ return rb_fiber_scheduler_io_result(-1, errno);
412
424
  }
413
425
  }
414
426
 
415
- return SIZET2NUM(offset);
427
+ if (DEBUG_IO_READ) fprintf(stderr, "io_read_loop(fd=%d, length=%zu) -> %zu\n", arguments->descriptor, length, offset);
428
+ return rb_fiber_scheduler_io_result(offset, 0);
416
429
  }
417
430
 
418
431
  static
@@ -474,22 +487,31 @@ VALUE io_write_loop(VALUE _arguments) {
474
487
  rb_raise(rb_eRuntimeError, "Length exceeds size of buffer!");
475
488
  }
476
489
 
477
- while (length > 0) {
478
- ssize_t result = write(arguments->descriptor, (char*)base+offset, length);
490
+ if (DEBUG_IO_WRITE) fprintf(stderr, "io_write_loop(fd=%d, length=%zu)\n", arguments->descriptor, length);
491
+
492
+ while (true) {
493
+ size_t maximum_size = size - offset;
494
+ if (DEBUG_IO_WRITE) fprintf(stderr, "write(%d, +%ld, %ld, length=%zu)\n", arguments->descriptor, offset, maximum_size, length);
495
+ ssize_t result = write(arguments->descriptor, (char*)base+offset, maximum_size);
496
+ if (DEBUG_IO_WRITE) fprintf(stderr, "write(%d, +%ld, %ld) -> %zd\n", arguments->descriptor, offset, maximum_size, result);
479
497
 
480
- if (result >= 0) {
498
+ if (result > 0) {
481
499
  offset += result;
482
-
483
- // Result must always be <= than length:
500
+ if ((size_t)result >= length) break;
484
501
  length -= result;
485
- } else if (errno == EAGAIN || errno == EWOULDBLOCK) {
486
- IO_Event_Selector_KQueue_io_wait(arguments->self, arguments->fiber, arguments->io, RB_INT2NUM(IO_EVENT_WRITABLE));
502
+ } else if (result == 0) {
503
+ break;
504
+ } else if (length > 0 && IO_Event_try_again(errno)) {
505
+ if (DEBUG_IO_WRITE) fprintf(stderr, "IO_Event_Selector_KQueue_io_wait(fd=%d, length=%zu)\n", arguments->descriptor, length);
506
+ IO_Event_Selector_KQueue_io_wait(arguments->self, arguments->fiber, arguments->io, RB_INT2NUM(IO_EVENT_READABLE));
487
507
  } else {
488
- rb_sys_fail("IO_Event_Selector_KQueue_io_write");
508
+ if (DEBUG_IO_WRITE) fprintf(stderr, "io_write_loop(fd=%d, length=%zu) -> errno=%d\n", arguments->descriptor, length, errno);
509
+ return rb_fiber_scheduler_io_result(-1, errno);
489
510
  }
490
511
  }
491
512
 
492
- return SIZET2NUM(offset);
513
+ if (DEBUG_IO_READ) fprintf(stderr, "io_write_loop(fd=%d, length=%zu) -> %zu\n", arguments->descriptor, length, offset);
514
+ return rb_fiber_scheduler_io_result(offset, 0);
493
515
  };
494
516
 
495
517
  static
@@ -620,7 +642,9 @@ VALUE IO_Event_Selector_KQueue_select(VALUE self, VALUE duration) {
620
642
  // Non-comprehensive testing shows this gives a 1.5x speedup.
621
643
 
622
644
  // First do the syscall with no timeout to get any immediately available events:
645
+ if (DEBUG) fprintf(stderr, "\r\nselect_internal_with_gvl timeout=" PRINTF_TIMESPEC "\r\n", PRINTF_TIMESPEC_ARGS(arguments.storage));
623
646
  select_internal_with_gvl(&arguments);
647
+ if (DEBUG) fprintf(stderr, "\r\nselect_internal_with_gvl done\r\n");
624
648
 
625
649
  // If we:
626
650
  // 1. Didn't process any ready fibers, and
@@ -633,6 +657,7 @@ VALUE IO_Event_Selector_KQueue_select(VALUE self, VALUE duration) {
633
657
  if (!timeout_nonblocking(arguments.timeout)) {
634
658
  arguments.count = KQUEUE_MAX_EVENTS;
635
659
 
660
+ if (DEBUG) fprintf(stderr, "IO_Event_Selector_KQueue_select timeout=" PRINTF_TIMESPEC "\n", PRINTF_TIMESPEC_ARGS(arguments.storage));
636
661
  select_internal_without_gvl(&arguments);
637
662
  }
638
663
  }
@@ -26,6 +26,7 @@
26
26
 
27
27
  #ifdef HAVE_RUBY_IO_BUFFER_H
28
28
  #include <ruby/io/buffer.h>
29
+ #include <ruby/fiber/scheduler.h>
29
30
  #endif
30
31
 
31
32
  #include <time.h>
@@ -40,6 +41,10 @@ enum IO_Event {
40
41
 
41
42
  void Init_IO_Event_Selector();
42
43
 
44
+ static inline int IO_Event_try_again(int error) {
45
+ return error == EAGAIN || error == EWOULDBLOCK;
46
+ }
47
+
43
48
  VALUE IO_Event_Selector_fiber_transfer(VALUE fiber, int argc, VALUE *argv);
44
49
 
45
50
  #ifdef HAVE__RB_FIBER_RAISE
@@ -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
  }
@@ -396,27 +396,24 @@ VALUE IO_Event_Selector_URing_io_read(VALUE self, VALUE fiber, VALUE io, VALUE b
396
396
  size_t offset = 0;
397
397
  size_t length = NUM2SIZET(_length);
398
398
 
399
- while (length > 0) {
399
+ while (true) {
400
400
  size_t maximum_size = size - offset;
401
401
  int result = io_read(data, fiber, descriptor, (char*)base+offset, maximum_size);
402
402
 
403
- if (result == 0) {
404
- break;
405
- } else if (result > 0) {
403
+ if (result > 0) {
406
404
  offset += result;
407
-
408
- // Ensure we don't underflow length:
409
- if ((size_t)result < length)
410
- length -= result;
411
- else break;
412
- } else if (-result == EAGAIN || -result == EWOULDBLOCK) {
405
+ if ((size_t)result >= length) break;
406
+ length -= result;
407
+ } else if (result == 0) {
408
+ break;
409
+ } else if (length > 0 && IO_Event_try_again(-result)) {
413
410
  IO_Event_Selector_URing_io_wait(self, fiber, io, RB_INT2NUM(IO_EVENT_READABLE));
414
411
  } else {
415
- rb_syserr_fail(-result, strerror(-result));
412
+ return rb_fiber_scheduler_io_result(-1, -result);
416
413
  }
417
414
  }
418
415
 
419
- return SIZET2NUM(offset);
416
+ return rb_fiber_scheduler_io_result(offset, 0);
420
417
  }
421
418
 
422
419
  static
@@ -452,21 +449,24 @@ VALUE IO_Event_Selector_URing_io_write(VALUE self, VALUE fiber, VALUE io, VALUE
452
449
  rb_raise(rb_eRuntimeError, "Length exceeds size of buffer!");
453
450
  }
454
451
 
455
- while (length > 0) {
456
- int result = io_write(data, fiber, descriptor, (char*)base+offset, length);
452
+ while (true) {
453
+ size_t maximum_size = size - offset;
454
+ int result = io_write(data, fiber, descriptor, (char*)base+offset, maximum_size);
457
455
 
458
- if (result >= 0) {
456
+ if (result > 0) {
459
457
  offset += result;
460
458
  if ((size_t)result >= length) break;
461
459
  length -= result;
462
- } else if (-result == EAGAIN || -result == EWOULDBLOCK) {
460
+ } else if (result == 0) {
461
+ break;
462
+ } else if (length > 0 && IO_Event_try_again(-result)) {
463
463
  IO_Event_Selector_URing_io_wait(self, fiber, io, RB_INT2NUM(IO_EVENT_WRITABLE));
464
464
  } else {
465
- rb_syserr_fail(-result, strerror(-result));
465
+ return rb_fiber_scheduler_io_result(-1, -result);
466
466
  }
467
467
  }
468
468
 
469
- return SIZET2NUM(offset);
469
+ return rb_fiber_scheduler_io_result(offset, 0);
470
470
  }
471
471
 
472
472
  #endif
@@ -554,7 +554,7 @@ int select_internal_without_gvl(struct select_arguments *arguments) {
554
554
  if (arguments->result == -ETIME) {
555
555
  arguments->result = 0;
556
556
  } else if (arguments->result < 0) {
557
- rb_syserr_fail(-arguments->result, "select_internal_without_gvl:io_uring_wait_cqes");
557
+ rb_syserr_fail(-arguments->result, "select_internal_without_gvl:io_uring_wait_cqe_timeout");
558
558
  } else {
559
559
  // At least 1 event is waiting:
560
560
  arguments->result = 1;
data/ext/kqueue.o CHANGED
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
- 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 "
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 -std=c99 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
- 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 "
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 -std=c99 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"
@@ -34,7 +34,7 @@ checked program was:
34
34
 
35
35
  have_func: checking for &rb_fiber_transfer()... -------------------- yes
36
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 "
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 -std=c99 conftest.c -L. -L/Users/samuel/.rubies/ruby-head/lib -L. -fstack-protector-strong -lruby.3.1-static -framework CoreFoundation -lpthread -ldl -lobjc "
38
38
  checked program was:
39
39
  /* begin */
40
40
  1: #include "ruby.h"
@@ -57,7 +57,7 @@ checked program was:
57
57
 
58
58
  have_library: checking for -luring... -------------------- no
59
59
 
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 "
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 -std=c99 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
61
  ld: library not found for -luring
62
62
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
63
63
  checked program was:
@@ -83,7 +83,7 @@ checked program was:
83
83
 
84
84
  have_header: checking for sys/epoll.h... -------------------- no
85
85
 
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"
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 -std=c99 -c conftest.c"
87
87
  conftest.c:3:10: fatal error: 'sys/epoll.h' file not found
88
88
  #include <sys/epoll.h>
89
89
  ^~~~~~~~~~~~~
@@ -99,7 +99,7 @@ checked program was:
99
99
 
100
100
  have_header: checking for sys/event.h... -------------------- yes
101
101
 
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"
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 -std=c99 -c conftest.c"
103
103
  checked program was:
104
104
  /* begin */
105
105
  1: #include "ruby.h"
@@ -111,7 +111,7 @@ checked program was:
111
111
 
112
112
  have_header: checking for sys/eventfd.h... -------------------- no
113
113
 
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"
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 -std=c99 -c conftest.c"
115
115
  conftest.c:3:10: fatal error: 'sys/eventfd.h' file not found
116
116
  #include <sys/eventfd.h>
117
117
  ^~~~~~~~~~~~~~~
@@ -127,7 +127,7 @@ checked program was:
127
127
 
128
128
  have_func: checking for rb_io_descriptor()... -------------------- yes
129
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 "
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 -std=c99 conftest.c -L. -L/Users/samuel/.rubies/ruby-head/lib -L. -fstack-protector-strong -lruby.3.1-static -framework CoreFoundation -lpthread -ldl -lobjc "
131
131
  conftest.c:14:57: error: use of undeclared identifier 'rb_io_descriptor'
132
132
  int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_io_descriptor; return !p; }
133
133
  ^
@@ -150,7 +150,7 @@ checked program was:
150
150
  14: int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_io_descriptor; return !p; }
151
151
  /* end */
152
152
 
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 "
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 -std=c99 conftest.c -L. -L/Users/samuel/.rubies/ruby-head/lib -L. -fstack-protector-strong -lruby.3.1-static -framework CoreFoundation -lpthread -ldl -lobjc "
154
154
  checked program was:
155
155
  /* begin */
156
156
  1: #include "ruby.h"
@@ -174,7 +174,7 @@ checked program was:
174
174
 
175
175
  have_func: checking for &rb_process_status_wait()... -------------------- no
176
176
 
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 "
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 -std=c99 conftest.c -L. -L/Users/samuel/.rubies/ruby-head/lib -L. -fstack-protector-strong -lruby.3.1-static -framework CoreFoundation -lpthread -ldl -lobjc "
178
178
  conftest.c:14:76: error: use of undeclared identifier 'rb_process_status_wait'
179
179
  int t(void) { const volatile void *volatile p; p = (const volatile void *)&rb_process_status_wait; return !p; }
180
180
  ^
@@ -201,7 +201,7 @@ checked program was:
201
201
 
202
202
  have_func: checking for rb_fiber_current()... -------------------- yes
203
203
 
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 "
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 -std=c99 conftest.c -L. -L/Users/samuel/.rubies/ruby-head/lib -L. -fstack-protector-strong -lruby.3.1-static -framework CoreFoundation -lpthread -ldl -lobjc "
205
205
  checked program was:
206
206
  /* begin */
207
207
  1: #include "ruby.h"
@@ -224,7 +224,7 @@ checked program was:
224
224
 
225
225
  have_func: checking for &rb_fiber_raise()... -------------------- yes
226
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 "
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 -std=c99 conftest.c -L. -L/Users/samuel/.rubies/ruby-head/lib -L. -fstack-protector-strong -lruby.3.1-static -framework CoreFoundation -lpthread -ldl -lobjc "
228
228
  checked program was:
229
229
  /* begin */
230
230
  1: #include "ruby.h"
@@ -247,7 +247,7 @@ checked program was:
247
247
 
248
248
  have_header: checking for ruby/io/buffer.h... -------------------- yes
249
249
 
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"
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 -std=c99 -c conftest.c"
251
251
  checked program was:
252
252
  /* begin */
253
253
  1: #include "ruby.h"
data/ext/selector.o CHANGED
Binary file
@@ -134,25 +134,36 @@ module IO::Event
134
134
  end
135
135
 
136
136
  if IO.const_defined?(:Buffer)
137
+ EAGAIN = Errno::EAGAIN::Errno
138
+
137
139
  def io_read(fiber, io, buffer, length)
138
140
  offset = 0
139
141
 
140
- while length > 0
141
- # The maximum size we can read:
142
+ while true
142
143
  maximum_size = buffer.size - offset
143
144
 
144
- case result = io.read_nonblock(maximum_size, exception: false)
145
+ case result = blocking{io.read_nonblock(maximum_size, exception: false)}
145
146
  when :wait_readable
146
- self.io_wait(fiber, io, IO::READABLE)
147
+ if length > 0
148
+ self.io_wait(fiber, io, IO::READABLE)
149
+ else
150
+ return -EAGAIN
151
+ end
147
152
  when :wait_writable
148
- self.io_wait(fiber, io, IO::WRITABLE)
153
+ if length > 0
154
+ self.io_wait(fiber, io, IO::WRITABLE)
155
+ else
156
+ return -EAGAIN
157
+ end
149
158
  else
150
159
  break unless result
151
160
 
152
161
  buffer.copy(result, offset)
153
162
 
154
- offset += result.bytesize
155
- length -= result.bytesize
163
+ size = result.bytesize
164
+ offset += size
165
+ break if size >= length
166
+ length -= size
156
167
  end
157
168
  end
158
169
 
@@ -162,16 +173,26 @@ module IO::Event
162
173
  def io_write(fiber, io, buffer, length)
163
174
  offset = 0
164
175
 
165
- while length > 0
166
- # From offset until the end:
167
- chunk = buffer.to_str(offset, length)
168
- case result = io.write_nonblock(chunk, exception: false)
176
+ while true
177
+ maximum_size = buffer.size - offset
178
+
179
+ chunk = buffer.to_str(offset, maximum_size)
180
+ case result = blocking{io.write_nonblock(chunk, exception: false)}
169
181
  when :wait_readable
170
- self.io_wait(fiber, io, IO::READABLE)
182
+ if length > 0
183
+ self.io_wait(fiber, io, IO::READABLE)
184
+ else
185
+ return -EAGAIN
186
+ end
171
187
  when :wait_writable
172
- self.io_wait(fiber, io, IO::WRITABLE)
188
+ if length > 0
189
+ self.io_wait(fiber, io, IO::WRITABLE)
190
+ else
191
+ return -EAGAIN
192
+ end
173
193
  else
174
194
  offset += result
195
+ break if result >= length
175
196
  length -= result
176
197
  end
177
198
  end
@@ -240,6 +261,10 @@ module IO::Event
240
261
 
241
262
  return ready.size
242
263
  end
264
+
265
+ private def blocking(&block)
266
+ Fiber.new(blocking: true, &block).resume
267
+ end
243
268
  end
244
269
  end
245
270
  end
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module IO::Event
22
- VERSION = "0.2.4"
22
+ VERSION = "0.3.1"
23
23
  end
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
4
+ version: 0.3.1
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 00:00:00.000000000 Z
11
+ date: 2021-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bake
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0.5'
61
+ version: '0.6'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0.5'
68
+ version: '0.6'
69
69
  description:
70
70
  email:
71
71
  executables: []