uringmachine 0.3 → 0.5

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.
Files changed (167) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/test.yml +2 -1
  3. data/CHANGELOG.md +23 -0
  4. data/README.md +128 -0
  5. data/TODO.md +14 -0
  6. data/examples/bm_snooze.rb +89 -0
  7. data/examples/bm_write.rb +56 -0
  8. data/examples/dns_client.rb +12 -0
  9. data/examples/echo_server.rb +18 -40
  10. data/examples/http_server.rb +42 -43
  11. data/examples/inout.rb +19 -0
  12. data/examples/nc.rb +36 -0
  13. data/examples/server_client.rb +64 -0
  14. data/examples/snooze.rb +44 -0
  15. data/examples/write_dev_null.rb +16 -0
  16. data/ext/um/extconf.rb +24 -23
  17. data/ext/um/um.c +524 -278
  18. data/ext/um/um.h +146 -44
  19. data/ext/um/um_buffer.c +49 -0
  20. data/ext/um/um_class.c +217 -106
  21. data/ext/um/um_const.c +213 -0
  22. data/ext/um/um_ext.c +4 -0
  23. data/ext/um/um_mutex_class.c +47 -0
  24. data/ext/um/um_op.c +86 -114
  25. data/ext/um/um_queue_class.c +58 -0
  26. data/ext/um/um_sync.c +273 -0
  27. data/ext/um/um_utils.c +49 -4
  28. data/lib/uringmachine/dns_resolver.rb +84 -0
  29. data/lib/uringmachine/version.rb +1 -1
  30. data/lib/uringmachine.rb +28 -0
  31. data/supressions/ruby.supp +71 -0
  32. data/test/helper.rb +8 -0
  33. data/test/test_um.rb +685 -46
  34. data/vendor/liburing/.github/workflows/build.yml +29 -1
  35. data/vendor/liburing/.gitignore +6 -0
  36. data/vendor/liburing/CHANGELOG +16 -0
  37. data/vendor/liburing/CONTRIBUTING.md +165 -0
  38. data/vendor/liburing/configure +64 -0
  39. data/vendor/liburing/examples/Makefile +9 -1
  40. data/vendor/liburing/examples/kdigest.c +405 -0
  41. data/vendor/liburing/examples/proxy.c +75 -8
  42. data/vendor/liburing/examples/reg-wait.c +159 -0
  43. data/vendor/liburing/liburing.pc.in +1 -1
  44. data/vendor/liburing/liburing.spec +1 -1
  45. data/vendor/liburing/src/Makefile +16 -2
  46. data/vendor/liburing/src/include/liburing/io_uring.h +77 -0
  47. data/vendor/liburing/src/include/liburing/sanitize.h +39 -0
  48. data/vendor/liburing/src/include/liburing.h +59 -6
  49. data/vendor/liburing/src/int_flags.h +10 -3
  50. data/vendor/liburing/src/liburing-ffi.map +16 -0
  51. data/vendor/liburing/src/liburing.map +10 -0
  52. data/vendor/liburing/src/queue.c +28 -16
  53. data/vendor/liburing/src/register.c +106 -1
  54. data/vendor/liburing/src/sanitize.c +176 -0
  55. data/vendor/liburing/src/setup.c +47 -19
  56. data/vendor/liburing/src/setup.h +6 -0
  57. data/vendor/liburing/test/35fa71a030ca.c +7 -0
  58. data/vendor/liburing/test/500f9fbadef8.c +2 -0
  59. data/vendor/liburing/test/7ad0e4b2f83c.c +0 -25
  60. data/vendor/liburing/test/917257daa0fe.c +7 -0
  61. data/vendor/liburing/test/Makefile +38 -4
  62. data/vendor/liburing/test/a0908ae19763.c +7 -0
  63. data/vendor/liburing/test/a4c0b3decb33.c +7 -0
  64. data/vendor/liburing/test/accept.c +14 -4
  65. data/vendor/liburing/test/b19062a56726.c +7 -0
  66. data/vendor/liburing/test/bind-listen.c +2 -2
  67. data/vendor/liburing/test/buf-ring-nommap.c +10 -3
  68. data/vendor/liburing/test/buf-ring.c +2 -0
  69. data/vendor/liburing/test/cmd-discard.c +427 -0
  70. data/vendor/liburing/test/coredump.c +7 -0
  71. data/vendor/liburing/test/cq-overflow.c +13 -1
  72. data/vendor/liburing/test/d4ae271dfaae.c +11 -3
  73. data/vendor/liburing/test/defer-taskrun.c +2 -2
  74. data/vendor/liburing/test/defer-tw-timeout.c +4 -1
  75. data/vendor/liburing/test/defer.c +2 -2
  76. data/vendor/liburing/test/double-poll-crash.c +1 -1
  77. data/vendor/liburing/test/eeed8b54e0df.c +2 -0
  78. data/vendor/liburing/test/eventfd.c +0 -1
  79. data/vendor/liburing/test/exit-no-cleanup.c +11 -0
  80. data/vendor/liburing/test/fadvise.c +9 -26
  81. data/vendor/liburing/test/fdinfo.c +9 -1
  82. data/vendor/liburing/test/fifo-nonblock-read.c +69 -0
  83. data/vendor/liburing/test/file-exit-unreg.c +48 -0
  84. data/vendor/liburing/test/file-register.c +14 -2
  85. data/vendor/liburing/test/file-update.c +1 -1
  86. data/vendor/liburing/test/file-verify.c +27 -16
  87. data/vendor/liburing/test/files-exit-hang-timeout.c +1 -2
  88. data/vendor/liburing/test/fixed-buf-iter.c +3 -1
  89. data/vendor/liburing/test/fixed-hugepage.c +12 -1
  90. data/vendor/liburing/test/fsnotify.c +1 -0
  91. data/vendor/liburing/test/futex.c +16 -4
  92. data/vendor/liburing/test/helpers.c +47 -0
  93. data/vendor/liburing/test/helpers.h +6 -0
  94. data/vendor/liburing/test/init-mem.c +5 -3
  95. data/vendor/liburing/test/io-cancel.c +0 -24
  96. data/vendor/liburing/test/io_uring_passthrough.c +4 -0
  97. data/vendor/liburing/test/io_uring_register.c +38 -8
  98. data/vendor/liburing/test/iopoll-leak.c +4 -0
  99. data/vendor/liburing/test/iopoll-overflow.c +1 -1
  100. data/vendor/liburing/test/iopoll.c +3 -3
  101. data/vendor/liburing/test/kallsyms.c +203 -0
  102. data/vendor/liburing/test/link-timeout.c +159 -0
  103. data/vendor/liburing/test/linked-defer-close.c +224 -0
  104. data/vendor/liburing/test/madvise.c +12 -25
  105. data/vendor/liburing/test/min-timeout-wait.c +0 -25
  106. data/vendor/liburing/test/min-timeout.c +0 -25
  107. data/vendor/liburing/test/mkdir.c +6 -0
  108. data/vendor/liburing/test/msg-ring.c +8 -2
  109. data/vendor/liburing/test/napi-test.c +16 -3
  110. data/vendor/liburing/test/no-mmap-inval.c +3 -1
  111. data/vendor/liburing/test/nop.c +44 -0
  112. data/vendor/liburing/test/ooo-file-unreg.c +1 -1
  113. data/vendor/liburing/test/open-close.c +40 -0
  114. data/vendor/liburing/test/openat2.c +37 -14
  115. data/vendor/liburing/test/poll-many.c +13 -7
  116. data/vendor/liburing/test/poll-mshot-update.c +17 -10
  117. data/vendor/liburing/test/poll-v-poll.c +6 -3
  118. data/vendor/liburing/test/pollfree.c +148 -0
  119. data/vendor/liburing/test/read-mshot-empty.c +158 -153
  120. data/vendor/liburing/test/read-mshot-stdin.c +121 -0
  121. data/vendor/liburing/test/read-mshot.c +282 -27
  122. data/vendor/liburing/test/read-write.c +78 -13
  123. data/vendor/liburing/test/recv-msgall-stream.c +3 -0
  124. data/vendor/liburing/test/recv-msgall.c +5 -0
  125. data/vendor/liburing/test/recvsend_bundle-inc.c +680 -0
  126. data/vendor/liburing/test/recvsend_bundle.c +94 -31
  127. data/vendor/liburing/test/reg-fd-only.c +15 -5
  128. data/vendor/liburing/test/reg-wait.c +251 -0
  129. data/vendor/liburing/test/regbuf-clone.c +645 -0
  130. data/vendor/liburing/test/regbuf-merge.c +7 -0
  131. data/vendor/liburing/test/register-restrictions.c +86 -85
  132. data/vendor/liburing/test/rename.c +59 -1
  133. data/vendor/liburing/test/resize-rings.c +643 -0
  134. data/vendor/liburing/test/ringbuf-read.c +5 -0
  135. data/vendor/liburing/test/ringbuf-status.c +5 -1
  136. data/vendor/liburing/test/rsrc_tags.c +1 -1
  137. data/vendor/liburing/test/runtests.sh +16 -1
  138. data/vendor/liburing/test/send-zerocopy.c +59 -0
  139. data/vendor/liburing/test/short-read.c +1 -0
  140. data/vendor/liburing/test/socket.c +43 -0
  141. data/vendor/liburing/test/splice.c +3 -1
  142. data/vendor/liburing/test/sq-poll-dup.c +1 -1
  143. data/vendor/liburing/test/sq-poll-share.c +2 -0
  144. data/vendor/liburing/test/sqpoll-disable-exit.c +8 -0
  145. data/vendor/liburing/test/sqpoll-exit-hang.c +1 -25
  146. data/vendor/liburing/test/sqpoll-sleep.c +40 -33
  147. data/vendor/liburing/test/sqwait.c +136 -0
  148. data/vendor/liburing/test/statx.c +89 -0
  149. data/vendor/liburing/test/stdout.c +2 -0
  150. data/vendor/liburing/test/submit-and-wait.c +1 -25
  151. data/vendor/liburing/test/submit-reuse.c +4 -26
  152. data/vendor/liburing/test/symlink.c +12 -1
  153. data/vendor/liburing/test/sync-cancel.c +56 -22
  154. data/vendor/liburing/test/thread-exit.c +5 -0
  155. data/vendor/liburing/test/timeout-new.c +1 -26
  156. data/vendor/liburing/test/timeout.c +25 -34
  157. data/vendor/liburing/test/unlink.c +94 -1
  158. data/vendor/liburing/test/uring_cmd_ublk.c +1252 -0
  159. data/vendor/liburing/test/waitid.c +62 -8
  160. data/vendor/liburing/test/wq-aff.c +35 -0
  161. data/vendor/liburing/test/xfail_prep_link_timeout_out_of_scope.c +46 -0
  162. data/vendor/liburing/test/xfail_register_buffers_out_of_scope.c +51 -0
  163. metadata +37 -6
  164. data/examples/event_loop.rb +0 -69
  165. data/examples/fibers.rb +0 -105
  166. data/examples/http_server_multishot.rb +0 -57
  167. data/examples/http_server_simpler.rb +0 -34
