polyphony 0.98 → 0.99

Sign up to get free protection for your applications and to get access to all the features.
Files changed (182) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +7 -0
  3. data/examples/io/https_server_sni_2.rb +14 -8
  4. data/ext/polyphony/extconf.rb +6 -5
  5. data/ext/polyphony/libev.h +0 -2
  6. data/lib/polyphony/core/sync.rb +53 -0
  7. data/lib/polyphony/extensions/io.rb +37 -14
  8. data/lib/polyphony/extensions/openssl.rb +1 -1
  9. data/lib/polyphony/version.rb +1 -1
  10. data/test/test_io.rb +6 -7
  11. data/test/test_socket.rb +61 -0
  12. data/test/test_sync.rb +42 -1
  13. data/vendor/liburing/.github/workflows/build.yml +7 -16
  14. data/vendor/liburing/.gitignore +5 -0
  15. data/vendor/liburing/CHANGELOG +23 -1
  16. data/vendor/liburing/Makefile +4 -3
  17. data/vendor/liburing/Makefile.common +1 -0
  18. data/vendor/liburing/README +48 -0
  19. data/vendor/liburing/configure +76 -6
  20. data/vendor/liburing/debian/changelog +11 -0
  21. data/vendor/liburing/debian/control +7 -16
  22. data/vendor/liburing/debian/liburing-dev.manpages +3 -6
  23. data/vendor/liburing/debian/liburing2.install +1 -0
  24. data/vendor/liburing/debian/liburing2.symbols +56 -0
  25. data/vendor/liburing/debian/rules +15 -68
  26. data/vendor/liburing/examples/Makefile +4 -0
  27. data/vendor/liburing/examples/io_uring-close-test.c +123 -0
  28. data/vendor/liburing/examples/io_uring-udp.c +1 -1
  29. data/vendor/liburing/examples/send-zerocopy.c +315 -56
  30. data/vendor/liburing/examples/ucontext-cp.c +2 -17
  31. data/vendor/liburing/liburing-ffi.pc.in +12 -0
  32. data/vendor/liburing/liburing.pc.in +1 -1
  33. data/vendor/liburing/liburing.spec +1 -1
  34. data/vendor/liburing/make-debs.sh +3 -3
  35. data/vendor/liburing/man/IO_URING_CHECK_VERSION.3 +1 -0
  36. data/vendor/liburing/man/IO_URING_VERSION_MAJOR.3 +1 -0
  37. data/vendor/liburing/man/IO_URING_VERSION_MINOR.3 +1 -0
  38. data/vendor/liburing/man/io_uring_buf_ring_add.3 +6 -6
  39. data/vendor/liburing/man/io_uring_check_version.3 +72 -0
  40. data/vendor/liburing/man/io_uring_close_ring_fd.3 +43 -0
  41. data/vendor/liburing/man/io_uring_major_version.3 +1 -0
  42. data/vendor/liburing/man/io_uring_minor_version.3 +1 -0
  43. data/vendor/liburing/man/io_uring_prep_accept.3 +1 -1
  44. data/vendor/liburing/man/io_uring_prep_fgetxattr.3 +1 -0
  45. data/vendor/liburing/man/io_uring_prep_fsetxattr.3 +1 -0
  46. data/vendor/liburing/man/io_uring_prep_getxattr.3 +61 -0
  47. data/vendor/liburing/man/io_uring_prep_link_timeout.3 +94 -0
  48. data/vendor/liburing/man/io_uring_prep_msg_ring.3 +22 -2
  49. data/vendor/liburing/man/io_uring_prep_msg_ring_cqe_flags.3 +1 -0
  50. data/vendor/liburing/man/io_uring_prep_poll_add.3 +1 -1
  51. data/vendor/liburing/man/io_uring_prep_provide_buffers.3 +18 -9
  52. data/vendor/liburing/man/io_uring_prep_readv.3 +3 -3
  53. data/vendor/liburing/man/io_uring_prep_readv2.3 +3 -3
  54. data/vendor/liburing/man/io_uring_prep_recv.3 +5 -5
  55. data/vendor/liburing/man/io_uring_prep_recvmsg.3 +4 -4
  56. data/vendor/liburing/man/io_uring_prep_send.3 +9 -0
  57. data/vendor/liburing/man/io_uring_prep_send_set_addr.3 +38 -0
  58. data/vendor/liburing/man/io_uring_prep_send_zc.3 +39 -7
  59. data/vendor/liburing/man/io_uring_prep_send_zc_fixed.3 +1 -0
  60. data/vendor/liburing/man/io_uring_prep_sendmsg.3 +20 -0
  61. data/vendor/liburing/man/io_uring_prep_sendmsg_zc.3 +1 -0
  62. data/vendor/liburing/man/io_uring_prep_setxattr.3 +64 -0
  63. data/vendor/liburing/man/io_uring_prep_splice.3 +40 -0
  64. data/vendor/liburing/man/io_uring_prep_writev.3 +2 -2
  65. data/vendor/liburing/man/io_uring_prep_writev2.3 +2 -2
  66. data/vendor/liburing/man/io_uring_recvmsg_out.3 +13 -9
  67. data/vendor/liburing/man/io_uring_register.2 +15 -9
  68. data/vendor/liburing/man/io_uring_register_buf_ring.3 +4 -4
  69. data/vendor/liburing/man/io_uring_register_buffers.3 +49 -6
  70. data/vendor/liburing/man/io_uring_register_buffers_sparse.3 +1 -0
  71. data/vendor/liburing/man/io_uring_register_buffers_tags.3 +1 -0
  72. data/vendor/liburing/man/io_uring_register_buffers_update_tag.3 +1 -0
  73. data/vendor/liburing/man/io_uring_register_files.3 +60 -5
  74. data/vendor/liburing/man/io_uring_register_files_tags.3 +1 -0
  75. data/vendor/liburing/man/io_uring_register_files_update.3 +1 -0
  76. data/vendor/liburing/man/io_uring_register_files_update_tag.3 +1 -0
  77. data/vendor/liburing/man/io_uring_setup.2 +31 -2
  78. data/vendor/liburing/man/io_uring_wait_cqe_timeout.3 +1 -1
  79. data/vendor/liburing/src/Makefile +25 -3
  80. data/vendor/liburing/src/ffi.c +15 -0
  81. data/vendor/liburing/src/include/liburing/io_uring.h +30 -7
  82. data/vendor/liburing/src/include/liburing.h +190 -148
  83. data/vendor/liburing/src/int_flags.h +1 -0
  84. data/vendor/liburing/src/lib.h +5 -16
  85. data/vendor/liburing/src/liburing-ffi.map +172 -0
  86. data/vendor/liburing/src/liburing.map +11 -0
  87. data/vendor/liburing/src/nolibc.c +9 -2
  88. data/vendor/liburing/src/queue.c +2 -2
  89. data/vendor/liburing/src/register.c +66 -96
  90. data/vendor/liburing/src/setup.c +5 -4
  91. data/vendor/liburing/src/version.c +21 -0
  92. data/vendor/liburing/test/232c93d07b74.c +3 -3
  93. data/vendor/liburing/test/35fa71a030ca.c +3 -3
  94. data/vendor/liburing/test/500f9fbadef8.c +2 -0
  95. data/vendor/liburing/test/917257daa0fe.c +1 -1
  96. data/vendor/liburing/test/Makefile +27 -7
  97. data/vendor/liburing/test/a0908ae19763.c +2 -2
  98. data/vendor/liburing/test/a4c0b3decb33.c +2 -2
  99. data/vendor/liburing/test/accept-link.c +4 -4
  100. data/vendor/liburing/test/accept-reuse.c +5 -7
  101. data/vendor/liburing/test/accept.c +34 -31
  102. data/vendor/liburing/test/b19062a56726.c +1 -1
  103. data/vendor/liburing/test/buf-ring.c +58 -4
  104. data/vendor/liburing/test/ce593a6c480a.c +2 -2
  105. data/vendor/liburing/test/close-opath.c +2 -1
  106. data/vendor/liburing/test/connect.c +8 -0
  107. data/vendor/liburing/test/cq-overflow.c +14 -8
  108. data/vendor/liburing/test/d4ae271dfaae.c +1 -1
  109. data/vendor/liburing/test/defer-taskrun.c +64 -9
  110. data/vendor/liburing/test/defer.c +1 -1
  111. data/vendor/liburing/test/double-poll-crash.c +3 -3
  112. data/vendor/liburing/test/eeed8b54e0df.c +8 -3
  113. data/vendor/liburing/test/eploop.c +74 -0
  114. data/vendor/liburing/test/eventfd-ring.c +1 -1
  115. data/vendor/liburing/test/eventfd.c +1 -1
  116. data/vendor/liburing/test/evloop.c +73 -0
  117. data/vendor/liburing/test/exit-no-cleanup.c +1 -1
  118. data/vendor/liburing/test/fadvise.c +1 -1
  119. data/vendor/liburing/test/fc2a85cb02ef.c +3 -3
  120. data/vendor/liburing/test/fd-pass.c +35 -16
  121. data/vendor/liburing/test/file-register.c +61 -0
  122. data/vendor/liburing/test/file-verify.c +2 -2
  123. data/vendor/liburing/test/files-exit-hang-timeout.c +2 -2
  124. data/vendor/liburing/test/fixed-link.c +1 -1
  125. data/vendor/liburing/test/fsnotify.c +118 -0
  126. data/vendor/liburing/test/hardlink.c +1 -1
  127. data/vendor/liburing/test/helpers.c +54 -2
  128. data/vendor/liburing/test/helpers.h +4 -0
  129. data/vendor/liburing/test/io-cancel.c +3 -1
  130. data/vendor/liburing/test/io_uring_passthrough.c +39 -8
  131. data/vendor/liburing/test/io_uring_setup.c +3 -80
  132. data/vendor/liburing/test/iopoll-overflow.c +118 -0
  133. data/vendor/liburing/test/iopoll.c +90 -4
  134. data/vendor/liburing/test/lfs-openat-write.c +7 -9
  135. data/vendor/liburing/test/lfs-openat.c +6 -8
  136. data/vendor/liburing/test/link_drain.c +31 -5
  137. data/vendor/liburing/test/madvise.c +1 -1
  138. data/vendor/liburing/test/msg-ring-flags.c +192 -0
  139. data/vendor/liburing/test/msg-ring-overflow.c +159 -0
  140. data/vendor/liburing/test/msg-ring.c +173 -13
  141. data/vendor/liburing/test/multicqes_drain.c +22 -19
  142. data/vendor/liburing/test/nvme.h +4 -3
  143. data/vendor/liburing/test/pipe-bug.c +95 -0
  144. data/vendor/liburing/test/poll-link.c +3 -3
  145. data/vendor/liburing/test/poll-many.c +41 -19
  146. data/vendor/liburing/test/poll-mshot-overflow.c +105 -2
  147. data/vendor/liburing/test/poll-race-mshot.c +292 -0
  148. data/vendor/liburing/test/poll-race.c +105 -0
  149. data/vendor/liburing/test/poll.c +244 -26
  150. data/vendor/liburing/test/pollfree.c +5 -5
  151. data/vendor/liburing/test/read-before-exit.c +20 -3
  152. data/vendor/liburing/test/read-write.c +2 -0
  153. data/vendor/liburing/test/recv-multishot.c +96 -3
  154. data/vendor/liburing/test/reg-reg-ring.c +90 -0
  155. data/vendor/liburing/test/rename.c +1 -1
  156. data/vendor/liburing/test/ring-leak.c +0 -1
  157. data/vendor/liburing/test/ring-leak2.c +1 -1
  158. data/vendor/liburing/test/ringbuf-read.c +10 -6
  159. data/vendor/liburing/test/send-zerocopy.c +273 -103
  160. data/vendor/liburing/test/send_recv.c +7 -4
  161. data/vendor/liburing/test/sendmsg_fs_cve.c +2 -2
  162. data/vendor/liburing/test/single-issuer.c +7 -9
  163. data/vendor/liburing/test/skip-cqe.c +3 -4
  164. data/vendor/liburing/test/socket.c +0 -1
  165. data/vendor/liburing/test/sq-poll-dup.c +10 -3
  166. data/vendor/liburing/test/sq-poll-kthread.c +1 -1
  167. data/vendor/liburing/test/sq-poll-share.c +3 -2
  168. data/vendor/liburing/test/sqpoll-cancel-hang.c +17 -6
  169. data/vendor/liburing/test/sqpoll-disable-exit.c +4 -4
  170. data/vendor/liburing/test/symlink.c +2 -1
  171. data/vendor/liburing/test/test.h +2 -1
  172. data/vendor/liburing/test/timeout-new.c +11 -7
  173. data/vendor/liburing/test/timeout.c +1 -2
  174. data/vendor/liburing/test/unlink.c +1 -1
  175. data/vendor/liburing/test/version.c +25 -0
  176. data/vendor/liburing/test/wakeup-hang.c +1 -1
  177. data/vendor/liburing/test/xattr.c +8 -4
  178. metadata +42 -6
  179. data/vendor/liburing/debian/compat +0 -1
  180. data/vendor/liburing/debian/liburing1-udeb.install +0 -1
  181. data/vendor/liburing/debian/liburing1.install +0 -1
  182. data/vendor/liburing/debian/liburing1.symbols +0 -32
