@nxtedition/rocksdb 6.0.2 → 7.0.0-alpha.2

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 (259) hide show
  1. package/BUILDING.md +12 -4
  2. package/binding.cc +589 -128
  3. package/chained-batch.js +6 -6
  4. package/deps/rocksdb/rocksdb/CMakeLists.txt +9 -0
  5. package/deps/rocksdb/rocksdb/Makefile +16 -5
  6. package/deps/rocksdb/rocksdb/TARGETS +23 -2
  7. package/deps/rocksdb/rocksdb/cmake/modules/CxxFlags.cmake +7 -0
  8. package/deps/rocksdb/rocksdb/cmake/modules/FindJeMalloc.cmake +29 -0
  9. package/deps/rocksdb/rocksdb/cmake/modules/FindNUMA.cmake +29 -0
  10. package/deps/rocksdb/rocksdb/cmake/modules/FindSnappy.cmake +29 -0
  11. package/deps/rocksdb/rocksdb/cmake/modules/FindTBB.cmake +33 -0
  12. package/deps/rocksdb/rocksdb/cmake/modules/Findgflags.cmake +29 -0
  13. package/deps/rocksdb/rocksdb/cmake/modules/Findlz4.cmake +29 -0
  14. package/deps/rocksdb/rocksdb/cmake/modules/Finduring.cmake +26 -0
  15. package/deps/rocksdb/rocksdb/cmake/modules/Findzstd.cmake +29 -0
  16. package/deps/rocksdb/rocksdb/cmake/modules/ReadVersion.cmake +10 -0
  17. package/deps/rocksdb/rocksdb/db/builder.cc +12 -4
  18. package/deps/rocksdb/rocksdb/db/c.cc +26 -0
  19. package/deps/rocksdb/rocksdb/db/c_test.c +3 -0
  20. package/deps/rocksdb/rocksdb/db/column_family.cc +8 -2
  21. package/deps/rocksdb/rocksdb/db/compaction/compaction_job.cc +29 -6
  22. package/deps/rocksdb/rocksdb/db/compaction/compaction_job.h +8 -2
  23. package/deps/rocksdb/rocksdb/db/compaction/compaction_job_test.cc +16 -4
  24. package/deps/rocksdb/rocksdb/db/compaction/compaction_picker_test.cc +2 -1
  25. package/deps/rocksdb/rocksdb/db/compaction/compaction_service_test.cc +16 -0
  26. package/deps/rocksdb/rocksdb/db/db_basic_test.cc +402 -30
  27. package/deps/rocksdb/rocksdb/db/db_impl/db_impl.cc +2 -12
  28. package/deps/rocksdb/rocksdb/db/db_impl/db_impl.h +14 -0
  29. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_compaction_flush.cc +7 -5
  30. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_experimental.cc +1 -1
  31. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_open.cc +33 -7
  32. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_readonly.cc +54 -23
  33. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_readonly.h +3 -0
  34. package/deps/rocksdb/rocksdb/db/db_impl/db_impl_secondary.cc +8 -1
  35. package/deps/rocksdb/rocksdb/db/db_options_test.cc +16 -0
  36. package/deps/rocksdb/rocksdb/db/db_rate_limiter_test.cc +14 -15
  37. package/deps/rocksdb/rocksdb/db/db_readonly_with_timestamp_test.cc +331 -0
  38. package/deps/rocksdb/rocksdb/db/db_secondary_test.cc +5 -0
  39. package/deps/rocksdb/rocksdb/db/db_test.cc +16 -0
  40. package/deps/rocksdb/rocksdb/db/db_test2.cc +221 -92
  41. package/deps/rocksdb/rocksdb/db/db_test_util.cc +6 -2
  42. package/deps/rocksdb/rocksdb/db/db_test_util.h +4 -2
  43. package/deps/rocksdb/rocksdb/db/db_with_timestamp_basic_test.cc +1 -171
  44. package/deps/rocksdb/rocksdb/db/db_with_timestamp_test_util.cc +96 -0
  45. package/deps/rocksdb/rocksdb/db/db_with_timestamp_test_util.h +126 -0
  46. package/deps/rocksdb/rocksdb/db/experimental.cc +1 -1
  47. package/deps/rocksdb/rocksdb/db/external_sst_file_basic_test.cc +57 -0
  48. package/deps/rocksdb/rocksdb/db/external_sst_file_ingestion_job.cc +13 -2
  49. package/deps/rocksdb/rocksdb/db/external_sst_file_ingestion_job.h +2 -0
  50. package/deps/rocksdb/rocksdb/db/flush_job.cc +10 -11
  51. package/deps/rocksdb/rocksdb/db/import_column_family_job.cc +11 -1
  52. package/deps/rocksdb/rocksdb/db/import_column_family_test.cc +6 -0
  53. package/deps/rocksdb/rocksdb/db/repair.cc +12 -1
  54. package/deps/rocksdb/rocksdb/db/repair_test.cc +32 -10
  55. package/deps/rocksdb/rocksdb/db/snapshot_impl.h +3 -1
  56. package/deps/rocksdb/rocksdb/db/table_cache.cc +19 -127
  57. package/deps/rocksdb/rocksdb/db/table_cache.h +3 -2
  58. package/deps/rocksdb/rocksdb/db/table_cache_sync_and_async.h +140 -0
  59. package/deps/rocksdb/rocksdb/db/version_builder_test.cc +130 -128
  60. package/deps/rocksdb/rocksdb/db/version_edit.cc +20 -0
  61. package/deps/rocksdb/rocksdb/db/version_edit.h +13 -4
  62. package/deps/rocksdb/rocksdb/db/version_edit_test.cc +14 -14
  63. package/deps/rocksdb/rocksdb/db/version_set.cc +205 -212
  64. package/deps/rocksdb/rocksdb/db/version_set.h +11 -0
  65. package/deps/rocksdb/rocksdb/db/version_set_sync_and_async.h +154 -0
  66. package/deps/rocksdb/rocksdb/db/version_set_test.cc +10 -9
  67. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_common.h +2 -0
  68. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_gflags.cc +13 -0
  69. package/deps/rocksdb/rocksdb/db_stress_tool/db_stress_test_base.cc +15 -0
  70. package/deps/rocksdb/rocksdb/file/file_prefetch_buffer.cc +159 -65
  71. package/deps/rocksdb/rocksdb/file/file_prefetch_buffer.h +43 -21
  72. package/deps/rocksdb/rocksdb/file/prefetch_test.cc +142 -17
  73. package/deps/rocksdb/rocksdb/file/writable_file_writer.cc +23 -27
  74. package/deps/rocksdb/rocksdb/file/writable_file_writer.h +2 -3
  75. package/deps/rocksdb/rocksdb/include/rocksdb/advanced_options.h +23 -5
  76. package/deps/rocksdb/rocksdb/include/rocksdb/c.h +14 -1
  77. package/deps/rocksdb/rocksdb/include/rocksdb/file_system.h +2 -0
  78. package/deps/rocksdb/rocksdb/include/rocksdb/options.h +17 -0
  79. package/deps/rocksdb/rocksdb/include/rocksdb/perf_context.h +2 -0
  80. package/deps/rocksdb/rocksdb/include/rocksdb/snapshot.h +4 -1
  81. package/deps/rocksdb/rocksdb/include/rocksdb/statistics.h +3 -0
  82. package/deps/rocksdb/rocksdb/include/rocksdb/utilities/options_type.h +189 -0
  83. package/deps/rocksdb/rocksdb/include/rocksdb/version.h +1 -1
  84. package/deps/rocksdb/rocksdb/monitoring/perf_context.cc +5 -0
  85. package/deps/rocksdb/rocksdb/monitoring/statistics.cc +1 -1
  86. package/deps/rocksdb/rocksdb/options/cf_options.cc +13 -0
  87. package/deps/rocksdb/rocksdb/options/db_options.cc +8 -0
  88. package/deps/rocksdb/rocksdb/options/db_options.h +1 -0
  89. package/deps/rocksdb/rocksdb/options/options.cc +7 -0
  90. package/deps/rocksdb/rocksdb/options/options_helper.cc +4 -0
  91. package/deps/rocksdb/rocksdb/options/options_settable_test.cc +6 -4
  92. package/deps/rocksdb/rocksdb/options/options_test.cc +107 -9
  93. package/deps/rocksdb/rocksdb/src.mk +4 -1
  94. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_builder.cc +9 -4
  95. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_iterator.cc +80 -6
  96. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_iterator.h +8 -2
  97. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_reader.cc +81 -757
  98. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_reader.h +21 -15
  99. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_reader_impl.h +9 -3
  100. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_reader_sync_and_async.h +754 -0
  101. package/deps/rocksdb/rocksdb/table/block_based/block_based_table_reader_test.cc +2 -1
  102. package/deps/rocksdb/rocksdb/table/block_based/block_prefetcher.cc +8 -0
  103. package/deps/rocksdb/rocksdb/table/block_based/filter_block.h +1 -10
  104. package/deps/rocksdb/rocksdb/table/block_based/filter_block_reader_common.cc +59 -1
  105. package/deps/rocksdb/rocksdb/table/block_based/filter_block_reader_common.h +18 -0
  106. package/deps/rocksdb/rocksdb/table/block_based/full_filter_block.cc +0 -61
  107. package/deps/rocksdb/rocksdb/table/block_based/full_filter_block.h +0 -13
  108. package/deps/rocksdb/rocksdb/table/block_based/index_reader_common.cc +1 -1
  109. package/deps/rocksdb/rocksdb/table/block_based/partitioned_filter_block.cc +3 -2
  110. package/deps/rocksdb/rocksdb/table/block_based/partitioned_index_iterator.cc +2 -2
  111. package/deps/rocksdb/rocksdb/table/block_based/partitioned_index_reader.cc +2 -1
  112. package/deps/rocksdb/rocksdb/table/block_based/uncompression_dict_reader.cc +2 -1
  113. package/deps/rocksdb/rocksdb/table/block_fetcher.cc +60 -2
  114. package/deps/rocksdb/rocksdb/table/block_fetcher.h +2 -0
  115. package/deps/rocksdb/rocksdb/table/merging_iterator.cc +39 -0
  116. package/deps/rocksdb/rocksdb/table/multiget_context.h +46 -2
  117. package/deps/rocksdb/rocksdb/table/sst_file_dumper.cc +2 -1
  118. package/deps/rocksdb/rocksdb/table/sst_file_dumper.h +1 -1
  119. package/deps/rocksdb/rocksdb/table/table_reader.h +13 -0
  120. package/deps/rocksdb/rocksdb/table/unique_id.cc +27 -0
  121. package/deps/rocksdb/rocksdb/table/unique_id_impl.h +3 -0
  122. package/deps/rocksdb/rocksdb/test_util/testutil.cc +2 -0
  123. package/deps/rocksdb/rocksdb/tools/db_bench_tool.cc +23 -7
  124. package/deps/rocksdb/rocksdb/tools/sst_dump_tool.cc +9 -1
  125. package/deps/rocksdb/rocksdb/util/async_file_reader.cc +72 -0
  126. package/deps/rocksdb/rocksdb/util/async_file_reader.h +144 -0
  127. package/deps/rocksdb/rocksdb/util/compression.h +49 -0
  128. package/deps/rocksdb/rocksdb/util/coro_utils.h +111 -0
  129. package/deps/rocksdb/rocksdb/util/single_thread_executor.h +55 -0
  130. package/deps/rocksdb/rocksdb.gyp +16 -15
  131. package/index.js +186 -3
  132. package/iterator.js +1 -0
  133. package/package-lock.json +23687 -0
  134. package/package.json +2 -30
  135. package/prebuilds/darwin-arm64/node.napi.node +0 -0
  136. package/deps/liburing/liburing/README +0 -46
  137. package/deps/liburing/liburing/test/232c93d07b74-test.c +0 -305
  138. package/deps/liburing/liburing/test/35fa71a030ca-test.c +0 -329
  139. package/deps/liburing/liburing/test/500f9fbadef8-test.c +0 -89
  140. package/deps/liburing/liburing/test/7ad0e4b2f83c-test.c +0 -93
  141. package/deps/liburing/liburing/test/8a9973408177-test.c +0 -106
  142. package/deps/liburing/liburing/test/917257daa0fe-test.c +0 -53
  143. package/deps/liburing/liburing/test/Makefile +0 -312
  144. package/deps/liburing/liburing/test/a0908ae19763-test.c +0 -58
  145. package/deps/liburing/liburing/test/a4c0b3decb33-test.c +0 -180
  146. package/deps/liburing/liburing/test/accept-link.c +0 -251
  147. package/deps/liburing/liburing/test/accept-reuse.c +0 -164
  148. package/deps/liburing/liburing/test/accept-test.c +0 -79
  149. package/deps/liburing/liburing/test/accept.c +0 -476
  150. package/deps/liburing/liburing/test/across-fork.c +0 -283
  151. package/deps/liburing/liburing/test/b19062a56726-test.c +0 -53
  152. package/deps/liburing/liburing/test/b5837bd5311d-test.c +0 -77
  153. package/deps/liburing/liburing/test/ce593a6c480a-test.c +0 -135
  154. package/deps/liburing/liburing/test/close-opath.c +0 -122
  155. package/deps/liburing/liburing/test/config +0 -10
  156. package/deps/liburing/liburing/test/connect.c +0 -398
  157. package/deps/liburing/liburing/test/cq-full.c +0 -96
  158. package/deps/liburing/liburing/test/cq-overflow.c +0 -294
  159. package/deps/liburing/liburing/test/cq-peek-batch.c +0 -102
  160. package/deps/liburing/liburing/test/cq-ready.c +0 -94
  161. package/deps/liburing/liburing/test/cq-size.c +0 -58
  162. package/deps/liburing/liburing/test/d4ae271dfaae-test.c +0 -96
  163. package/deps/liburing/liburing/test/d77a67ed5f27-test.c +0 -65
  164. package/deps/liburing/liburing/test/defer.c +0 -307
  165. package/deps/liburing/liburing/test/double-poll-crash.c +0 -186
  166. package/deps/liburing/liburing/test/eeed8b54e0df-test.c +0 -114
  167. package/deps/liburing/liburing/test/empty-eownerdead.c +0 -42
  168. package/deps/liburing/liburing/test/eventfd-disable.c +0 -151
  169. package/deps/liburing/liburing/test/eventfd-ring.c +0 -97
  170. package/deps/liburing/liburing/test/eventfd.c +0 -112
  171. package/deps/liburing/liburing/test/fadvise.c +0 -202
  172. package/deps/liburing/liburing/test/fallocate.c +0 -249
  173. package/deps/liburing/liburing/test/fc2a85cb02ef-test.c +0 -138
  174. package/deps/liburing/liburing/test/file-register.c +0 -843
  175. package/deps/liburing/liburing/test/file-update.c +0 -173
  176. package/deps/liburing/liburing/test/files-exit-hang-poll.c +0 -128
  177. package/deps/liburing/liburing/test/files-exit-hang-timeout.c +0 -134
  178. package/deps/liburing/liburing/test/fixed-link.c +0 -90
  179. package/deps/liburing/liburing/test/fsync.c +0 -224
  180. package/deps/liburing/liburing/test/hardlink.c +0 -136
  181. package/deps/liburing/liburing/test/helpers.c +0 -135
  182. package/deps/liburing/liburing/test/helpers.h +0 -67
  183. package/deps/liburing/liburing/test/io-cancel.c +0 -537
  184. package/deps/liburing/liburing/test/io_uring_enter.c +0 -296
  185. package/deps/liburing/liburing/test/io_uring_register.c +0 -664
  186. package/deps/liburing/liburing/test/io_uring_setup.c +0 -192
  187. package/deps/liburing/liburing/test/iopoll.c +0 -366
  188. package/deps/liburing/liburing/test/lfs-openat-write.c +0 -117
  189. package/deps/liburing/liburing/test/lfs-openat.c +0 -273
  190. package/deps/liburing/liburing/test/link-timeout.c +0 -1107
  191. package/deps/liburing/liburing/test/link.c +0 -496
  192. package/deps/liburing/liburing/test/link_drain.c +0 -229
  193. package/deps/liburing/liburing/test/madvise.c +0 -195
  194. package/deps/liburing/liburing/test/mkdir.c +0 -108
  195. package/deps/liburing/liburing/test/multicqes_drain.c +0 -383
  196. package/deps/liburing/liburing/test/nop-all-sizes.c +0 -107
  197. package/deps/liburing/liburing/test/nop.c +0 -115
  198. package/deps/liburing/liburing/test/open-close.c +0 -146
  199. package/deps/liburing/liburing/test/openat2.c +0 -240
  200. package/deps/liburing/liburing/test/personality.c +0 -204
  201. package/deps/liburing/liburing/test/pipe-eof.c +0 -81
  202. package/deps/liburing/liburing/test/pipe-reuse.c +0 -105
  203. package/deps/liburing/liburing/test/poll-cancel-ton.c +0 -139
  204. package/deps/liburing/liburing/test/poll-cancel.c +0 -135
  205. package/deps/liburing/liburing/test/poll-link.c +0 -227
  206. package/deps/liburing/liburing/test/poll-many.c +0 -208
  207. package/deps/liburing/liburing/test/poll-mshot-update.c +0 -273
  208. package/deps/liburing/liburing/test/poll-ring.c +0 -48
  209. package/deps/liburing/liburing/test/poll-v-poll.c +0 -353
  210. package/deps/liburing/liburing/test/poll.c +0 -109
  211. package/deps/liburing/liburing/test/probe.c +0 -137
  212. package/deps/liburing/liburing/test/read-write.c +0 -876
  213. package/deps/liburing/liburing/test/register-restrictions.c +0 -633
  214. package/deps/liburing/liburing/test/rename.c +0 -134
  215. package/deps/liburing/liburing/test/ring-leak.c +0 -173
  216. package/deps/liburing/liburing/test/ring-leak2.c +0 -249
  217. package/deps/liburing/liburing/test/rsrc_tags.c +0 -449
  218. package/deps/liburing/liburing/test/runtests-loop.sh +0 -16
  219. package/deps/liburing/liburing/test/runtests.sh +0 -170
  220. package/deps/liburing/liburing/test/rw_merge_test.c +0 -97
  221. package/deps/liburing/liburing/test/self.c +0 -91
  222. package/deps/liburing/liburing/test/send_recv.c +0 -291
  223. package/deps/liburing/liburing/test/send_recvmsg.c +0 -345
  224. package/deps/liburing/liburing/test/sendmsg_fs_cve.c +0 -198
  225. package/deps/liburing/liburing/test/shared-wq.c +0 -84
  226. package/deps/liburing/liburing/test/short-read.c +0 -75
  227. package/deps/liburing/liburing/test/shutdown.c +0 -163
  228. package/deps/liburing/liburing/test/sigfd-deadlock.c +0 -74
  229. package/deps/liburing/liburing/test/socket-rw-eagain.c +0 -156
  230. package/deps/liburing/liburing/test/socket-rw.c +0 -147
  231. package/deps/liburing/liburing/test/splice.c +0 -511
  232. package/deps/liburing/liburing/test/sq-full-cpp.cc +0 -45
  233. package/deps/liburing/liburing/test/sq-full.c +0 -45
  234. package/deps/liburing/liburing/test/sq-poll-dup.c +0 -200
  235. package/deps/liburing/liburing/test/sq-poll-kthread.c +0 -168
  236. package/deps/liburing/liburing/test/sq-poll-share.c +0 -137
  237. package/deps/liburing/liburing/test/sq-space_left.c +0 -159
  238. package/deps/liburing/liburing/test/sqpoll-cancel-hang.c +0 -159
  239. package/deps/liburing/liburing/test/sqpoll-disable-exit.c +0 -195
  240. package/deps/liburing/liburing/test/sqpoll-exit-hang.c +0 -77
  241. package/deps/liburing/liburing/test/sqpoll-sleep.c +0 -68
  242. package/deps/liburing/liburing/test/statx.c +0 -172
  243. package/deps/liburing/liburing/test/stdout.c +0 -232
  244. package/deps/liburing/liburing/test/submit-link-fail.c +0 -154
  245. package/deps/liburing/liburing/test/submit-reuse.c +0 -239
  246. package/deps/liburing/liburing/test/symlink.c +0 -116
  247. package/deps/liburing/liburing/test/teardowns.c +0 -58
  248. package/deps/liburing/liburing/test/thread-exit.c +0 -131
  249. package/deps/liburing/liburing/test/timeout-new.c +0 -246
  250. package/deps/liburing/liburing/test/timeout-overflow.c +0 -204
  251. package/deps/liburing/liburing/test/timeout.c +0 -1354
  252. package/deps/liburing/liburing/test/unlink.c +0 -111
  253. package/deps/liburing/liburing/test/wakeup-hang.c +0 -162
  254. package/deps/rocksdb/rocksdb/README.md +0 -32
  255. package/deps/rocksdb/rocksdb/microbench/README.md +0 -60
  256. package/deps/rocksdb/rocksdb/plugin/README.md +0 -43
  257. package/deps/rocksdb/rocksdb/port/README +0 -10
  258. package/deps/rocksdb/rocksdb/utilities/transactions/lock/range/range_tree/lib/README +0 -13
  259. package/prebuilds/linux-x64/node.napi.node +0 -0