@@ -7,7 +7,7 @@ on:
7
7
 
8
8
  jobs:
9
9
  build:
10
- runs-on: ubuntu-22.04
10
+ runs-on: ubuntu-24.04
11
11
 
12
12
  strategy:
13
13
  fail-fast: false
@@ -19,6 +19,15 @@ jobs:
19
19
  cxx_pkg: g++-x86-64-linux-gnu
20
20
  cc: x86_64-linux-gnu-gcc
21
21
  cxx: x86_64-linux-gnu-g++
22
+ sanitize: 0
23
+
24
+ # x86-64 gcc asan
25
+ - arch: x86_64
26
+ cc_pkg: gcc-x86-64-linux-gnu
27
+ cxx_pkg: g++-x86-64-linux-gnu
28
+ cc: x86_64-linux-gnu-gcc
29
+ cxx: x86_64-linux-gnu-g++
30
+ sanitize: 1
22
31
 
23
32
  # x86-64 clang
24
33
  - arch: x86_64
@@ -28,6 +37,7 @@ jobs:
28
37
  cxx: clang++
29
38
  liburing_extra_flags: -Wshorten-64-to-32
30
39
  extra_flags: -Wmissing-prototypes -Wstrict-prototypes -Wunreachable-code-loop-increment -Wunreachable-code -Wmissing-variable-declarations -Wextra-semi-stmt