@@ -5,6 +5,22 @@ set -e
5
5
  cc=${CC:-gcc}
6
6
  cxx=${CXX:-g++}
7
7
 
8
+ #
9
+ # TODO(ammarfaizi2): Remove this notice and `--nolibc` option.
10
+ #
11
+ nolibc_deprecated() {
12
+ echo "";
13
+ echo "=================================================================";
14
+ echo "";
15
+ echo " --nolibc option is deprecated and has no effect.";
16
+ echo " It will be removed in a future liburing release.";
17
+ echo "";
18
+ echo " liburing on x86-64, x86 (32-bit) and aarch64 always use CONFIG_NOLIBC.";
19
+ echo "";
20
+ echo "=================================================================";
21
+ echo "";
22
+ }
23
+
8
24
  for opt do
9
25
  optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)' || true)
10
26
  case "$opt" in
@@ -26,7 +42,7 @@ for opt do
26
42
  ;;
27
43
  --cxx=*) cxx="$optarg"
28
44
  ;;
29
- --nolibc) liburing_nolibc="yes"
45
+ --nolibc) nolibc_deprecated
30
46
  ;;
31
47
  *)
32
48
  echo "ERROR: unknown option $opt"
@@ -115,7 +131,7 @@ print_config() {
115
131
  }