@@ -1,116 +0,0 @@
1
- /* SPDX-License-Identifier: MIT */
2
- /*
3
- * Description: test io_uring symlinkat handling
4
- */
5
- #include <fcntl.h>
6
- #include <stdio.h>
7
- #include <string.h>
8
- #include <sys/stat.h>
9
- #include <sys/types.h>
10
- #include <unistd.h>
11
-
12
- #include "liburing.h"
13
-
14
-
15
- static int do_symlinkat(struct io_uring *ring, const char *oldname, const char *newname)
16
- {
17
- int ret;
18
- struct io_uring_sqe *sqe;
19
- struct io_uring_cqe *cqe;
20
-
21
- sqe = io_uring_get_sqe(ring);
22
- if (!sqe) {
23
- fprintf(stderr, "sqe get failed\n");
24
- goto err;
25
- }
26
- io_uring_prep_symlinkat(sqe, oldname, AT_FDCWD, newname);
27
-
28
- ret = io_uring_submit(ring);
29
- if (ret != 1) {
30
- fprintf(stderr, "submit failed: %d\n", ret);
31
- goto err;
32
- }
33
-
34
- ret = io_uring_wait_cqes(ring, &cqe, 1, 0, 0);
35
- if (ret) {
36
- fprintf(stderr, "wait_cqe failed: %d\n", ret);
37
- goto err;
38
- }
39
- ret = cqe->res;
40
- io_uring_cqe_seen(ring, cqe);
41
- return ret;
42
- err:
43
- return 1;
44
- }
45
-
46
- int test_link_contents(const char* linkname, const char *expected_contents)
47
- {
48
- char buf[128];
49
- int ret = readlink(linkname, buf, 127);
50
- if (ret < 0) {
51
- perror("readlink");
52
- return ret;
53
- }
54
- buf[ret] = 0;
55
- if (strncmp(buf, expected_contents, 128)) {
56
- fprintf(stderr, "link contents differs from expected: '%s' vs '%s'",
57
- buf, expected_contents);
58
- return -1;
59
- }
60
- return 0;
61
- }
62
-
63
- int main(int argc, char *argv[])
64
- {
65
- static const char target[] = "io_uring-symlinkat-test-target";
66
- static const char linkname[] = "io_uring-symlinkat-test-link";
67
- int ret;
68
- struct io_uring ring;
69
-
70
- if (argc > 1)
71
- return 0;
72
-
73
- ret = io_uring_queue_init(8, &ring, 0);
74
- if (ret) {
75
- fprintf(stderr, "queue init failed: %d\n", ret);
76
- return ret;
77
- }
78
-
79
- ret = do_symlinkat(&ring, target, linkname);
80
- if (ret < 0) {
81
- if (ret == -EBADF || ret == -EINVAL) {
82
- fprintf(stdout, "symlinkat not supported, skipping\n");
83
- goto out;
84
- }
85
- fprintf(stderr, "symlinkat: %s\n", strerror(-ret));
86
- goto err;
87
- } else if (ret) {
88
- goto err;
89
- }
90
-
91
- ret = test_link_contents(linkname, target);
92
- if (ret < 0)
93
- goto err1;
94
-
95
- ret = do_symlinkat(&ring, target, linkname);
96
- if (ret != -EEXIST) {
97
- fprintf(stderr, "test_symlinkat linkname already exists failed: %d\n", ret);
98
- goto err1;
99
- }
100
-
101
- ret = do_symlinkat(&ring, target, "surely/this/does/not/exist");
102
- if (ret != -ENOENT) {
103
- fprintf(stderr, "test_symlinkat no parent failed: %d\n", ret);
104
- goto err1;
105
- }
106
-
107
- out:
108
- unlinkat(AT_FDCWD, linkname, 0);
109
- io_uring_queue_exit(&ring);
110
- return 0;
111
- err1:
112
- unlinkat(AT_FDCWD, linkname, 0);
113
- err:
114
- io_uring_queue_exit(&ring);
115
- return 1;
116
- }
@@ -1,58 +0,0 @@
1
- /* SPDX-License-Identifier: MIT */
2
- #include <stdint.h>
3
- #include <stdio.h>
4
- #include <stdlib.h>
5
- #include <string.h>
6
- #include <sys/types.h>
7
- #include <sys/wait.h>
8
- #include <unistd.h>
9
- #include <errno.h>
10
-
11
- #include "liburing.h"
12
-
13
- static void loop(void)
14
- {
15
- int i, ret = 0;
16
-
17
- for (i = 0; i < 100; i++) {
18
- struct io_uring ring;
19
- int fd;
20
-
21
- memset(&ring, 0, sizeof(ring));
22
- fd = io_uring_queue_init(0xa4, &ring, 0);
23
- if (fd >= 0) {
24
- close(fd);
25
- continue;
26
- }
27
- if (fd != -ENOMEM)
28
- ret++;
29
- }
30
- exit(ret);
31
- }
32
-
33
- int main(int argc, char *argv[])
34
- {
35
- int i, ret, status;
36
-
37
- if (argc > 1)
38
- return 0;
39
-
40
- for (i = 0; i < 12; i++) {
41
- if (!fork()) {
42
- loop();
43
- break;
44
- }
45
- }
46
-
47
- ret = 0;
48
- for (i = 0; i < 12; i++) {
49
- if (waitpid(-1, &status, 0) < 0) {
50
- perror("waitpid");
51
- return 1;
52
- }
53
- if (WEXITSTATUS(status))
54
- ret++;
55
- }
56
-
57
- return ret;
58
- }
@@ -1,131 +0,0 @@
1
- /* SPDX-License-Identifier: MIT */
2
- /*
3
- * Description: test that thread pool issued requests don't cancel on thread
4
- * exit, but do get canceled once the parent exits. Do both
5
- * writes that finish and a poll request that sticks around.
6
- *
7
- */
8
- #include <errno.h>
9
- #include <stdio.h>
10
- #include <unistd.h>
11
- #include <stdlib.h>
12
- #include <string.h>
13
- #include <fcntl.h>
14
- #include <sys/poll.h>
15
- #include <pthread.h>
16
-
17
- #include "helpers.h"
18
- #include "liburing.h"
19
-
20
- #define NR_IOS 8
21
- #define WSIZE 512
22
-
23
- struct d {
24
- int fd;
25
- struct io_uring *ring;
26
- unsigned long off;
27
- int pipe_fd;
28
- int err;
29
- };
30
-
31
- static void *do_io(void *data)
32
- {
33
- struct d *d = data;
34
- struct io_uring_sqe *sqe;
35
- char *buffer;
36
- int ret;
37
-
38
- buffer = t_malloc(WSIZE);
39
- memset(buffer, 0x5a, WSIZE);
40
- sqe = io_uring_get_sqe(d->ring);
41
- if (!sqe) {
42
- d->err++;
43
- return NULL;
44
- }
45
- io_uring_prep_write(sqe, d->fd, buffer, WSIZE, d->off);
46
- sqe->user_data = d->off;
47
-
48
- sqe = io_uring_get_sqe(d->ring);
49
- if (!sqe) {
50
- d->err++;
51
- return NULL;
52
- }
53
- io_uring_prep_poll_add(sqe, d->pipe_fd, POLLIN);
54
-
55
- ret = io_uring_submit(d->ring);
56
- if (ret != 2)
57
- d->err++;
58
-
59
- free(buffer);
60
- return NULL;
61
- }
62
-
63
- int main(int argc, char *argv[])
64
- {
65
- struct io_uring ring;
66
- const char *fname;
67
- pthread_t thread;
68
- int ret, do_unlink, i, fd;
69
- struct d d;
70
- int fds[2];
71
-
72
- if (pipe(fds) < 0) {
73
- perror("pipe");
74
- return 1;
75
- }
76
-
77
- ret = io_uring_queue_init(32, &ring, 0);
78
- if (ret) {
79
- fprintf(stderr, "ring setup failed\n");
80
- return 1;
81
- }
82
-
83
- if (argc > 1) {
84
- fname = argv[1];
85
- do_unlink = 0;
86
- } else {
87
- fname = ".thread.exit";
88
- do_unlink = 1;
89
- t_create_file(fname, 4096);
90
- }
91
-
92
- fd = open(fname, O_WRONLY);
93
- if (do_unlink)
94
- unlink(fname);
95
- if (fd < 0) {
96
- perror("open");
97
- return 1;
98
- }
99
-
100
- d.fd = fd;
101
- d.ring = &ring;
102
- d.off = 0;
103
- d.pipe_fd = fds[0];
104
- d.err = 0;
105
- for (i = 0; i < NR_IOS; i++) {
106
- memset(&thread, 0, sizeof(thread));
107
- pthread_create(&thread, NULL, do_io, &d);
108
- pthread_join(thread, NULL);
109
- d.off += WSIZE;
110
- }
111
-
112
- for (i = 0; i < NR_IOS; i++) {
113
- struct io_uring_cqe *cqe;
114
-
115
- ret = io_uring_wait_cqe(&ring, &cqe);
116
- if (ret) {
117
- fprintf(stderr, "io_uring_wait_cqe=%d\n", ret);
118
- goto err;
119
- }
120
- if (cqe->res != WSIZE) {
121
- fprintf(stderr, "cqe->res=%d, Expected %d\n", cqe->res,
122
- WSIZE);
123
- goto err;
124
- }
125
- io_uring_cqe_seen(&ring, cqe);
126
- }
127
-
128
- return d.err;
129
- err:
130
- return 1;
131
- }
@@ -1,246 +0,0 @@
1
- /* SPDX-License-Identifier: MIT */
2
- /*
3
- * Description: tests for getevents timeout
4
- *
5
- */
6
- #include <stdio.h>
7
- #include <sys/time.h>
8
- #include <unistd.h>
9
- #include <pthread.h>
10
- #include "liburing.h"
11
-
12
- #define TIMEOUT_MSEC 200
13
- #define TIMEOUT_SEC 10
14
-
15
- int thread_ret0, thread_ret1;
16
- int cnt = 0;
17
- pthread_mutex_t mutex;
18
-
19
- static void msec_to_ts(struct __kernel_timespec *ts, unsigned int msec)
20
- {
21
- ts->tv_sec = msec / 1000;
22
- ts->tv_nsec = (msec % 1000) * 1000000;
23
- }
24
-
25
- static unsigned long long mtime_since(const struct timeval *s,
26
- const struct timeval *e)
27
- {
28
- long long sec, usec;
29
-
30
- sec = e->tv_sec - s->tv_sec;
31
- usec = (e->tv_usec - s->tv_usec);
32
- if (sec > 0 && usec < 0) {
33
- sec--;
34
- usec += 1000000;
35
- }
36
-
37
- sec *= 1000;
38
- usec /= 1000;
39
- return sec + usec;
40
- }
41
-
42
- static unsigned long long mtime_since_now(struct timeval *tv)
43
- {
44
- struct timeval end;
45
-
46
- gettimeofday(&end, NULL);
47
- return mtime_since(tv, &end);
48
- }
49
-
50
-
51
- static int test_return_before_timeout(struct io_uring *ring)
52
- {
53
- struct io_uring_cqe *cqe;
54
- struct io_uring_sqe *sqe;
55
- int ret;
56
- struct __kernel_timespec ts;
57
-
58
- sqe = io_uring_get_sqe(ring);
59
- if (!sqe) {
60
- fprintf(stderr, "%s: get sqe failed\n", __FUNCTION__);
61
- return 1;
62
- }
63
-
64
- io_uring_prep_nop(sqe);
65
-
66
- ret = io_uring_submit(ring);
67
- if (ret <= 0) {
68
- fprintf(stderr, "%s: sqe submit failed: %d\n", __FUNCTION__, ret);
69
- return 1;
70
- }
71
-
72
- msec_to_ts(&ts, TIMEOUT_MSEC);
73
- ret = io_uring_wait_cqe_timeout(ring, &cqe, &ts);
74
- if (ret < 0) {
75
- fprintf(stderr, "%s: timeout error: %d\n", __FUNCTION__, ret);
76
- return 1;
77
- }
78
-
79
- io_uring_cqe_seen(ring, cqe);
80
- return 0;
81
- }
82
-
83
- static int test_return_after_timeout(struct io_uring *ring)
84
- {
85
- struct io_uring_cqe *cqe;
86
- int ret;
87
- struct __kernel_timespec ts;
88
- struct timeval tv;
89
- unsigned long long exp;
90
-
91
- msec_to_ts(&ts, TIMEOUT_MSEC);
92
- gettimeofday(&tv, NULL);
93
- ret = io_uring_wait_cqe_timeout(ring, &cqe, &ts);
94
- exp = mtime_since_now(&tv);
95
- if (ret != -ETIME) {
96
- fprintf(stderr, "%s: timeout error: %d\n", __FUNCTION__, ret);
97
- return 1;
98
- }
99
-
100
- if (exp < TIMEOUT_MSEC / 2 || exp > (TIMEOUT_MSEC * 3) / 2) {
101
- fprintf(stderr, "%s: Timeout seems wonky (got %llu)\n", __FUNCTION__, exp);
102
- return 1;
103
- }
104
-
105
- return 0;
106
- }
107
-
108
- int __reap_thread_fn(void *data) {
109
- struct io_uring *ring = (struct io_uring *)data;
110
- struct io_uring_cqe *cqe;
111
- struct __kernel_timespec ts;
112
-
113
- msec_to_ts(&ts, TIMEOUT_SEC);
114
- pthread_mutex_lock(&mutex);
115
- cnt++;
116
- pthread_mutex_unlock(&mutex);
117
- return io_uring_wait_cqe_timeout(ring, &cqe, &ts);
118
- }
119
-
120
- void *reap_thread_fn0(void *data) {
121
- thread_ret0 = __reap_thread_fn(data);
122
- return NULL;
123
- }
124
-
125
- void *reap_thread_fn1(void *data) {
126
- thread_ret1 = __reap_thread_fn(data);
127
- return NULL;
128
- }
129
-
130
- /*
131
- * This is to test issuing a sqe in main thread and reaping it in two child-thread
132
- * at the same time. To see if timeout feature works or not.
133
- */
134
- int test_multi_threads_timeout() {
135
- struct io_uring ring;
136
- int ret;
137
- bool both_wait = false;
138
- pthread_t reap_thread0, reap_thread1;
139
- struct io_uring_sqe *sqe;
140
-
141
- ret = io_uring_queue_init(8, &ring, 0);
142
- if (ret) {
143
- fprintf(stderr, "%s: ring setup failed: %d\n", __FUNCTION__, ret);
144
- return 1;
145
- }
146
-
147
- pthread_create(&reap_thread0, NULL, reap_thread_fn0, &ring);
148
- pthread_create(&reap_thread1, NULL, reap_thread_fn1, &ring);
149
-
150
- /*
151
- * make two threads both enter io_uring_wait_cqe_timeout() before issuing the sqe
152
- * as possible as we can. So that there are two threads in the ctx->wait queue.
153
- * In this way, we can test if a cqe wakes up two threads at the same time.
154
- */
155
- while(!both_wait) {
156
- pthread_mutex_lock(&mutex);
157
- if (cnt == 2)
158
- both_wait = true;
159
- pthread_mutex_unlock(&mutex);
160
- sleep(1);
161
- }
162
-
163
- sqe = io_uring_get_sqe(&ring);
164
- if (!sqe) {
165
- fprintf(stderr, "%s: get sqe failed\n", __FUNCTION__);
166
- goto err;
167
- }
168
-
169
- io_uring_prep_nop(sqe);
170
-
171
- ret = io_uring_submit(&ring);
172
- if (ret <= 0) {
173
- fprintf(stderr, "%s: sqe submit failed: %d\n", __FUNCTION__, ret);
174
- goto err;
175
- }
176
-
177
- pthread_join(reap_thread0, NULL);
178
- pthread_join(reap_thread1, NULL);
179
-
180
- if ((thread_ret0 && thread_ret0 != -ETIME) || (thread_ret1 && thread_ret1 != -ETIME)) {
181
- fprintf(stderr, "%s: thread wait cqe timeout failed: %d %d\n",
182
- __FUNCTION__, thread_ret0, thread_ret1);
183
- goto err;
184
- }
185
-
186
- return 0;
187
- err:
188
- return 1;
189
- }
190
-
191
- int main(int argc, char *argv[])
192
- {
193
- struct io_uring ring_normal, ring_sq;
194
- int ret;
195
-
196
- if (argc > 1)
197
- return 0;
198
-
199
- ret = io_uring_queue_init(8, &ring_normal, 0);
200
- if (ret) {
201
- fprintf(stderr, "ring_normal setup failed: %d\n", ret);
202
- return 1;
203
- }
204
- if (!(ring_normal.features & IORING_FEAT_EXT_ARG)) {
205
- fprintf(stderr, "feature IORING_FEAT_EXT_ARG not supported, skipping.\n");
206
- return 0;
207
- }
208
-
209
- ret = test_return_before_timeout(&ring_normal);
210
- if (ret) {
211
- fprintf(stderr, "ring_normal: test_return_before_timeout failed\n");
212
- return ret;
213
- }
214
-
215
- ret = test_return_after_timeout(&ring_normal);
216
- if (ret) {
217
- fprintf(stderr, "ring_normal: test_return_after_timeout failed\n");
218
- return ret;
219
- }
220
-
221
- ret = io_uring_queue_init(8, &ring_sq, IORING_SETUP_SQPOLL);
222
- if (ret) {
223
- fprintf(stderr, "ring_sq setup failed: %d\n", ret);
224
- return 1;
225
- }
226
-
227
- ret = test_return_before_timeout(&ring_sq);
228
- if (ret) {
229
- fprintf(stderr, "ring_sq: test_return_before_timeout failed\n");
230
- return ret;
231
- }
232
-
233
- ret = test_return_after_timeout(&ring_sq);
234
- if (ret) {
235
- fprintf(stderr, "ring_sq: test_return_after_timeout failed\n");
236
- return ret;
237
- }
238
-
239
- ret = test_multi_threads_timeout();
240
- if (ret) {
241
- fprintf(stderr, "test_multi_threads_timeout failed\n");
242
- return ret;
243
- }
244
-
245
- return 0;
246
- }