40
+ sanitize: 0
31
41
 
32
42
  # x86 (32-bit) gcc
33
43
  - arch: i686
@@ -35,6 +45,7 @@ jobs:
35
45
  cxx_pkg: g++-i686-linux-gnu
36
46
  cc: i686-linux-gnu-gcc
37
47
  cxx: i686-linux-gnu-g++
48
+ sanitize: 0
38
49
 
39
50
  # aarch64 gcc
40
51
  - arch: aarch64
@@ -42,6 +53,7 @@ jobs:
42
53
  cxx_pkg: g++-aarch64-linux-gnu
43
54
  cc: aarch64-linux-gnu-gcc
44
55
  cxx: aarch64-linux-gnu-g++
56
+ sanitize: 0
45
57
 
46
58
  # arm (32-bit) gcc
47
59
  - arch: arm
@@ -49,6 +61,7 @@ jobs:
49
61
  cxx_pkg: g++-arm-linux-gnueabi
50
62
  cc: arm-linux-gnueabi-gcc
51
63
  cxx: arm-linux-gnueabi-g++
64
+ sanitize: 0
52
65
 
53
66
  # riscv64
54
67
  - arch: riscv64
@@ -56,6 +69,7 @@ jobs:
56
69
  cxx_pkg: g++-riscv64-linux-gnu