116
132
 
117
133
  # Default CFLAGS
118
- CFLAGS="-D_GNU_SOURCE -include config-host.h"
134
+ CFLAGS="-D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -include config-host.h"
119
135
  BUILD_CFLAGS=""
120
136
 
121
137
  # Print configure header at the top of $config_host_h
@@ -385,13 +401,43 @@ fi
385
401
  print_config "NVMe uring command support" "$nvme_uring_cmd"
386
402
 
387
403
  #############################################################################
404
+ #
405
+ # Currently, CONFIG_NOLIBC is only enabled on x86-64, x86 (32-bit) and aarch64.
406
+ #
407
+ cat > $TMPC << EOF
408
+ int main(void){
409
+ #if defined(__x86_64__) || defined(__i386__) || defined(__aarch64__)
410
+ return 0;
411
+ #else
412
+ #error libc is needed
413
+ #endif
414
+ }
415
+ EOF
416
+ if compile_prog "" "" "nolibc support"; then
417
+ liburing_nolibc="yes"
418
+ fi
419
+ print_config "nolibc support" "$liburing_nolibc";
420
+ #############################################################################
421
+
422
+ ####################################################
423
+ # Most Android devices don't have sys/fanotify.h
424
+ has_fanotify="no"
425
+ cat > $TMPC << EOF
426
+ #include <sys/fanotify.h>
427
+ int main(void)
428
+ {
429
+ return 0;
430
+ }
431
+ EOF
432
+ if compile_prog "" "" "fanotify"; then
433
+ has_fanotify="yes"
434
+ fi
435
+ print_config "has_fanotify" "$has_fanotify"
436
+ ####################################################
437
+
388
438
  if test "$liburing_nolibc" = "yes"; then
