@nxtedition/rocksdb 5.2.36 → 5.2.39
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.
- package/binding.cc +66 -91
- package/deps/liburing/liburing/COPYING +502 -0
- package/deps/liburing/liburing/COPYING.GPL +339 -0
- package/deps/liburing/liburing/LICENSE +7 -0
- package/deps/liburing/liburing/Makefile +84 -0
- package/deps/liburing/liburing/Makefile.quiet +11 -0
- package/deps/liburing/liburing/README +46 -0
- package/deps/liburing/liburing/configure +420 -0
- package/deps/liburing/liburing/debian/README.Debian +7 -0
- package/deps/liburing/liburing/debian/changelog +27 -0
- package/deps/liburing/liburing/debian/compat +1 -0
- package/deps/liburing/liburing/debian/control +48 -0
- package/deps/liburing/liburing/debian/copyright +49 -0
- package/deps/liburing/liburing/debian/liburing-dev.install +4 -0
- package/deps/liburing/liburing/debian/liburing-dev.manpages +6 -0
- package/deps/liburing/liburing/debian/liburing1-udeb.install +1 -0
- package/deps/liburing/liburing/debian/liburing1.install +1 -0
- package/deps/liburing/liburing/debian/liburing1.symbols +32 -0
- package/deps/liburing/liburing/debian/patches/series +1 -0
- package/deps/liburing/liburing/debian/rules +81 -0
- package/deps/liburing/liburing/debian/source/format +1 -0
- package/deps/liburing/liburing/debian/source/local-options +2 -0
- package/deps/liburing/liburing/debian/source/options +1 -0
- package/deps/liburing/liburing/debian/watch +3 -0
- package/deps/liburing/liburing/examples/Makefile +29 -0
- package/deps/liburing/liburing/examples/io_uring-cp.c +279 -0
- package/deps/liburing/liburing/examples/io_uring-test.c +112 -0
- package/deps/liburing/liburing/examples/link-cp.c +193 -0
- package/deps/liburing/liburing/examples/ucontext-cp.c +273 -0
- package/deps/liburing/liburing/liburing.pc.in +12 -0
- package/deps/liburing/liburing/liburing.spec +66 -0
- package/deps/liburing/liburing/make-debs.sh +53 -0
- package/deps/liburing/liburing/man/io_uring.7 +736 -0
- package/deps/liburing/liburing/man/io_uring_enter.2 +1403 -0
- package/deps/liburing/liburing/man/io_uring_get_sqe.3 +37 -0
- package/deps/liburing/liburing/man/io_uring_queue_exit.3 +27 -0
- package/deps/liburing/liburing/man/io_uring_queue_init.3 +44 -0
- package/deps/liburing/liburing/man/io_uring_register.2 +605 -0
- package/deps/liburing/liburing/man/io_uring_setup.2 +515 -0
- package/deps/liburing/liburing/src/Makefile +76 -0
- package/deps/liburing/liburing/src/include/liburing/barrier.h +73 -0
- package/deps/liburing/liburing/src/include/liburing/io_uring.h +422 -0
- package/deps/liburing/liburing/src/include/liburing.h +775 -0
- package/deps/liburing/liburing/src/liburing.map +46 -0
- package/deps/liburing/liburing/src/queue.c +403 -0
- package/deps/liburing/liburing/src/register.c +299 -0
- package/deps/liburing/liburing/src/setup.c +356 -0
- package/deps/liburing/liburing/src/syscall.c +73 -0
- package/deps/liburing/liburing/src/syscall.h +20 -0
- package/deps/liburing/liburing/test/232c93d07b74-test.c +305 -0
- package/deps/liburing/liburing/test/35fa71a030ca-test.c +329 -0
- package/deps/liburing/liburing/test/500f9fbadef8-test.c +89 -0
- package/deps/liburing/liburing/test/7ad0e4b2f83c-test.c +93 -0
- package/deps/liburing/liburing/test/8a9973408177-test.c +106 -0
- package/deps/liburing/liburing/test/917257daa0fe-test.c +53 -0
- package/deps/liburing/liburing/test/Makefile +312 -0
- package/deps/liburing/liburing/test/a0908ae19763-test.c +58 -0
- package/deps/liburing/liburing/test/a4c0b3decb33-test.c +180 -0
- package/deps/liburing/liburing/test/accept-link.c +251 -0
- package/deps/liburing/liburing/test/accept-reuse.c +164 -0
- package/deps/liburing/liburing/test/accept-test.c +79 -0
- package/deps/liburing/liburing/test/accept.c +476 -0
- package/deps/liburing/liburing/test/across-fork.c +283 -0
- package/deps/liburing/liburing/test/b19062a56726-test.c +53 -0
- package/deps/liburing/liburing/test/b5837bd5311d-test.c +77 -0
- package/deps/liburing/liburing/test/ce593a6c480a-test.c +135 -0
- package/deps/liburing/liburing/test/close-opath.c +122 -0
- package/deps/liburing/liburing/test/config +10 -0
- package/deps/liburing/liburing/test/connect.c +398 -0
- package/deps/liburing/liburing/test/cq-full.c +96 -0
- package/deps/liburing/liburing/test/cq-overflow.c +294 -0
- package/deps/liburing/liburing/test/cq-peek-batch.c +102 -0
- package/deps/liburing/liburing/test/cq-ready.c +94 -0
- package/deps/liburing/liburing/test/cq-size.c +58 -0
- package/deps/liburing/liburing/test/d4ae271dfaae-test.c +96 -0
- package/deps/liburing/liburing/test/d77a67ed5f27-test.c +65 -0
- package/deps/liburing/liburing/test/defer.c +307 -0
- package/deps/liburing/liburing/test/double-poll-crash.c +186 -0
- package/deps/liburing/liburing/test/eeed8b54e0df-test.c +114 -0
- package/deps/liburing/liburing/test/empty-eownerdead.c +42 -0
- package/deps/liburing/liburing/test/eventfd-disable.c +151 -0
- package/deps/liburing/liburing/test/eventfd-ring.c +97 -0
- package/deps/liburing/liburing/test/eventfd.c +112 -0
- package/deps/liburing/liburing/test/fadvise.c +202 -0
- package/deps/liburing/liburing/test/fallocate.c +249 -0
- package/deps/liburing/liburing/test/fc2a85cb02ef-test.c +138 -0
- package/deps/liburing/liburing/test/file-register.c +843 -0
- package/deps/liburing/liburing/test/file-update.c +173 -0
- package/deps/liburing/liburing/test/files-exit-hang-poll.c +128 -0
- package/deps/liburing/liburing/test/files-exit-hang-timeout.c +134 -0
- package/deps/liburing/liburing/test/fixed-link.c +90 -0
- package/deps/liburing/liburing/test/fsync.c +224 -0
- package/deps/liburing/liburing/test/hardlink.c +136 -0
- package/deps/liburing/liburing/test/helpers.c +135 -0
- package/deps/liburing/liburing/test/helpers.h +67 -0
- package/deps/liburing/liburing/test/io-cancel.c +537 -0
- package/deps/liburing/liburing/test/io_uring_enter.c +296 -0
- package/deps/liburing/liburing/test/io_uring_register.c +664 -0
- package/deps/liburing/liburing/test/io_uring_setup.c +192 -0
- package/deps/liburing/liburing/test/iopoll.c +366 -0
- package/deps/liburing/liburing/test/lfs-openat-write.c +117 -0
- package/deps/liburing/liburing/test/lfs-openat.c +273 -0
- package/deps/liburing/liburing/test/link-timeout.c +1107 -0
- package/deps/liburing/liburing/test/link.c +496 -0
- package/deps/liburing/liburing/test/link_drain.c +229 -0
- package/deps/liburing/liburing/test/madvise.c +195 -0
- package/deps/liburing/liburing/test/mkdir.c +108 -0
- package/deps/liburing/liburing/test/multicqes_drain.c +383 -0
- package/deps/liburing/liburing/test/nop-all-sizes.c +107 -0
- package/deps/liburing/liburing/test/nop.c +115 -0
- package/deps/liburing/liburing/test/open-close.c +146 -0
- package/deps/liburing/liburing/test/openat2.c +240 -0
- package/deps/liburing/liburing/test/personality.c +204 -0
- package/deps/liburing/liburing/test/pipe-eof.c +81 -0
- package/deps/liburing/liburing/test/pipe-reuse.c +105 -0
- package/deps/liburing/liburing/test/poll-cancel-ton.c +139 -0
- package/deps/liburing/liburing/test/poll-cancel.c +135 -0
- package/deps/liburing/liburing/test/poll-link.c +227 -0
- package/deps/liburing/liburing/test/poll-many.c +208 -0
- package/deps/liburing/liburing/test/poll-mshot-update.c +273 -0
- package/deps/liburing/liburing/test/poll-ring.c +48 -0
- package/deps/liburing/liburing/test/poll-v-poll.c +353 -0
- package/deps/liburing/liburing/test/poll.c +109 -0
- package/deps/liburing/liburing/test/probe.c +137 -0
- package/deps/liburing/liburing/test/read-write.c +876 -0
- package/deps/liburing/liburing/test/register-restrictions.c +633 -0
- package/deps/liburing/liburing/test/rename.c +134 -0
- package/deps/liburing/liburing/test/ring-leak.c +173 -0
- package/deps/liburing/liburing/test/ring-leak2.c +249 -0
- package/deps/liburing/liburing/test/rsrc_tags.c +449 -0
- package/deps/liburing/liburing/test/runtests-loop.sh +16 -0
- package/deps/liburing/liburing/test/runtests.sh +170 -0
- package/deps/liburing/liburing/test/rw_merge_test.c +97 -0
- package/deps/liburing/liburing/test/self.c +91 -0
- package/deps/liburing/liburing/test/send_recv.c +291 -0
- package/deps/liburing/liburing/test/send_recvmsg.c +345 -0
- package/deps/liburing/liburing/test/sendmsg_fs_cve.c +198 -0
- package/deps/liburing/liburing/test/shared-wq.c +84 -0
- package/deps/liburing/liburing/test/short-read.c +75 -0
- package/deps/liburing/liburing/test/shutdown.c +163 -0
- package/deps/liburing/liburing/test/sigfd-deadlock.c +74 -0
- package/deps/liburing/liburing/test/socket-rw-eagain.c +156 -0
- package/deps/liburing/liburing/test/socket-rw.c +147 -0
- package/deps/liburing/liburing/test/splice.c +511 -0
- package/deps/liburing/liburing/test/sq-full-cpp.cc +45 -0
- package/deps/liburing/liburing/test/sq-full.c +45 -0
- package/deps/liburing/liburing/test/sq-poll-dup.c +200 -0
- package/deps/liburing/liburing/test/sq-poll-kthread.c +168 -0
- package/deps/liburing/liburing/test/sq-poll-share.c +137 -0
- package/deps/liburing/liburing/test/sq-space_left.c +159 -0
- package/deps/liburing/liburing/test/sqpoll-cancel-hang.c +159 -0
- package/deps/liburing/liburing/test/sqpoll-disable-exit.c +195 -0
- package/deps/liburing/liburing/test/sqpoll-exit-hang.c +77 -0
- package/deps/liburing/liburing/test/sqpoll-sleep.c +68 -0
- package/deps/liburing/liburing/test/statx.c +172 -0
- package/deps/liburing/liburing/test/stdout.c +232 -0
- package/deps/liburing/liburing/test/submit-link-fail.c +154 -0
- package/deps/liburing/liburing/test/submit-reuse.c +239 -0
- package/deps/liburing/liburing/test/symlink.c +116 -0
- package/deps/liburing/liburing/test/teardowns.c +58 -0
- package/deps/liburing/liburing/test/thread-exit.c +131 -0
- package/deps/liburing/liburing/test/timeout-new.c +246 -0
- package/deps/liburing/liburing/test/timeout-overflow.c +204 -0
- package/deps/liburing/liburing/test/timeout.c +1354 -0
- package/deps/liburing/liburing/test/unlink.c +111 -0
- package/deps/liburing/liburing/test/wakeup-hang.c +162 -0
- package/deps/liburing/liburing.gyp +20 -0
- package/deps/rocksdb/rocksdb/db/corruption_test.cc +62 -0
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl.h +7 -62
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl_files.cc +25 -11
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl_open.cc +74 -155
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl_secondary.cc +1 -2
- package/deps/rocksdb/rocksdb/db/db_impl/db_impl_secondary.h +2 -2
- package/deps/rocksdb/rocksdb/env/fs_posix.cc +13 -0
- package/deps/rocksdb/rocksdb/file/file_prefetch_buffer.cc +4 -2
- package/deps/rocksdb/rocksdb/file/file_prefetch_buffer.h +22 -4
- package/deps/rocksdb/rocksdb/file/prefetch_test.cc +5 -0
- package/deps/rocksdb/rocksdb/include/rocksdb/file_system.h +15 -0
- package/deps/rocksdb/rocksdb/include/rocksdb/statistics.h +5 -0
- package/deps/rocksdb/rocksdb/include/rocksdb/version.h +1 -1
- package/deps/rocksdb/rocksdb/monitoring/statistics.cc +3 -0
- package/deps/rocksdb/rocksdb/monitoring/stats_history_test.cc +3 -7
- package/deps/rocksdb/rocksdb/table/block_based/block_based_table_reader.h +2 -1
- package/deps/rocksdb/rocksdb/table/block_based/block_based_table_reader_test.cc +44 -29
- package/deps/rocksdb/rocksdb.gyp +4 -3
- package/package.json +1 -1
- package/prebuilds/darwin-arm64/node.napi.node +0 -0
- package/prebuilds/darwin-x64/node.napi.node +0 -0
- package/prebuilds/linux-x64/node.napi.node +0 -0
- package/prebuilds/prebuilds/linux-x64/node.napi.node +0 -0
|
@@ -0,0 +1,515 @@
|
|
|
1
|
+
.\" Copyright (C) 2019 Jens Axboe <axboe@kernel.dk>
|
|
2
|
+
.\" Copyright (C) 2019 Jon Corbet <corbet@lwn.net>
|
|
3
|
+
.\" Copyright (C) 2019 Red Hat, Inc.
|
|
4
|
+
.\"
|
|
5
|
+
.\" SPDX-License-Identifier: LGPL-2.0-or-later
|
|
6
|
+
.\"
|
|
7
|
+
.TH IO_URING_SETUP 2 2019-01-29 "Linux" "Linux Programmer's Manual"
|
|
8
|
+
.SH NAME
|
|
9
|
+
io_uring_setup \- setup a context for performing asynchronous I/O
|
|
10
|
+
.SH SYNOPSIS
|
|
11
|
+
.nf
|
|
12
|
+
.BR "#include <linux/io_uring.h>"
|
|
13
|
+
.PP
|
|
14
|
+
.BI "int io_uring_setup(u32 " entries ", struct io_uring_params *" p );
|
|
15
|
+
.fi
|
|
16
|
+
.PP
|
|
17
|
+
.SH DESCRIPTION
|
|
18
|
+
.PP
|
|
19
|
+
The io_uring_setup() system call sets up a submission queue (SQ) and
|
|
20
|
+
completion queue (CQ) with at least
|
|
21
|
+
.I entries
|
|
22
|
+
entries, and returns a file descriptor which can be used to perform
|
|
23
|
+
subsequent operations on the io_uring instance. The submission and
|
|
24
|
+
completion queues are shared between userspace and the kernel, which
|
|
25
|
+
eliminates the need to copy data when initiating and completing I/O.
|
|
26
|
+
|
|
27
|
+
.I params
|
|
28
|
+
is used by the application to pass options to the kernel, and by the
|
|
29
|
+
kernel to convey information about the ring buffers.
|
|
30
|
+
.PP
|
|
31
|
+
.in +4n
|
|
32
|
+
.EX
|
|
33
|
+
struct io_uring_params {
|
|
34
|
+
__u32 sq_entries;
|
|
35
|
+
__u32 cq_entries;
|
|
36
|
+
__u32 flags;
|
|
37
|
+
__u32 sq_thread_cpu;
|
|
38
|
+
__u32 sq_thread_idle;
|
|
39
|
+
__u32 features;
|
|
40
|
+
__u32 resv[4];
|
|
41
|
+
struct io_sqring_offsets sq_off;
|
|
42
|
+
struct io_cqring_offsets cq_off;
|
|
43
|
+
};
|
|
44
|
+
.EE
|
|
45
|
+
.in
|
|
46
|
+
.PP
|
|
47
|
+
The
|
|
48
|
+
.IR flags ,
|
|
49
|
+
.IR sq_thread_cpu ,
|
|
50
|
+
and
|
|
51
|
+
.I sq_thread_idle
|
|
52
|
+
fields are used to configure the io_uring instance.
|
|
53
|
+
.I flags
|
|
54
|
+
is a bit mask of 0 or more of the following values ORed
|
|
55
|
+
together:
|
|
56
|
+
.TP
|
|
57
|
+
.B IORING_SETUP_IOPOLL
|
|
58
|
+
Perform busy-waiting for an I/O completion, as opposed to getting
|
|
59
|
+
notifications via an asynchronous IRQ (Interrupt Request). The file
|
|
60
|
+
system (if any) and block device must support polling in order for
|
|
61
|
+
this to work. Busy-waiting provides lower latency, but may consume
|
|
62
|
+
more CPU resources than interrupt driven I/O. Currently, this feature
|
|
63
|
+
is usable only on a file descriptor opened using the
|
|
64
|
+
.B O_DIRECT
|
|
65
|
+
flag. When a read or write is submitted to a polled context, the
|
|
66
|
+
application must poll for completions on the CQ ring by calling
|
|
67
|
+
.BR io_uring_enter (2).
|
|
68
|
+
It is illegal to mix and match polled and non-polled I/O on an io_uring
|
|
69
|
+
instance.
|
|
70
|
+
|
|
71
|
+
.TP
|
|
72
|
+
.B IORING_SETUP_SQPOLL
|
|
73
|
+
When this flag is specified, a kernel thread is created to perform
|
|
74
|
+
submission queue polling. An io_uring instance configured in this way
|
|
75
|
+
enables an application to issue I/O without ever context switching
|
|
76
|
+
into the kernel. By using the submission queue to fill in new
|
|
77
|
+
submission queue entries and watching for completions on the
|
|
78
|
+
completion queue, the application can submit and reap I/Os without
|
|
79
|
+
doing a single system call.
|
|
80
|
+
|
|
81
|
+
If the kernel thread is idle for more than
|
|
82
|
+
.I sq_thread_idle
|
|
83
|
+
milliseconds, it will set the
|
|
84
|
+
.B IORING_SQ_NEED_WAKEUP
|
|
85
|
+
bit in the
|
|
86
|
+
.I flags
|
|
87
|
+
field of the
|
|
88
|
+
.IR "struct io_sq_ring" .
|
|
89
|
+
When this happens, the application must call
|
|
90
|
+
.BR io_uring_enter (2)
|
|
91
|
+
to wake the kernel thread. If I/O is kept busy, the kernel thread
|
|
92
|
+
will never sleep. An application making use of this feature will need
|
|
93
|
+
to guard the
|
|
94
|
+
.BR io_uring_enter (2)
|
|
95
|
+
call with the following code sequence:
|
|
96
|
+
|
|
97
|
+
.in +4n
|
|
98
|
+
.EX
|
|
99
|
+
/*
|
|
100
|
+
* Ensure that the wakeup flag is read after the tail pointer
|
|
101
|
+
* has been written. It's important to use memory load acquire
|
|
102
|
+
* semantics for the flags read, as otherwise the application
|
|
103
|
+
* and the kernel might not agree on the consistency of the
|
|
104
|
+
* wakeup flag.
|
|
105
|
+
*/
|
|
106
|
+
unsigned flags = atomic_load_relaxed(sq_ring->flags);
|
|
107
|
+
if (flags & IORING_SQ_NEED_WAKEUP)
|
|
108
|
+
io_uring_enter(fd, 0, 0, IORING_ENTER_SQ_WAKEUP);
|
|
109
|
+
.EE
|
|
110
|
+
.in
|
|
111
|
+
|
|
112
|
+
where
|
|
113
|
+
.I sq_ring
|
|
114
|
+
is a submission queue ring setup using the
|
|
115
|
+
.I struct io_sqring_offsets
|
|
116
|
+
described below.
|
|
117
|
+
.TP
|
|
118
|
+
.BR
|
|
119
|
+
Before version 5.11 of the Linux kernel, to successfully use this feature, the
|
|
120
|
+
application must register a set of files to be used for IO through
|
|
121
|
+
.BR io_uring_register (2)
|
|
122
|
+
using the
|
|
123
|
+
.B IORING_REGISTER_FILES
|
|
124
|
+
opcode. Failure to do so will result in submitted IO being errored with
|
|
125
|
+
.B EBADF.
|
|
126
|
+
The presence of this feature can be detected by the
|
|
127
|
+
.B IORING_FEAT_SQPOLL_NONFIXED
|
|
128
|
+
feature flag.
|
|
129
|
+
In version 5.11 and later, it is no longer necessary to register files to use
|
|
130
|
+
this feature. 5.11 also allows using this as non-root, if the user has the
|
|
131
|
+
.B CAP_SYS_NICE
|
|
132
|
+
capability.
|
|
133
|
+
.TP
|
|
134
|
+
.B IORING_SETUP_SQ_AFF
|
|
135
|
+
If this flag is specified, then the poll thread will be bound to the
|
|
136
|
+
cpu set in the
|
|
137
|
+
.I sq_thread_cpu
|
|
138
|
+
field of the
|
|
139
|
+
.IR "struct io_uring_params" .
|
|
140
|
+
This flag is only meaningful when
|
|
141
|
+
.B IORING_SETUP_SQPOLL
|
|
142
|
+
is specified. When cgroup setting
|
|
143
|
+
.I cpuset.cpus
|
|
144
|
+
changes (typically in container environment), the bounded cpu set may be
|
|
145
|
+
changed as well.
|
|
146
|
+
.TP
|
|
147
|
+
.B IORING_SETUP_CQSIZE
|
|
148
|
+
Create the completion queue with
|
|
149
|
+
.IR "struct io_uring_params.cq_entries"
|
|
150
|
+
entries. The value must be greater than
|
|
151
|
+
.IR entries ,
|
|
152
|
+
and may be rounded up to the next power-of-two.
|
|
153
|
+
.TP
|
|
154
|
+
.B IORING_SETUP_CLAMP
|
|
155
|
+
If this flag is specified, and if
|
|
156
|
+
.IR entries
|
|
157
|
+
exceeds
|
|
158
|
+
.B IORING_MAX_ENTRIES ,
|
|
159
|
+
then
|
|
160
|
+
.IR entries
|
|
161
|
+
will be clamped at
|
|
162
|
+
.B IORING_MAX_ENTRIES .
|
|
163
|
+
If the flag
|
|
164
|
+
.BR IORING_SETUP_SQPOLL
|
|
165
|
+
is set, and if the value of
|
|
166
|
+
.IR "struct io_uring_params.cq_entries"
|
|
167
|
+
exceeds
|
|
168
|
+
.B IORING_MAX_CQ_ENTRIES ,
|
|
169
|
+
then it will be clamped at
|
|
170
|
+
.B IORING_MAX_CQ_ENTRIES .
|
|
171
|
+
.TP
|
|
172
|
+
.B IORING_SETUP_ATTACH_WQ
|
|
173
|
+
This flag should be set in conjunction with
|
|
174
|
+
.IR "struct io_uring_params.wq_fd"
|
|
175
|
+
being set to an existing io_uring ring file descriptor. When set, the
|
|
176
|
+
io_uring instance being created will share the asynchronous worker
|
|
177
|
+
thread backend of the specified io_uring ring, rather than create a new
|
|
178
|
+
separate thread pool.
|
|
179
|
+
.TP
|
|
180
|
+
.B IORING_SETUP_R_DISABLED
|
|
181
|
+
If this flag is specified, the io_uring ring starts in a disabled state.
|
|
182
|
+
In this state, restrictions can be registered, but submissions are not allowed.
|
|
183
|
+
See
|
|
184
|
+
.BR io_uring_register (2)
|
|
185
|
+
for details on how to enable the ring. Available since 5.10.
|
|
186
|
+
.PP
|
|
187
|
+
If no flags are specified, the io_uring instance is setup for
|
|
188
|
+
interrupt driven I/O. I/O may be submitted using
|
|
189
|
+
.BR io_uring_enter (2)
|
|
190
|
+
and can be reaped by polling the completion queue.
|
|
191
|
+
|
|
192
|
+
The
|
|
193
|
+
.I resv
|
|
194
|
+
array must be initialized to zero.
|
|
195
|
+
|
|
196
|
+
.I features
|
|
197
|
+
is filled in by the kernel, which specifies various features supported
|
|
198
|
+
by current kernel version.
|
|
199
|
+
.TP
|
|
200
|
+
.B IORING_FEAT_SINGLE_MMAP
|
|
201
|
+
If this flag is set, the two SQ and CQ rings can be mapped with a single
|
|
202
|
+
.I mmap(2)
|
|
203
|
+
call. The SQEs must still be allocated separately. This brings the necessary
|
|
204
|
+
.I mmap(2)
|
|
205
|
+
calls down from three to two. Available since kernel 5.4.
|
|
206
|
+
.TP
|
|
207
|
+
.B IORING_FEAT_NODROP
|
|
208
|
+
If this flag is set, io_uring supports never dropping completion events.
|
|
209
|
+
If a completion event occurs and the CQ ring is full, the kernel stores
|
|
210
|
+
the event internally until such a time that the CQ ring has room for more
|
|
211
|
+
entries. If this overflow condition is entered, attempting to submit more
|
|
212
|
+
IO will fail with the
|
|
213
|
+
.B -EBUSY
|
|
214
|
+
error value, if it can't flush the overflown events to the CQ ring. If this
|
|
215
|
+
happens, the application must reap events from the CQ ring and attempt the
|
|
216
|
+
submit again. Available since kernel 5.5.
|
|
217
|
+
.TP
|
|
218
|
+
.B IORING_FEAT_SUBMIT_STABLE
|
|
219
|
+
If this flag is set, applications can be certain that any data for
|
|
220
|
+
async offload has been consumed when the kernel has consumed the SQE. Available
|
|
221
|
+
since kernel 5.5.
|
|
222
|
+
.TP
|
|
223
|
+
.B IORING_FEAT_RW_CUR_POS
|
|
224
|
+
If this flag is set, applications can specify
|
|
225
|
+
.I offset
|
|
226
|
+
== -1 with
|
|
227
|
+
.B IORING_OP_{READV,WRITEV}
|
|
228
|
+
,
|
|
229
|
+
.B IORING_OP_{READ,WRITE}_FIXED
|
|
230
|
+
, and
|
|
231
|
+
.B IORING_OP_{READ,WRITE}
|
|
232
|
+
to mean current file position, which behaves like
|
|
233
|
+
.I preadv2(2)
|
|
234
|
+
and
|
|
235
|
+
.I pwritev2(2)
|
|
236
|
+
with
|
|
237
|
+
.I offset
|
|
238
|
+
== -1. It'll use (and update) the current file position. This obviously comes
|
|
239
|
+
with the caveat that if the application has multiple reads or writes in flight,
|
|
240
|
+
then the end result will not be as expected. This is similar to threads sharing
|
|
241
|
+
a file descriptor and doing IO using the current file position. Available since
|
|
242
|
+
kernel 5.6.
|
|
243
|
+
.TP
|
|
244
|
+
.B IORING_FEAT_CUR_PERSONALITY
|
|
245
|
+
If this flag is set, then io_uring guarantees that both sync and async
|
|
246
|
+
execution of a request assumes the credentials of the task that called
|
|
247
|
+
.I
|
|
248
|
+
io_uring_enter(2)
|
|
249
|
+
to queue the requests. If this flag isn't set, then requests are issued with
|
|
250
|
+
the credentials of the task that originally registered the io_uring. If only
|
|
251
|
+
one task is using a ring, then this flag doesn't matter as the credentials
|
|
252
|
+
will always be the same. Note that this is the default behavior, tasks can
|
|
253
|
+
still register different personalities through
|
|
254
|
+
.I
|
|
255
|
+
io_uring_register(2)
|
|
256
|
+
with
|
|
257
|
+
.B IORING_REGISTER_PERSONALITY
|
|
258
|
+
and specify the personality to use in the sqe. Available since kernel 5.6.
|
|
259
|
+
.TP
|
|
260
|
+
.B IORING_FEAT_FAST_POLL
|
|
261
|
+
If this flag is set, then io_uring supports using an internal poll mechanism
|
|
262
|
+
to drive data/space readiness. This means that requests that cannot read or
|
|
263
|
+
write data to a file no longer need to be punted to an async thread for
|
|
264
|
+
handling, instead they will begin operation when the file is ready. This is
|
|
265
|
+
similar to doing poll + read/write in userspace, but eliminates the need to do
|
|
266
|
+
so. If this flag is set, requests waiting on space/data consume a lot less
|
|
267
|
+
resources doing so as they are not blocking a thread. Available since kernel
|
|
268
|
+
5.7.
|
|
269
|
+
.TP
|
|
270
|
+
.B IORING_FEAT_POLL_32BITS
|
|
271
|
+
If this flag is set, the
|
|
272
|
+
.B IORING_OP_POLL_ADD
|
|
273
|
+
command accepts the full 32-bit range of epoll based flags. Most notably
|
|
274
|
+
.B EPOLLEXCLUSIVE
|
|
275
|
+
which allows exclusive (waking single waiters) behavior. Available since kernel
|
|
276
|
+
5.9.
|
|
277
|
+
.TP
|
|
278
|
+
.B IORING_FEAT_SQPOLL_NONFIXED
|
|
279
|
+
If this flag is set, the
|
|
280
|
+
.B IORING_SETUP_SQPOLL
|
|
281
|
+
feature no longer requires the use of fixed files. Any normal file descriptor
|
|
282
|
+
can be used for IO commands without needing registration. Available since
|
|
283
|
+
kernel 5.11.
|
|
284
|
+
.TP
|
|
285
|
+
.B IORING_FEAT_ENTER_EXT_ARG
|
|
286
|
+
If this flag is set, then the
|
|
287
|
+
.BR io_uring_enter (2)
|
|
288
|
+
system call supports passing in an extended argument instead of just the
|
|
289
|
+
.IR "sigset_t"
|
|
290
|
+
of earlier kernels. This.
|
|
291
|
+
extended argument is of type
|
|
292
|
+
.IR "struct io_uring_getevents_arg"
|
|
293
|
+
and allows the caller to pass in both a
|
|
294
|
+
.IR "sigset_t"
|
|
295
|
+
and a timeout argument for waiting on events. The struct layout is as follows:
|
|
296
|
+
.TP
|
|
297
|
+
.in +8n
|
|
298
|
+
.EX
|
|
299
|
+
struct io_uring_getevents_arg {
|
|
300
|
+
__u64 sigmask;
|
|
301
|
+
__u32 sigmask_sz;
|
|
302
|
+
__u32 pad;
|
|
303
|
+
__u64 ts;
|
|
304
|
+
};
|
|
305
|
+
.EE
|
|
306
|
+
|
|
307
|
+
and a pointer to this struct must be passed in if
|
|
308
|
+
.B IORING_ENTER_EXT_ARG
|
|
309
|
+
is set in the flags for the enter system call. Available since kernel 5.11.
|
|
310
|
+
.TP
|
|
311
|
+
.B IORING_FEAT_NATIVE_WORKERS
|
|
312
|
+
If this flag is set, io_uring is using native workers for its async helpers.
|
|
313
|
+
Previous kernels used kernel threads that assumed the identity of the
|
|
314
|
+
original io_uring owning task, but later kernels will actively create what
|
|
315
|
+
looks more like regular process threads instead. Available since kernel
|
|
316
|
+
5.12.
|
|
317
|
+
.TP
|
|
318
|
+
.B IORING_FEAT_RSRC_TAGS
|
|
319
|
+
If this flag is set, then io_uring supports a variety of features related
|
|
320
|
+
to fixed files and buffers. In particular, it indicates that registered
|
|
321
|
+
buffers can be updated in-place, whereas before the full set would have to
|
|
322
|
+
be unregistered first. Available since kernel 5.13.
|
|
323
|
+
|
|
324
|
+
.PP
|
|
325
|
+
The rest of the fields in the
|
|
326
|
+
.I struct io_uring_params
|
|
327
|
+
are filled in by the kernel, and provide the information necessary to
|
|
328
|
+
memory map the submission queue, completion queue, and the array of
|
|
329
|
+
submission queue entries.
|
|
330
|
+
.I sq_entries
|
|
331
|
+
specifies the number of submission queue entries allocated.
|
|
332
|
+
.I sq_off
|
|
333
|
+
describes the offsets of various ring buffer fields:
|
|
334
|
+
.PP
|
|
335
|
+
.in +4n
|
|
336
|
+
.EX
|
|
337
|
+
struct io_sqring_offsets {
|
|
338
|
+
__u32 head;
|
|
339
|
+
__u32 tail;
|
|
340
|
+
__u32 ring_mask;
|
|
341
|
+
__u32 ring_entries;
|
|
342
|
+
__u32 flags;
|
|
343
|
+
__u32 dropped;
|
|
344
|
+
__u32 array;
|
|
345
|
+
__u32 resv[3];
|
|
346
|
+
};
|
|
347
|
+
.EE
|
|
348
|
+
.in
|
|
349
|
+
.PP
|
|
350
|
+
Taken together,
|
|
351
|
+
.I sq_entries
|
|
352
|
+
and
|
|
353
|
+
.I sq_off
|
|
354
|
+
provide all of the information necessary for accessing the submission
|
|
355
|
+
queue ring buffer and the submission queue entry array. The
|
|
356
|
+
submission queue can be mapped with a call like:
|
|
357
|
+
.PP
|
|
358
|
+
.in +4n
|
|
359
|
+
.EX
|
|
360
|
+
ptr = mmap(0, sq_off.array + sq_entries * sizeof(__u32),
|
|
361
|
+
PROT_READ|PROT_WRITE, MAP_SHARED|MAP_POPULATE,
|
|
362
|
+
ring_fd, IORING_OFF_SQ_RING);
|
|
363
|
+
.EE
|
|
364
|
+
.in
|
|
365
|
+
.PP
|
|
366
|
+
where
|
|
367
|
+
.I sq_off
|
|
368
|
+
is the
|
|
369
|
+
.I io_sqring_offsets
|
|
370
|
+
structure, and
|
|
371
|
+
.I ring_fd
|
|
372
|
+
is the file descriptor returned from
|
|
373
|
+
.BR io_uring_setup (2).
|
|
374
|
+
The addition of
|
|
375
|
+
.I sq_off.array
|
|
376
|
+
to the length of the region accounts for the fact that the ring
|
|
377
|
+
located at the end of the data structure. As an example, the ring
|
|
378
|
+
buffer head pointer can be accessed by adding
|
|
379
|
+
.I sq_off.head
|
|
380
|
+
to the address returned from
|
|
381
|
+
.BR mmap (2):
|
|
382
|
+
.PP
|
|
383
|
+
.in +4n
|
|
384
|
+
.EX
|
|
385
|
+
head = ptr + sq_off.head;
|
|
386
|
+
.EE
|
|
387
|
+
.in
|
|
388
|
+
|
|
389
|
+
The
|
|
390
|
+
.I flags
|
|
391
|
+
field is used by the kernel to communicate state information to the
|
|
392
|
+
application. Currently, it is used to inform the application when a
|
|
393
|
+
call to
|
|
394
|
+
.BR io_uring_enter (2)
|
|
395
|
+
is necessary. See the documentation for the
|
|
396
|
+
.B IORING_SETUP_SQPOLL
|
|
397
|
+
flag above.
|
|
398
|
+
The
|
|
399
|
+
.I dropped
|
|
400
|
+
member is incremented for each invalid submission queue entry
|
|
401
|
+
encountered in the ring buffer.
|
|
402
|
+
|
|
403
|
+
The head and tail track the ring buffer state. The tail is
|
|
404
|
+
incremented by the application when submitting new I/O, and the head
|
|
405
|
+
is incremented by the kernel when the I/O has been successfully
|
|
406
|
+
submitted. Determining the index of the head or tail into the ring is
|
|
407
|
+
accomplished by applying a mask:
|
|
408
|
+
.PP
|
|
409
|
+
.in +4n
|
|
410
|
+
.EX
|
|
411
|
+
index = tail & ring_mask;
|
|
412
|
+
.EE
|
|
413
|
+
.in
|
|
414
|
+
.PP
|
|
415
|
+
The array of submission queue entries is mapped with:
|
|
416
|
+
.PP
|
|
417
|
+
.in +4n
|
|
418
|
+
.EX
|
|
419
|
+
sqentries = mmap(0, sq_entries * sizeof(struct io_uring_sqe),
|
|
420
|
+
PROT_READ|PROT_WRITE, MAP_SHARED|MAP_POPULATE,
|
|
421
|
+
ring_fd, IORING_OFF_SQES);
|
|
422
|
+
.EE
|
|
423
|
+
.in
|
|
424
|
+
.PP
|
|
425
|
+
The completion queue is described by
|
|
426
|
+
.I cq_entries
|
|
427
|
+
and
|
|
428
|
+
.I cq_off
|
|
429
|
+
shown here:
|
|
430
|
+
.PP
|
|
431
|
+
.in +4n
|
|
432
|
+
.EX
|
|
433
|
+
struct io_cqring_offsets {
|
|
434
|
+
__u32 head;
|
|
435
|
+
__u32 tail;
|
|
436
|
+
__u32 ring_mask;
|
|
437
|
+
__u32 ring_entries;
|
|
438
|
+
__u32 overflow;
|
|
439
|
+
__u32 cqes;
|
|
440
|
+
__u32 flags;
|
|
441
|
+
__u32 resv[3];
|
|
442
|
+
};
|
|
443
|
+
.EE
|
|
444
|
+
.in
|
|
445
|
+
.PP
|
|
446
|
+
The completion queue is simpler, since the entries are not separated
|
|
447
|
+
from the queue itself, and can be mapped with:
|
|
448
|
+
.PP
|
|
449
|
+
.in +4n
|
|
450
|
+
.EX
|
|
451
|
+
ptr = mmap(0, cq_off.cqes + cq_entries * sizeof(struct io_uring_cqe),
|
|
452
|
+
PROT_READ|PROT_WRITE, MAP_SHARED|MAP_POPULATE, ring_fd,
|
|
453
|
+
IORING_OFF_CQ_RING);
|
|
454
|
+
.EE
|
|
455
|
+
.in
|
|
456
|
+
.PP
|
|
457
|
+
Closing the file descriptor returned by
|
|
458
|
+
.BR io_uring_setup (2)
|
|
459
|
+
will free all resources associated with the io_uring context.
|
|
460
|
+
.PP
|
|
461
|
+
.SH RETURN VALUE
|
|
462
|
+
.BR io_uring_setup (2)
|
|
463
|
+
returns a new file descriptor on success. The application may then
|
|
464
|
+
provide the file descriptor in a subsequent
|
|
465
|
+
.BR mmap (2)
|
|
466
|
+
call to map the submission and completion queues, or to the
|
|
467
|
+
.BR io_uring_register (2)
|
|
468
|
+
or
|
|
469
|
+
.BR io_uring_enter (2)
|
|
470
|
+
system calls.
|
|
471
|
+
|
|
472
|
+
On error, -1 is returned and
|
|
473
|
+
.I errno
|
|
474
|
+
is set appropriately.
|
|
475
|
+
.PP
|
|
476
|
+
.SH ERRORS
|
|
477
|
+
.TP
|
|
478
|
+
.B EFAULT
|
|
479
|
+
params is outside your accessible address space.
|
|
480
|
+
.TP
|
|
481
|
+
.B EINVAL
|
|
482
|
+
The resv array contains non-zero data, p.flags contains an unsupported
|
|
483
|
+
flag,
|
|
484
|
+
.I entries
|
|
485
|
+
is out of bounds,
|
|
486
|
+
.B IORING_SETUP_SQ_AFF
|
|
487
|
+
was specified, but
|
|
488
|
+
.B IORING_SETUP_SQPOLL
|
|
489
|
+
was not, or
|
|
490
|
+
.B IORING_SETUP_CQSIZE
|
|
491
|
+
was specified, but
|
|
492
|
+
.I io_uring_params.cq_entries
|
|
493
|
+
was invalid.
|
|
494
|
+
.TP
|
|
495
|
+
.B EMFILE
|
|
496
|
+
The per-process limit on the number of open file descriptors has been
|
|
497
|
+
reached (see the description of
|
|
498
|
+
.B RLIMIT_NOFILE
|
|
499
|
+
in
|
|
500
|
+
.BR getrlimit (2)).
|
|
501
|
+
.TP
|
|
502
|
+
.B ENFILE
|
|
503
|
+
The system-wide limit on the total number of open files has been
|
|
504
|
+
reached.
|
|
505
|
+
.TP
|
|
506
|
+
.B ENOMEM
|
|
507
|
+
Insufficient kernel resources are available.
|
|
508
|
+
.TP
|
|
509
|
+
.B EPERM
|
|
510
|
+
.B IORING_SETUP_SQPOLL
|
|
511
|
+
was specified, but the effective user ID of the caller did not have sufficient
|
|
512
|
+
privileges.
|
|
513
|
+
.SH SEE ALSO
|
|
514
|
+
.BR io_uring_register (2),
|
|
515
|
+
.BR io_uring_enter (2)
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
prefix ?= /usr
|
|
2
|
+
includedir ?= $(prefix)/include
|
|
3
|
+
libdir ?= $(prefix)/lib
|
|
4
|
+
libdevdir ?= $(prefix)/lib
|
|
5
|
+
|
|
6
|
+
CPPFLAGS ?=
|
|
7
|
+
override CPPFLAGS += -D_GNU_SOURCE \
|
|
8
|
+
-Iinclude/ -include ../config-host.h
|
|
9
|
+
CFLAGS ?= -g -fomit-frame-pointer -O2
|
|
10
|
+
override CFLAGS += -D_GNU_SOURCE \
|
|
11
|
+
-Wall -Wextra -Wno-unused-parameter -Wno-sign-compare
|
|
12
|
+
SO_CFLAGS=-fPIC $(CFLAGS)
|
|
13
|
+
L_CFLAGS=$(CFLAGS)
|
|
14
|
+
LINK_FLAGS=
|
|
15
|
+
LINK_FLAGS+=$(LDFLAGS)
|
|
16
|
+
ENABLE_SHARED ?= 1
|
|
17
|
+
|
|
18
|
+
soname=liburing.so.2
|
|
19
|
+
minor=1
|
|
20
|
+
micro=0
|
|
21
|
+
libname=$(soname).$(minor).$(micro)
|
|
22
|
+
all_targets += liburing.a
|
|
23
|
+
|
|
24
|
+
ifeq ($(ENABLE_SHARED),1)
|
|
25
|
+
all_targets += $(libname)
|
|
26
|
+
endif
|
|
27
|
+
|
|
28
|
+
include ../Makefile.quiet
|
|
29
|
+
|
|
30
|
+
ifneq ($(MAKECMDGOALS),clean)
|
|
31
|
+
include ../config-host.mak
|
|
32
|
+
endif
|
|
33
|
+
|
|
34
|
+
all: $(all_targets)
|
|
35
|
+
|
|
36
|
+
liburing_srcs := setup.c queue.c syscall.c register.c
|
|
37
|
+
|
|
38
|
+
liburing_objs := $(patsubst %.c,%.ol,$(liburing_srcs))
|
|
39
|
+
liburing_sobjs := $(patsubst %.c,%.os,$(liburing_srcs))
|
|
40
|
+
|
|
41
|
+
$(liburing_objs) $(liburing_sobjs): include/liburing/io_uring.h
|
|
42
|
+
|
|
43
|
+
%.os: %.c
|
|
44
|
+
$(QUIET_CC)$(CC) $(CPPFLAGS) $(SO_CFLAGS) -c -o $@ $<
|
|
45
|
+
|
|
46
|
+
%.ol: %.c
|
|
47
|
+
$(QUIET_CC)$(CC) $(CPPFLAGS) $(L_CFLAGS) -c -o $@ $<
|
|
48
|
+
|
|
49
|
+
AR ?= ar
|
|
50
|
+
RANLIB ?= ranlib
|
|
51
|
+
liburing.a: $(liburing_objs)
|
|
52
|
+
@rm -f liburing.a
|
|
53
|
+
$(QUIET_AR)$(AR) r liburing.a $^
|
|
54
|
+
$(QUIET_RANLIB)$(RANLIB) liburing.a
|
|
55
|
+
|
|
56
|
+
$(libname): $(liburing_sobjs) liburing.map
|
|
57
|
+
$(QUIET_CC)$(CC) $(SO_CFLAGS) -shared -Wl,--version-script=liburing.map -Wl,-soname=$(soname) -o $@ $(liburing_sobjs) $(LINK_FLAGS)
|
|
58
|
+
|
|
59
|
+
install: $(all_targets)
|
|
60
|
+
install -D -m 644 include/liburing/io_uring.h $(includedir)/liburing/io_uring.h
|
|
61
|
+
install -D -m 644 include/liburing.h $(includedir)/liburing.h
|
|
62
|
+
install -D -m 644 include/liburing/compat.h $(includedir)/liburing/compat.h
|
|
63
|
+
install -D -m 644 include/liburing/barrier.h $(includedir)/liburing/barrier.h
|
|
64
|
+
install -D -m 644 liburing.a $(libdevdir)/liburing.a
|
|
65
|
+
ifeq ($(ENABLE_SHARED),1)
|
|
66
|
+
install -D -m 755 $(libname) $(libdir)/$(libname)
|
|
67
|
+
ln -sf $(libname) $(libdir)/$(soname)
|
|
68
|
+
ln -sf $(relativelibdir)$(libname) $(libdevdir)/liburing.so
|
|
69
|
+
endif
|
|
70
|
+
|
|
71
|
+
$(liburing_objs): include/liburing.h
|
|
72
|
+
|
|
73
|
+
clean:
|
|
74
|
+
@rm -f $(all_targets) $(liburing_objs) $(liburing_sobjs) $(soname).new
|
|
75
|
+
@rm -f *.so* *.a *.o
|
|
76
|
+
@rm -f include/liburing/compat.h
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/* SPDX-License-Identifier: MIT */
|
|
2
|
+
#ifndef LIBURING_BARRIER_H
|
|
3
|
+
#define LIBURING_BARRIER_H
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
From the kernel documentation file refcount-vs-atomic.rst:
|
|
7
|
+
|
|
8
|
+
A RELEASE memory ordering guarantees that all prior loads and
|
|
9
|
+
stores (all po-earlier instructions) on the same CPU are completed
|
|
10
|
+
before the operation. It also guarantees that all po-earlier
|
|
11
|
+
stores on the same CPU and all propagated stores from other CPUs
|
|
12
|
+
must propagate to all other CPUs before the release operation
|
|
13
|
+
(A-cumulative property). This is implemented using
|
|
14
|
+
:c:func:`smp_store_release`.
|
|
15
|
+
|
|
16
|
+
An ACQUIRE memory ordering guarantees that all post loads and
|
|
17
|
+
stores (all po-later instructions) on the same CPU are
|
|
18
|
+
completed after the acquire operation. It also guarantees that all
|
|
19
|
+
po-later stores on the same CPU must propagate to all other CPUs
|
|
20
|
+
after the acquire operation executes. This is implemented using
|
|
21
|
+
:c:func:`smp_acquire__after_ctrl_dep`.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
#ifdef __cplusplus
|
|
25
|
+
#include <atomic>
|
|
26
|
+
|
|
27
|
+
template <typename T>
|
|
28
|
+
static inline void IO_URING_WRITE_ONCE(T &var, T val)
|
|
29
|
+
{
|
|
30
|
+
std::atomic_store_explicit(reinterpret_cast<std::atomic<T> *>(&var),
|
|
31
|
+
val, std::memory_order_relaxed);
|
|
32
|
+
}
|
|
33
|
+
template <typename T>
|
|
34
|
+
static inline T IO_URING_READ_ONCE(const T &var)
|
|
35
|
+
{
|
|
36
|
+
return std::atomic_load_explicit(
|
|
37
|
+
reinterpret_cast<const std::atomic<T> *>(&var),
|
|
38
|
+
std::memory_order_relaxed);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
template <typename T>
|
|
42
|
+
static inline void io_uring_smp_store_release(T *p, T v)
|
|
43
|
+
{
|
|
44
|
+
std::atomic_store_explicit(reinterpret_cast<std::atomic<T> *>(p), v,
|
|
45
|
+
std::memory_order_release);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
template <typename T>
|
|
49
|
+
static inline T io_uring_smp_load_acquire(const T *p)
|
|
50
|
+
{
|
|
51
|
+
return std::atomic_load_explicit(
|
|
52
|
+
reinterpret_cast<const std::atomic<T> *>(p),
|
|
53
|
+
std::memory_order_acquire);
|
|
54
|
+
}
|
|
55
|
+
#else
|
|
56
|
+
#include <stdatomic.h>
|
|
57
|
+
|
|
58
|
+
#define IO_URING_WRITE_ONCE(var, val) \
|
|
59
|
+
atomic_store_explicit((_Atomic __typeof__(var) *)&(var), \
|
|
60
|
+
(val), memory_order_relaxed)
|
|
61
|
+
#define IO_URING_READ_ONCE(var) \
|
|
62
|
+
atomic_load_explicit((_Atomic __typeof__(var) *)&(var), \
|
|
63
|
+
memory_order_relaxed)
|
|
64
|
+
|
|
65
|
+
#define io_uring_smp_store_release(p, v) \
|
|
66
|
+
atomic_store_explicit((_Atomic __typeof__(*(p)) *)(p), (v), \
|
|
67
|
+
memory_order_release)
|
|
68
|
+
#define io_uring_smp_load_acquire(p) \
|
|
69
|
+
atomic_load_explicit((_Atomic __typeof__(*(p)) *)(p), \
|
|
70
|
+
memory_order_acquire)
|
|
71
|
+
#endif
|
|
72
|
+
|
|
73
|
+
#endif /* defined(LIBURING_BARRIER_H) */
|