57
70
  cc: riscv64-linux-gnu-gcc
58
71
  cxx: riscv64-linux-gnu-g++
72
+ sanitize: 0
59
73
 
60
74
  # powerpc64
61
75
  - arch: powerpc64
@@ -63,6 +77,7 @@ jobs:
63
77
  cxx_pkg: g++-powerpc64-linux-gnu
64
78
  cc: powerpc64-linux-gnu-gcc
65
79
  cxx: powerpc64-linux-gnu-g++
80
+ sanitize: 0
66
81
 
67
82
  # powerpc
68
83
  - arch: powerpc
@@ -70,6 +85,7 @@ jobs:
70
85
  cxx_pkg: g++-powerpc-linux-gnu
71
86
  cc: powerpc-linux-gnu-gcc
72
87
  cxx: powerpc-linux-gnu-g++
88
+ sanitize: 0
73
89
 
74
90
  # alpha
75
91
  - arch: alpha
@@ -77,6 +93,7 @@ jobs:
77
93
  cxx_pkg: g++-alpha-linux-gnu
78
94
  cc: alpha-linux-gnu-gcc
79
95
  cxx: alpha-linux-gnu-g++
96
+ sanitize: 0
80
97
 
81
98
  # mips64
82
99
  - arch: mips64
@@ -84,6 +101,7 @@ jobs:
84
101
  cxx_pkg: g++-mips64-linux-gnuabi64
85
102
  cc: mips64-linux-gnuabi64-gcc
86
103
  cxx: mips64-linux-gnuabi64-g++
104
+ sanitize: 0
87
105
 
88
106
  # mips
89
107
  - arch: mips
@@ -91,6 +109,7 @@ jobs:
91
109
  cxx_pkg: g++-mips-linux-gnu
92
110
  cc: mips-linux-gnu-gcc
93
111
  cxx: mips-linux-gnu-g++
112
+ sanitize: 0
94
113
 
95
114
  # hppa
96
115
  - arch: hppa