389
439
  output_sym "CONFIG_NOLIBC"
390
- else
391
- liburing_nolibc="no"
392
440
  fi
393
- print_config "liburing_nolibc" "$liburing_nolibc"
394
-
395
441
  if test "$__kernel_rwf_t" = "yes"; then
396
442
  output_sym "CONFIG_HAVE_KERNEL_RWF_T"
397
443
  fi
@@ -422,12 +468,31 @@ fi
422
468
  if test "$nvme_uring_cmd" = "yes"; then
423
469
  output_sym "CONFIG_HAVE_NVME_URING"
424
470
  fi
471
+ if test "$has_fanotify" = "yes"; then
472
+ output_sym "CONFIG_HAVE_FANOTIFY"
473
+ fi
425
474
 
426
475
  echo "CC=$cc" >> $config_host_mak
427
476
  print_config "CC" "$cc"
428
477
  echo "CXX=$cxx" >> $config_host_mak
429
478
  print_config "CXX" "$cxx"
430
479
 
480
+ # generate io_uring_version.h
481
+ MAKE_PRINT_VARS="include Makefile.common\nprint-%: ; @echo \$(\$*)\n"
482
+ VERSION_MAJOR=$(env echo -e "$MAKE_PRINT_VARS" | make -s --no-print-directory -f - print-VERSION_MAJOR)
483
+ VERSION_MINOR=$(env echo -e "$MAKE_PRINT_VARS" | make -s --no-print-directory -f - print-VERSION_MINOR)
484
+ io_uring_version_h="src/include/liburing/io_uring_version.h"
485
+ cat > $io_uring_version_h << EOF
486
+ /* SPDX-License-Identifier: MIT */
487
+ #ifndef LIBURING_VERSION_H
488
+ #define LIBURING_VERSION_H
489
+
490
+ #define IO_URING_VERSION_MAJOR $VERSION_MAJOR
491
+ #define IO_URING_VERSION_MINOR $VERSION_MINOR
492
+
493
+ #endif
494
+ EOF
495
+
431
496
  # generate compat.h
432
497
  compat_h="src/include/liburing/compat.h"
433
498
  cat > $compat_h << EOF
@@ -452,10 +517,15 @@ struct __kernel_timespec {
452
517
  long long tv_nsec;
453
518
  };
454
519
 
520
+ /* <linux/time_types.h> is not available, so it can't be included */
521
+ #define UAPI_LINUX_IO_URING_H_SKIP_LINUX_TIME_TYPES_H 1
522
+
455
523
  EOF
456
524
  else
457
525
  cat >> $compat_h << EOF
458
526
  #include <linux/time_types.h>
527
+ /* <linux/time_types.h> is included above and not needed again */
528
+ #define UAPI_LINUX_IO_URING_H_SKIP_LINUX_TIME_TYPES_H 1
459
529
 
460
530
  EOF
461
531
  fi
@@ -1,3 +1,14 @@
1
+ liburing (2.2-1) stable; urgency=low
2
+
3
+ * Update to 2.2
4
+ * Bump up so version to 2
5
+ * Drop liburing1-udeb
6
+ * Package using dh instead of using dh_* helpers manually
7
+ * Add linux header dependency to liburing-dev
8
+ * Bump up debhelper-compact level to 13
9
+
10
+ -- Kefu Chai <tchaikov@gmail.com> Sun, 16 Oct 2022 16:30:48 +0800
11
+
1
12
  liburing (0.7-1) stable; urgency=low
2
13
 
3
14
  * Update to 0.7
@@ -2,13 +2,14 @@ Source: liburing
2
2
  Section: libs
3
3
  Priority: optional
4
4
  Maintainer: Liu Changcheng <changcheng.liu@intel.com>
5
- Build-Depends: debhelper (>=9)
5
+ Build-Depends:
6
+ debhelper-compat (= 13)
6
7
  Standards-Version: 4.1.4
7
8
  Homepage: https://git.kernel.dk/cgit/liburing/tree/README
8
9
  Vcs-Git: https://git.kernel.dk/liburing
9
10
  Vcs-Browser: https://git.kernel.dk/cgit/liburing/
10
11
 
11
- Package: liburing1
12
+ Package: liburing2
12
13
  Architecture: linux-any
13
14
  Multi-Arch: same
14
15
  Pre-Depends: ${misc:Pre-Depends}
@@ -21,24 +22,14 @@ Description: userspace library for using io_uring
21
22
  .
22
23
  This package contains the shared library.
23
24
 
24
- Package: liburing1-udeb
25
- Package-Type: udeb
26
- Section: debian-installer
27
- Architecture: linux-any
28
- Depends: ${misc:Depends}, ${shlibs:Depends},
29
- Description: userspace library for using io_uring
30
- io_uring is kernel feature to improve development
31
- The newese Linux IO interface, io_uring could improve
32
- system performance a lot. liburing is the userpace
33
- library to use io_uring feature.
34
- .
35
- This package contains the udeb shared library.
36
-
37
25
  Package: liburing-dev
38
26
  Section: libdevel
39
27
  Architecture: linux-any
40
28
  Multi-Arch: same
41
- Depends: ${misc:Depends}, liburing1 (= ${binary:Version}),
29
+ Depends:
30
+ ${misc:Depends},
31
+ liburing2 (= ${binary:Version}),
32
+ linux-libc-dev (>= 5.1)
42
33
  Description: userspace library for using io_uring
43
34
  io_uring is kernel feature to improve development
44
35
  The newese Linux IO interface, io_uring could improve