@@ -98,9 +117,11 @@ jobs:
98
117
  cxx_pkg: g++-hppa-linux-gnu
99
118
  cc: hppa-linux-gnu-gcc
100
119
  cxx: hppa-linux-gnu-g++
120
+ sanitize: 0
101
121
 
102
122
  env:
103
123
  FLAGS: -g -O3 -Wall -Wextra -Werror -Wno-sign-compare ${{matrix.extra_flags}}
124
+ SANITIZE: ${{matrix.sanitize}}
104
125
 
105
126
  # Flags for building sources in src/ dir only.
106
127
  LIBURING_CFLAGS: ${{matrix.liburing_extra_flags}}
@@ -128,10 +149,17 @@ jobs:
128
149
  ${{matrix.cxx}} --version;
129
150
 
130
151
  - name: Build
152
+ if: ${{matrix.sanitizer == '0'}}
131
153
  run: |
132
154
  ./configure --cc=${{matrix.cc}} --cxx=${{matrix.cxx}};
133
155
  make -j$(nproc) V=1 CPPFLAGS="-Werror" CFLAGS="$FLAGS" CXXFLAGS="$FLAGS";
134
156
 
157
+ - name: Build
158
+ if: ${{matrix.sanitizer == '1'}}
159
+ run: |
160
+ ./configure --cc=${{matrix.cc}} --cxx=${{matrix.cxx}} --enable-sanitizer;
161
+ make -j$(nproc) V=1 CPPFLAGS="-Werror" CFLAGS="$FLAGS" CXXFLAGS="$FLAGS";
162
+
135
163
  - name: Test install command
136
164
  run: |
137
165
  sudo make install;
@@ -26,11 +26,17 @@
26
26
  /examples/proxy
27
27
  /examples/send-zerocopy
28
28
  /examples/rsrc-update-bench
29
+ /examples/kdigest
30
+ /examples/reg-wait
29
31
 