@@ -1,6 +1,3 @@
1
- man/io_uring_setup.2
2
- man/io_uring_enter.2
3
- man/io_uring_register.2
4
- man/io_uring_queue_exit.3
5
- man/io_uring_queue_init.3
6
- man/io_uring_get_sqe.3
1
+ usr/share/man/man2/io_uring_*.2
2
+ usr/share/man/man3/io_uring_*.3
3
+ usr/share/man/man7/io_uring.7
@@ -0,0 +1 @@
1
+ usr/lib/*/lib*.so.*
@@ -0,0 +1,56 @@
1
+ liburing.so.2 liburing2 #MINVER# [47/1887]
2
+ LIBURING_2.0@LIBURING_2.0 0.7-1
3
+ LIBURING_2.1@LIBURING_2.1 0.7-1
4
+ LIBURING_2.2@LIBURING_2.2 0.7-1
5
+ LIBURING_2.3@LIBURING_2.3 0.7-1
6
+ __io_uring_get_cqe@LIBURING_2.0 0.7-1
7
+ __io_uring_sqring_wait@LIBURING_2.0 0.7-1
8
+ io_uring_enter2@LIBURING_2.3 0.7-1
9
+ io_uring_enter@LIBURING_2.3 0.7-1
10
+ io_uring_free_probe@LIBURING_2.0 0.7-1
11
+ io_uring_get_events@LIBURING_2.3 0.7-1
12
+ io_uring_get_probe@LIBURING_2.0 0.7-1
13
+ io_uring_get_probe_ring@LIBURING_2.0 0.7-1
14
+ io_uring_get_sqe@LIBURING_2.0 0.7-1
15
+ io_uring_mlock_size@LIBURING_2.1 0.7-1
16
+ io_uring_mlock_size_params@LIBURING_2.1 0.7-1
17
+ io_uring_peek_batch_cqe@LIBURING_2.0 0.7-1
18
+ io_uring_queue_exit@LIBURING_2.0 0.7-1
19
+ io_uring_queue_init@LIBURING_2.0 0.7-1
20
+ io_uring_queue_init_params@LIBURING_2.0 0.7-1
21
+ io_uring_queue_mmap@LIBURING_2.0 0.7-1
22
+ io_uring_register@LIBURING_2.3 0.7-1
23
+ io_uring_register_buf_ring@LIBURING_2.2 0.7-1
24
+ io_uring_register_buffers@LIBURING_2.0 0.7-1
25
+ io_uring_register_buffers_sparse@LIBURING_2.2 0.7-1
26
+ io_uring_register_buffers_tags@LIBURING_2.1 0.7-1
27
+ io_uring_register_buffers_update_tag@LIBURING_2.1 0.7-1
28
+ io_uring_register_eventfd@LIBURING_2.0 0.7-1
29
+ io_uring_register_eventfd_async@LIBURING_2.0 0.7-1
30
+ io_uring_register_file_alloc_range@LIBURING_2.3 0.7-1
31
+ io_uring_register_files@LIBURING_2.0 0.7-1
32
+ io_uring_register_files_sparse@LIBURING_2.2 0.7-1
33
+ io_uring_register_files_tags@LIBURING_2.1 0.7-1
34
+ io_uring_register_files_update@LIBURING_2.0 0.7-1
35
+ io_uring_register_files_update_tag@LIBURING_2.1 0.7-1
36
+ io_uring_register_iowq_aff@LIBURING_2.1 0.7-1
37
+ io_uring_register_iowq_max_workers@LIBURING_2.1 0.7-1
38
+ io_uring_register_personality@LIBURING_2.0 0.7-1
39
+ io_uring_register_probe@LIBURING_2.0 0.7-1
40
+ io_uring_register_ring_fd@LIBURING_2.2 0.7-1
41
+ io_uring_register_sync_cancel@LIBURING_2.3 0.7-1
42
+ io_uring_ring_dontfork@LIBURING_2.0 0.7-1
43
+ io_uring_setup@LIBURING_2.3 0.7-1
44
+ io_uring_submit@LIBURING_2.0 0.7-1
45
+ io_uring_submit_and_get_events@LIBURING_2.3 0.7-1
46
+ io_uring_submit_and_wait@LIBURING_2.0 0.7-1
47
+ io_uring_submit_and_wait_timeout@LIBURING_2.2 0.7-1
48
+ io_uring_unregister_buf_ring@LIBURING_2.2 0.7-1
49
+ io_uring_unregister_buffers@LIBURING_2.0 0.7-1
50
+ io_uring_unregister_eventfd@LIBURING_2.0 0.7-1
51
+ io_uring_unregister_files@LIBURING_2.0 0.7-1
52
+ io_uring_unregister_iowq_aff@LIBURING_2.1 0.7-1
53
+ io_uring_unregister_personality@LIBURING_2.0 0.7-1
54
+ io_uring_unregister_ring_fd@LIBURING_2.2 0.7-1
55
+ io_uring_wait_cqe_timeout@LIBURING_2.0 0.7-1
56
+ io_uring_wait_cqes@LIBURING_2.0 0.7-1
@@ -9,73 +9,20 @@ DEB_CFLAGS_MAINT_PREPEND = -Wall
9
9
  include /usr/share/dpkg/default.mk
10
10
  include /usr/share/dpkg/buildtools.mk
11
11
 
12
- export CC
13
-
14
- lib := liburing1
15
- libdbg := $(lib)-dbg
16
- libudeb := $(lib)-udeb
17
- libdev := liburing-dev
18
-
19
- build-indep:
20
-
21
- build-arch:
22
- dh_testdir
23
-
24
- $(MAKE) CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)"
25
-
26
- build: build-indep build-arch
27
-
28
- clean:
29
- dh_testdir
30
- dh_testroot
31
-
32
- $(MAKE) clean
33
-
34
- dh_clean
35
-
36
- check-arch: build-arch
37
- dh_testdir
38
-
12
+ %:
13
+ dh $@
14
+
15
+ override_dh_auto_configure:
16
+ ./configure \
17
+ --prefix=/usr \
18
+ --includedir=/usr/include \
19
+ --datadir=/usr/share \
20
+ --mandir=/usr/share/man \
21
+ --libdir=/usr/lib/$(DEB_HOST_MULTIARCH) \
22
+ --libdevdir=/usr/lib/$(DEB_HOST_MULTIARCH) \
23
+ --cc=$(CC)
24
+
25
+ override_dh_auto_test:
39
26
  ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
40
- $(MAKE) CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" \
41
- partcheck
27
+ $(MAKE) runtests
42
28
  endif
43
-
44
- install-arch: check-arch
45
- dh_testdir
46
- dh_testroot
47
- dh_clean
48
- dh_installdirs
49
-
50
- $(MAKE) install \
51
- DESTDIR=$(CURDIR)/debian/tmp \
52
- libdir=/lib/$(DEB_HOST_MULTIARCH) \
53
- libdevdir=/usr/lib/$(DEB_HOST_MULTIARCH) \
54
- relativelibdir=/lib/$(DEB_HOST_MULTIARCH)/
55
-
56
- binary: binary-indep binary-arch
57
-
58
- binary-indep:
59
- # Nothing to do.
60
-
61
- binary-arch: install-arch
62
- dh_testdir
63
- dh_testroot
64
- dh_install -a
65
- dh_installdocs -a
66
- dh_installexamples -a
67
- dh_installman -a
68
- dh_lintian -a
69
- dh_link -a
70
- dh_strip -a --ddeb-migration='$(libdbg) (<< 0.3)'
71
- dh_compress -a
72
- dh_fixperms -a
73
- dh_makeshlibs -a --add-udeb '$(libudeb)'
74
- dh_shlibdeps -a
75
- dh_installdeb -a
76
- dh_gencontrol -a
77
- dh_md5sums -a
78
- dh_builddeb -a
79
-
80
- .PHONY: clean build-indep build-arch build
81
- .PHONY: install-arch binary-indep binary-arch binary
@@ -10,7 +10,11 @@ ifneq ($(MAKECMDGOALS),clean)
10
10
  include ../config-host.mak
11
11
  endif
12
12
 
13
+ LDFLAGS ?=
14
+ override LDFLAGS += -L../src/ -luring -lpthread
15
+
13
16
  example_srcs := \
17
+ io_uring-close-test.c \
14
18
  io_uring-cp.c \
15
19
  io_uring-test.c \
16
20
  io_uring-udp.c \
@@ -0,0 +1,123 @@
1
+ /* SPDX-License-Identifier: MIT */
2
+ /*
3
+ * Simple app that demonstrates how to setup an io_uring interface, and use it
4
+ * via a registered ring fd, without leaving the original fd open.
5
+ *
6
+ * gcc -Wall -O2 -D_GNU_SOURCE -o io_uring-close-test io_uring-close-test.c -luring
7
+ */
8
+ #include <stdio.h>
9
+ #include <fcntl.h>
10
+ #include <string.h>
11
+ #include <stdlib.h>
12
+ #include <sys/types.h>
13
+ #include <sys/stat.h>
14
+ #include <unistd.h>
15
+ #include "liburing.h"
16
+
17
+ #define QD 4
18
+
19
+ int main(int argc, char *argv[])
20
+ {
21
+ struct io_uring ring;
22
+ int i, fd, ret, pending, done;
23
+ struct io_uring_sqe *sqe;
24
+ struct io_uring_cqe *cqe;
25
+ struct iovec *iovecs;
26
+ struct stat sb;
27
+ ssize_t fsize;
28
+ off_t offset;
29
+ void *buf;
30
+
31
+ if (argc < 2) {
32
+ printf("%s: file\n", argv[0]);
33
+ return 1;
34
+ }
35
+
36
+ ret = io_uring_queue_init(QD, &ring, 0);
37
+ if (ret < 0) {
38
+ fprintf(stderr, "queue_init: %s\n", strerror(-ret));
39
+ return 1;
40
+ }
41
+
42
+ ret = io_uring_register_ring_fd(&ring);
43
+ if (ret < 0) {
44
+ fprintf(stderr, "register_ring_fd: %s\n", strerror(-ret));
45
+ return 1;
46
+ }
47
+ ret = io_uring_close_ring_fd(&ring);
48
+ if (ret < 0) {
49
+ fprintf(stderr, "close_ring_fd: %s\n", strerror(-ret));
50
+ return 1;
51
+ }
52
+
53
+ fd = open(argv[1], O_RDONLY);
54
+ if (fd < 0) {
55
+ perror("open");
56
+ return 1;
57
+ }
58
+
59
+ if (fstat(fd, &sb) < 0) {
60
+ perror("fstat");
61
+ return 1;
62
+ }
63
+
64
+ fsize = 0;
65
+ iovecs = calloc(QD, sizeof(struct iovec));
66
+ for (i = 0; i < QD; i++) {
67
+ if (posix_memalign(&buf, 4096, 4096))
68
+ return 1;
69
+ iovecs[i].iov_base = buf;
70
+ iovecs[i].iov_len = 4096;
71
+ fsize += 4096;
72
+ }
73
+
74
+ offset = 0;
75
+ i = 0;
76
+ do {
77
+ sqe = io_uring_get_sqe(&ring);
78
+ if (!sqe)
79
+ break;
80
+ io_uring_prep_readv(sqe, fd, &iovecs[i], 1, offset);
81
+ offset += iovecs[i].iov_len;
82
+ i++;
83
+ if (offset > sb.st_size)
84
+ break;
85
+ } while (1);
86
+
87
+ ret = io_uring_submit(&ring);
88
+ if (ret < 0) {
89
+ fprintf(stderr, "io_uring_submit: %s\n", strerror(-ret));
90
+ return 1;
91
+ } else if (ret != i) {
92
+ fprintf(stderr, "io_uring_submit submitted less %d\n", ret);
93
+ return 1;
94
+ }
95
+
96
+ done = 0;
97
+ pending = ret;
98
+ fsize = 0;
99
+ for (i = 0; i < pending; i++) {
100
+ ret = io_uring_wait_cqe(&ring, &cqe);
101
+ if (ret < 0) {
102
+ fprintf(stderr, "io_uring_wait_cqe: %s\n", strerror(-ret));
103
+ return 1;
104
+ }
105
+
106
+ done++;
107
+ ret = 0;
108
+ if (cqe->res != 4096 && cqe->res + fsize != sb.st_size) {
109
+ fprintf(stderr, "ret=%d, wanted 4096\n", cqe->res);
110
+ ret = 1;
111
+ }
112
+ fsize += cqe->res;
113
+ io_uring_cqe_seen(&ring, cqe);
114
+ if (ret)
115
+ break;
116
+ }
117
+
118
+ printf("Submitted=%d, completed=%d, bytes=%lu\n", pending, done,
119
+ (unsigned long) fsize);
120
+ close(fd);
121
+ io_uring_queue_exit(&ring);
122
+ return 0;
123
+ }
@@ -275,7 +275,7 @@ static int process_cqe_recv(struct ctx *ctx, struct io_uring_cqe *cqe,
275
275
  const char *name;
276
276
  struct sockaddr_in *addr = io_uring_recvmsg_name(o);
277
277
 
278
- name = inet_ntop(ctx->af, addr, buff, sizeof(buff));
278
+ name = inet_ntop(ctx->af, &addr->sin_addr, buff, sizeof(buff));
279
279
  if (!name)
280
280
  name = "<INVALID>";
281
281
  fprintf(stderr, "received %u bytes %d from %s:%d\n",