30
32
  /test/*.t
31
33
  /test/*.dmesg
32
34
  /test/output/
33
35
 
36
+ # Clang's compilation database file and directory.
37
+ /.cache
38
+ /compile_commands.json
39
+
34
40
  config-host.h
35
41
  config-host.mak
36
42
  config.log
@@ -1,3 +1,19 @@
1
+ liburing-2.8 release
2
+ - Add support for incrementally/partially consumed provided buffers,
3
+ usable with the provided buffer ring support.
4
+ - Add support for foo_and_wait_min_timeout(), where it's possible to
5
+ define a minimum timeout for waiting to get batches of completions,
6
+ but if that fails, extend for a longer timeout without having any
7
+ extra context switches.
8
+ - Add support for using different clock sources for completion waiting.
9
+ - Great increase coverage of test cases, test case improvements and
10
+ fixes.
11
+ - Man page updates
12
+ - Don't leak _GNU_SOURCE via pkb-config --cflags
13
+ - Support for address sanitizer
14
+ - Add examples/kdigest sample program
15
+ - Add discard helper, test, and man page
16
+
1
17
  liburing-2.7 release
2
18
 
3
19
  - Man page updates
@@ -0,0 +1,165 @@
1
+ Introduction
2
+ ============
3
+
4
+ liburing welcomes contributions, whether they be bug fixes, features, or
5
+ documentation additions/updates. However, we do have some rules in place
6
+ to govern the sanity of the project, and all contributions should follow
7
+ the guidelines in this document. The main reasons for the rules are:
8
+
9
+ 1) Keep the code consistent
10
+ 2) Keep the git repository consistent
11
+ 3) Maintain bisectability
12
+
13
+ Coding style
14
+ ============
15
+
16
+ Generally, all the code in liburing should follow the same style. A few
17
+ known exceptions exist, like syzbot test cases that got committed rather
18
+ than re-writing them in a saner format. Any change you make, please
19
+ follow the style of the code around you.
20
+
21
+ Commit format
22
+ =============
23
+
24
+ Each commit should do one thing, and one thing only. If you find yourself,
25
+ in the commit message, adding phrases like "Also do [...]" or "While in
26
+ here [...]", then that's a sign that the change should have been split
27
+ into multiple commits. If your change includes some refactoring of code to
28
+ make your change possible, then that refactoring should be a separate
29
+ commit, done first. That means this preparatory commit won't have any
30
+ functional changes, and hence should be a no-op. It also means that your
31
+ main commit, with the change that you actually care about, will be smaller
32
+ and easier to review.
33
+
34
+ Each commit must stand on its own in terms of what it provides, and how it
35
+ works. Lots of changes are just a single commit, but for something a bit
36
+ more involved, it's not uncommon to have a pull request contain multiple
37
+ commits. Make each commit as simple as possible, and not any simpler. We'd
38
+ much rather see 10 simple commits than 2 more complicated ones. If you
39
+ stumble across something that needs fixing while making an unrelated
40
+ change, then please make that change as a separate commit, explaining why
41
+ it's being made.
42
+
43
+ Each commit in a series must be buildable, it's not enough that the end
44
+ result is buildable. See reason 3 in the introduction for why that's the
45
+ case.
46
+
47
+ No fixup commits! Sometimes people post a change and errors are pointed
48
+ out in the commit, and the author then does a followup fix for that
49
+ error. This isn't acceptable, please squash fixup commits into the
50
+ commit that introduced the problem in the first place. This is done by
51
+ amending the fix into the original commit that caused the issue. You can
52
+ do that with git rebase -i <sha> and arrange the commit order such that
53
+ the fixup is right after the original commit, and then use 's' (for
54
+ squash) to squash the fixup into the original commit. Don't forget to
55
+ edit the commit message while doing that, as git will combine the two
56
+ commit messages into one. Or you can do it manually. Once done, force
57
+ push your rewritten git history. See reasons 1-3 in the introduction
58
+ series for why that is.
59
+
60
+ Commit message
61
+ ==============
62
+
63
+ A good commit explains the WHY of a commit - explain the reason for this
64
+ commit to exist. Don't explain what the code in commit does, that should
65
+ be readily apparent from just reading the code. If that isn't the case,
66
+ then a comment in the code is going to be more useful than a lengthy
67
+ explanation in the commit message. liburing commits use the following
68
+ format:
69
+
70
+ Title
71
+
72
+ Body of commit
73
+
74
+ Signed-off-by: ```My Identity <my@email.com>```
75
+
76
+ That is, a descriptive title on the first line, then an empty line, then
77
+ the body of the commit message, then an empty line, and finally an SOB
78
+ tag. The signed-off-by exists to provide proof of origin, see the
79
+ [DCO](https://developercertificate.org/).
80
+
81
+ Example commit:
82
+
83
+ ```
84
+ commit 0fe5c09195c0918f89582dd6ff098a58a0bdf62a
85
+ Author: Jens Axboe <axboe@kernel.dk>
86
+ Date: Fri Sep 6 15:54:04 2024 -0600
87
+
88
+ configure: fix ublk_cmd header check
89
+
90
+ The previous commit is mixing private structures and defines with public
91
+ uapi ones. Testing for UBLK_U_CMD_START_DEV is fine, CTRL_CMD_HAS_DATA
92
+ is not. And struct ublk_ctrl_cmd_data is not a public struct.
93
+
94
+ Fixes: 83bc535a3118 ("configure: don't enable ublk if modern commands not available")
95
+ Signed-off-by: Jens Axboe <axboe@kernel.dk>
96
+ ```
97
+
98
+ Since this change is pretty trivial, a huge explanation need not be given
99
+ as to the reasonings for the change. However, for more complicated
100
+ changes, better reasonings should be given.
101
+
102
+ A Fixes line can be added if this commit fixes an issue in a previous
103
+ commit. That kind of meta data can be useful down the line for finding
104
+ dependencies between commits. Adding the following to your .gitconfig:
105
+
106
+ ```
107
+ [pretty]
108
+ fixes = Fixes: %h (\"%s\")
109
+ ```
110
+
111
+ and running ```git fixes <sha>``` will then generate the correctly
112
+ formatted Fixes line for the commit. Likewise, other meta data can be:
113
+
114
+ Link: https://somesite/somewhere
115
+
116
+ can be useful to link to a discussion around the issue that led to this
117
+ commit, perhaps a bug report. This can be a GitHub issue as well. If a
118
+ commit closes/solves a GitHub issue, than:
119
+
120
+ Closes: https://github.com/axboe/liburing/issues/XXXX
121
+
122
+ can also be used.
123
+
124
+ Each commit message should be formatted so each full line is 72-74 chars
125
+ wide. For many of us, GitHub is not the primary location, and git log is
126
+ often used in a terminal to browse the repo. Breaking lines at 72-74
127
+ characters retains readability in an xterm/terminal.
128
+
129
+ Pull Requests
130
+ =============
131
+
132
+ The git repository itself is the canonical location for information. It's
133
+ quite fine to provide a lengthy explanation for a pull request on GitHub,
134
+ however please ensure that this doesn't come at the expense of the commit
135
+ messages themselves being lacking. The commit messages should stand on
136
+ their own and contain everything that you'd otherwise put in the PR
137
+ message. If you've worked on projects that send patches before, consider
138
+ the PR message similar to the cover letter for a series of patches.
139
+
140
+ Most contributors seem to use GH for sending patches, which is fine. If
141
+ you prefer using email, then patches can also be sent to the io_uring
142
+ mailing list: io-uring@vger.kernel.org.
143
+
144
+ liburing doesn't squash/rebase-on-merge, or other heinous practices
145
+ sometimes seen elsewhere. Whatever sha your commit has in your tree is
146
+ what it'll have in the upstream tree. Patches are applied directly, and
147
+ pull requests are merged with a merge commit. If meta data needs to go
148
+ into the merge commit, then it will go into the merge commit message.
149
+ This means that you don't need to continually rebase your changes on top
150
+ of the master branch.
151
+
152
+ Testing changes
153
+ ===============
154
+
155
+ You should ALWAYS test your changes, no matter how trivial or obviously
156
+ correct they may seem. Nobody is infallible, and making mistakes is only
157
+ human.
158
+
159
+ liburing contains a wide variety of functional tests. If you make changes
160
+ to liburing, then you should run the test cases. This is done by building
161
+ the repo and running ```make runtests```. Note that some of the liburing
162
+ tests test for defects in older kernels, and hence it's possible that they
163
+ will crash on an outdated kernel that doesn't contain fixes from the
164
+ stable kernel tree. If in doubt, building and running the tests in a vm is
165
+ encouraged.
@@ -28,6 +28,8 @@ for opt do
28
28
  ;;
29
29
  --use-libc) use_libc=yes
30
30
  ;;
31
+ --enable-sanitizer) use_sanitizer=yes
32
+ ;;
31
33
  *)
32
34
  echo "ERROR: unknown option $opt"
33
35
  echo "Try '$0 --help' for more information"
@@ -76,6 +78,7 @@ Options: [defaults in brackets after descriptions]
76
78
  --cc=CMD use CMD as the C compiler
77
79
  --cxx=CMD use CMD as the C++ compiler
78
80
  --use-libc use libc for liburing (useful for hardening)
81
+ --enable-sanitizer compile liburing with the address and undefined behaviour sanitizers. (useful for debugging)
79
82
  EOF
80
83
  exit 0
81
84
  fi
@@ -414,6 +417,21 @@ if compile_prog "" "" "futexv"; then
414
417
  fi
415
418
  print_config "futex waitv support" "$futexv"
416
419
 
420
+ ##########################################
421
+ # Check block discard cmd support
422
+ discard_cmd="no"
423
+ cat > $TMPC << EOF
424
+ #include <linux/blkdev.h>
425
+ int main(void)
426
+ {
427
+ return BLOCK_URING_CMD_DISCARD;
428
+ }
429
+ EOF
430
+ if compile_prog "" "" "discard command"; then
431
+ discard_cmd="yes"
432
+ fi
433
+ print_config "io_uring discard command support" "$discard_cmd"
434
+
417
435
  ##########################################
418
436
  # Check idtype_t support
419
437
  has_idtype_t="no"
@@ -471,6 +489,26 @@ fi
471
489
  print_config "has_fanotify" "$has_fanotify"
472
490
  ####################################################
473
491
 
492
+ ##########################################
493
+ # check for ublk headers
494
+ ublk_header="no"
495
+ cat > $TMPC << EOF
496
+ #include <string.h>
497
+ #include <sys/ioctl.h>
498
+ #include <linux/ublk_cmd.h>
499
+ int main(int argc, char **argv)
500
+ {
501
+ struct ublksrv_ctrl_cmd cmd = { };
502
+
503
+ cmd.addr = UBLK_U_CMD_START_DEV;
504
+ return cmd.queue_id;
505
+ }
506
+ EOF
507
+ if compile_prog "" "" "ublk_header"; then
508
+ ublk_header="yes"
509
+ fi
510
+ print_config "ublk_header" "$ublk_header"
511
+
474
512
  if test "$liburing_nolibc" = "yes"; then
475
513
  output_sym "CONFIG_NOLIBC"
476
514
  fi
@@ -510,6 +548,15 @@ fi
510
548
  if test "$futexv" = "yes"; then
511
549
  output_sym "CONFIG_HAVE_FUTEXV"
512
550
  fi
551
+ if test "$ublk_header" = "yes"; then
552
+ output_sym "CONFIG_HAVE_UBLK_HEADER"
553
+ fi
554
+ if test "$use_sanitizer" = "yes"; then
555
+ output_sym "CONFIG_USE_SANITIZER"
556
+ print_config "use sanitizer" "yes"
557
+ else
558
+ print_config "use sanitizer" "no"
559
+ fi
513
560
 
514
561
  echo "CC=$cc" >> $config_host_mak
515
562
  print_config "CC" "$cc"
@@ -619,6 +666,23 @@ typedef enum
619
666
  } idtype_t;
620
667
  EOF
621
668
  fi
669
+
670
+ if test "$discard_cmd" != "yes"; then
671
+ cat >> $compat_h << EOF
672
+
673
+ #include <linux/ioctl.h>
674
+
675
+ #ifndef BLOCK_URING_CMD_DISCARD
676
+ #define BLOCK_URING_CMD_DISCARD _IO(0x12, 0)
677
+ #endif
678
+
679
+ EOF
680
+ else cat >> $compat_h << EOF
681
+ #include <linux/blkdev.h>
682
+
683
+ EOF
684
+ fi
685
+
622
686
  cat >> $compat_h << EOF
623
687
  #endif
624
688
  EOF
@@ -13,6 +13,12 @@ endif
13
13
  LDFLAGS ?=
14
14
  override LDFLAGS += -L../src/ -luring -lpthread
15
15
 
16
+ ifeq ($(CONFIG_USE_SANITIZER),y)
17
+ override CFLAGS += -fsanitize=address,undefined -fno-omit-frame-pointer -fno-optimize-sibling-calls
18
+ override CPPFLAGS += -fsanitize=address,undefined -fno-omit-frame-pointer -fno-optimize-sibling-calls
19
+ override LDFLAGS += -fsanitize=address,undefined
20
+ endif
21
+
16
22
  example_srcs := \
17
23
  io_uring-close-test.c \
18
24
  io_uring-cp.c \
@@ -22,9 +28,11 @@ example_srcs := \
22
28
  napi-busy-poll-client.c \
23
29
  napi-busy-poll-server.c \
24
30
  poll-bench.c \
31
+ reg-wait.c \
25
32
  send-zerocopy.c \
26
33
  rsrc-update-bench.c \
27
- proxy.c
34
+ proxy.c \
35
+ kdigest.c
28
36
 
29
37
  all_targets :=
30
38