├── .gitignore ├── CHANGES.md ├── HACKING.md ├── LICENSE.md ├── Makefile ├── README.md ├── bench ├── .ocamlformat ├── bechamel_csv │ ├── bechamel_csv.ml │ ├── bechamel_csv.mli │ └── dune ├── cptest.ml ├── dune ├── main.ml └── readv.ml ├── dune ├── dune-project ├── lib └── uring │ ├── dune │ ├── heap.ml │ ├── heap.mli │ ├── include │ ├── discover.ml │ ├── dune │ └── liburing │ │ └── dune │ ├── primitives.h │ ├── region.ml │ ├── region.mli │ ├── uring.ml │ ├── uring.mli │ └── uring_stubs.c ├── tests ├── dune ├── heap.md ├── lwtcp.ml ├── lwtcp_lib.ml ├── main.md ├── poll_add.ml ├── sketch.md ├── urcat.ml ├── urcp.ml ├── urcp_fixed_lib.ml ├── urcp_lib.ml └── urstat.ml ├── uring.opam ├── uring.opam.template └── vendor └── liburing ├── .github ├── pull_request_template.md └── workflows │ ├── build.yml │ └── shellcheck.yml ├── .gitignore ├── CHANGELOG ├── CITATION.cff ├── COPYING ├── COPYING.GPL ├── LICENSE ├── Makefile ├── Makefile.common ├── Makefile.quiet ├── README ├── SECURITY.md ├── configure ├── debian ├── README.Debian ├── changelog ├── control ├── copyright ├── liburing-dev.install ├── liburing-dev.manpages ├── liburing2.install ├── liburing2.symbols ├── patches │ └── series ├── rules ├── source │ ├── format │ ├── local-options │ └── options └── watch ├── examples ├── Makefile ├── io_uring-close-test.c ├── io_uring-cp.c ├── io_uring-test.c ├── io_uring-udp.c ├── link-cp.c ├── poll-bench.c ├── rsrc-update-bench.c ├── send-zerocopy.c └── ucontext-cp.c ├── liburing-ffi.pc.in ├── liburing.pc.in ├── liburing.spec ├── make-debs.sh ├── man ├── IO_URING_CHECK_VERSION.3 ├── IO_URING_VERSION_MAJOR.3 ├── IO_URING_VERSION_MINOR.3 ├── __io_uring_buf_ring_cq_advance.3 ├── io_uring.7 ├── io_uring_buf_ring_add.3 ├── io_uring_buf_ring_advance.3 ├── io_uring_buf_ring_cq_advance.3 ├── io_uring_buf_ring_init.3 ├── io_uring_buf_ring_mask.3 ├── io_uring_check_version.3 ├── io_uring_close_ring_fd.3 ├── io_uring_cq_advance.3 ├── io_uring_cq_has_overflow.3 ├── io_uring_cq_ready.3 ├── io_uring_cqe_get_data.3 ├── io_uring_cqe_get_data64.3 ├── io_uring_cqe_seen.3 ├── io_uring_enter.2 ├── io_uring_enter2.2 ├── io_uring_for_each_cqe.3 ├── io_uring_free_buf_ring.3 ├── io_uring_free_probe.3 ├── io_uring_get_events.3 ├── io_uring_get_probe.3 ├── io_uring_get_sqe.3 ├── io_uring_major_version.3 ├── io_uring_minor_version.3 ├── io_uring_opcode_supported.3 ├── io_uring_peek_cqe.3 ├── io_uring_prep_accept.3 ├── io_uring_prep_accept_direct.3 ├── io_uring_prep_cancel.3 ├── io_uring_prep_cancel64.3 ├── io_uring_prep_close.3 ├── io_uring_prep_close_direct.3 ├── io_uring_prep_connect.3 ├── io_uring_prep_fadvise.3 ├── io_uring_prep_fallocate.3 ├── io_uring_prep_fgetxattr.3 ├── io_uring_prep_files_update.3 ├── io_uring_prep_fsetxattr.3 ├── io_uring_prep_fsync.3 ├── io_uring_prep_getxattr.3 ├── io_uring_prep_link.3 ├── io_uring_prep_link_timeout.3 ├── io_uring_prep_linkat.3 ├── io_uring_prep_madvise.3 ├── io_uring_prep_mkdir.3 ├── io_uring_prep_mkdirat.3 ├── io_uring_prep_msg_ring.3 ├── io_uring_prep_msg_ring_cqe_flags.3 ├── io_uring_prep_msg_ring_fd.3 ├── io_uring_prep_msg_ring_fd_alloc.3 ├── io_uring_prep_multishot_accept.3 ├── io_uring_prep_multishot_accept_direct.3 ├── io_uring_prep_nop.3 ├── io_uring_prep_openat.3 ├── io_uring_prep_openat2.3 ├── io_uring_prep_openat2_direct.3 ├── io_uring_prep_openat_direct.3 ├── io_uring_prep_poll_add.3 ├── io_uring_prep_poll_multishot.3 ├── io_uring_prep_poll_remove.3 ├── io_uring_prep_poll_update.3 ├── io_uring_prep_provide_buffers.3 ├── io_uring_prep_read.3 ├── io_uring_prep_read_fixed.3 ├── io_uring_prep_readv.3 ├── io_uring_prep_readv2.3 ├── io_uring_prep_recv.3 ├── io_uring_prep_recv_multishot.3 ├── io_uring_prep_recvmsg.3 ├── io_uring_prep_recvmsg_multishot.3 ├── io_uring_prep_remove_buffers.3 ├── io_uring_prep_rename.3 ├── io_uring_prep_renameat.3 ├── io_uring_prep_send.3 ├── io_uring_prep_send_set_addr.3 ├── io_uring_prep_send_zc.3 ├── io_uring_prep_send_zc_fixed.3 ├── io_uring_prep_sendmsg.3 ├── io_uring_prep_sendmsg_zc.3 ├── io_uring_prep_sendto.3 ├── io_uring_prep_setxattr.3 ├── io_uring_prep_shutdown.3 ├── io_uring_prep_socket.3 ├── io_uring_prep_socket_direct.3 ├── io_uring_prep_socket_direct_alloc.3 ├── io_uring_prep_splice.3 ├── io_uring_prep_statx.3 ├── io_uring_prep_symlink.3 ├── io_uring_prep_symlinkat.3 ├── io_uring_prep_sync_file_range.3 ├── io_uring_prep_tee.3 ├── io_uring_prep_timeout.3 ├── io_uring_prep_timeout_remove.3 ├── io_uring_prep_timeout_update.3 ├── io_uring_prep_unlink.3 ├── io_uring_prep_unlinkat.3 ├── io_uring_prep_write.3 ├── io_uring_prep_write_fixed.3 ├── io_uring_prep_writev.3 ├── io_uring_prep_writev2.3 ├── io_uring_queue_exit.3 ├── io_uring_queue_init.3 ├── io_uring_queue_init_params.3 ├── io_uring_recvmsg_cmsg_firsthdr.3 ├── io_uring_recvmsg_cmsg_nexthdr.3 ├── io_uring_recvmsg_name.3 ├── io_uring_recvmsg_out.3 ├── io_uring_recvmsg_payload.3 ├── io_uring_recvmsg_payload_length.3 ├── io_uring_recvmsg_validate.3 ├── io_uring_register.2 ├── io_uring_register_buf_ring.3 ├── io_uring_register_buffers.3 ├── io_uring_register_buffers_sparse.3 ├── io_uring_register_buffers_tags.3 ├── io_uring_register_buffers_update_tag.3 ├── io_uring_register_eventfd.3 ├── io_uring_register_eventfd_async.3 ├── io_uring_register_file_alloc_range.3 ├── io_uring_register_files.3 ├── io_uring_register_files_sparse.3 ├── io_uring_register_files_tags.3 ├── io_uring_register_files_update.3 ├── io_uring_register_files_update_tag.3 ├── io_uring_register_iowq_aff.3 ├── io_uring_register_iowq_max_workers.3 ├── io_uring_register_ring_fd.3 ├── io_uring_register_sync_cancel.3 ├── io_uring_setup.2 ├── io_uring_setup_buf_ring.3 ├── io_uring_sq_ready.3 ├── io_uring_sq_space_left.3 ├── io_uring_sqe_set_data.3 ├── io_uring_sqe_set_data64.3 ├── io_uring_sqe_set_flags.3 ├── io_uring_sqring_wait.3 ├── io_uring_submit.3 ├── io_uring_submit_and_get_events.3 ├── io_uring_submit_and_wait.3 ├── io_uring_submit_and_wait_timeout.3 ├── io_uring_unregister_buf_ring.3 ├── io_uring_unregister_buffers.3 ├── io_uring_unregister_eventfd.3 ├── io_uring_unregister_files.3 ├── io_uring_unregister_iowq_aff.3 ├── io_uring_unregister_ring_fd.3 ├── io_uring_wait_cqe.3 ├── io_uring_wait_cqe_nr.3 ├── io_uring_wait_cqe_timeout.3 └── io_uring_wait_cqes.3 ├── src ├── Makefile ├── arch │ ├── aarch64 │ │ ├── lib.h │ │ └── syscall.h │ ├── generic │ │ ├── lib.h │ │ └── syscall.h │ ├── syscall-defs.h │ └── x86 │ │ ├── lib.h │ │ └── syscall.h ├── ffi.c ├── include │ ├── liburing.h │ └── liburing │ │ ├── barrier.h │ │ └── io_uring.h ├── int_flags.h ├── lib.h ├── liburing-ffi.map ├── liburing.map ├── nolibc.c ├── queue.c ├── register.c ├── setup.c ├── syscall.c ├── syscall.h └── version.c └── test ├── 232c93d07b74.c ├── 35fa71a030ca.c ├── 500f9fbadef8.c ├── 7ad0e4b2f83c.c ├── 8a9973408177.c ├── 917257daa0fe.c ├── Makefile ├── a0908ae19763.c ├── a4c0b3decb33.c ├── accept-link.c ├── accept-reuse.c ├── accept-test.c ├── accept.c ├── across-fork.c ├── b19062a56726.c ├── b5837bd5311d.c ├── buf-ring.c ├── ce593a6c480a.c ├── close-opath.c ├── config ├── connect-rep.c ├── connect.c ├── cq-full.c ├── cq-overflow.c ├── cq-peek-batch.c ├── cq-ready.c ├── cq-size.c ├── d4ae271dfaae.c ├── d77a67ed5f27.c ├── defer-taskrun.c ├── defer.c ├── double-poll-crash.c ├── drop-submit.c ├── eeed8b54e0df.c ├── empty-eownerdead.c ├── eploop.c ├── eventfd-disable.c ├── eventfd-reg.c ├── eventfd-ring.c ├── eventfd.c ├── evloop.c ├── exec-target.c ├── exit-no-cleanup.c ├── fadvise.c ├── fallocate.c ├── fc2a85cb02ef.c ├── fd-pass.c ├── file-register.c ├── file-update.c ├── file-verify.c ├── files-exit-hang-poll.c ├── files-exit-hang-timeout.c ├── fixed-buf-iter.c ├── fixed-link.c ├── fixed-reuse.c ├── fpos.c ├── fsnotify.c ├── fsync.c ├── hardlink.c ├── helpers.c ├── helpers.h ├── io-cancel.c ├── io_uring_enter.c ├── io_uring_passthrough.c ├── io_uring_register.c ├── io_uring_setup.c ├── iopoll-leak.c ├── iopoll-overflow.c ├── iopoll.c ├── lfs-openat-write.c ├── lfs-openat.c ├── link-timeout.c ├── link.c ├── link_drain.c ├── madvise.c ├── mkdir.c ├── msg-ring-flags.c ├── msg-ring-overflow.c ├── msg-ring.c ├── multicqes_drain.c ├── nolibc.c ├── nop-all-sizes.c ├── nop.c ├── nvme.h ├── open-close.c ├── open-direct-link.c ├── open-direct-pick.c ├── openat2.c ├── personality.c ├── pipe-bug.c ├── pipe-eof.c ├── pipe-reuse.c ├── poll-cancel-all.c ├── poll-cancel-ton.c ├── poll-cancel.c ├── poll-link.c ├── poll-many.c ├── poll-mshot-overflow.c ├── poll-mshot-update.c ├── poll-race-mshot.c ├── poll-race.c ├── poll-ring.c ├── poll-v-poll.c ├── poll.c ├── pollfree.c ├── probe.c ├── read-before-exit.c ├── read-write.c ├── recv-msgall-stream.c ├── recv-msgall.c ├── recv-multishot.c ├── reg-hint.c ├── reg-reg-ring.c ├── regbuf-merge.c ├── register-restrictions.c ├── rename.c ├── ring-leak.c ├── ring-leak2.c ├── ringbuf-read.c ├── rsrc_tags.c ├── runtests-loop.sh ├── runtests-quiet.sh ├── runtests.sh ├── rw_merge_test.c ├── self.c ├── send-zerocopy.c ├── send_recv.c ├── send_recvmsg.c ├── sendmsg_fs_cve.c ├── shared-wq.c ├── short-read.c ├── shutdown.c ├── sigfd-deadlock.c ├── single-issuer.c ├── skip-cqe.c ├── socket-rw-eagain.c ├── socket-rw-offset.c ├── socket-rw.c ├── socket.c ├── splice.c ├── sq-full-cpp.cc ├── sq-full.c ├── sq-poll-dup.c ├── sq-poll-kthread.c ├── sq-poll-share.c ├── sq-space_left.c ├── sqpoll-cancel-hang.c ├── sqpoll-disable-exit.c ├── sqpoll-exit-hang.c ├── sqpoll-sleep.c ├── statx.c ├── stdout.c ├── submit-and-wait.c ├── submit-link-fail.c ├── submit-reuse.c ├── symlink.c ├── sync-cancel.c ├── teardowns.c ├── test.h ├── thread-exit.c ├── timeout-new.c ├── timeout.c ├── tty-write-dpoll.c ├── unlink.c ├── version.c ├── wakeup-hang.c └── xattr.c /.gitignore: -------------------------------------------------------------------------------- 1 | .merlin 2 | .vscode 3 | _build 4 | _opam 5 | .*.sw? 6 | .#* 7 | -------------------------------------------------------------------------------- /HACKING.md: -------------------------------------------------------------------------------- 1 | # Maintainer notes 2 | 3 | ## liburing updates 4 | 5 | `vendor/liburing/` contains the upstream version of liburing. Updating it 6 | is normally done using `git subtree`. 7 | 8 | To do an update, first fetch the remote references from the liburing repo: 9 | 10 | ``` 11 | git remote add liburing https://github.com/axboe/liburing.git 12 | git fetch 13 | ``` 14 | 15 | Then run a subtree pull, and substitute `2.3` with the right version: 16 | 17 | ``` 18 | git subtree pull --prefix vendor/liburing https://github.com/axboe/liburing.git liburing-2.3 --squash 19 | ``` 20 | 21 | Then modify the build rules over at `lib/uring/dune` to pick up the 22 | right version of the shared library that's built. 23 | 24 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020-2021 Anil Madhavapeddy 3 | * 4 | * Permission to use, copy, modify, and distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | */ 16 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | dune build @check @runtest 3 | -------------------------------------------------------------------------------- /bench/.ocamlformat: -------------------------------------------------------------------------------- 1 | enable 2 | profile = conventional 3 | break-infix = fit-or-vertical 4 | module-item-spacing = compact 5 | -------------------------------------------------------------------------------- /bench/bechamel_csv/bechamel_csv.ml: -------------------------------------------------------------------------------- 1 | open Bechamel 2 | 3 | let pad width v = 4 | let padding = String.make (width - String.length v) ' ' in 5 | padding ^ v 6 | 7 | let pp_row ~width f data = 8 | data |> List.iteri (fun i v -> 9 | if i > 0 then Fmt.comma f (); 10 | Fmt.pf f "%s" (pad width.(i) v) 11 | ) 12 | 13 | let pp f results = 14 | let results = Hashtbl.to_seq results |> Array.of_seq in 15 | Array.sort (fun (n1, _) (n2, _) -> String.compare n1 n2) results; (* Sort columns *) 16 | let rows = snd results.(0) |> Hashtbl.to_seq |> Seq.map fst |> Array.of_seq in 17 | let width = Array.make (Array.length results + 1) 0 in 18 | width.(0) <- String.length "name, "; 19 | results |> Array.iteri (fun i (name, _) -> width.(i + 1) <- String.length name + 2); 20 | Array.sort String.compare rows; 21 | let rows = 22 | rows |> Array.map (fun name -> 23 | width.(0) <- max width.(0) (String.length name + 2); 24 | let values = 25 | results |> Array.mapi (fun i (_, col) -> 26 | let v = 27 | match Hashtbl.find col name |> Analyze.OLS.estimates with 28 | | Some [v] -> Printf.sprintf "%f" v 29 | | _ -> assert false 30 | in 31 | width.(i + 1) <- max width.(i + 1) (String.length v + 2); 32 | v 33 | ) 34 | in 35 | name, values 36 | ) 37 | in 38 | let metrics = Array.to_list results |> List.map fst in 39 | let headings = List.mapi (fun i v -> pad width.(i) v) ("name" :: metrics) in 40 | Fmt.pf f "@[@[%a@]" Fmt.(list ~sep:comma string) headings; 41 | rows |> Array.iter (fun (name, data) -> 42 | Fmt.pf f "@,@[%a@]" (pp_row ~width) (name :: Array.to_list data); 43 | ); 44 | Fmt.pf f "@]" 45 | -------------------------------------------------------------------------------- /bench/bechamel_csv/bechamel_csv.mli: -------------------------------------------------------------------------------- 1 | val pp : (string, (string, Bechamel.Analyze.OLS.t) Stdlib.Hashtbl.t) Stdlib.Hashtbl.t Fmt.t 2 | (** [pp] formats the results of {!Bechamel.Analyze.merge} as a CSV table. *) 3 | -------------------------------------------------------------------------------- /bench/bechamel_csv/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name bechamel_csv) 3 | (libraries bechamel fmt)) 4 | -------------------------------------------------------------------------------- /bench/dune: -------------------------------------------------------------------------------- 1 | (executable 2 | (name main) 3 | (modules main) 4 | (libraries uring bechamel bechamel_csv)) 5 | 6 | (executable 7 | (name readv) 8 | (modules readv) 9 | (libraries uring)) 10 | 11 | (executable 12 | (name cptest) 13 | (modules cptest) 14 | (libraries urcp_fixed_lib urcp_lib lwtcp_lib uring bechamel bechamel_csv)) 15 | 16 | (rule 17 | (alias runbenchmark) 18 | (package uring) 19 | (action 20 | (run ./cptest.exe))) 21 | -------------------------------------------------------------------------------- /bench/main.ml: -------------------------------------------------------------------------------- 1 | open Bechamel 2 | 3 | let noop_run queue_depth = 4 | let t = Uring.create ~queue_depth () in 5 | Staged.stage (fun () -> 6 | for i = 1 to queue_depth do 7 | let r = Uring.noop t i in 8 | assert (r <> None) 9 | done; 10 | let submitted = Uring.submit t in 11 | assert (submitted = queue_depth); 12 | for _ = 1 to queue_depth do 13 | ignore (Uring.wait t : _ Uring.completion_option) 14 | done) 15 | 16 | let suite = 17 | Test.make_indexed ~name:"noop" ~fmt:"%s %7d" 18 | ~args:[ 10; 30; 100; 300; 1_000; 3_000; 10000 ] 19 | noop_run 20 | 21 | let metrics = 22 | Toolkit.Instance.[ minor_allocated; major_allocated; monotonic_clock ] 23 | 24 | let benchmark () = 25 | let ols = 26 | Analyze.ols ~bootstrap:0 ~r_square:true ~predictors:Measure.[| run |] 27 | in 28 | let quota = Time.second 0.5 in 29 | let cfg = Benchmark.cfg ~limit:2000 ~quota ~kde:(Some 1000) () in 30 | let raw_results = Benchmark.all cfg metrics suite in 31 | List.map (fun i -> Analyze.all ols i raw_results) metrics 32 | |> Analyze.merge ols metrics 33 | 34 | let () = 35 | let results = benchmark () in 36 | Fmt.pr "@[%a@]@." Bechamel_csv.pp results 37 | -------------------------------------------------------------------------------- /dune: -------------------------------------------------------------------------------- 1 | (mdx 2 | (deps (package uring)) 3 | (enabled_if (>= %{ocaml_version} 5.1.0)) 4 | (files README.md)) 5 | -------------------------------------------------------------------------------- /dune-project: -------------------------------------------------------------------------------- 1 | (lang dune 3.0) 2 | (name uring) 3 | (generate_opam_files true) 4 | (using mdx 0.2) 5 | (formatting disabled) 6 | (source (github ocaml-multicore/ocaml-uring)) 7 | (license "(ISC AND MIT)") 8 | (authors "Anil Madhavapeddy" "Sadiq Jaffer" "Thomas Leonard") 9 | (maintainers "anil@recoil.org") 10 | (documentation "https://ocaml-multicore.github.io/ocaml-uring/") 11 | (package 12 | (name uring) 13 | (synopsis "OCaml bindings for Linux io_uring") 14 | (description "Bindings to the Linux io_uring kernel IO interfaces. See https://github.com/ocaml-multicore/eio for a higher-level API using this.") 15 | (depends 16 | (cstruct (>= 6.0.1)) 17 | (ocaml (>= 4.12.0)) 18 | dune-configurator 19 | (lwt (and :with-test (>= 5.0.0))) 20 | (bechamel (and (>= 0.1.0) :with-test)) 21 | (logs (and :with-test (>= 0.5.0))) 22 | (cmdliner (and :with-test (>= 1.1.0))) 23 | (fmt (>= 0.8.10)) 24 | (optint (>= 0.1.0)) 25 | (mdx (and (>= 2.1.0) :with-test)))) 26 | -------------------------------------------------------------------------------- /lib/uring/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name uring) 3 | (public_name uring) 4 | (foreign_archives uring) 5 | (libraries cstruct fmt optint unix) 6 | (foreign_stubs 7 | (language c) 8 | (names uring_stubs) 9 | (include_dirs include) 10 | (extra_deps include/liburing/compat.h primitives.h))) 11 | 12 | (rule 13 | (enabled_if %{bin-available:lintcstubs_arity_cmt}) 14 | (action 15 | (with-stdout-to 16 | primitives.h.new 17 | (run %{bin:lintcstubs_arity_cmt} %{dep:.uring.objs/byte/uring.cmt})))) 18 | 19 | (rule 20 | (enabled_if %{bin-available:lintcstubs_arity_cmt}) 21 | (alias runtest) 22 | (action 23 | (diff primitives.h primitives.h.new))) 24 | 25 | (rule 26 | (targets config.ml) 27 | (deps 28 | include/liburing.h 29 | include/liburing/io_uring.h 30 | include/liburing/io_uring_version.h 31 | include/liburing/barrier.h 32 | include/liburing/compat.h) 33 | (action 34 | (run ./include/discover.exe))) 35 | 36 | (rule 37 | (deps 38 | (source_tree %{project_root}/vendor/liburing)) 39 | (targets 40 | liburing.a 41 | dlluring.so 42 | barrier.h 43 | compat.h 44 | io_uring.h 45 | liburing.h 46 | io_uring_version.h) 47 | (action 48 | (no-infer 49 | (progn 50 | (chdir 51 | %{project_root}/vendor/liburing 52 | (progn 53 | (run ./configure) 54 | (setenv 55 | CFLAGS 56 | "%{ocaml-config:ocamlc_cflags}" 57 | (run make -j -C src)))) 58 | (copy %{project_root}/vendor/liburing/src/liburing.a liburing.a) 59 | (copy %{project_root}/vendor/liburing/src/liburing.so.2.4 dlluring.so) 60 | (copy %{project_root}/vendor/liburing/src/include/liburing.h liburing.h) 61 | (copy 62 | %{project_root}/vendor/liburing/src/include/liburing/io_uring.h 63 | io_uring.h) 64 | (copy 65 | %{project_root}/vendor/liburing/src/include/liburing/barrier.h 66 | barrier.h) 67 | (copy 68 | %{project_root}/vendor/liburing/src/include/liburing/compat.h 69 | compat.h) 70 | (copy 71 | %{project_root}/vendor/liburing/src/include/liburing/io_uring.h 72 | io_uring_version.h))))) 73 | -------------------------------------------------------------------------------- /lib/uring/heap.mli: -------------------------------------------------------------------------------- 1 | (* 2 | * Copyright (c) 2021 Craig Ferguson 3 | * 4 | * Permission to use, copy, modify, and distribute this software for any 5 | * purpose with or without fee is hereby granted, provided that the above 6 | * copyright notice and this permission notice appear in all copies. 7 | * 8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 | *) 16 | 17 | type 'a t 18 | (** A bounded heap of values of type ['a]. *) 19 | 20 | val create : int -> _ t 21 | (** [create n] is a heap that holds at most [n] elements. *) 22 | 23 | type 'a entry 24 | (** An element in a heap. *) 25 | 26 | type ptr = private int 27 | (** The index of an entry. *) 28 | 29 | val ptr : 'a entry -> ptr 30 | (** [ptr e] is the index of [e]. 31 | @raise Invalid_arg if [e] has already been freed. *) 32 | 33 | val alloc : 'a t -> 'a -> extra_data:'b -> 'a entry 34 | (** [alloc t a ~extra_data] adds the value [a] to [t] and returns a 35 | pointer to that value, or raises [Invalid_argument] if no extra space 36 | can be created for [t], or [t] has already been [release]d. 37 | @param extra_data Prevent this from being GC'd until [free] is called. *) 38 | 39 | val free : 'a t -> ptr -> 'a 40 | (** [free t p] returns the element referenced by [p] and removes it from the 41 | heap. Has undefined behaviour if [p] has already been freed. *) 42 | 43 | val in_use : 'a t -> int 44 | (** [in_use t] is the number of entries currently allocated. *) 45 | 46 | val release : _ t -> unit 47 | (** [release t] marks [t] as unusable. Future operations on it will fail. [t] must be idle. *) 48 | 49 | val is_released : _ t -> bool 50 | (** [is_released t] is [true] once {!release} has succeeded. *) 51 | -------------------------------------------------------------------------------- /lib/uring/include/dune: -------------------------------------------------------------------------------- 1 | (copy_files %{project_root}/vendor/liburing/src/include/liburing.h) 2 | 3 | (copy_files %{project_root}/vendor/liburing/src/include/liburing/*.h) 4 | 5 | (executable 6 | (name discover) 7 | (modules discover) 8 | (libraries dune-configurator)) 9 | -------------------------------------------------------------------------------- /lib/uring/include/liburing/dune: -------------------------------------------------------------------------------- 1 | (copy_files ../../{io_uring,io_uring_version,barrier,compat}.h) 2 | -------------------------------------------------------------------------------- /lib/uring/region.ml: -------------------------------------------------------------------------------- 1 | (* Carve up a region of contiguous memory for use 2 | * by the uring IO stack *) 3 | 4 | (* TODO turn into a variable length slab allocator *) 5 | type t = { 6 | buf: Cstruct.buffer; 7 | block_size: int; 8 | freelist: int Queue.t; 9 | } 10 | 11 | type chunk = t * int 12 | 13 | exception No_space 14 | 15 | let init ~block_size buf slots = 16 | let freelist = Queue.create () in 17 | for i = 0 to slots - 1 do 18 | Queue.push (i*block_size) freelist 19 | done; 20 | { freelist; block_size; buf } 21 | 22 | let alloc t = 23 | match Queue.pop t.freelist with 24 | | r -> t, r 25 | | exception Queue.Empty -> raise No_space 26 | 27 | let free ({freelist; _}, v) = 28 | Queue.push v freelist 29 | 30 | let length ({block_size;_}, _) = block_size 31 | 32 | let length_option t = function 33 | | None -> t.block_size 34 | | Some len -> 35 | if len > t.block_size then 36 | invalid_arg (Printf.sprintf "to_cstruct: requested length %d > block size %d" len t.block_size) 37 | else 38 | len 39 | 40 | let to_cstruct ?len (t, chunk) = 41 | Cstruct.of_bigarray ~off:chunk ~len:(length_option t len) t.buf 42 | 43 | let to_bigstring ?len (t, chunk) = 44 | Bigarray.Array1.sub t.buf chunk (length_option t len) 45 | 46 | let to_string ?len (t, chunk) = 47 | Cstruct.to_string (to_cstruct ?len (t, chunk)) 48 | 49 | let avail {freelist;_} = Queue.length freelist 50 | 51 | let to_offset (_,t) = t 52 | -------------------------------------------------------------------------------- /tests/dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name urcp_lib) 3 | (modules urcp_lib) 4 | (libraries fmt unix uring logs)) 5 | 6 | (library 7 | (name urcp_fixed_lib) 8 | (modules urcp_fixed_lib) 9 | (libraries fmt unix uring logs)) 10 | 11 | (library 12 | (name lwtcp_lib) 13 | (modules lwtcp_lib) 14 | (libraries lwt.unix logs)) 15 | 16 | (executable 17 | (name urcat) 18 | (modules urcat) 19 | (libraries unix uring)) 20 | 21 | (executable 22 | (name urcp) 23 | (modules urcp) 24 | (libraries cmdliner logs.cli logs.fmt fmt.tty fmt.cli urcp_fixed_lib 25 | urcp_lib)) 26 | 27 | (executable 28 | (name lwtcp) 29 | (modules lwtcp) 30 | (libraries cmdliner logs.cli logs.fmt fmt.tty fmt.cli lwtcp_lib)) 31 | 32 | (executable 33 | (name urstat) 34 | (modules urstat) 35 | (libraries uring fmt)) 36 | 37 | (executable 38 | (name poll_add) 39 | (modules poll_add) 40 | (libraries unix uring logs logs.fmt)) 41 | 42 | (rule 43 | (alias runtest) 44 | (package uring) 45 | (action (run ./poll_add.exe))) 46 | 47 | (rule 48 | (alias runbenchmark) 49 | (package uring) 50 | (deps urcp.exe) 51 | (action 52 | (run ./urcp.exe))) 53 | 54 | (mdx 55 | (deps (package uring))) 56 | -------------------------------------------------------------------------------- /tests/lwtcp.ml: -------------------------------------------------------------------------------- 1 | let setup_log style_renderer level = 2 | Fmt_tty.setup_std_outputs ?style_renderer (); 3 | Logs.set_level level; 4 | Logs.set_reporter (Logs_fmt.reporter ()) 5 | 6 | open Cmdliner 7 | 8 | let cmd = 9 | let setup_log = 10 | Term.(const setup_log $ Fmt_cli.style_renderer () $ Logs_cli.level ()) in 11 | let infile = 12 | let doc = "Source filename to copy from" in 13 | Arg.(required & pos 0 (some file) None & info [] ~docv:"SOURCE_FILE" ~doc) in 14 | let outfile = 15 | let doc = "Target filename to copy to" in 16 | Arg.(required & pos 1 (some string) None & info [] ~docv:"TARGET_FILE" ~doc) in 17 | let block_size = 18 | let doc = "Block size per chunk in bytes" in 19 | Arg.(value & opt int (32 * 1024) & info ["block-size"] ~docv:"BYTES" ~doc) in 20 | let queue_depth = 21 | let doc = "Number of async requests in parallel" in 22 | Arg.(value & opt int 64 & info ["queue-depth"] ~docv:"ENTRIES" ~doc) in 23 | let doc = "copy a file using async io_uring" in 24 | let man = 25 | [ 26 | `S "DESCRIPTION"; 27 | `P "$(tname) copies a file using Linux io_uring."; 28 | ] 29 | in 30 | let info = 31 | Cmd.info "lwtcp" ~version:"1.0.0" ~doc ~man 32 | in 33 | Cmd.v info Term.(const Lwtcp_lib.run_cp $ block_size $ queue_depth $ infile $ outfile $ setup_log) 34 | 35 | let () = 36 | match Cmd.eval cmd with 37 | | 0 -> exit (if Logs.err_count () > 0 then 1 else 0) 38 | | _ -> exit 1 39 | -------------------------------------------------------------------------------- /tests/lwtcp_lib.ml: -------------------------------------------------------------------------------- 1 | (* cp(1) built with Lwt. *) 2 | open Lwt.Infix 3 | 4 | let full_io iofn fd buf ~file_offset off len = 5 | let rec fn off = 6 | let file_offset = file_offset + off in 7 | iofn fd buf ~file_offset off (len - off) >>= function 8 | | 0 -> if off < len then Lwt.fail End_of_file else Lwt.return_unit 9 | | n when n < len - off -> fn (off+n) 10 | | _n -> Lwt.return_unit 11 | in 12 | fn off 13 | 14 | let full_pread = full_io Lwt_unix.pread 15 | let full_pwrite = full_io Lwt_unix.pwrite 16 | 17 | let copy_file infd outfd insize block_size pool = 18 | let reqs = ref [] in 19 | let read_then_write_chunk ~file_offset len = 20 | Lwt_pool.use pool (fun buf -> 21 | full_pread infd buf ~file_offset 0 len >>= fun () -> 22 | Logs.debug (fun l -> l "read done %d %d" file_offset len); 23 | full_pwrite outfd buf ~file_offset 0 len >>= fun () -> 24 | Logs.debug (fun l -> l "write done %d %d" file_offset len); 25 | Lwt.return_unit 26 | ) 27 | in 28 | let rec fn file_offset = 29 | match insize - file_offset with 30 | | 0 -> () 31 | | remaining -> 32 | let len = min block_size remaining in 33 | let t = read_then_write_chunk ~file_offset len in 34 | reqs := t :: !reqs; 35 | fn (file_offset + len) 36 | in 37 | fn 0; 38 | Logs.debug (fun l -> l "Waiting on %d reqs" (List.length !reqs)); 39 | Lwt.join !reqs >>= fun () -> 40 | Logs.debug (fun l -> l "Done all reqs"); 41 | Lwt.return_unit 42 | 43 | let run_cp block_size queue_depth infile outfile () = 44 | Lwt_main.run ( 45 | let open Lwt_unix in 46 | openfile infile [O_RDONLY] 0 >>= fun infd -> 47 | openfile outfile [O_WRONLY; O_CREAT; O_TRUNC] 0o644 >>= fun outfd -> 48 | (fstat infd >|= fun {st_size; _} -> st_size) >>= fun insize -> 49 | let pool = Lwt_pool.create queue_depth (fun () -> Lwt.return @@ Bytes.make block_size '\000') in 50 | Logs.debug (fun l -> l "lwtcp: %s -> %s size %d queue %d bs %d" infile outfile insize queue_depth block_size); 51 | copy_file infd outfd insize block_size pool >>= fun () -> 52 | Logs.debug (fun l -> l "lwtcp: done"); 53 | Lwt_unix.close outfd >>= fun () -> 54 | Lwt_unix.close infd) 55 | -------------------------------------------------------------------------------- /tests/poll_add.ml: -------------------------------------------------------------------------------- 1 | let () = 2 | Logs.set_level (Some Logs.Debug); 3 | Logs.set_reporter (Logs_fmt.reporter ()) 4 | 5 | let () = 6 | let t = Uring.create ~queue_depth:1 () in 7 | let readable, writable = Unix.pipe () in 8 | let r = Uring.poll_add t readable Uring.Poll_mask.(pollin + pollerr) () in assert(r <> None); 9 | let res = Uring.submit t in 10 | Printf.eprintf "submitted %d\n%!" res; 11 | let sent = Unix.write writable (Bytes.of_string "!") 0 1 in 12 | assert (sent = 1); 13 | let rec retry () = 14 | match Uring.wait t with 15 | | None -> retry () 16 | | Some { result; _ } -> result 17 | in 18 | let res = retry () in 19 | Printf.eprintf "poll_add: %x\n%!" res; 20 | Uring.exit t 21 | -------------------------------------------------------------------------------- /tests/sketch.md: -------------------------------------------------------------------------------- 1 | ```ocaml 2 | # #require "uring";; 3 | ``` 4 | 5 | ## Sketch allocation 6 | 7 | ```ocaml 8 | module Int63 = Optint.Int63 9 | 10 | let ldup n x = List.init n (Fun.const x) 11 | 12 | let rec consume t = 13 | match Uring.wait t with 14 | | Some { data; result } -> (data, result) 15 | | None -> consume t 16 | ``` 17 | 18 | ```ocaml 19 | # let t : unit Uring.t = Uring.create ~queue_depth:4 ();; 20 | val t : unit Uring.t = 21 | # let fd = Unix.openfile "/dev/zero" [ O_RDONLY ] 0;; 22 | val fd : Unix.file_descr = 23 | # let b = Cstruct.create 1;; 24 | val b : Cstruct.t = {Cstruct.buffer = ; off = 0; len = 1} 25 | 26 | # Uring.readv t fd (ldup 1 b) () ~file_offset:Int63.zero;; 27 | - : unit Uring.job option = Some 28 | # Uring.submit t;; 29 | - : int = 1 30 | 31 | # consume t;; 32 | - : unit * int = ((), 1) 33 | 34 | # Uring.readv t fd (ldup 7 b) () ~file_offset:Int63.zero;; 35 | - : unit Uring.job option = Some 36 | # Uring.submit t;; 37 | - : int = 1 38 | # consume t;; 39 | - : unit * int = ((), 7) 40 | 41 | # Uring.readv t fd (ldup 1000 b) () ~file_offset:Int63.zero;; 42 | - : unit Uring.job option = Some 43 | # Uring.submit t;; 44 | - : int = 1 45 | # consume t;; 46 | - : unit * int = ((), 1000) 47 | 48 | # let fd : unit = Unix.close fd;; 49 | val fd : unit = () 50 | # Uring.exit t;; 51 | - : unit = () 52 | ``` 53 | -------------------------------------------------------------------------------- /tests/urcat.ml: -------------------------------------------------------------------------------- 1 | (* cat(1) built with liburing. 2 | OCaml version of https://unixism.net/loti/tutorial/cat_liburing.html *) 3 | 4 | let block_size = 1024 5 | 6 | let get_file_size fd = 7 | Unix.handle_unix_error Unix.fstat fd |> 8 | fun {Unix.st_size; _} -> st_size 9 | (* TODO make this work with ST_ISBLK *) 10 | 11 | let get_completion_and_print uring = 12 | let iov, len = 13 | match Uring.wait uring with 14 | | Some { data; result } -> (data, result) 15 | | None -> failwith "retry" 16 | in 17 | let remaining = ref len in 18 | Printf.eprintf "%d bytes read\n%!" len; 19 | List.iter (fun buf -> 20 | let buflen = Cstruct.length buf in 21 | if !remaining > 0 then begin 22 | if buflen <= !remaining then begin 23 | print_string (Cstruct.to_string buf); 24 | remaining := !remaining - buflen; 25 | end else begin 26 | print_string (Cstruct.to_string ~off:0 ~len:!remaining buf); 27 | remaining := 0; 28 | end 29 | end 30 | ) iov 31 | 32 | let submit_read_request fname uring = 33 | let fd = Unix.(handle_unix_error (openfile fname [O_RDONLY]) 0) in 34 | let file_sz = get_file_size fd in 35 | let blocks = if file_sz mod block_size <> 0 then (file_sz / block_size)+1 else file_sz/block_size in 36 | let iov = List.init blocks (fun _ -> Cstruct.create block_size) in 37 | let _ = Uring.readv uring fd iov iov ~file_offset:Optint.Int63.zero in 38 | let numreq = Uring.submit uring in 39 | assert(numreq=1); 40 | () 41 | 42 | let () = 43 | let fname = Sys.argv.(1) in 44 | let uring = Uring.create ~queue_depth:1 () in 45 | submit_read_request fname uring; 46 | get_completion_and_print uring 47 | -------------------------------------------------------------------------------- /tests/urcp.ml: -------------------------------------------------------------------------------- 1 | let setup_log style_renderer level = 2 | Fmt_tty.setup_std_outputs ?style_renderer (); 3 | Logs.set_level level; 4 | Logs.set_reporter (Logs_fmt.reporter ()) 5 | 6 | open Cmdliner 7 | 8 | 9 | let run fixed block_size queue_depth infile outfile () = 10 | let fn = if fixed then Urcp_fixed_lib.run_cp else Urcp_lib.run_cp in 11 | fn block_size queue_depth infile outfile () 12 | 13 | let cmd = 14 | let setup_log = 15 | Term.(const setup_log $ Fmt_cli.style_renderer () $ Logs_cli.level ()) in 16 | let infile = 17 | let doc = "Source filename to copy from" in 18 | Arg.(required & pos 0 (some file) None & info [] ~docv:"SOURCE_FILE" ~doc) in 19 | let outfile = 20 | let doc = "Target filename to copy to" in 21 | Arg.(required & pos 1 (some string) None & info [] ~docv:"TARGET_FILE" ~doc) in 22 | let block_size = 23 | let doc = "Block size per chunk in bytes" in 24 | Arg.(value & opt int (32 * 1024) & info ["block-size"] ~docv:"BYTES" ~doc) in 25 | let queue_depth = 26 | let doc = "Number of async requests in parallel" in 27 | Arg.(value & opt int 64 & info ["queue-depth"] ~docv:"ENTRIES" ~doc) in 28 | let fixed = 29 | let doc = "Use fixed buffers mode instead of dynamic allocation" in 30 | Arg.(value & flag & info ["fixed"] ~docv:"FIXED" ~doc) in 31 | let doc = "copy a file using async io_uring" in 32 | let man = 33 | [ 34 | `S "DESCRIPTION"; 35 | `P "$(tname) copies a file using Linux io_uring."; 36 | ] 37 | in 38 | let info = Cmd.info "urcp" ~version:"1.0.0" ~doc ~man in 39 | Cmd.v info Term.(const run $ fixed $ block_size $ queue_depth $ infile $ outfile $ setup_log) 40 | 41 | let () = 42 | match Cmd.eval cmd with 43 | | 0 -> exit (if Logs.err_count () > 0 then 1 else 0) 44 | | _ -> exit 1 45 | -------------------------------------------------------------------------------- /uring.opam: -------------------------------------------------------------------------------- 1 | # This file is generated by dune, edit dune-project instead 2 | opam-version: "2.0" 3 | synopsis: "OCaml bindings for Linux io_uring" 4 | description: 5 | "Bindings to the Linux io_uring kernel IO interfaces. See https://github.com/ocaml-multicore/eio for a higher-level API using this." 6 | maintainer: ["anil@recoil.org"] 7 | authors: ["Anil Madhavapeddy" "Sadiq Jaffer" "Thomas Leonard"] 8 | homepage: "https://github.com/ocaml-multicore/ocaml-uring" 9 | doc: "https://ocaml-multicore.github.io/ocaml-uring/" 10 | bug-reports: "https://github.com/ocaml-multicore/ocaml-uring/issues" 11 | depends: [ 12 | "dune" {>= "3.0"} 13 | "cstruct" {>= "6.0.1"} 14 | "ocaml" {>= "4.12.0"} 15 | "dune-configurator" 16 | "lwt" {with-test & >= "5.0.0"} 17 | "bechamel" {>= "0.1.0" & with-test} 18 | "logs" {with-test & >= "0.5.0"} 19 | "cmdliner" {with-test & >= "1.1.0"} 20 | "fmt" {>= "0.8.10"} 21 | "optint" {>= "0.1.0"} 22 | "mdx" {>= "2.1.0" & with-test} 23 | "odoc" {with-doc} 24 | ] 25 | build: [ 26 | ["dune" "subst"] {dev} 27 | [ 28 | "dune" 29 | "build" 30 | "-p" 31 | name 32 | "-j" 33 | jobs 34 | "@install" 35 | "@runtest" {with-test} 36 | "@doc" {with-doc} 37 | ] 38 | ] 39 | dev-repo: "git+https://github.com/ocaml-multicore/ocaml-uring.git" 40 | depexts: [ 41 | ["linux-headers"] {os-distribution = "alpine"} 42 | ] 43 | available: [os = "linux"] 44 | license: ["ISC" "MIT"] 45 | x-ci-accept-failures: [ 46 | "centos-7" # default C compiler does not support stdatomic.h 47 | "oraclelinux-7" # default C compiler does not support stdatomic.h 48 | ] 49 | -------------------------------------------------------------------------------- /uring.opam.template: -------------------------------------------------------------------------------- 1 | depexts: [ 2 | ["linux-headers"] {os-distribution = "alpine"} 3 | ] 4 | available: [os = "linux"] 5 | license: ["ISC" "MIT"] 6 | x-ci-accept-failures: [ 7 | "centos-7" # default C compiler does not support stdatomic.h 8 | "oraclelinux-7" # default C compiler does not support stdatomic.h 9 | ] 10 | -------------------------------------------------------------------------------- /vendor/liburing/.github/workflows/shellcheck.yml: -------------------------------------------------------------------------------- 1 | name: Shellcheck 2 | 3 | on: 4 | # Trigger the workflow on push or pull requests. 5 | push: 6 | pull_request: 7 | 8 | jobs: 9 | test: 10 | runs-on: ubuntu-22.04 11 | 12 | steps: 13 | - name: Checkout source 14 | uses: actions/checkout@v2 15 | 16 | - name: Display shellcheck version 17 | run: shellcheck --version 18 | 19 | - name: Shellcheck execution 20 | run: shellcheck test/runtest*.sh 21 | -------------------------------------------------------------------------------- /vendor/liburing/.gitignore: -------------------------------------------------------------------------------- 1 | *.rej 2 | *.orig 3 | *~ 4 | /*.patch 5 | 6 | *.d 7 | *.o 8 | *.o[ls] 9 | 10 | /src/liburing.a 11 | /src/liburing.so* 12 | /src/liburing-ffi.a 13 | /src/liburing-ffi.so* 14 | /src/include/liburing/compat.h 15 | /src/include/liburing/io_uring_version.h 16 | 17 | /examples/io_uring-close-test 18 | /examples/io_uring-cp 19 | /examples/io_uring-test 20 | /examples/io_uring-udp 21 | /examples/link-cp 22 | /examples/ucontext-cp 23 | /examples/poll-bench 24 | /examples/send-zerocopy 25 | /examples/rsrc-update-bench 26 | 27 | /test/*.t 28 | /test/*.dmesg 29 | /test/output/ 30 | 31 | config-host.h 32 | config-host.mak 33 | config.log 34 | 35 | liburing.pc 36 | liburing-ffi.pc 37 | 38 | cscope.out 39 | -------------------------------------------------------------------------------- /vendor/liburing/CITATION.cff: -------------------------------------------------------------------------------- 1 | cff-version: 1.2.0 2 | preferred-citation: 3 | type: software 4 | authors: 5 | - family-names: "Axboe" 6 | given-names: "Jens" 7 | email: axboe@kernel.dk 8 | title: "liburing library for io_uring" 9 | year: 2022 10 | url: "https://github.com/axboe/liburing" 11 | licence: MIT 12 | -------------------------------------------------------------------------------- /vendor/liburing/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2020 Jens Axboe 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a 4 | copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included 12 | in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 18 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 19 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 20 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /vendor/liburing/Makefile.common: -------------------------------------------------------------------------------- 1 | TOP := $(dir $(CURDIR)/$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))) 2 | NAME=liburing 3 | SPECFILE=$(TOP)/$(NAME).spec 4 | VERSION=$(shell awk '/Version:/ { print $$2 }' $(SPECFILE)) 5 | VERSION_MAJOR=$(shell echo $(VERSION) | cut -d. -f1) 6 | VERSION_MINOR=$(shell echo $(VERSION) | cut -d. -f2) 7 | TAG = $(NAME)-$(VERSION) 8 | -------------------------------------------------------------------------------- /vendor/liburing/Makefile.quiet: -------------------------------------------------------------------------------- 1 | ifneq ($(findstring $(MAKEFLAGS),s),s) 2 | ifndef V 3 | QUIET_CC = @echo ' ' CC $@; 4 | QUIET_CXX = @echo ' ' CXX $@; 5 | QUIET_LINK = @echo ' ' LINK $@; 6 | QUIET_AR = @echo ' ' AR $@; 7 | QUIET_RANLIB = @echo '' RANLIB $@; 8 | endif 9 | endif 10 | 11 | 12 | -------------------------------------------------------------------------------- /vendor/liburing/SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Reporting a Vulnerability 4 | 5 | Please report any security issue to axboe@kernel.dk where the issue will be triaged appropriately. 6 | Thank you in advance for helping to keep liburing secure. 7 | -------------------------------------------------------------------------------- /vendor/liburing/debian/README.Debian: -------------------------------------------------------------------------------- 1 | liburing for Debian 2 | 3 | The newest Linux IO interface i.e. io_uring, need 4 | userspace library to support it. This package 5 | liburing is the library for io_uring. 6 | 7 | -- Liu Changcheng Thu, 14 Nov 2019 21:35:39 +0800 8 | -------------------------------------------------------------------------------- /vendor/liburing/debian/changelog: -------------------------------------------------------------------------------- 1 | liburing (2.2-1) stable; urgency=low 2 | 3 | * Update to 2.2 4 | * Bump up so version to 2 5 | * Drop liburing1-udeb 6 | * Package using dh instead of using dh_* helpers manually 7 | * Add linux header dependency to liburing-dev 8 | * Bump up debhelper-compact level to 13 9 | 10 | -- Kefu Chai Sun, 16 Oct 2022 16:30:48 +0800 11 | 12 | liburing (0.7-1) stable; urgency=low 13 | 14 | * Update to 0.7 15 | * Fix library symlinks 16 | 17 | -- Stefan Metzmacher Thu, 23 Jul 2020 00:23:00 +0200 18 | 19 | liburing (0.4-2) stable; urgency=low 20 | 21 | * Fix /usr/lib/*/liburing.so symlink to /lib/*/liburing.so.1.0.4 22 | 23 | -- Stefan Metzmacher Fri, 07 Feb 2020 15:30:00 +0100 24 | 25 | liburing (0.4-1) stable; urgency=low 26 | 27 | * Package liburing-0.4 using a packaging layout similar to libaio1 28 | 29 | -- Stefan Metzmacher Thu, 06 Feb 2020 11:30:00 +0100 30 | 31 | liburing (0.2-1ubuntu1) stable; urgency=low 32 | 33 | * Initial release. 34 | * commit 4bce856d43ab1f9a64477aa5a8f9f02f53e64b74 35 | * Author: Jens Axboe 36 | * Date: Mon Nov 11 16:00:58 2019 -0700 37 | 38 | -- Liu Changcheng Fri, 15 Nov 2019 00:06:46 +0800 39 | -------------------------------------------------------------------------------- /vendor/liburing/debian/control: -------------------------------------------------------------------------------- 1 | Source: liburing 2 | Section: libs 3 | Priority: optional 4 | Maintainer: Liu Changcheng 5 | Build-Depends: 6 | debhelper-compat (= 13) 7 | Standards-Version: 4.1.4 8 | Homepage: https://git.kernel.dk/cgit/liburing/tree/README 9 | Vcs-Git: https://git.kernel.dk/liburing 10 | Vcs-Browser: https://git.kernel.dk/cgit/liburing/ 11 | 12 | Package: liburing2 13 | Architecture: linux-any 14 | Multi-Arch: same 15 | Pre-Depends: ${misc:Pre-Depends} 16 | Depends: ${misc:Depends}, ${shlibs:Depends} 17 | Description: userspace library for using io_uring 18 | io_uring is kernel feature to improve development 19 | The newese Linux IO interface, io_uring could improve 20 | system performance a lot. liburing is the userpace 21 | library to use io_uring feature. 22 | . 23 | This package contains the shared library. 24 | 25 | Package: liburing-dev 26 | Section: libdevel 27 | Architecture: linux-any 28 | Multi-Arch: same 29 | Depends: 30 | ${misc:Depends}, 31 | liburing2 (= ${binary:Version}), 32 | linux-libc-dev (>= 5.1) 33 | Description: userspace library for using io_uring 34 | io_uring is kernel feature to improve development 35 | The newese Linux IO interface, io_uring could improve 36 | system performance a lot. liburing is the userpace 37 | library to use io_uring feature. 38 | . 39 | This package contains the static library and the header files. 40 | -------------------------------------------------------------------------------- /vendor/liburing/debian/liburing-dev.install: -------------------------------------------------------------------------------- 1 | usr/include 2 | usr/lib/*/lib*.so 3 | usr/lib/*/lib*.a 4 | usr/lib/*/pkgconfig 5 | -------------------------------------------------------------------------------- /vendor/liburing/debian/liburing-dev.manpages: -------------------------------------------------------------------------------- 1 | usr/share/man/man2/io_uring_*.2 2 | usr/share/man/man3/io_uring_*.3 3 | usr/share/man/man7/io_uring.7 4 | -------------------------------------------------------------------------------- /vendor/liburing/debian/liburing2.install: -------------------------------------------------------------------------------- 1 | usr/lib/*/lib*.so.* 2 | -------------------------------------------------------------------------------- /vendor/liburing/debian/patches/series: -------------------------------------------------------------------------------- 1 | # You must remove unused comment lines for the released package. 2 | -------------------------------------------------------------------------------- /vendor/liburing/debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | 3 | # Uncomment this to turn on verbose mode. 4 | #export DH_VERBOSE=1 5 | 6 | DEB_BUILD_MAINT_OPTIONS = hardening=+bindnow 7 | DEB_CFLAGS_MAINT_PREPEND = -Wall 8 | 9 | include /usr/share/dpkg/default.mk 10 | include /usr/share/dpkg/buildtools.mk 11 | 12 | %: 13 | dh $@ 14 | 15 | override_dh_auto_configure: 16 | ./configure \ 17 | --prefix=/usr \ 18 | --includedir=/usr/include \ 19 | --datadir=/usr/share \ 20 | --mandir=/usr/share/man \ 21 | --libdir=/usr/lib/$(DEB_HOST_MULTIARCH) \ 22 | --libdevdir=/usr/lib/$(DEB_HOST_MULTIARCH) \ 23 | --cc=$(CC) 24 | 25 | override_dh_auto_test: 26 | ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) 27 | $(MAKE) runtests 28 | endif 29 | -------------------------------------------------------------------------------- /vendor/liburing/debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (quilt) 2 | -------------------------------------------------------------------------------- /vendor/liburing/debian/source/local-options: -------------------------------------------------------------------------------- 1 | #abort-on-upstream-changes 2 | #unapply-patches 3 | -------------------------------------------------------------------------------- /vendor/liburing/debian/source/options: -------------------------------------------------------------------------------- 1 | extend-diff-ignore = "(^|/)(config\.log|config-host\.h|config-host\.mak|liburing\.pc)$" 2 | -------------------------------------------------------------------------------- /vendor/liburing/debian/watch: -------------------------------------------------------------------------------- 1 | # Site Directory Pattern Version Script 2 | version=4 3 | https://git.kernel.dk/cgit/liburing/ snapshot\/liburing-([\d\.]+)\.tar\.(?:gz|xz) debian uupdate 4 | -------------------------------------------------------------------------------- /vendor/liburing/examples/Makefile: -------------------------------------------------------------------------------- 1 | CPPFLAGS ?= 2 | override CPPFLAGS += -D_GNU_SOURCE -I../src/include/ 3 | CFLAGS ?= -g -O2 -Wall 4 | LDFLAGS ?= 5 | override LDFLAGS += -L../src/ -luring 6 | 7 | include ../Makefile.quiet 8 | 9 | ifneq ($(MAKECMDGOALS),clean) 10 | include ../config-host.mak 11 | endif 12 | 13 | LDFLAGS ?= 14 | override LDFLAGS += -L../src/ -luring -lpthread 15 | 16 | example_srcs := \ 17 | io_uring-close-test.c \ 18 | io_uring-cp.c \ 19 | io_uring-test.c \ 20 | io_uring-udp.c \ 21 | link-cp.c \ 22 | poll-bench.c \ 23 | send-zerocopy.c \ 24 | rsrc-update-bench.c 25 | 26 | all_targets := 27 | 28 | 29 | ifdef CONFIG_HAVE_UCONTEXT 30 | example_srcs += ucontext-cp.c 31 | endif 32 | all_targets += ucontext-cp 33 | 34 | example_targets := $(patsubst %.c,%,$(patsubst %.cc,%,$(example_srcs))) 35 | all_targets += $(example_targets) 36 | 37 | 38 | all: $(example_targets) 39 | 40 | %: %.c ../src/liburing.a 41 | $(QUIET_CC)$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $< $(LDFLAGS) 42 | 43 | clean: 44 | @rm -f $(all_targets) 45 | 46 | .PHONY: all clean 47 | -------------------------------------------------------------------------------- /vendor/liburing/liburing-ffi.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=${prefix} 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: @NAME@ 7 | Version: @VERSION@ 8 | Description: io_uring FFI library 9 | URL: https://git.kernel.dk/cgit/liburing/ 10 | 11 | Libs: -L${libdir} -luring-ffi 12 | Cflags: -I${includedir} 13 | -------------------------------------------------------------------------------- /vendor/liburing/liburing.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=${prefix} 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: @NAME@ 7 | Version: @VERSION@ 8 | Description: io_uring library 9 | URL: https://git.kernel.dk/cgit/liburing/ 10 | 11 | Libs: -L${libdir} -luring 12 | Cflags: -I${includedir} 13 | -------------------------------------------------------------------------------- /vendor/liburing/liburing.spec: -------------------------------------------------------------------------------- 1 | Name: liburing 2 | Version: 2.4 3 | Release: 1%{?dist} 4 | Summary: Linux-native io_uring I/O access library 5 | License: (GPLv2 with exceptions and LGPLv2+) or MIT 6 | Source0: https://brick.kernel.dk/snaps/%{name}-%{version}.tar.gz 7 | Source1: https://brick.kernel.dk/snaps/%{name}-%{version}.tar.gz.asc 8 | URL: https://git.kernel.dk/cgit/liburing/ 9 | BuildRequires: gcc 10 | BuildRequires: make 11 | 12 | %description 13 | Provides native async IO for the Linux kernel, in a fast and efficient 14 | manner, for both buffered and O_DIRECT. 15 | 16 | %package devel 17 | Summary: Development files for Linux-native io_uring I/O access library 18 | Requires: %{name}%{_isa} = %{version}-%{release} 19 | Requires: pkgconfig 20 | 21 | %description devel 22 | This package provides header files to include and libraries to link with 23 | for the Linux-native io_uring. 24 | 25 | %prep 26 | %autosetup 27 | 28 | %build 29 | %set_build_flags 30 | ./configure --prefix=%{_prefix} --libdir=/%{_libdir} --libdevdir=/%{_libdir} --mandir=%{_mandir} --includedir=%{_includedir} 31 | 32 | %make_build 33 | 34 | %install 35 | %make_install 36 | 37 | %files 38 | %attr(0755,root,root) %{_libdir}/liburing.so.* 39 | %license COPYING 40 | 41 | %files devel 42 | %{_includedir}/liburing/ 43 | %{_includedir}/liburing.h 44 | %{_libdir}/liburing.so 45 | %exclude %{_libdir}/liburing.a 46 | %{_libdir}/pkgconfig/* 47 | %{_mandir}/man2/* 48 | %{_mandir}/man3/* 49 | %{_mandir}/man7/* 50 | 51 | %changelog 52 | * Thu Oct 31 2019 Jeff Moyer - 0.2-1 53 | - Add io_uring_cq_ready() 54 | - Add io_uring_peek_batch_cqe() 55 | - Add io_uring_prep_accept() 56 | - Add io_uring_prep_{recv,send}msg() 57 | - Add io_uring_prep_timeout_remove() 58 | - Add io_uring_queue_init_params() 59 | - Add io_uring_register_files_update() 60 | - Add io_uring_sq_space_left() 61 | - Add io_uring_wait_cqe_timeout() 62 | - Add io_uring_wait_cqes() 63 | - Add io_uring_wait_cqes_timeout() 64 | 65 | * Tue Jan 8 2019 Jens Axboe - 0.1 66 | - Initial version 67 | -------------------------------------------------------------------------------- /vendor/liburing/make-debs.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright (C) 2019 Liu Changcheng 3 | # Author: Liu Changcheng 4 | # 5 | # This program is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU General Public License 7 | # as published by the Free Software Foundation; either version 2 8 | # of the License, or (at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see . 17 | # 18 | set -xe 19 | 20 | # Create dir for build 21 | base=${1:-/tmp/release} 22 | distro=unstable 23 | releasedir=$base/$(lsb_release -si)/liburing 24 | rm -rf $releasedir 25 | mkdir -p $releasedir 26 | 27 | src_dir=$(readlink -e `basename $0`) 28 | liburing_dir=$(dirname $src_dir) 29 | basename=$(basename $liburing_dir) 30 | dirname=$(dirname $liburing_dir) 31 | version=$(git describe --match "lib*" | cut -d '-' -f 2) 32 | outfile="liburing-$version" 33 | orgfile=$(echo $outfile | tr '-' '_') 34 | 35 | # Prepare source code 36 | cp -arf ${dirname}/${basename} ${releasedir}/${outfile} 37 | cd ${releasedir}/${outfile} 38 | git clean -dxf 39 | 40 | # Change changelog if it's needed 41 | cur_ver=`head -l debian/changelog | sed -n -e 's/.* (\(.*\)) .*/\1/p'` 42 | if [ "$cur_ver" != "$version-1" ]; then 43 | dch -D $distro --force-distribution -b -v "$version-1" "new version" 44 | fi 45 | 46 | # Create tar archieve 47 | cd ../ 48 | tar cvzf ${outfile}.tar.gz ${outfile} 49 | ln -s ${outfile}.tar.gz ${orgfile}.orig.tar.gz 50 | 51 | # Build debian package 52 | cd - 53 | debuild 54 | -------------------------------------------------------------------------------- /vendor/liburing/man/IO_URING_CHECK_VERSION.3: -------------------------------------------------------------------------------- 1 | io_uring_check_version.3 -------------------------------------------------------------------------------- /vendor/liburing/man/IO_URING_VERSION_MAJOR.3: -------------------------------------------------------------------------------- 1 | io_uring_check_version.3 -------------------------------------------------------------------------------- /vendor/liburing/man/IO_URING_VERSION_MINOR.3: -------------------------------------------------------------------------------- 1 | io_uring_check_version.3 -------------------------------------------------------------------------------- /vendor/liburing/man/__io_uring_buf_ring_cq_advance.3: -------------------------------------------------------------------------------- 1 | io_uring_buf_ring_cq_advance.3 -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_buf_ring_add.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2022 Jens Axboe 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_buf_ring_add 3 "May 18, 2022" "liburing-2.2" "liburing Manual" 6 | .SH NAME 7 | io_uring_buf_ring_add \- add buffers to a shared buffer ring 8 | .SH SYNOPSIS 9 | .nf 10 | .B #include 11 | .PP 12 | .BI "void io_uring_buf_ring_add(struct io_uring_buf_ring *" br ", 13 | .BI " void *" addr ", 14 | .BI " unsigned int " len ", 15 | .BI " unsigned short " bid ", 16 | .BI " int " mask ", 17 | .BI " int " buf_offset ");" 18 | .fi 19 | .SH DESCRIPTION 20 | .PP 21 | The 22 | .BR io_uring_buf_ring_add (3) 23 | adds a new buffer to the shared buffer ring 24 | .IR br . 25 | The buffer address is indicated by 26 | .I addr 27 | and is of 28 | .I len 29 | bytes of length. 30 | .I bid 31 | is the buffer ID, which will be returned in the CQE. 32 | .I mask 33 | is the size mask of the ring, available from 34 | .BR io_uring_buf_ring_mask (3) . 35 | .I buf_offset 36 | is the offset to insert at from the current tail. If just one buffer is provided 37 | before the ring tail is committed with 38 | .BR io_uring_buf_ring_advance (3) 39 | or 40 | .BR io_uring_buf_ring_cq_advance (3), 41 | then 42 | .I buf_offset 43 | should be 0. If buffers are provided in a loop before being committed, the 44 | .I buf_offset 45 | must be incremented by one for each buffer added. 46 | 47 | .SH RETURN VALUE 48 | None 49 | .SH SEE ALSO 50 | .BR io_uring_register_buf_ring (3), 51 | .BR io_uring_buf_ring_mask (3), 52 | .BR io_uring_buf_ring_advance (3), 53 | .BR io_uring_buf_ring_cq_advance (3) 54 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_buf_ring_advance.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2022 Jens Axboe 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_buf_ring_advance 3 "May 18, 2022" "liburing-2.2" "liburing Manual" 6 | .SH NAME 7 | io_uring_buf_ring_advance \- advance index of provided buffer in buffer ring 8 | .SH SYNOPSIS 9 | .nf 10 | .B #include 11 | .PP 12 | .BI "void io_uring_buf_ring_advance(struct io_uring_buf_ring *" br ", 13 | .BI " int " count ");" 14 | .fi 15 | .SH DESCRIPTION 16 | .PP 17 | The 18 | .BR io_uring_buf_ring_advance (3) 19 | commits 20 | .I count 21 | previously added buffers to the shared buffer ring 22 | .IR br , 23 | making them visible to the kernel and hence consumable. This passes ownership 24 | of the buffer to the ring. 25 | 26 | .SH RETURN VALUE 27 | None 28 | .SH SEE ALSO 29 | .BR io_uring_register_buf_ring (3), 30 | .BR io_uring_buf_ring_add (3), 31 | .BR io_uring_buf_ring_cq_advance (3) 32 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_buf_ring_cq_advance.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2022 Jens Axboe 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_buf_ring_cq_advance 3 "May 18, 2022" "liburing-2.2" "liburing Manual" 6 | .SH NAME 7 | io_uring_buf_ring_cq_advance \- advance index of provided buffer and CQ ring 8 | .SH SYNOPSIS 9 | .nf 10 | .B #include 11 | .PP 12 | .BI "void io_uring_buf_ring_cq_advance(struct io_uring *" ring ", 13 | .BI " struct io_uring_buf_ring *" br ", 14 | .BI " int " count ");" 15 | .PP 16 | .BI "void __io_uring_buf_ring_cq_advance(struct io_uring *" ring ", 17 | .BI " struct io_uring_buf_ring *" br ", 18 | .BI " int " cq_count ", 19 | .BI " int " buf_count ");" 20 | .fi 21 | .SH DESCRIPTION 22 | .PP 23 | The 24 | .BR io_uring_buf_ring_cq_advance (3) 25 | commits 26 | .I count 27 | previously added buffers to the shared buffer ring 28 | .IR br , 29 | making them visible to the kernel and hence consumable. This passes ownership 30 | of the buffer to the ring. At the same time, it advances the CQ ring of 31 | .I ring 32 | by 33 | .I count 34 | amount. This effectively bundles both a 35 | .BR io_uring_buf_ring_advance (3) 36 | call and a 37 | .BR io_uring_cq_advance (3) 38 | into one operation. Since updating either ring index entails a store memory 39 | barrier, doing both at once is more efficient. 40 | 41 | The 42 | .BR __io_uring_buf_ring_cq_advance (3) 43 | function performs the same operation, except it splits the counts into two 44 | separate values. It advances the CQ ring by 45 | .I cq_count 46 | entries, and the buffer ring by 47 | .I buf_count 48 | entries rather than increment both by the same value. 49 | 50 | .SH RETURN VALUE 51 | None 52 | .SH SEE ALSO 53 | .BR io_uring_register_buf_ring (3), 54 | .BR io_uring_buf_ring_add (3), 55 | .BR io_uring_buf_ring_advance (3) 56 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_buf_ring_init.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2022 Dylan Yudaken 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_buf_ring_init 3 "June 13, 2022" "liburing-2.2" "liburing Manual" 6 | .SH NAME 7 | io_uring_buf_ring_init \- Initialise a buffer ring 8 | .SH SYNOPSIS 9 | .nf 10 | .B #include 11 | .PP 12 | .BI "void io_uring_buf_ring_init(struct io_uring_buf_ring *" br ");" 13 | .fi 14 | .SH DESCRIPTION 15 | .PP 16 | .BR io_uring_buf_ring_init (3) 17 | initialises 18 | .IR br 19 | so that it is ready to be used. It may be called after 20 | .BR io_uring_register_buf_ring (3) 21 | but must be called before the buffer ring is used in any other way. 22 | 23 | .SH RETURN VALUE 24 | None 25 | 26 | .SH SEE ALSO 27 | .BR io_uring_register_buf_ring (3), 28 | .BR io_uring_buf_ring_add (3) 29 | .BR io_uring_buf_ring_advance (3), 30 | .BR io_uring_buf_ring_cq_advance (3) 31 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_buf_ring_mask.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2022 Dylan Yudaken 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_buf_ring_mask 3 "June 13, 2022" "liburing-2.2" "liburing Manual" 6 | .SH NAME 7 | io_uring_buf_ring_mask \- Calculate buffer ring mask size 8 | .SH SYNOPSIS 9 | .nf 10 | .B #include 11 | .PP 12 | .BI "int io_uring_buf_ring_mask(__u32 " ring_entries ");" 13 | .fi 14 | .SH DESCRIPTION 15 | .PP 16 | .BR io_uring_buf_ring_mask (3) 17 | calculates the appropriate size mask for a buffer ring. 18 | .IR ring_entries 19 | is the ring entries as specified in 20 | .BR io_uring_register_buf_ring (3) . 21 | 22 | .SH RETURN VALUE 23 | Size mask for the buffer ring. 24 | 25 | .SH SEE ALSO 26 | .BR io_uring_register_buf_ring (3), 27 | .BR io_uring_buf_ring_add (3) 28 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_check_version.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2022 Christian Hergert 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_check_version 3 "December 1, 2022" "liburing-2.4" "liburing Manual" 6 | .SH NAME 7 | io_uring_check_version \- functions and macros to check the liburing version 8 | .SH SYNOPSIS 9 | .nf 10 | .B #include 11 | .PP 12 | .BI "bool io_uring_check_version(int " major ", int " minor ");" 13 | .BI "IO_URING_CHECK_VERSION(" major ", " minor ");" 14 | .PP 15 | .BI "int io_uring_major_version(void);" 16 | .BI "IO_URING_VERSION_MAJOR;" 17 | .PP 18 | .BI "int io_uring_minor_version(void);" 19 | .BI "IO_URING_VERSION_MINOR;" 20 | .fi 21 | .SH DESCRIPTION 22 | .PP 23 | The 24 | .BR io_uring_check_version (3) 25 | function returns 26 | .I true 27 | if the liburing library loaded by the dynamic linker is greater-than 28 | or equal-to the 29 | .I major 30 | and 31 | .I minor 32 | numbers provided. 33 | 34 | .PP 35 | The 36 | .BR IO_URING_CHECK_VERSION (3) 37 | macro returns 38 | .I 1 39 | if the liburing library being compiled against is greater-than or equal-to the 40 | .I major 41 | and 42 | .I minor 43 | numbers provided. 44 | 45 | .PP 46 | The 47 | .BR io_uring_major_version (3) 48 | function returns the 49 | .I major 50 | version number of the liburing library loaded by the dynamic linker. 51 | 52 | .PP 53 | The 54 | .BR IO_URING_VERSION_MAJOR (3) 55 | macro returns the 56 | .I major 57 | version number of the liburing library being compiled against. 58 | 59 | .PP 60 | The 61 | .BR io_uring_minor_version (3) 62 | function returns the 63 | .I minor 64 | version number of the liburing library loaded by the dynamic linker. 65 | 66 | .PP 67 | The 68 | .BR IO_URING_VERSION_MINOR (3) 69 | macro returns the 70 | .I minor 71 | version number of the liburing library being compiled against. 72 | 73 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_close_ring_fd.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2022 Jens Axboe 2 | .\" Copyright (C) 2022 Josh Triplett 3 | .\" 4 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 5 | .\" 6 | .TH io_uring_close_ring_fd 3 "September 25, 2022" "liburing-2.4" "liburing Manual" 7 | .SH NAME 8 | io_uring_close_ring_fd \- close a ring file descriptor and use it only via registered index 9 | .SH SYNOPSIS 10 | .nf 11 | .B #include 12 | .PP 13 | .BI "int io_uring_close_ring_fd(struct io_uring *" ring ");" 14 | .fi 15 | .SH DESCRIPTION 16 | .PP 17 | .BR io_uring_close_ring_fd (3) 18 | closes the ring file descriptor, which must have been previously registered. 19 | The file will remain open, but accessible only via the registered index, not 20 | via any file descriptor. Subsequent liburing calls will continue to work, using 21 | the registered ring fd. 22 | 23 | The kernel must support 24 | .BR IORING_FEAT_REG_REG_RING . 25 | 26 | Libraries that must avoid disrupting their users' uses of file descriptors, and 27 | must continue working even in the face of 28 | .BR close_range (2) 29 | and similar, can use 30 | .BR io_uring_close_ring_fd (3) 31 | to work with liburing without having any open file descriptor. 32 | 33 | .SH NOTES 34 | Each thread that wants to make use of io_uring must register the fd. A library 35 | that may get called from arbitrary theads may need to detect when it gets 36 | called on a previously unseen thread and create and register a ring for that 37 | thread. 38 | .SH RETURN VALUE 39 | Returns 1 on success, or 40 | .BR -errno 41 | on error. 42 | .SH SEE ALSO 43 | .BR io_uring_register_ring_fd (3) 44 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_cq_advance.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2022 Stefan Roesch 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_cq_advance 3 "January 25, 2022" "liburing-2.1" "liburing Manual" 6 | .SH NAME 7 | io_uring_cq_advance \- mark one or more io_uring completion events as consumed 8 | .SH SYNOPSIS 9 | .nf 10 | .B #include 11 | .PP 12 | .BI "void io_uring_cq_advance(struct io_uring *" ring "," 13 | .BI " unsigned " nr ");" 14 | .fi 15 | .SH DESCRIPTION 16 | .PP 17 | The 18 | .BR io_uring_cq_advance (3) 19 | function marks 20 | .I nr 21 | IO completions belonging to the 22 | .I ring 23 | param as consumed. 24 | 25 | After the caller has submitted a request with 26 | .BR io_uring_submit (3), 27 | the application can retrieve the completion with 28 | .BR io_uring_wait_cqe (3), 29 | .BR io_uring_peek_cqe (3), 30 | or any of the other CQE retrieval helpers, and mark it as consumed with 31 | .BR io_uring_cqe_seen (3). 32 | 33 | The function 34 | .BR io_uring_cqe_seen (3) 35 | calls the function 36 | .BR io_uring_cq_advance (3). 37 | 38 | Completions must be marked as seen, so their slot can get reused. Failure to do 39 | so will result in the same completion being returned on the next invocation. 40 | 41 | .SH RETURN VALUE 42 | None 43 | .SH SEE ALSO 44 | .BR io_uring_submit (3), 45 | .BR io_uring_wait_cqe (3), 46 | .BR io_uring_peek_cqe (3), 47 | .BR io_uring_wait_cqes (3), 48 | .BR io_uring_wait_cqe_timeout (3), 49 | .BR io_uring_cqe_seen (3) 50 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_cq_has_overflow.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2022 Dylan Yudaken 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_cq_has_overflow 3 "September 5, 2022" "liburing-2.3" "liburing Manual" 6 | .SH NAME 7 | io_uring_cq_has_overflow \- returns if there are overflow entries waiting to move to the CQ ring 8 | .SH SYNOPSIS 9 | .nf 10 | .B #include 11 | .PP 12 | .BI "bool io_uring_cq_has_overflow(const struct io_uring *" ring ");" 13 | .fi 14 | .SH DESCRIPTION 15 | .PP 16 | The 17 | .BR io_uring_cq_has_overflow (3) 18 | function informs the application if CQ entries have overflowed and are waiting to be flushed to 19 | the CQ ring. For example using 20 | .BR io_uring_get_events (3) 21 | . 22 | .SH RETURN VALUE 23 | True if there are CQ entries waiting to be flushed to the CQ ring. 24 | .SH SEE ALSO 25 | .BR io_uring_get_events (3) 26 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_cq_ready.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2022 Stefan Roesch 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_cq_ready 3 "January 25, 2022" "liburing-2.1" "liburing Manual" 6 | .SH NAME 7 | io_uring_cq_ready \- returns number of unconsumed ready entries in the CQ ring 8 | .SH SYNOPSIS 9 | .nf 10 | .B #include 11 | .PP 12 | .BI "unsigned io_uring_cq_ready(const struct io_uring *" ring ");" 13 | .fi 14 | .SH DESCRIPTION 15 | .PP 16 | The 17 | .BR io_uring_cq_ready (3) 18 | function returns the number of unconsumed entries that are ready belonging to the 19 | .I ring 20 | param. 21 | 22 | .SH RETURN VALUE 23 | Returns the number of unconsumed ready entries in the CQ ring. 24 | .SH SEE ALSO 25 | .BR io_uring_submit (3), 26 | .BR io_uring_wait_cqe (3) 27 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_cqe_get_data.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2021 Stefan Roesch 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_cqe_get_data 3 "November 15, 2021" "liburing-2.1" "liburing Manual" 6 | .SH NAME 7 | io_uring_cqe_get_data \- get user data for completion event 8 | .SH SYNOPSIS 9 | .nf 10 | .B #include 11 | .PP 12 | .BI "void *io_uring_cqe_get_data(struct io_uring_cqe *" cqe ");" 13 | .BI " 14 | .BI "__u64 io_uring_cqe_get_data64(struct io_uring_cqe *" cqe ");" 15 | .fi 16 | .SH DESCRIPTION 17 | .PP 18 | The 19 | .BR io_uring_cqe_get_data (3) 20 | function returns the user_data with the completion queue entry 21 | .IR cqe 22 | as a data pointer. 23 | 24 | The 25 | .BR io_uring_cqe_get_data64 (3) 26 | function returns the user_data with the completion queue entry 27 | .IR cqe 28 | as a 64-bit data value. 29 | 30 | After the caller has received a completion queue entry (CQE) with 31 | .BR io_uring_wait_cqe (3), 32 | the application can call 33 | .BR io_uring_cqe_get_data (3) 34 | or 35 | .BR io_uring_cqe_get_data64 (3) 36 | function to retrieve the 37 | .I user_data 38 | value. This requires that 39 | .I user_data 40 | has been set earlier with the function 41 | .BR io_uring_sqe_set_data (3) 42 | or 43 | .BR io_uring_sqe_set_data64 (3). 44 | 45 | .SH RETURN VALUE 46 | If the 47 | .I user_data 48 | value has been set before submitting the request, it will be returned. 49 | Otherwise, the return value is undefined. 50 | .SH SEE ALSO 51 | .BR io_uring_get_sqe (3), 52 | .BR io_uring_sqe_set_data (3), 53 | .BR io_uring_sqe_submit (3) 54 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_cqe_get_data64.3: -------------------------------------------------------------------------------- 1 | io_uring_cqe_get_data.3 -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_cqe_seen.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2021 Stefan Roesch 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_cqe_seen 3 "November 15, 2021" "liburing-2.1" "liburing Manual" 6 | .SH NAME 7 | io_uring_cqe_seen \- mark io_uring completion event as consumed 8 | .SH SYNOPSIS 9 | .nf 10 | .B #include 11 | .PP 12 | .BI "void io_uring_cqe_seen(struct io_uring *" ring "," 13 | .BI " struct io_uring_cqe *" cqe ");" 14 | .fi 15 | .SH DESCRIPTION 16 | .PP 17 | The 18 | .BR io_uring_cqe_seen (3) 19 | function marks the IO completion 20 | .I cqe 21 | belonging to the 22 | .I ring 23 | param as consumed. 24 | 25 | After the caller has submitted a request with 26 | .BR io_uring_submit (3), 27 | the application can retrieve the completion with 28 | .BR io_uring_wait_cqe (3), 29 | .BR io_uring_peek_cqe (3), 30 | or any of the other CQE retrieval helpers, and mark it as consumed with 31 | .BR io_uring_cqe_seen (3). 32 | 33 | Completions must be marked as completed so their slot can get reused. 34 | .SH RETURN VALUE 35 | None 36 | .SH SEE ALSO 37 | .BR io_uring_submit (3), 38 | .BR io_uring_peek_cqe (3), 39 | .BR io_uring_wait_cqe (3), 40 | .BR io_uring_wait_cqes (3), 41 | .BR io_uring_wait_cqe_timeout (3) 42 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_enter2.2: -------------------------------------------------------------------------------- 1 | io_uring_enter.2 -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_for_each_cqe.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2023 Jens Axboe 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_for_each_cqe 3 "June 04, 2023" "liburing-2.4" "liburing Manual" 6 | .SH NAME 7 | io_uring_for_each_cqe \- iterate pending completion events 8 | .SH SYNOPSIS 9 | .nf 10 | .B #include 11 | .PP 12 | .BI "io_uring_for_each_cqe(struct io_uring *" ring "," 13 | .BI " unsigned " head "," 14 | .BI " struct io_uring_cqe *" cqe ") { } 15 | .fi 16 | .SH DESCRIPTION 17 | .PP 18 | The 19 | .BR io_uring_for_each_cqe (3) 20 | is a macro helper that iterates completion events belonging to the 21 | .I ring 22 | using 23 | .I head 24 | as a temporary iterator, and points 25 | .I cqe 26 | to each pending event when iterating. 27 | 28 | This helper provides an efficient way to iterate all pending events in 29 | the ring, and then advancing the CQ ring by calling 30 | .BR io_uring_cq_advance (3) 31 | with the number of CQEs consumed when done. As updating the kernel visible 32 | CQ ring state involves an ordered write, doing it once for a number of 33 | events is more efficient than handling each completion separately and 34 | calling 35 | .BR io_uring_cqe_seen (3) 36 | for each of them. 37 | 38 | .SH EXAMPLE 39 | .EX 40 | void handle_cqes(struct io_uring *ring) 41 | { 42 | struct io_uring_cqe *cqe; 43 | unsigned head; 44 | unsigned i = 0; 45 | 46 | io_uring_for_each_cqe(ring, head, cqe) { 47 | /* handle completion */ 48 | printf("cqe: %d\\n", cqe->res); 49 | i++; 50 | } 51 | 52 | io_uring_cq_advance(ring, i); 53 | } 54 | .EE 55 | 56 | .SH RETURN VALUE 57 | None 58 | .SH SEE ALSO 59 | .BR io_uring_wait_cqe_timeout (3), 60 | .BR io_uring_wait_cqe (3), 61 | .BR io_uring_wait_cqes (3), 62 | .BR io_uring_cqe_seen (3), 63 | .BR io_uring_buf_ring_cq_advance (3) 64 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_free_buf_ring.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2022 Jens Axboe 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_free_buf_ring 3 "Mar 07, 2023" "liburing-2.4" "liburing Manual" 6 | .SH NAME 7 | io_uring_free_buf_ring \- register and free a buffer ring for provided buffers 8 | .SH SYNOPSIS 9 | .nf 10 | .B #include 11 | .PP 12 | .BI "int io_uring_free_buf_ring(struct io_uring *" ring ", 13 | .BI " struct io_uring_buf_ring *" br ", 14 | .BI " unsigned int " nentries ", 15 | .BI " int " bgid ");" 16 | .BI " 17 | .fi 18 | .SH DESCRIPTION 19 | .PP 20 | The 21 | .BR io_uring_free_buf_ring (3) 22 | function unregisters a previously registered shared buffer ring. The ring must 23 | have heen previously returned from 24 | .BR io_uring_setup_buf_ring (3) . 25 | 26 | The 27 | .I ring 28 | argument must pointer to the ring for which the provided buffer ring is being 29 | registered, 30 | .I br 31 | must point to a buffer ring previously returned by 32 | .BR io_uring_setup_buf_ring (3) , 33 | .I nentries 34 | is the number of entries requested in the buffer ring, and 35 | .I bgid 36 | is the buffer group ID that 37 | .I br 38 | was setup with. 39 | 40 | Under the covers, this function uses 41 | .BR io_uring_unregister_buf_ring (3) 42 | to unregister the ring, and handles the freeing of the ring rather than 43 | letting the application open code it. 44 | 45 | Available since 5.19. 46 | 47 | .SH RETURN VALUE 48 | On success 49 | .BR io_uring_register_free_ring (3) 50 | returns a pointer to the buffe ring. On failure it returns 51 | .BR -errno . 52 | .SH SEE ALSO 53 | .BR io_uring_setup_buf_ring (3) 54 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_free_probe.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2022 Stefan Roesch 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_free_probe 3 "January 25, 2022" "liburing-2.1" "liburing Manual" 6 | .SH NAME 7 | io_uring_free_probe \- free probe instance 8 | .SH SYNOPSIS 9 | .nf 10 | .B #include 11 | .PP 12 | .BI "void io_uring_free_probe(struct io_uring_probe *" probe ");" 13 | .fi 14 | .SH DESCRIPTION 15 | .PP 16 | The function 17 | .BR io_uring_free_probe (3) 18 | frees the 19 | .I probe 20 | instance allocated with the 21 | .BR io_uring_get_probe (3) 22 | function. 23 | 24 | .SH RETURN VALUE 25 | None 26 | .SH SEE ALSO 27 | .BR io_uring_get_probe (3) 28 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_get_events.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2022 Dylan Yudaken 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_get_events 3 "September 5, 2022" "liburing-2.3" "liburing Manual" 6 | .SH NAME 7 | io_uring_get_events \- Flush outstanding requests to CQE ring 8 | .SH SYNOPSIS 9 | .nf 10 | .B #include 11 | .PP 12 | .BI "int io_uring_get_events(struct io_uring *" ring ");" 13 | .fi 14 | .SH DESCRIPTION 15 | .PP 16 | The 17 | .BR io_uring_get_events (3) 18 | function runs outstanding work and flushes completion events to the CQE ring. 19 | 20 | There can be events needing to be flushed if the ring was full and had overflowed. 21 | Alternatively if the ring was setup with the 22 | .BR IORING_SETUP_DEFER_TASKRUN 23 | flag then this will process outstanding tasks, possibly resulting in more CQEs. 24 | 25 | .SH RETURN VALUE 26 | On success 27 | .BR io_uring_get_events (3) 28 | returns 0. On failure it returns 29 | .BR -errno . 30 | .SH SEE ALSO 31 | .BR io_uring_get_sqe (3), 32 | .BR io_uring_submit_and_get_events (3), 33 | .BR io_uring_cq_has_overflow (3) 34 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_get_probe.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2022 Stefan Roesch 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_get_probe 3 "January 25, 2022" "liburing-2.1" "liburing Manual" 6 | .SH NAME 7 | io_uring_get_probe \- get probe instance 8 | .SH SYNOPSIS 9 | .nf 10 | .B #include 11 | .PP 12 | .BI "io_uring_probe *io_uring_get_probe(void);" 13 | .fi 14 | .SH DESCRIPTION 15 | .PP 16 | The function 17 | .BR io_uring_get_probe (3) 18 | returns an allocated io_uring_probe structure to the caller. The caller is 19 | responsible for freeing the structure with the function 20 | .BR io_uring_free_probe (3). 21 | 22 | .SH NOTES 23 | Earlier versions of the Linux kernel do not support probe. If the kernel 24 | doesn't support probe, this function will return NULL. 25 | 26 | .SH RETURN VALUE 27 | On success it returns an allocated io_uring_probe structure, otherwise 28 | it returns NULL. 29 | .SH SEE ALSO 30 | .BR io_uring_free_probe (3) 31 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_get_sqe.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2020 Jens Axboe 2 | .\" Copyright (C) 2020 Red Hat, Inc. 3 | .\" 4 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 5 | .\" 6 | .TH io_uring_get_sqe 3 "July 10, 2020" "liburing-0.7" "liburing Manual" 7 | .SH NAME 8 | io_uring_get_sqe \- get the next available submission queue entry from the 9 | submission queue 10 | .SH SYNOPSIS 11 | .nf 12 | .B #include 13 | .PP 14 | .BI "struct io_uring_sqe *io_uring_get_sqe(struct io_uring *" ring ");" 15 | .fi 16 | .SH DESCRIPTION 17 | .PP 18 | The 19 | .BR io_uring_get_sqe (3) 20 | function gets the next available submission queue entry from the submission 21 | queue belonging to the 22 | .I ring 23 | param. 24 | 25 | On success 26 | .BR io_uring_get_sqe (3) 27 | returns a pointer to the submission queue entry. On failure NULL is returned. 28 | 29 | If a submission queue entry is returned, it should be filled out via one of the 30 | prep functions such as 31 | .BR io_uring_prep_read (3) 32 | and submitted via 33 | .BR io_uring_submit (3). 34 | 35 | Note that neither 36 | .BR io_uring_get_sqe 37 | nor the prep functions set (or clear) the 38 | .B user_data 39 | field of the SQE. If the caller expects 40 | .BR io_uring_cqe_get_data (3) 41 | or 42 | .BR io_uring_cqe_get_data64 (3) 43 | to return valid data when reaping IO completions, either 44 | .BR io_uring_sqe_set_data (3) 45 | or 46 | .BR io_uring_sqe_set_data64 (3) 47 | .B MUST 48 | have been called before submitting the request. 49 | 50 | .SH RETURN VALUE 51 | .BR io_uring_get_sqe (3) 52 | returns a pointer to the next submission queue event on success and NULL on 53 | failure. If NULL is returned, the SQ ring is currently full and entries must 54 | be submitted for processing before new ones can get allocated. 55 | .SH SEE ALSO 56 | .BR io_uring_submit (3), 57 | .BR io_uring_sqe_set_data (3) 58 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_major_version.3: -------------------------------------------------------------------------------- 1 | io_uring_check_version.3 -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_minor_version.3: -------------------------------------------------------------------------------- 1 | io_uring_check_version.3 -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_opcode_supported.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2022 Stefan Roesch 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_opcode_supported 3 "January 25, 2022" "liburing-2.1" "liburing Manual" 6 | .SH NAME 7 | io_uring_opcode_supported \- is op code supported? 8 | .SH SYNOPSIS 9 | .nf 10 | .B #include 11 | .PP 12 | .BI "int io_uring_opcode_supported(struct io_uring_probe *" probe "," 13 | .BI " int " opcode ");" 14 | .fi 15 | .SH DESCRIPTION 16 | .PP 17 | The function 18 | .BR io_uring_opcode_supported (3) 19 | allows the caller to determine if the passed in 20 | .I opcode 21 | belonging to the 22 | .I probe 23 | param is supported. An instance of the io_uring_probe instance can be 24 | obtained by calling the function 25 | .BR io_uring_get_probe (3). 26 | 27 | .SH RETURN VALUE 28 | On success it returns 1, otherwise it returns 0. 29 | .SH SEE ALSO 30 | .BR io_uring_get_probe (3) 31 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_peek_cqe.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2022 Jens Axboe 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_peek_cqe 3 "March 12, 2022" "liburing-2.2" "liburing Manual" 6 | .SH NAME 7 | io_uring_peek_cqe \- check if an io_uring completion event is available 8 | .SH SYNOPSIS 9 | .nf 10 | .B #include 11 | .PP 12 | .BI "int io_uring_peek_cqe(struct io_uring *" ring "," 13 | .BI " struct io_uring_cqe **" cqe_ptr ");" 14 | .fi 15 | .SH DESCRIPTION 16 | .PP 17 | The 18 | .BR io_uring_peek_cqe (3) 19 | function returns an IO completion from the queue belonging to the 20 | .I ring 21 | param, if one is readily available. On successful return, 22 | .I cqe_ptr 23 | param is filled with a valid CQE entry. 24 | 25 | This function does not enter the kernel to wait for an event, an event 26 | is only returned if it's already available in the CQ ring. 27 | 28 | .SH RETURN VALUE 29 | On success 30 | .BR io_uring_peek_cqe (3) 31 | returns 32 | .B 0 33 | and the cqe_ptr parameter is filled in. On failure it returns 34 | .BR -EAGAIN . 35 | .SH SEE ALSO 36 | .BR io_uring_submit (3), 37 | .BR io_uring_wait_cqes (3), 38 | .BR io_uring_wait_cqe (3) 39 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_prep_accept_direct.3: -------------------------------------------------------------------------------- 1 | io_uring_prep_accept.3 -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_prep_cancel64.3: -------------------------------------------------------------------------------- 1 | io_uring_prep_cancel.3 -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_prep_close.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2022 Jens Axboe 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_prep_close 3 "March 13, 2022" "liburing-2.2" "liburing Manual" 6 | .SH NAME 7 | io_uring_prep_close \- prepare a file descriptor close request 8 | .SH SYNOPSIS 9 | .nf 10 | .B #include 11 | .PP 12 | .BI "void io_uring_prep_close(struct io_uring_sqe *" sqe "," 13 | .BI " int " fd ");" 14 | .PP 15 | .BI "void io_uring_prep_close_direct(struct io_uring_sqe *" sqe "," 16 | .BI " unsigned " file_index ");" 17 | .PP 18 | .fi 19 | .SH DESCRIPTION 20 | .PP 21 | The 22 | .BR io_uring_prep_close (3) 23 | function prepares a close request. The submission queue entry 24 | .I sqe 25 | is setup to close the file descriptor indicated by 26 | .IR fd . 27 | 28 | For a direct descriptor close request, the offset is specified by the 29 | .I file_index 30 | argument instead of the 31 | .IR fd . 32 | This is identical to unregistering the direct descriptor, and is provided as 33 | a convenience. 34 | 35 | These functions prepare an async 36 | .BR close (2) 37 | request. See that man page for details. 38 | 39 | .SH RETURN VALUE 40 | None 41 | .SH ERRORS 42 | The CQE 43 | .I res 44 | field will contain the result of the operation. See the related man page for 45 | details on possible values. Note that where synchronous system calls will return 46 | .B -1 47 | on failure and set 48 | .I errno 49 | to the actual error value, io_uring never uses 50 | .IR errno . 51 | Instead it returns the negated 52 | .I errno 53 | directly in the CQE 54 | .I res 55 | field. 56 | .SH SEE ALSO 57 | .BR io_uring_get_sqe (3), 58 | .BR io_uring_submit (3), 59 | .BR close (2) 60 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_prep_close_direct.3: -------------------------------------------------------------------------------- 1 | io_uring_prep_close.3 -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_prep_connect.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2022 Jens Axboe 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_prep_connect 3 "March 13, 2022" "liburing-2.2" "liburing Manual" 6 | .SH NAME 7 | io_uring_prep_connect \- prepare a connect request 8 | .SH SYNOPSIS 9 | .nf 10 | .B #include 11 | .B #include 12 | .B #include 13 | .PP 14 | .BI "void io_uring_prep_connect(struct io_uring_sqe *" sqe "," 15 | .BI " int " sockfd "," 16 | .BI " const struct sockaddr *" addr "," 17 | .BI " socklen_t " addrlen ");" 18 | .fi 19 | .SH DESCRIPTION 20 | .PP 21 | The 22 | .BR io_uring_prep_connect (3) 23 | function prepares a connect request. The submission queue entry 24 | .I sqe 25 | is setup to use the file descriptor 26 | .I sockfd 27 | to start connecting to the destination described by the socket address at 28 | .I addr 29 | and of structure length 30 | .IR addrlen . 31 | 32 | This function prepares an async 33 | .BR connect (2) 34 | request. See that man page for details. 35 | 36 | .SH RETURN VALUE 37 | None 38 | .SH ERRORS 39 | The CQE 40 | .I res 41 | field will contain the result of the operation. See the related man page for 42 | details on possible values. Note that where synchronous system calls will return 43 | .B -1 44 | on failure and set 45 | .I errno 46 | to the actual error value, io_uring never uses 47 | .IR errno . 48 | Instead it returns the negated 49 | .I errno 50 | directly in the CQE 51 | .I res 52 | field. 53 | .SH NOTES 54 | As with any request that passes in data in a struct, that data must remain 55 | valid until the request has been successfully submitted. It need not remain 56 | valid until completion. Once a request has been submitted, the in-kernel 57 | state is stable. Very early kernels (5.4 and earlier) required state to be 58 | stable until the completion occurred. Applications can test for this 59 | behavior by inspecting the 60 | .B IORING_FEAT_SUBMIT_STABLE 61 | flag passed back from 62 | .BR io_uring_queue_init_params (3). 63 | .SH SEE ALSO 64 | .BR io_uring_get_sqe (3), 65 | .BR io_uring_submit (3), 66 | .BR connect (2) 67 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_prep_fadvise.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2022 Jens Axboe 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_prep_fadvise 3 "March 13, 2022" "liburing-2.2" "liburing Manual" 6 | .SH NAME 7 | io_uring_prep_fadvise \- prepare a fadvise request 8 | .SH SYNOPSIS 9 | .nf 10 | .B #include 11 | .B #include 12 | .PP 13 | .BI "void io_uring_prep_fadvise(struct io_uring_sqe *" sqe "," 14 | .BI " int " fd "," 15 | .BI " __u64 " offset "," 16 | .BI " off_t " len "," 17 | .BI " int " advice ");" 18 | .fi 19 | .SH DESCRIPTION 20 | .PP 21 | The 22 | .BR io_uring_prep_fadvise (3) 23 | function prepares an fadvise request. The submission queue entry 24 | .I sqe 25 | is setup to use the file descriptor pointed to by 26 | .I fd 27 | to start an fadvise operation at 28 | .I offset 29 | and of 30 | .I len 31 | length in bytes, giving it the advise located in 32 | .IR advice . 33 | 34 | This function prepares an async 35 | .BR posix_fadvise (2) 36 | request. See that man page for details. 37 | 38 | .SH RETURN VALUE 39 | None 40 | .SH ERRORS 41 | The CQE 42 | .I res 43 | field will contain the result of the operation. See the related man page for 44 | details on possible values. Note that where synchronous system calls will return 45 | .B -1 46 | on failure and set 47 | .I errno 48 | to the actual error value, io_uring never uses 49 | .IR errno . 50 | Instead it returns the negated 51 | .I errno 52 | directly in the CQE 53 | .I res 54 | field. 55 | .SH SEE ALSO 56 | .BR io_uring_get_sqe (3), 57 | .BR io_uring_submit (3), 58 | .BR io_uring_register (2), 59 | .BR posix_fadvise (2) 60 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_prep_fallocate.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2022 Jens Axboe 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_prep_fallocate 3 "March 13, 2022" "liburing-2.2" "liburing Manual" 6 | .SH NAME 7 | io_uring_prep_fallocate \- prepare a fallocate request 8 | .SH SYNOPSIS 9 | .nf 10 | .B #include 11 | .B #include 12 | .PP 13 | .BI "void io_uring_prep_fallocate(struct io_uring_sqe *" sqe "," 14 | .BI " int " fd "," 15 | .BI " int " mode "," 16 | .BI " __u64 " offset "," 17 | .BI " __u64 " len ");" 18 | .fi 19 | .SH DESCRIPTION 20 | .PP 21 | The 22 | .BR io_uring_prep_fallocate (3) 23 | function prepares a fallocate request. The submission queue entry 24 | .I sqe 25 | is setup to use the file descriptor pointed to by 26 | .I fd 27 | to start a fallocate operation described by 28 | .I mode 29 | at offset 30 | .I offset 31 | and 32 | .I len 33 | length in bytes. 34 | 35 | This function prepares an async 36 | .BR fallocate (2) 37 | request. See that man page for details. 38 | 39 | .SH RETURN VALUE 40 | None 41 | .SH ERRORS 42 | The CQE 43 | .I res 44 | field will contain the result of the operation. See the related man page for 45 | details on possible values. Note that where synchronous system calls will return 46 | .B -1 47 | on failure and set 48 | .I errno 49 | to the actual error value, io_uring never uses 50 | .IR errno . 51 | Instead it returns the negated 52 | .I errno 53 | directly in the CQE 54 | .I res 55 | field. 56 | .SH SEE ALSO 57 | .BR io_uring_get_sqe (3), 58 | .BR io_uring_submit (3), 59 | .BR fallocate (2) 60 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_prep_fgetxattr.3: -------------------------------------------------------------------------------- 1 | io_uring_prep_getxattr.3 -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_prep_fsetxattr.3: -------------------------------------------------------------------------------- 1 | io_uring_prep_setxattr.3 -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_prep_fsync.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2022 Jens Axboe 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_prep_fsync 3 "March 12, 2022" "liburing-2.2" "liburing Manual" 6 | .SH NAME 7 | io_uring_prep_fsync \- prepare an fsync request 8 | .SH SYNOPSIS 9 | .nf 10 | .B #include 11 | .PP 12 | .BI "void io_uring_prep_fsync(struct io_uring_sqe *" sqe "," 13 | .BI " int " fd "," 14 | .BI " unsigned " flags ");" 15 | .fi 16 | .SH DESCRIPTION 17 | .PP 18 | The 19 | .BR io_uring_prep_fsync (3) 20 | function prepares an fsync request. The submission queue entry 21 | .I sqe 22 | is setup to use the file descriptor 23 | .I fd 24 | that should get synced, with the modifier flags indicated by the 25 | .I flags 26 | argument. 27 | 28 | This function prepares an fsync request. It can act either like an 29 | .BR fsync (2) 30 | operation, which is the default behavior. If 31 | .B IORING_FSYNC_DATASYNC 32 | is set in the 33 | .I flags 34 | argument, then it behaves like 35 | .BR fdatasync (2). 36 | If no range is specified, the 37 | .I fd 38 | will be synced from 0 to end-of-file. 39 | 40 | It's possible to specify a range to sync, if one is desired. If the 41 | .I off 42 | field of the SQE is set to non-zero, then that indicates the offset to 43 | start syncing at. If 44 | .I len 45 | is set in the SQE, then that indicates the size in bytes to sync from the 46 | offset. Note that these fields are not accepted by this helper, so they have 47 | to be set manually in the SQE after calling this prep helper. 48 | 49 | .SH RETURN VALUE 50 | None 51 | .SH ERRORS 52 | The CQE 53 | .I res 54 | field will contain the result of the operation. See the related man page for 55 | details on possible values. Note that where synchronous system calls will return 56 | .B -1 57 | on failure and set 58 | .I errno 59 | to the actual error value, io_uring never uses 60 | .IR errno . 61 | Instead it returns the negated 62 | .I errno 63 | directly in the CQE 64 | .I res 65 | field. 66 | .SH SEE ALSO 67 | .BR io_uring_get_sqe (3), 68 | .BR io_uring_submit (3), 69 | .BR fsync (2), 70 | .BR fdatasync (2) 71 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_prep_getxattr.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2023 Rutvik Patel 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_prep_getxattr 3 "January 23, 2023" "liburing-2.4" "liburing Manual" 6 | .SH NAME 7 | io_uring_prep_getxattr, io_uring_prep_fgetxattr \- prepare a request to get an 8 | extended attribute value 9 | .SH SYNOPSIS 10 | .nf 11 | .B #include 12 | .PP 13 | .BI "void io_uring_prep_getxattr(struct io_uring_sqe *" sqe "," 14 | .BI " const char *" name "," 15 | .BI " char *" value "," 16 | .BI " const char *" path "," 17 | .BI " unsigned int " len ");" 18 | .PP 19 | .BI "void io_uring_prep_fgetxattr(struct io_uring_sqe *" sqe "," 20 | .BI " int " fd "," 21 | .BI " const char *" name "," 22 | .BI " char *" value "," 23 | .BI " unsigned int " len ");" 24 | .fi 25 | .SH DESCRIPTION 26 | .PP 27 | The 28 | .BR io_uring_prep_getxattr (3) 29 | function prepares a request to get an extended attribute value. The submission 30 | queue entry 31 | .I sqe 32 | is setup to get the 33 | .I value 34 | of the extended attribute identified by 35 | .I name 36 | and associated with the given 37 | .I path 38 | in the filesystem. 39 | The 40 | .I len 41 | argument specifies the size (in bytes) of 42 | .IR value . 43 | 44 | .BR io_uring_prep_fgetxattr (3) 45 | is identical to 46 | .BR io_uring_prep_getxattr (3), 47 | only the open file referred to by 48 | .I fd 49 | is interrogated in place of 50 | .IR path . 51 | 52 | This function prepares an async 53 | .BR getxattr (2) 54 | request. See that man page for details. 55 | 56 | .SH RETURN VALUE 57 | None 58 | 59 | .SH SEE ALSO 60 | .BR io_uring_get_sqe (3), 61 | .BR getxattr (2) 62 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_prep_link.3: -------------------------------------------------------------------------------- 1 | io_uring_prep_linkat.3 -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_prep_madvise.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2022 Jens Axboe 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_prep_madvise 3 "March 13, 2022" "liburing-2.2" "liburing Manual" 6 | .SH NAME 7 | io_uring_prep_madvise \- prepare a madvise request 8 | .SH SYNOPSIS 9 | .nf 10 | .B #include 11 | .B #include 12 | .PP 13 | .BI "void io_uring_prep_madvise(struct io_uring_sqe *" sqe "," 14 | .BI " void *" addr "," 15 | .BI " off_t " len "," 16 | .BI " int " advice ");" 17 | .fi 18 | .SH DESCRIPTION 19 | .PP 20 | The 21 | .BR io_uring_prep_madvise (3) 22 | function prepares an madvise request. The submission queue entry 23 | .I sqe 24 | is setup to start an madvise operation at the virtual address of 25 | .I addr 26 | and of 27 | .I len 28 | length in bytes, giving it the advise located in 29 | .IR advice . 30 | 31 | This function prepares an async 32 | .BR madvise (2) 33 | request. See that man page for details. 34 | 35 | .SH RETURN VALUE 36 | None 37 | .SH ERRORS 38 | The CQE 39 | .I res 40 | field will contain the result of the operation. See the related man page for 41 | details on possible values. Note that where synchronous system calls will return 42 | .B -1 43 | on failure and set 44 | .I errno 45 | to the actual error value, io_uring never uses 46 | .IR errno . 47 | Instead it returns the negated 48 | .I errno 49 | directly in the CQE 50 | .I res 51 | field. 52 | .SH SEE ALSO 53 | .BR io_uring_get_sqe (3), 54 | .BR io_uring_submit (3), 55 | .BR io_uring_register (2), 56 | .BR madvise (2) 57 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_prep_mkdir.3: -------------------------------------------------------------------------------- 1 | io_uring_prep_mkdirat.3 -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_prep_msg_ring_cqe_flags.3: -------------------------------------------------------------------------------- 1 | io_uring_prep_msg_ring.3 -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_prep_msg_ring_fd_alloc.3: -------------------------------------------------------------------------------- 1 | io_uring_prep_msg_ring_fd.3 -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_prep_multishot_accept.3: -------------------------------------------------------------------------------- 1 | io_uring_prep_accept.3 -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_prep_multishot_accept_direct.3: -------------------------------------------------------------------------------- 1 | io_uring_prep_accept.3 -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_prep_nop.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2022 Samuel Williams 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_prep_nop 3 "October 20, 2022" "liburing-2.2" "liburing Manual" 6 | .SH NAME 7 | io_uring_prep_nop \- prepare a nop request 8 | .SH SYNOPSIS 9 | .nf 10 | .B #include 11 | .PP 12 | .BI "void io_uring_prep_nop(struct io_uring_sqe *" sqe ");" 13 | .fi 14 | .SH DESCRIPTION 15 | .PP 16 | The 17 | .BR io_uring_prep_nop (3) 18 | function prepares nop (no operation) request. The submission queue entry 19 | .I sqe 20 | does not require any additional setup. 21 | 22 | .SH RETURN VALUE 23 | None 24 | .SH ERRORS 25 | None 26 | .SH SEE ALSO 27 | .BR io_uring_get_sqe (3), 28 | .BR io_uring_submit (3), 29 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_prep_openat2_direct.3: -------------------------------------------------------------------------------- 1 | io_uring_prep_openat2.3 -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_prep_openat_direct.3: -------------------------------------------------------------------------------- 1 | io_uring_prep_openat.3 -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_prep_poll_multishot.3: -------------------------------------------------------------------------------- 1 | io_uring_prep_poll_add.3 -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_prep_poll_remove.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2022 Jens Axboe 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_prep_poll_remove 3 "March 12, 2022" "liburing-2.2" "liburing Manual" 6 | .SH NAME 7 | io_uring_prep_poll_remove \- prepare a poll deletion request 8 | .SH SYNOPSIS 9 | .nf 10 | .B #include 11 | .PP 12 | .BI "void io_uring_prep_poll_remove(struct io_uring_sqe *" sqe "," 13 | .BI " __u64 " user_data ");" 14 | .BI " 15 | .fi 16 | .SH DESCRIPTION 17 | .PP 18 | The 19 | .BR io_uring_prep_poll_remove (3) 20 | function prepares a poll removal request. The submission queue entry 21 | .I sqe 22 | is setup to remove a poll request identified by 23 | .I user_data 24 | 25 | Works like 26 | .BR io_uring_prep_cancel (3) 27 | except only looks for poll requests. Apart from that, behavior is identical. 28 | See that man page for specific details. 29 | 30 | .SH RETURN VALUE 31 | None 32 | .SH ERRORS 33 | These are the errors that are reported in the CQE 34 | .I res 35 | field. On success, 36 | .B 0 37 | is returned. 38 | .TP 39 | .B -ENOENT 40 | The request identified by 41 | .I user_data 42 | could not be located. This could be because it completed before the cancelation 43 | request was issued, or if an invalid identifier is used. 44 | .TP 45 | .B -EINVAL 46 | One of the fields set in the SQE was invalid. 47 | .TP 48 | .B -EALREADY 49 | The execution state of the request has progressed far enough that cancelation 50 | is no longer possible. This should normally mean that it will complete shortly, 51 | either successfully, or interrupted due to the cancelation. 52 | .SH SEE ALSO 53 | .BR io_uring_get_sqe (3), 54 | .BR io_uring_submit (3), 55 | .BR io_uring_prep_cancel (3) 56 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_prep_read.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2021 Stefan Roesch 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_prep_read 3 "November 15, 2021" "liburing-2.1" "liburing Manual" 6 | .SH NAME 7 | io_uring_prep_read \- prepare I/O read request 8 | .SH SYNOPSIS 9 | .nf 10 | .B #include 11 | .PP 12 | .BI "void io_uring_prep_read(struct io_uring_sqe *" sqe "," 13 | .BI " int " fd "," 14 | .BI " void *" buf "," 15 | .BI " unsigned " nbytes "," 16 | .BI " __u64 " offset ");" 17 | .fi 18 | .SH DESCRIPTION 19 | .PP 20 | The 21 | .BR io_uring_prep_read (3) 22 | prepares an IO read request. The submission queue entry 23 | .I sqe 24 | is setup to use the file descriptor 25 | .I fd 26 | to start reading 27 | .I nbytes 28 | into the buffer 29 | .I buf 30 | at the specified 31 | .IR offset . 32 | 33 | On files that support seeking, if the offset is set to 34 | .BR -1 , 35 | the read operation commences at the file offset, and the file offset is 36 | incremented by the number of bytes read. See 37 | .BR read (2) 38 | for more details. Note that for an async API, reading and updating the 39 | current file offset may result in unpredictable behavior, unless access 40 | to the file is serialized. It is not encouraged to use this feature, if it's 41 | possible to provide the desired IO offset from the application or library. 42 | 43 | On files that are not capable of seeking, the offset must be 0 or -1. 44 | 45 | After the read has been prepared it can be submitted with one of the submit 46 | functions. 47 | 48 | .SH RETURN VALUE 49 | None 50 | .SH ERRORS 51 | The CQE 52 | .I res 53 | field will contain the result of the operation. See the related man page for 54 | details on possible values. Note that where synchronous system calls will return 55 | .B -1 56 | on failure and set 57 | .I errno 58 | to the actual error value, io_uring never uses 59 | .IR errno . 60 | Instead it returns the negated 61 | .I errno 62 | directly in the CQE 63 | .I res 64 | field. 65 | .SH SEE ALSO 66 | .BR io_uring_get_sqe (3), 67 | .BR io_uring_prep_readv (3), 68 | .BR io_uring_prep_readv2 (3), 69 | .BR io_uring_submit (3) 70 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_prep_read_fixed.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2022 Jens Axboe 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_prep_read 3 "February 13, 2022" "liburing-2.1" "liburing Manual" 6 | .SH NAME 7 | io_uring_prep_read_fixed \- prepare I/O read request with registered buffer 8 | .SH SYNOPSIS 9 | .nf 10 | .B #include 11 | .PP 12 | .BI "void io_uring_prep_read_fixed(struct io_uring_sqe *" sqe "," 13 | .BI " int " fd "," 14 | .BI " void *" buf "," 15 | .BI " unsigned " nbytes "," 16 | .BI " __u64 " offset "," 17 | .BI " int " buf_index ");" 18 | .fi 19 | .SH DESCRIPTION 20 | .PP 21 | The 22 | .BR io_uring_prep_read_fixed (3) 23 | prepares an IO read request with a previously registered IO buffer. The 24 | submission queue entry 25 | .I sqe 26 | is setup to use the file descriptor 27 | .I fd 28 | to start reading 29 | .I nbytes 30 | into the buffer 31 | .I buf 32 | at the specified 33 | .IR offset , 34 | and with the buffer matching the registered index of 35 | .IR buf_index . 36 | 37 | This works just like 38 | .BR io_uring_prep_read (3) 39 | except it requires the use of buffers that have been registered with 40 | .BR io_uring_register_buffers (3). 41 | The 42 | .I buf 43 | and 44 | .I nbytes 45 | arguments must fall within a region specified by 46 | .I buf_index 47 | in the previously registered buffer. The buffer need not be aligned with 48 | the start of the registered buffer. 49 | 50 | After the read has been prepared it can be submitted with one of the submit 51 | functions. 52 | 53 | .SH RETURN VALUE 54 | None 55 | .SH ERRORS 56 | The CQE 57 | .I res 58 | field will contain the result of the operation. See the related man page for 59 | details on possible values. Note that where synchronous system calls will return 60 | .B -1 61 | on failure and set 62 | .I errno 63 | to the actual error value, io_uring never uses 64 | .IR errno . 65 | Instead it returns the negated 66 | .I errno 67 | directly in the CQE 68 | .I res 69 | field. 70 | .SH SEE ALSO 71 | .BR io_uring_prep_read (3), 72 | .BR io_uring_register_buffers (3) 73 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_prep_recv_multishot.3: -------------------------------------------------------------------------------- 1 | io_uring_prep_recv.3 -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_prep_recvmsg_multishot.3: -------------------------------------------------------------------------------- 1 | io_uring_prep_recvmsg.3 -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_prep_remove_buffers.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2022 Jens Axboe 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_prep_remove_buffers 3 "March 13, 2022" "liburing-2.2" "liburing Manual" 6 | .SH NAME 7 | io_uring_prep_remove_buffers \- prepare a remove buffers request 8 | .SH SYNOPSIS 9 | .nf 10 | .B #include 11 | .PP 12 | .BI "void io_uring_prep_remove_buffers(struct io_uring_sqe *" sqe "," 13 | .BI " int " nr "," 14 | .BI " int " bgid ");" 15 | .fi 16 | .SH DESCRIPTION 17 | .PP 18 | The 19 | .BR io_uring_prep_remove_buffers (3) 20 | function prepares a request for removing previously supplied buffers. The 21 | submission queue entry 22 | .I sqe 23 | is setup to remove 24 | .I nr 25 | number of buffers from the buffer group ID indicated by 26 | .IR bgid . 27 | 28 | .SH RETURN VALUE 29 | None 30 | .SH ERRORS 31 | These are the errors that are reported in the CQE 32 | .I res 33 | field. On success, 34 | .I res 35 | will contain the number of successfully removed buffers. On error, 36 | the following errors can occur. 37 | .TP 38 | .B -ENOMEM 39 | The kernel was unable to allocate memory for the request. 40 | .TP 41 | .B -EINVAL 42 | One of the fields set in the SQE was invalid. 43 | .TP 44 | .B -ENOENT 45 | No buffers exist at the specified 46 | .I bgid 47 | buffer group ID. 48 | .SH SEE ALSO 49 | .BR io_uring_get_sqe (3), 50 | .BR io_uring_submit (3), 51 | .BR io_uring_register (2), 52 | .BR io_uring_prep_provide_buffers (3) 53 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_prep_rename.3: -------------------------------------------------------------------------------- 1 | io_uring_prep_renameat.3 -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_prep_send_set_addr.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2023 Rutvik Patel 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_prep_send_set_addr 3 "January 23, 2023" "liburing-2.4" "liburing Manual" 6 | .SH NAME 7 | io_uring_prep_send_set_addr \- set address details for send requests 8 | .SH SYNOPSIS 9 | .nf 10 | .B #include 11 | .PP 12 | .BI "void io_uring_prep_send_set_addr(struct io_uring_sqe *" sqe "," 13 | .BI " const struct sockaddr *" dest_addr "," 14 | .BI " __u16 " addr_len ");" 15 | .fi 16 | .SH DESCRIPTION 17 | .PP 18 | The 19 | .BR io_uring_prep_send_set_addr (3) 20 | function sets a socket destination address specified by 21 | .I dest_addr 22 | and its length using 23 | .I addr_len 24 | parameters. It can be used once 25 | .I sqe 26 | is prepared using any of the 27 | .BR send (2) 28 | io_uring helpers. See man pages of 29 | .BR io_uring_prep_send (3) 30 | or 31 | .BR io_uring_prep_send_zc (3). 32 | .SH RETURN VALUE 33 | None 34 | .SH SEE ALSO 35 | .BR io_uring_get_sqe (3), 36 | .BR io_uring_prep_send (3), 37 | .BR io_uring_prep_send_zc (3), 38 | .BR send (2) 39 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_prep_send_zc_fixed.3: -------------------------------------------------------------------------------- 1 | io_uring_prep_send_zc.3 -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_prep_sendmsg_zc.3: -------------------------------------------------------------------------------- 1 | io_uring_prep_sendmsg.3 -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_prep_sendto.3: -------------------------------------------------------------------------------- 1 | io_uring_prep_send.3 -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_prep_setxattr.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2023 Rutvik Patel 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_prep_setxattr 3 "January 23, 2023" "liburing-2.4" "liburing Manual" 6 | .SH NAME 7 | io_uring_prep_setxattr, io_uring_prep_fsetxattr \- prepare a request to set an 8 | extended attribute value 9 | .SH SYNOPSIS 10 | .nf 11 | .B #include 12 | .PP 13 | .BI "void io_uring_prep_setxattr(struct io_uring_sqe *" sqe "," 14 | .BI " const char *" name "," 15 | .BI " const char *" value "," 16 | .BI " const char *" path "," 17 | .BI " int " flags "," 18 | .BI " unsigned int " len ");" 19 | .PP 20 | .BI "void io_uring_prep_fsetxattr(struct io_uring_sqe *" sqe "," 21 | .BI " int " fd "," 22 | .BI " const char *" name "," 23 | .BI " const char *" value "," 24 | .BI " int " flags "," 25 | .BI " unsigned int " len ");" 26 | .fi 27 | .SH DESCRIPTION 28 | .PP 29 | The 30 | .BR io_uring_prep_setxattr (3) 31 | function prepares a request to set an extended attribute value. The submission 32 | queue entry 33 | .I sqe 34 | is setup to set the 35 | .I value 36 | of the extended attribute identified by 37 | .I name 38 | and associated with the given 39 | .I path 40 | in the filesystem with modifier flags 41 | .IR flags . 42 | The 43 | .I len 44 | argument specifies the size (in bytes) of 45 | .IR value . 46 | 47 | .BR io_uring_prep_fsetxattr (3) 48 | is identical to 49 | .BR io_uring_prep_setxattr (3), 50 | only the extended attribute is set on the open file referred to by 51 | .I fd 52 | in place of 53 | .IR path . 54 | 55 | This function prepares an async 56 | .BR setxattr (2) 57 | request. See that man page for details. 58 | 59 | .SH RETURN VALUE 60 | None 61 | 62 | .SH SEE ALSO 63 | .BR io_uring_get_sqe (3), 64 | .BR setxattr (2) 65 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_prep_shutdown.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2022 Jens Axboe 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_prep_shutdown 3 "March 12, 2022" "liburing-2.2" "liburing Manual" 6 | .SH NAME 7 | io_uring_prep_shutdown \- prepare a shutdown request 8 | .SH SYNOPSIS 9 | .nf 10 | .B #include 11 | .B #include 12 | .PP 13 | .BI "void io_uring_prep_shutdown(struct io_uring_sqe *" sqe "," 14 | .BI " int " sockfd "," 15 | .BI " int " how ");" 16 | .fi 17 | .SH DESCRIPTION 18 | .PP 19 | The 20 | .BR io_uring_prep_shutdown (3) 21 | function prepares a shutdown request. The submission queue entry 22 | .I sqe 23 | is setup to use the file descriptor 24 | .I sockfd 25 | that should be shutdown with the 26 | .I how 27 | argument. 28 | 29 | This function prepares an async 30 | .BR shutdown (2) 31 | request. See that man page for details. 32 | 33 | .SH RETURN VALUE 34 | None 35 | .SH ERRORS 36 | The CQE 37 | .I res 38 | field will contain the result of the operation. See the related man page for 39 | details on possible values. Note that where synchronous system calls will return 40 | .B -1 41 | on failure and set 42 | .I errno 43 | to the actual error value, io_uring never uses 44 | .IR errno . 45 | Instead it returns the negated 46 | .I errno 47 | directly in the CQE 48 | .I res 49 | field. 50 | .SH SEE ALSO 51 | .BR io_uring_get_sqe (3), 52 | .BR io_uring_submit (3), 53 | .BR shutdown (2) 54 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_prep_socket_direct.3: -------------------------------------------------------------------------------- 1 | io_uring_prep_socket.3 -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_prep_socket_direct_alloc.3: -------------------------------------------------------------------------------- 1 | io_uring_prep_socket.3 -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_prep_symlink.3: -------------------------------------------------------------------------------- 1 | io_uring_prep_symlinkat.3 -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_prep_sync_file_range.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2022 Jens Axboe 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_prep_sync_file_range 3 "March 12, 2022" "liburing-2.2" "liburing Manual" 6 | .SH NAME 7 | io_uring_prep_sync_file_range \- prepare a sync_file_range request 8 | .SH SYNOPSIS 9 | .nf 10 | .B #include 11 | .B #include 12 | .PP 13 | .BI "void io_uring_prep_sync_file_range(struct io_uring_sqe *" sqe "," 14 | .BI " int " fd "," 15 | .BI " unsigned " len "," 16 | .BI " __u64 " offset "," 17 | .BI " int " flags ");" 18 | .fi 19 | .SH DESCRIPTION 20 | .PP 21 | The 22 | .BR io_uring_prep_sync_file_range (3) 23 | function prepares a sync_file_range request. The submission queue entry 24 | .I sqe 25 | is setup to use the file descriptor 26 | .I fd 27 | that should get 28 | .I len 29 | bytes synced started at offset 30 | .I offset 31 | and with modifier flags in the 32 | .I flags 33 | argument. 34 | 35 | This function prepares an async 36 | .BR sync_file_range (2) 37 | request. See that man page for details on the arguments. 38 | 39 | .SH RETURN VALUE 40 | None 41 | .SH ERRORS 42 | The CQE 43 | .I res 44 | field will contain the result of the operation. See the related man page for 45 | details on possible values. Note that where synchronous system calls will return 46 | .B -1 47 | on failure and set 48 | .I errno 49 | to the actual error value, io_uring never uses 50 | .IR errno . 51 | Instead it returns the negated 52 | .I errno 53 | directly in the CQE 54 | .I res 55 | field. 56 | .SH SEE ALSO 57 | .BR io_uring_get_sqe (3), 58 | .BR io_uring_submit (3), 59 | .BR sync_file_range (2) 60 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_prep_tee.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2022 Jens Axboe 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_prep_tee 3 "March 13, 2022" "liburing-2.2" "liburing Manual" 6 | .SH NAME 7 | io_uring_prep_tee \- prepare a tee request 8 | .SH SYNOPSIS 9 | .nf 10 | .B #include 11 | .B #include 12 | .PP 13 | .BI "void io_uring_prep_tee(struct io_uring_sqe *" sqe "," 14 | .BI " int " fd_in "," 15 | .BI " int " fd_out "," 16 | .BI " unsigned int " nbytes "," 17 | .BI " unsigned int " splice_flags ");" 18 | .fi 19 | .SH DESCRIPTION 20 | .PP 21 | The 22 | .BR io_uring_prep_tee (3) 23 | function prepares a tee request. The submission queue entry 24 | .I sqe 25 | is setup to use as input the file descriptor 26 | .I fd_in 27 | and as output the file descriptor 28 | .I fd_out 29 | duplicating 30 | .I nbytes 31 | bytes worth of data. 32 | .I splice_flags 33 | are modifier flags for the operation. See 34 | .BR tee (2) 35 | for the generic splice flags. 36 | 37 | If the 38 | .I fd_out 39 | descriptor, 40 | .B IOSQE_FIXED_FILE 41 | can be set in the SQE to indicate that. For the input file, the io_uring 42 | specific 43 | .B SPLICE_F_FD_IN_FIXED 44 | can be set and 45 | .I fd_in 46 | given as a registered file descriptor offset. 47 | 48 | This function prepares an async 49 | .BR tee (2) 50 | request. See that man page for details. 51 | 52 | .SH RETURN VALUE 53 | None 54 | .SH ERRORS 55 | The CQE 56 | .I res 57 | field will contain the result of the operation. See the related man page for 58 | details on possible values. Note that where synchronous system calls will return 59 | .B -1 60 | on failure and set 61 | .I errno 62 | to the actual error value, io_uring never uses 63 | .IR errno . 64 | Instead it returns the negated 65 | .I errno 66 | directly in the CQE 67 | .I res 68 | field. 69 | .SH SEE ALSO 70 | .BR io_uring_get_sqe (3), 71 | .BR io_uring_submit (3), 72 | .BR io_uring_register (2), 73 | .BR splice (2), 74 | .BR tee (2) 75 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_prep_timeout_remove.3: -------------------------------------------------------------------------------- 1 | io_uring_prep_timeout_update.3 -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_prep_unlink.3: -------------------------------------------------------------------------------- 1 | io_uring_prep_unlinkat.3 -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_prep_write.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2021 Stefan Roesch 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_prep_write 3 "November 15, 2021" "liburing-2.1" "liburing Manual" 6 | .SH NAME 7 | io_uring_prep_write \- prepare I/O write request 8 | .SH SYNOPSIS 9 | .nf 10 | .B #include 11 | .PP 12 | .BI "void io_uring_prep_write(struct io_uring_sqe *" sqe "," 13 | .BI " int " fd "," 14 | .BI " const void *" buf "," 15 | .BI " unsigned " nbytes "," 16 | .BI " __u64 " offset ");" 17 | .fi 18 | .SH DESCRIPTION 19 | .PP 20 | The 21 | .BR io_uring_prep_write (3) 22 | prepares an IO write request. The submission queue entry 23 | .I sqe 24 | is setup to use the file descriptor 25 | .I fd 26 | to start writing 27 | .I nbytes 28 | from the buffer 29 | .I buf 30 | at the specified 31 | .IR offset . 32 | 33 | On files that support seeking, if the offset is set to 34 | .BR -1 , 35 | the write operation commences at the file offset, and the file offset is 36 | incremented by the number of bytes written. See 37 | .BR write (2) 38 | for more details. Note that for an async API, reading and updating the 39 | current file offset may result in unpredictable behavior, unless access 40 | to the file is serialized. It is not encouraged to use this feature if it's 41 | possible to provide the desired IO offset from the application or library. 42 | 43 | On files that are not capable of seeking, the offset must be 0 or -1. 44 | 45 | After the write has been prepared, it can be submitted with one of the submit 46 | functions. 47 | 48 | .SH RETURN VALUE 49 | None 50 | .SH ERRORS 51 | The CQE 52 | .I res 53 | field will contain the result of the operation. See the related man page for 54 | details on possible values. Note that where synchronous system calls will return 55 | .B -1 56 | on failure and set 57 | .I errno 58 | to the actual error value, io_uring never uses 59 | .IR errno . 60 | Instead it returns the negated 61 | .I errno 62 | directly in the CQE 63 | .I res 64 | field. 65 | .SH SEE ALSO 66 | .BR io_uring_get_sqe (3), 67 | .BR io_uring_submit (3) 68 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_prep_write_fixed.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2022 Jens Axboe 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_prep_write 3 "February 13, 2022" "liburing-2.1" "liburing Manual" 6 | .SH NAME 7 | io_uring_prep_write_fixed \- prepare I/O write request with registered buffer 8 | .SH SYNOPSIS 9 | .nf 10 | .B #include 11 | .PP 12 | .BI "void io_uring_prep_write_fixed(struct io_uring_sqe *" sqe "," 13 | .BI " int " fd ", 14 | .BI " const void *" buf "," 15 | .BI " unsigned " nbytes "," 16 | .BI " __u64 " offset "," 17 | .BI " int " buf_index ");" 18 | .fi 19 | .SH DESCRIPTION 20 | .PP 21 | The 22 | .BR io_uring_prep_write_fixed (3) 23 | prepares an IO write request with a previously registered IO buffer. The 24 | submission queue entry 25 | .I sqe 26 | is setup to use the file descriptor 27 | .I fd 28 | to start writing 29 | .I nbytes 30 | from the buffer 31 | .I buf 32 | at the specified 33 | .I offset 34 | and with the buffer matching the registered index of 35 | .IR buf_index . 36 | 37 | This works just like 38 | .BR io_uring_prep_write (3) 39 | except it requires the use of buffers that have been registered with 40 | .BR io_uring_register_buffers (3). 41 | The 42 | .I buf 43 | and 44 | .I nbytes 45 | arguments must fall within a region specified by 46 | .I buf_index 47 | in the previously registered buffer. The buffer need not be aligned with 48 | the start of the registered buffer. 49 | 50 | After the read has been prepared it can be submitted with one of the submit 51 | functions. 52 | 53 | .SH RETURN VALUE 54 | None 55 | .SH ERRORS 56 | The CQE 57 | .I res 58 | field will contain the result of the operation. See the related man page for 59 | details on possible values. Note that where synchronous system calls will return 60 | .B -1 61 | on failure and set 62 | .I errno 63 | to the actual error value, io_uring never uses 64 | .IR errno . 65 | Instead it returns the negated 66 | .I errno 67 | directly in the CQE 68 | .I res 69 | field. 70 | .SH SEE ALSO 71 | .BR io_uring_prep_write (3), 72 | .BR io_uring_register_buffers (3) 73 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_queue_exit.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2020 Jens Axboe 2 | .\" Copyright (C) 2020 Red Hat, Inc. 3 | .\" 4 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 5 | .\" 6 | .TH io_uring_queue_exit 3 "July 10, 2020" "liburing-0.7" "liburing Manual" 7 | .SH NAME 8 | io_uring_queue_exit \- tear down io_uring submission and completion queues 9 | .SH SYNOPSIS 10 | .nf 11 | .B #include 12 | .PP 13 | .BI "void io_uring_queue_exit(struct io_uring *" ring ");" 14 | .fi 15 | .SH DESCRIPTION 16 | .PP 17 | .BR io_uring_queue_exit (3) 18 | will release all resources acquired and initialized by 19 | .BR io_uring_queue_init (3). 20 | It first unmaps the memory shared between the application and the kernel and then closes the io_uring file descriptor. 21 | .SH RETURN VALUE 22 | None 23 | .SH SEE ALSO 24 | .BR io_uring_setup (2), 25 | .BR mmap (2), 26 | .BR io_uring_queue_init (3) 27 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_queue_init_params.3: -------------------------------------------------------------------------------- 1 | io_uring_queue_init.3 -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_recvmsg_cmsg_firsthdr.3: -------------------------------------------------------------------------------- 1 | io_uring_recvmsg_out.3 -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_recvmsg_cmsg_nexthdr.3: -------------------------------------------------------------------------------- 1 | io_uring_recvmsg_out.3 -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_recvmsg_name.3: -------------------------------------------------------------------------------- 1 | io_uring_recvmsg_out.3 -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_recvmsg_payload.3: -------------------------------------------------------------------------------- 1 | io_uring_recvmsg_out.3 -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_recvmsg_payload_length.3: -------------------------------------------------------------------------------- 1 | io_uring_recvmsg_out.3 -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_recvmsg_validate.3: -------------------------------------------------------------------------------- 1 | io_uring_recvmsg_out.3 -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_register_buffers_sparse.3: -------------------------------------------------------------------------------- 1 | io_uring_register_buffers.3 -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_register_buffers_tags.3: -------------------------------------------------------------------------------- 1 | io_uring_register_buffers.3 -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_register_buffers_update_tag.3: -------------------------------------------------------------------------------- 1 | io_uring_register_buffers.3 -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_register_eventfd.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2022 Jens Axboe 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_register_eventfd 3 "April 16, 2022" "liburing-2.2" "liburing Manual" 6 | .SH NAME 7 | io_uring_register_eventfd \- register an eventfd with a ring 8 | .SH SYNOPSIS 9 | .nf 10 | .B #include 11 | .PP 12 | .BI "int io_uring_register_eventfd(struct io_uring *" ring "," 13 | .BI " int " fd ");" 14 | .PP 15 | .BI "int io_uring_register_eventfd_async(struct io_uring *" ring "," 16 | .BI " int " fd ");" 17 | .PP 18 | .BI "int io_uring_unregister_eventfd(struct io_uring *" ring ");" 19 | .fi 20 | .SH DESCRIPTION 21 | .PP 22 | .BR io_uring_register_eventfd (3) 23 | registers the eventfd file descriptor 24 | .I fd 25 | with the ring identified by 26 | .IR ring . 27 | 28 | Whenever completions are posted to the CQ ring, an eventfd notification 29 | is generated with the registered eventfd descriptor. If 30 | .BR io_uring_register_eventfd_async (3) 31 | is used, only events that completed out-of-line will trigger a notification. 32 | 33 | It notifications are no longer desired, 34 | .BR io_uring_unregister_eventfd (3) 35 | may be called to remove the eventfd registration. No eventfd argument is 36 | needed, as a ring can only have a single eventfd registered. 37 | 38 | .SH NOTES 39 | While io_uring generally takes care to avoid spurious events, they can occur. 40 | Similarly, batched completions of CQEs may only trigger a single eventfd 41 | notification even if multiple CQEs are posted. The application should make no 42 | assumptions on number of events being available having a direct correlation to 43 | eventfd notifications posted. An eventfd notification must thus only be treated 44 | as a hint to check the CQ ring for completions. 45 | .SH RETURN VALUE 46 | Returns 0 on success, or 47 | or 48 | .BR -errno 49 | on error. 50 | .SH SEE ALSO 51 | .BR eventfd (2) 52 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_register_eventfd_async.3: -------------------------------------------------------------------------------- 1 | io_uring_register_eventfd.3 -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_register_file_alloc_range.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2022 Jens Axboe 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_register_file_alloc_range 3 "Oct 21, 2022" "liburing-2.3" "liburing Manual" 6 | .SH NAME 7 | io_uring_register_file_alloc_range \- set range for fixed file allocations 8 | .SH SYNOPSIS 9 | .nf 10 | .B #include 11 | .PP 12 | .BI "int io_uring_register_file_alloc_range(struct io_uring *" ring ", 13 | .BI " unsigned " off "," 14 | .BI " unsigned " len ");" 15 | .BI " 16 | .fi 17 | .SH DESCRIPTION 18 | .PP 19 | The 20 | .BR io_uring_register_file_alloc_range (3) 21 | function sets the allowable range for fixed file index allocations within the 22 | kernel. When requests that can instantiate a new fixed file are used with 23 | .B IORING_FILE_INDEX_ALLOC , 24 | the application is asking the kernel to allocate a new fixed file descriptor 25 | rather than pass in a specific value for one. By default, the kernel will 26 | pick any available fixed file descriptor within the range available. Calling 27 | this function with 28 | .I off 29 | set to the starting offset and 30 | .I len 31 | set to the number of descriptors, the application can limit the allocated 32 | descriptors to that particular range. This effectively allows the application 33 | to set aside a range just for dynamic allocations, with the remainder being 34 | used for specific values. 35 | 36 | The application must have registered a fixed file table upfront, eg through 37 | .BR io_uring_register_files (3) 38 | or 39 | .BR io_uring_register_files_sparse (3) . 40 | 41 | Available since 6.0. 42 | 43 | .SH RETURN VALUE 44 | On success 45 | .BR io_uring_register_buf_ring (3) 46 | returns 0. On failure it returns 47 | .BR -errno . 48 | .SH SEE ALSO 49 | .BR io_uring_register_files (3) 50 | .BR io_uring_prep_accept_direct (3) 51 | .BR io_uring_prep_openat_direct (3) 52 | .BR io_uring_prep_socket_direct (3) 53 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_register_files_sparse.3: -------------------------------------------------------------------------------- 1 | io_uring_register_files.3 -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_register_files_tags.3: -------------------------------------------------------------------------------- 1 | io_uring_register_files.3 -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_register_files_update.3: -------------------------------------------------------------------------------- 1 | io_uring_register_files.3 -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_register_files_update_tag.3: -------------------------------------------------------------------------------- 1 | io_uring_register_files.3 -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_register_iowq_aff.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2022 Jens Axboe 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_register_iowq_aff 3 "March 13, 2022" "liburing-2.2" "liburing Manual" 6 | .SH NAME 7 | io_uring_register_iowq_aff \- register async worker CPU affinities 8 | .SH SYNOPSIS 9 | .nf 10 | .B #include 11 | .B #include 12 | .PP 13 | .BI "int io_uring_register_iowq_aff(struct io_uring *" ring "," 14 | .BI " size_t " cpusz "," 15 | .BI " const cpu_set_t *" mask "); 16 | .PP 17 | .BI "void io_uring_unregister_iowq_aff(struct io_uring *" ring ");" 18 | .fi 19 | .SH DESCRIPTION 20 | .PP 21 | The 22 | .BR io_uring_prep_register_iowq_aff (3) 23 | function registers a set of CPU affinities to be used by the io_uring async 24 | workers. By default, io_uring async workers are allowed to run on any CPU in 25 | the system. If this function is called with 26 | .I ring 27 | set to the ring in question and 28 | .I mask 29 | set to a pointer to a 30 | .B cpu_set_t 31 | value and 32 | .I cpusz 33 | set to the size of the CPU set, then async workers will only be allowed to run 34 | on the CPUs specified in the mask. Existing workers may need to hit a schedule 35 | point before they are migrated. 36 | 37 | For unregistration, 38 | .BR io_uring_unregister_iowq_aff (3) 39 | may be called to restore CPU affinities to the default. 40 | 41 | .SH RETURN VALUE 42 | Returns 43 | .B 0 44 | on success, or any of the following values in case of error. 45 | .TP 46 | .B -EFAULT 47 | The kernel was unable to copy the memory pointer to by 48 | .I mask 49 | as it was invalid. 50 | .TP 51 | .B -ENOMEM 52 | The kernel was unable to allocate memory for the new CPU mask. 53 | .TP 54 | .B -EINVAL 55 | .I cpusz 56 | or 57 | .I mask 58 | was NULL/0, or any other value specified was invalid. 59 | .SH SEE ALSO 60 | .BR io_uring_queue_init (3), 61 | .BR io_uring_register (2) 62 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_register_ring_fd.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2022 Jens Axboe 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_register_ring_fd 3 "March 11, 2022" "liburing-2.2" "liburing Manual" 6 | .SH NAME 7 | io_uring_register_ring_fd \- register a ring file descriptor 8 | .SH SYNOPSIS 9 | .nf 10 | .B #include 11 | .PP 12 | .BI "int io_uring_register_ring_fd(struct io_uring *" ring ");" 13 | .fi 14 | .SH DESCRIPTION 15 | .PP 16 | .BR io_uring_register_ring_fd (3) 17 | registers the file descriptor of the ring. 18 | 19 | Whenever 20 | .BR io_uring_enter (2) 21 | is called to submit request or wait for completions, the kernel must grab a 22 | reference to the file descriptor. If the application using io_uring is threaded, 23 | the file table is marked as shared, and the reference grab and put of the file 24 | descriptor count is more expensive than it is for a non-threaded application. 25 | 26 | Similarly to how io_uring allows registration of files, this allow registration 27 | of the ring file descriptor itself. This reduces the overhead of the 28 | .BR io_uring_enter (2) 29 | system call. 30 | 31 | If an application using liburing is threaded, then an application should call 32 | this function to register the ring descriptor when a ring is set up. See NOTES 33 | for restrictions when a ring is shared. 34 | 35 | .SH NOTES 36 | When the ring descriptor is registered, it is stored internally in the 37 | .I struct io_uring 38 | structure. For applications that share a ring between threads, for example 39 | having one thread do submits and another reap events, then this optimization 40 | cannot be used as each thread may have a different index for the registered 41 | ring fd. 42 | .SH RETURN VALUE 43 | Returns 1 on success, indicating that one file descriptor was registered, 44 | or 45 | .BR -errno 46 | on error. 47 | .SH SEE ALSO 48 | .BR io_uring_unregister_ring_fd (3), 49 | .BR io_uring_register_files (3) 50 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_register_sync_cancel.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2022 Jens Axboe 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_register_sync_cancel 3 "September 21, 2022" "liburing-2.3" "liburing Manual" 6 | .SH NAME 7 | io_uring_register_sync_cancel \- issue a synchronous cancelation request 8 | .SH SYNOPSIS 9 | .nf 10 | .B #include 11 | .PP 12 | .BI "int io_uring_register_sync_cancel(struct io_uring *" ring ", 13 | .BI " struct io_uring_sync_cancel_reg *" reg "); 14 | .PP 15 | .SH DESCRIPTION 16 | .PP 17 | The 18 | .BR io_uring_register_sync_cancel (3) 19 | function performs a synchronous cancelation request based on the parameters 20 | specified in 21 | .I reg . 22 | 23 | The 24 | .I reg 25 | argument must be filled in with the appropriate information for the 26 | cancelation request. It looks as follows: 27 | .PP 28 | .in +4n 29 | .EX 30 | struct io_uring_sync_cancel_reg { 31 | __u64 addr; 32 | __s32 fd; 33 | __u32 flags; 34 | struct __kernel_timespec timeout; 35 | __u64 pad[4]; 36 | }; 37 | .EE 38 | .in 39 | .PP 40 | 41 | The arguments largely mirror what the async prep functions support, see 42 | .BR io_uring_prep_cancel (3) 43 | for details. Similarly, the return value is the same. The exception is the 44 | .I timeout 45 | argument, which can be used to limit the time that the kernel will wait for 46 | cancelations to be successful. If the 47 | .I tv_sec 48 | and 49 | .I tv_nsec 50 | values are set to anything but 51 | .B -1UL , 52 | then they indicate a relative timeout upon which cancelations should be 53 | completed by. 54 | 55 | The 56 | .I pad 57 | values must be zero filled. 58 | 59 | .SH RETURN VALUE 60 | See 61 | .BR io_uring_prep_cancel (3) 62 | for details on the return value. If 63 | .I timeout 64 | is set to indicate a timeout, then 65 | .B -ETIME 66 | will be returned if exceeded. If an unknown value is set in the request, 67 | or if the pad values are not cleared to zero, then 68 | .I -EINVAL 69 | is returned. 70 | .SH SEE ALSO 71 | .BR io_uring_prep_cancel (3) 72 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_sq_ready.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2022 Stefan Roesch 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_sq_ready 3 "January 25, 2022" "liburing-2.1" "liburing Manual" 6 | .SH NAME 7 | io_uring_sq_ready \- number of unconsumed or unsubmitted entries in the SQ ring 8 | .SH SYNOPSIS 9 | .nf 10 | .B #include 11 | .PP 12 | .BI "unsigned io_uring_sq_ready(const struct io_uring *" ring ");" 13 | .fi 14 | .SH DESCRIPTION 15 | .PP 16 | The 17 | .BR io_uring_sq_ready (3) 18 | function returns the number of unconsumed (if SQPOLL) or unsubmitted entries 19 | that exist in the SQ ring belonging to the 20 | .I ring 21 | param. 22 | 23 | Usage of this function only applies if the ring has been setup with 24 | .B IORING_SETUP_SQPOLL, 25 | where request submissions, and hence consumption from the SQ ring, happens 26 | through a polling thread. 27 | 28 | .SH RETURN VALUE 29 | Returns the number of unconsumed or unsubmitted entries in the SQ ring. 30 | .SH SEE ALSO 31 | .BR io_uring_cq_ready (3) 32 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_sq_space_left.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2022 Stefan Roesch 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_sq_space-left 3 "January 25, 2022" "liburing-2.1" "liburing Manual" 6 | .SH NAME 7 | io_uring_sq_space_left \- free space in the SQ ring 8 | .SH SYNOPSIS 9 | .nf 10 | .B #include 11 | .PP 12 | .BI "unsigned io_uring_sq_space_left(const struct io_uring *" ring ");" 13 | .fi 14 | .SH DESCRIPTION 15 | .PP 16 | The 17 | .BR io_uring_sq_space_left (3) 18 | function returns how much space is left in the SQ ring belonging to the 19 | .I ring 20 | param. 21 | 22 | .SH RETURN VALUE 23 | Returns the number of availables entries in the SQ ring. 24 | .SH SEE ALSO 25 | .BR io_uring_sq_ready (3) 26 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_sqe_set_data.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2021 Stefan Roesch 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_sqe_set_data 3 "November 15, 2021" "liburing-2.1" "liburing Manual" 6 | .SH NAME 7 | io_uring_sqe_set_data \- set user data for submission queue event 8 | .SH SYNOPSIS 9 | .nf 10 | .B #include 11 | .PP 12 | .BI "void io_uring_sqe_set_data(struct io_uring_sqe *" sqe "," 13 | .BI " void *" user_data ");" 14 | .BI " 15 | .BI "void io_uring_sqe_set_data64(struct io_uring_sqe *" sqe "," 16 | .BI " __u64 " data ");" 17 | .fi 18 | .SH DESCRIPTION 19 | .PP 20 | The 21 | .BR io_uring_sqe_set_data (3) 22 | function stores a 23 | .I user_data 24 | pointer with the submission queue entry 25 | .IR sqe . 26 | 27 | The 28 | .BR io_uring_sqe_set_data64 (3) 29 | function stores a 64-bit 30 | .I data 31 | value with the submission queue entry 32 | .IR sqe . 33 | 34 | After the caller has requested a submission queue entry (SQE) with 35 | .BR io_uring_get_sqe (3) , 36 | they can associate a data pointer or value with the SQE. Once the completion 37 | arrives, the function 38 | .BR io_uring_cqe_get_data (3) 39 | or 40 | .BR io_uring_cqe_get_data64 (3) 41 | can be called to retrieve the data pointer or value associated with the 42 | submitted request. 43 | 44 | .SH RETURN VALUE 45 | None 46 | .SH SEE ALSO 47 | .BR io_uring_get_sqe (3), 48 | .BR io_uring_cqe_get_data (3) 49 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_sqe_set_data64.3: -------------------------------------------------------------------------------- 1 | io_uring_sqe_set_data.3 -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_sqring_wait.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2022 Stefan Roesch 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_sqring_wait 3 "January 25, 2022" "liburing-2.1" "liburing Manual" 6 | .SH NAME 7 | io_uring_sqring_wait \- wait for free space in the SQ ring 8 | .SH SYNOPSIS 9 | .nf 10 | .B #include 11 | .PP 12 | .BI "int io_uring_sqring_wait(struct io_uring *" ring ");" 13 | .fi 14 | .SH DESCRIPTION 15 | .PP 16 | The function 17 | .BR io_uring_sqring_wait (3) 18 | allows the caller to wait for space to free up in the SQ ring belonging to the 19 | .I ring 20 | param, which happens when the kernel side thread 21 | has consumed one or more entries. If the SQ ring is currently non-full, 22 | no action is taken. 23 | 24 | This feature can only be used when the ring has been setup with 25 | .B IORING_SETUP_SQPOLL 26 | and hence is using an offloaded approach to request submissions. 27 | 28 | .SH RETURN VALUE 29 | On success it returns the free space. If the kernel does not support the 30 | feature, -EINVAL is returned. 31 | .SH SEE ALSO 32 | .BR io_uring_submit (3), 33 | .BR io_uring_wait_cqe (3), 34 | .BR io_uring_wait_cqes (3) 35 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_submit.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2021 Stefan Roesch 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_submit 3 "November 15, 2021" "liburing-2.1" "liburing Manual" 6 | .SH NAME 7 | io_uring_submit \- submit requests to the submission queue 8 | .SH SYNOPSIS 9 | .nf 10 | .B #include 11 | .PP 12 | .BI "int io_uring_submit(struct io_uring *" ring ");" 13 | .fi 14 | .SH DESCRIPTION 15 | .PP 16 | The 17 | .BR io_uring_submit (3) 18 | function submits the next events to the submission queue belonging to the 19 | .IR ring . 20 | 21 | After the caller retrieves a submission queue entry (SQE) with 22 | .BR io_uring_get_sqe (3) 23 | and prepares the SQE using one of the provided helpers, it can be submitted with 24 | .BR io_uring_submit (3) . 25 | 26 | .SH RETURN VALUE 27 | On success 28 | .BR io_uring_submit (3) 29 | returns the number of submitted submission queue entries. On failure it returns 30 | .BR -errno . 31 | .SH NOTES 32 | For any request that passes in data in a struct, that data must remain 33 | valid until the request has been successfully submitted. It need not remain 34 | valid until completion. Once a request has been submitted, the in-kernel 35 | state is stable. Very early kernels (5.4 and earlier) required state to be 36 | stable until the completion occurred. Applications can test for this 37 | behavior by inspecting the 38 | .B IORING_FEAT_SUBMIT_STABLE 39 | flag passed back from 40 | .BR io_uring_queue_init_params (3). 41 | In general, the man pages for the individual prep helpers will have a note 42 | mentioning this fact as well, if required for the given command. 43 | .SH SEE ALSO 44 | .BR io_uring_get_sqe (3), 45 | .BR io_uring_submit_and_wait (3), 46 | .BR io_uring_submit_and_wait_timeout (3) 47 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_submit_and_get_events.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C), 2022 dylany 2 | .\" You may distribute this file under the terms of the GNU Free 3 | .\" Documentation License. 4 | .TH io_uring_submit_and_get_events 3 "September 5, 2022" "liburing-2.3" "liburing Manual" 5 | .SH NAME 6 | io_uring_submit_and_get_events \- submit requests to the submission queue and flush completions 7 | .SH SYNOPSIS 8 | .nf 9 | .B #include 10 | .PP 11 | .BI "int io_uring_submit_and_get_events(struct io_uring *" ring ");" 12 | .fi 13 | 14 | .SH DESCRIPTION 15 | The 16 | .BR io_uring_submit_and_get_events (3) 17 | function submits the next events to the submission queue as with 18 | .BR io_uring_submit (3) . 19 | After submission it will flush CQEs as with 20 | .BR io_uring_get_events (3) . 21 | 22 | The benefit of this function is that it does both with only one system call. 23 | 24 | .SH RETURN VALUE 25 | On success 26 | .BR io_uring_submit_and_get_events (3) 27 | returns the number of submitted submission queue entries. On failure it returns 28 | .BR -errno . 29 | .SH SEE ALSO 30 | .BR io_uring_submit (3), 31 | .BR io_uring_get_events (3) 32 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_submit_and_wait.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2021 Stefan Roesch 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_submit_and_wait 3 "November 15, 2021" "liburing-2.1" "liburing Manual" 6 | .SH NAME 7 | io_uring_submit_and_wait \- submit requests to the submission queue and wait for completion 8 | .SH SYNOPSIS 9 | .nf 10 | .B #include 11 | .PP 12 | .BI "int io_uring_submit_and_wait(struct io_uring *" ring "," 13 | .BI " unsigned " wait_nr ");" 14 | .fi 15 | .SH DESCRIPTION 16 | .PP 17 | The 18 | .BR io_uring_submit_and_wait (3) 19 | function submits the next requests from the submission queue belonging to the 20 | .I ring 21 | and waits for 22 | .I wait_nr 23 | completion events. 24 | 25 | After the caller retrieves a submission queue entry (SQE) with 26 | .BR io_uring_get_sqe (3) 27 | and prepares the SQE, it can be submitted with 28 | .BR io_uring_submit_and_wait (3) . 29 | 30 | .SH RETURN VALUE 31 | On success 32 | .BR io_uring_submit_and_wait (3) 33 | returns the number of submitted submission queue entries. On failure it returns 34 | .BR -errno . 35 | .SH SEE ALSO 36 | .BR io_uring_get_sqe (3), 37 | .BR io_uring_submit (3), 38 | .BR io_uring_submit_and_wait_timeout (3) 39 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_submit_and_wait_timeout.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2021 Stefan Roesch 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_submit_and_wait_timeout 3 "November 15, 2021" "liburing-2.1" "liburing Manual" 6 | .SH NAME 7 | io_uring_submit_and_wait_timeout \- submit requests to the submission queue and 8 | wait for the completion with timeout 9 | .SH SYNOPSIS 10 | .nf 11 | .B #include 12 | .PP 13 | .BI "int io_uring_submit_and_wait_timeout(struct io_uring *" ring "," 14 | .BI " struct io_uring_cqe **" cqe_ptr "," 15 | .BI " unsigned " wait_nr "," 16 | .BI " struct __kernel_timespec *" ts "," 17 | .BI " sigset_t *" sigmask ");" 18 | .fi 19 | .SH DESCRIPTION 20 | .PP 21 | The 22 | .BR io_uring_submit_and_wait_timeout (3) 23 | function submits the next requests from the submission queue belonging to the 24 | .I ring 25 | and waits for 26 | .I wait_nr 27 | completion events, or until the timeout 28 | .I ts 29 | expires. The completion events are stored in the 30 | .I cqe_ptr 31 | array. The 32 | .I sigmask 33 | specifies the set of signals to block. The prevailing signal mask is restored 34 | before returning. 35 | 36 | After the caller retrieves a submission queue entry (SQE) with 37 | .BR io_uring_get_sqe (3) 38 | and prepares the SQE, it can be submitted with 39 | .BR io_uring_submit_and_wait_timeout (3) . 40 | 41 | .SH RETURN VALUE 42 | On success 43 | .BR io_uring_submit_and_wait_timeout (3) 44 | returns the number of submitted submission queue entries. On failure it returns 45 | .BR -errno . 46 | Note that in earlier versions of the liburing library, the return value was 0 47 | on success. 48 | The most common failure case is not receiving a completion within the specified 49 | timeout, 50 | .B -ETIME 51 | is returned in this case. 52 | .SH SEE ALSO 53 | .BR io_uring_get_sqe (3), 54 | .BR io_uring_submit (3), 55 | .BR io_uring_submit_and_wait (3), 56 | .BR io_uring_wait_cqe (3) 57 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_unregister_buf_ring.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2022 Jens Axboe 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_unregister_buf_ring 3 "May 18, 2022" "liburing-2.2" "liburing Manual" 6 | .SH NAME 7 | io_uring_unregister_buf_ring \- unregister a previously registered buffer ring 8 | .SH SYNOPSIS 9 | .nf 10 | .B #include 11 | .PP 12 | .BI "int io_uring_unregister_buf_ring(struct io_uring *" ring ", 13 | .BI " int " bgid ");" 14 | .BI " 15 | .fi 16 | .SH DESCRIPTION 17 | .PP 18 | The 19 | .BR io_uring_unregister_buf_ring (3) 20 | function unregisters a previously registered shared buffer ring indicated by 21 | .IR bgid . 22 | 23 | .SH RETURN VALUE 24 | On success 25 | .BR io_uring_unregister_buf_ring (3) 26 | returns 0. On failure it returns 27 | .BR -errno . 28 | .SH SEE ALSO 29 | .BR io_uring_register_buf_ring (3), 30 | .BR io_uring_buf_ring_free (3) 31 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_unregister_buffers.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2021 Stefan Roesch 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_unregister_buffers 3 "November 15, 2021" "liburing-2.1" "liburing Manual" 6 | .SH NAME 7 | io_uring_unregister_buffers \- unregister buffers for fixed buffer operations 8 | .SH SYNOPSIS 9 | .nf 10 | .B #include 11 | .PP 12 | .BI "int io_uring_unregister_buffers(struct io_uring *" ring ");" 13 | .fi 14 | .SH DESCRIPTION 15 | .PP 16 | The 17 | .BR io_uring_unregister_buffers (3) 18 | function unregisters the fixed buffers previously registered to the 19 | .IR ring . 20 | 21 | .SH RETURN VALUE 22 | On success 23 | .BR io_uring_unregister_buffers (3) 24 | returns 0. On failure it returns 25 | .BR -errno . 26 | .SH SEE ALSO 27 | .BR io_uring_register_buffers (3) 28 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_unregister_eventfd.3: -------------------------------------------------------------------------------- 1 | io_uring_register_eventfd.3 -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_unregister_files.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2021 Stefan Roesch 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_unregister_files 3 "November 15, 2021" "liburing-2.1" "liburing Manual" 6 | .SH NAME 7 | io_uring_unregister_files \- unregister file descriptors 8 | .SH SYNOPSIS 9 | .nf 10 | .B #include 11 | .PP 12 | .BI "int io_uring_unregister_files(struct io_uring *" ring ");" 13 | .fi 14 | .SH DESCRIPTION 15 | .PP 16 | The 17 | .BR io_uring_unregister_files (3) 18 | function unregisters the file descriptors previously registered to the 19 | .IR ring . 20 | 21 | .SH RETURN VALUE 22 | On success 23 | .BR io_uring_unregister_files (3) 24 | returns 0. On failure it returns 25 | .BR -errno . 26 | .SH SEE ALSO 27 | .BR io_uring_register_files (3) 28 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_unregister_iowq_aff.3: -------------------------------------------------------------------------------- 1 | io_uring_register_iowq_aff.3 -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_unregister_ring_fd.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2022 Jens Axboe 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_unregister_ring_fd 3 "March 11, 2022" "liburing-2.2" "liburing Manual" 6 | .SH NAME 7 | io_uring_unregister_ring_fd \- unregister a ring file descriptor 8 | .SH SYNOPSIS 9 | .nf 10 | .B #include 11 | .PP 12 | .BI "int io_uring_unregister_ring_fd(struct io_uring *" ring ");" 13 | .fi 14 | .SH DESCRIPTION 15 | .PP 16 | .BR io_uring_unregister_ring_fd (3) 17 | unregisters the file descriptor of the ring. 18 | 19 | Unregisters a ring descriptor previously registered with the task. This is 20 | done automatically when 21 | .BR io_uring_queue_exit (3) 22 | is called, but can also be done to free up space for new ring registrations. 23 | For more information on ring descriptor registration, see 24 | .BR io_uring_register_ring_fd (3) 25 | 26 | .SH RETURN VALUE 27 | Returns 1 on success, indicating that one file descriptor was unregistered, or 28 | .BR -errno 29 | on error. 30 | .SH SEE ALSO 31 | .BR io_uring_register_ring_fd (3), 32 | .BR io_uring_register_files (3) 33 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_wait_cqe.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2021 Stefan Roesch 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_wait_cqe 3 "November 15, 2021" "liburing-2.1" "liburing Manual" 6 | .SH NAME 7 | io_uring_wait_cqe \- wait for one io_uring completion event 8 | .SH SYNOPSIS 9 | .nf 10 | .B #include 11 | .PP 12 | .BI "int io_uring_wait_cqe(struct io_uring *" ring "," 13 | .BI " struct io_uring_cqe **" cqe_ptr ");" 14 | .fi 15 | .SH DESCRIPTION 16 | .PP 17 | The 18 | .BR io_uring_wait_cqe (3) 19 | function waits for an IO completion from the queue belonging to the 20 | .I ring 21 | param, waiting for it if necessary. If an event is already available in 22 | the ring when invoked, no waiting will occur. The 23 | .I cqe_ptr 24 | param is filled in on success. 25 | 26 | After the caller has submitted a request with 27 | .BR io_uring_submit (3), 28 | the application can retrieve the completion with 29 | .BR io_uring_wait_cqe (3). 30 | 31 | .SH RETURN VALUE 32 | On success 33 | .BR io_uring_wait_cqe (3) 34 | returns 0 and the cqe_ptr param is filled in. On failure it returns 35 | .BR -errno . 36 | The return value indicates the result of waiting for a CQE, and it has no 37 | relation to the CQE result itself. 38 | .SH SEE ALSO 39 | .BR io_uring_submit (3), 40 | .BR io_uring_wait_cqe_timeout (3), 41 | .BR io_uring_wait_cqes (3) 42 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_wait_cqe_nr.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2021 Stefan Roesch 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_wait_cqe_nr 3 "November 15, 2021" "liburing-2.1" "liburing Manual" 6 | .SH NAME 7 | io_uring_wait_cqe_nr \- wait for one or more io_uring completion events 8 | .SH SYNOPSIS 9 | .nf 10 | .B #include 11 | .PP 12 | .BI "int io_uring_wait_cqe_nr(struct io_uring *" ring "," 13 | .BI " struct io_uring_cqe **" cqe_ptr "," 14 | .BI " unsigned " wait_nr ");" 15 | .fi 16 | .SH DESCRIPTION 17 | .PP 18 | The 19 | .BR io_uring_wait_cqe_nr (3) 20 | function returns 21 | .I wait_nr 22 | IO completion events from the queue belonging to the 23 | .I ring 24 | param, waiting for it if necessary. If the requested number of events are 25 | already available in the ring when invoked, no waiting will occur. The 26 | .I cqe_ptr 27 | param is filled in on success. 28 | 29 | After the caller has submitted a request with 30 | .BR io_uring_submit (3), 31 | the application can retrieve the completion with 32 | .BR io_uring_wait_cqe (3). 33 | 34 | .SH RETURN VALUE 35 | On success 36 | .BR io_uring_wait_cqe_nr (3) 37 | returns 0 and the cqe_ptr param is filled in. On failure it returns 38 | .BR -errno . 39 | The return value indicates the result of waiting for a CQE, and it has no 40 | relation to the CQE result itself. 41 | .SH SEE ALSO 42 | .BR io_uring_submit (3), 43 | .BR io_uring_wait_cqes (3) 44 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_wait_cqe_timeout.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2021 Stefan Roesch 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_wait_cqe_timeout 3 "November 15, 2021" "liburing-2.1" "liburing Manual" 6 | .SH NAME 7 | io_uring_wait_cqe_timeout \- wait for one io_uring completion event with timeout 8 | .SH SYNOPSIS 9 | .nf 10 | .B #include 11 | .PP 12 | .BI "int io_uring_wait_cqe_timeout(struct io_uring *" ring "," 13 | .BI " struct io_uring_cqe **" cqe_ptr "," 14 | .BI " struct __kernel_timespec *" ts ");" 15 | .fi 16 | .SH DESCRIPTION 17 | .PP 18 | The 19 | .BR io_uring_wait_cqe_timeout (3) 20 | function waits for one IO completion to be available from the queue belonging 21 | to the 22 | .I ring 23 | param, waiting for it if necessary or until the timeout 24 | .I ts 25 | expires. If an event is already available in the ring when invoked, no waiting 26 | will occur. 27 | 28 | The 29 | .I cqe_ptr 30 | param is filled in on success. 31 | 32 | If 33 | .I ts 34 | is specified and an older kernel without 35 | .B IORING_FEAT_EXT_ARG 36 | is used, the application does not need to call 37 | .BR io_uring_submit (3) 38 | before calling 39 | .BR io_uring_wait_cqes (3). 40 | For newer kernels with that feature flag set, there is no implied submit 41 | when waiting for a request. 42 | 43 | .SH RETURN VALUE 44 | On success 45 | .BR io_uring_wait_cqe_timeout (3) 46 | returns 0 and the cqe_ptr param is filled in. On failure it returns 47 | .BR -errno . 48 | The return value indicates the result of waiting for a CQE, and it has no 49 | relation to the CQE result itself. 50 | .SH SEE ALSO 51 | .BR io_uring_submit (3), 52 | .BR io_uring_wait_cqes (3), 53 | .BR io_uring_wait_cqe (3) 54 | -------------------------------------------------------------------------------- /vendor/liburing/man/io_uring_wait_cqes.3: -------------------------------------------------------------------------------- 1 | .\" Copyright (C) 2021 Stefan Roesch 2 | .\" 3 | .\" SPDX-License-Identifier: LGPL-2.0-or-later 4 | .\" 5 | .TH io_uring_wait_cqes 3 "November 15, 2021" "liburing-2.1" "liburing Manual" 6 | .SH NAME 7 | io_uring_wait_cqes \- wait for one or more io_uring completion events 8 | .SH SYNOPSIS 9 | .nf 10 | .B #include 11 | .PP 12 | .BI "int io_uring_wait_cqes(struct io_uring *" ring "," 13 | .BI " struct io_uring_cqe **" cqe_ptr "," 14 | .BI " unsigned " wait_nr "," 15 | .BI " struct __kernel_timespec *" ts "," 16 | .BI " sigset_t *" sigmask "); 17 | .fi 18 | .SH DESCRIPTION 19 | .PP 20 | The 21 | .BR io_uring_wait_cqes (3) 22 | function returns 23 | .I wait_nr 24 | IO completions from the queue belonging to the 25 | .I ring 26 | param, waiting for them if necessary or until the timeout 27 | .I ts 28 | expires. The 29 | .I sigmask 30 | specifies the set of signals to block. The prevailing signal mask is restored 31 | before returning. 32 | 33 | The 34 | .I cqe_ptr 35 | param is filled in on success with the first CQE. Callers of this function 36 | should use 37 | .BR io_uring_for_each_cqe (3) 38 | to iterate all available CQEs. 39 | 40 | If 41 | .I ts 42 | is specified and an older kernel without 43 | .B IORING_FEAT_EXT_ARG 44 | is used, the application does not need to call 45 | .BR io_uring_submit (3) 46 | before calling 47 | .BR io_uring_wait_cqes (3). 48 | For newer kernels with that feature flag set, there is no implied submit 49 | when waiting for a request. 50 | 51 | .SH RETURN VALUE 52 | On success 53 | .BR io_uring_wait_cqes (3) 54 | returns 0 and the cqe_ptr param is filled in. On failure it returns 55 | .BR -errno . 56 | .SH SEE ALSO 57 | .BR io_uring_submit (3), 58 | .BR io_uring_for_each_cqe (3), 59 | .BR io_uring_wait_cqe_timeout (3), 60 | .BR io_uring_wait_cqe (3) 61 | -------------------------------------------------------------------------------- /vendor/liburing/src/arch/aarch64/lib.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: MIT */ 2 | 3 | #ifndef LIBURING_ARCH_AARCH64_LIB_H 4 | #define LIBURING_ARCH_AARCH64_LIB_H 5 | 6 | #include 7 | #include 8 | #include "../../syscall.h" 9 | 10 | static inline long __get_page_size(void) 11 | { 12 | Elf64_Off buf[2]; 13 | long ret = 4096; 14 | int fd; 15 | 16 | fd = __sys_open("/proc/self/auxv", O_RDONLY, 0); 17 | if (fd < 0) 18 | return ret; 19 | 20 | while (1) { 21 | ssize_t x; 22 | 23 | x = __sys_read(fd, buf, sizeof(buf)); 24 | if (x < (long) sizeof(buf)) 25 | break; 26 | 27 | if (buf[0] == AT_PAGESZ) { 28 | ret = buf[1]; 29 | break; 30 | } 31 | } 32 | 33 | __sys_close(fd); 34 | return ret; 35 | } 36 | 37 | static inline long get_page_size(void) 38 | { 39 | static long cache_val; 40 | 41 | if (cache_val) 42 | return cache_val; 43 | 44 | cache_val = __get_page_size(); 45 | return cache_val; 46 | } 47 | 48 | #endif /* #ifndef LIBURING_ARCH_AARCH64_LIB_H */ 49 | -------------------------------------------------------------------------------- /vendor/liburing/src/arch/generic/lib.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: MIT */ 2 | 3 | #ifndef LIBURING_ARCH_GENERIC_LIB_H 4 | #define LIBURING_ARCH_GENERIC_LIB_H 5 | 6 | static inline long get_page_size(void) 7 | { 8 | long page_size; 9 | 10 | page_size = sysconf(_SC_PAGESIZE); 11 | if (page_size < 0) 12 | page_size = 4096; 13 | 14 | return page_size; 15 | } 16 | 17 | #endif /* #ifndef LIBURING_ARCH_GENERIC_LIB_H */ 18 | -------------------------------------------------------------------------------- /vendor/liburing/src/arch/x86/lib.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: MIT */ 2 | 3 | #ifndef LIBURING_ARCH_X86_LIB_H 4 | #define LIBURING_ARCH_X86_LIB_H 5 | 6 | static inline long get_page_size(void) 7 | { 8 | return 4096; 9 | } 10 | 11 | #endif /* #ifndef LIBURING_ARCH_X86_LIB_H */ 12 | -------------------------------------------------------------------------------- /vendor/liburing/src/ffi.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: MIT */ 2 | #define IOURINGINLINE 3 | 4 | #ifdef __clang__ 5 | // clang doesn't seem to particularly like that we're including a header that 6 | // deliberately contains function definitions so we explicitly silence it 7 | #pragma clang diagnostic push 8 | #pragma clang diagnostic ignored "-Wmissing-prototypes" 9 | #endif 10 | 11 | #include "liburing.h" 12 | 13 | #ifdef __clang__ 14 | #pragma clang diagnostic pop 15 | #endif 16 | -------------------------------------------------------------------------------- /vendor/liburing/src/int_flags.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: MIT */ 2 | #ifndef LIBURING_INT_FLAGS 3 | #define LIBURING_INT_FLAGS 4 | 5 | enum { 6 | INT_FLAG_REG_RING = 1, 7 | INT_FLAG_REG_REG_RING = 2, 8 | }; 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /vendor/liburing/src/lib.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: MIT */ 2 | #ifndef LIBURING_LIB_H 3 | #define LIBURING_LIB_H 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | #if defined(__x86_64__) || defined(__i386__) 10 | #include "arch/x86/lib.h" 11 | #elif defined(__aarch64__) 12 | #include "arch/aarch64/lib.h" 13 | #else 14 | /* 15 | * We don't have nolibc support for this arch. Must use libc! 16 | */ 17 | #ifdef CONFIG_NOLIBC 18 | #error "This arch doesn't support building liburing without libc" 19 | #endif 20 | /* libc wrappers. */ 21 | #include "arch/generic/lib.h" 22 | #endif 23 | 24 | 25 | #ifndef offsetof 26 | #define offsetof(TYPE, FIELD) ((size_t) &((TYPE *)0)->FIELD) 27 | #endif 28 | 29 | #ifndef container_of 30 | #define container_of(PTR, TYPE, FIELD) ({ \ 31 | __typeof__(((TYPE *)0)->FIELD) *__FIELD_PTR = (PTR); \ 32 | (TYPE *)((char *) __FIELD_PTR - offsetof(TYPE, FIELD)); \ 33 | }) 34 | #endif 35 | 36 | #define __maybe_unused __attribute__((__unused__)) 37 | #define __hot __attribute__((__hot__)) 38 | #define __cold __attribute__((__cold__)) 39 | 40 | #ifdef CONFIG_NOLIBC 41 | void *__uring_memset(void *s, int c, size_t n); 42 | void *__uring_malloc(size_t len); 43 | void __uring_free(void *p); 44 | 45 | #define malloc(LEN) __uring_malloc(LEN) 46 | #define free(PTR) __uring_free(PTR) 47 | #define memset(PTR, C, LEN) __uring_memset(PTR, C, LEN) 48 | #endif 49 | 50 | #endif /* #ifndef LIBURING_LIB_H */ 51 | -------------------------------------------------------------------------------- /vendor/liburing/src/liburing.map: -------------------------------------------------------------------------------- 1 | LIBURING_2.0 { 2 | global: 3 | io_uring_get_probe; 4 | io_uring_get_probe_ring; 5 | io_uring_free_probe; 6 | io_uring_get_sqe; 7 | io_uring_peek_batch_cqe; 8 | io_uring_queue_exit; 9 | io_uring_queue_init; 10 | io_uring_queue_init_params; 11 | io_uring_queue_mmap; 12 | io_uring_register_buffers; 13 | io_uring_register_eventfd; 14 | io_uring_register_eventfd_async; 15 | io_uring_register_files; 16 | io_uring_register_files_update; 17 | io_uring_register_personality; 18 | io_uring_register_probe; 19 | io_uring_ring_dontfork; 20 | io_uring_submit; 21 | io_uring_submit_and_wait; 22 | io_uring_unregister_buffers; 23 | io_uring_unregister_eventfd; 24 | io_uring_unregister_files; 25 | io_uring_unregister_personality; 26 | io_uring_wait_cqe_timeout; 27 | io_uring_wait_cqes; 28 | 29 | __io_uring_get_cqe; 30 | __io_uring_sqring_wait; 31 | local: 32 | *; 33 | }; 34 | 35 | LIBURING_2.1 { 36 | global: 37 | io_uring_mlock_size_params; 38 | io_uring_mlock_size; 39 | io_uring_register_buffers_tags; 40 | io_uring_register_buffers_update_tag; 41 | io_uring_register_files_tags; 42 | io_uring_register_files_update_tag; 43 | io_uring_register_iowq_aff; 44 | io_uring_unregister_iowq_aff; 45 | io_uring_register_iowq_max_workers; 46 | } LIBURING_2.0; 47 | 48 | LIBURING_2.2 { 49 | global: 50 | io_uring_submit_and_wait_timeout; 51 | io_uring_register_ring_fd; 52 | io_uring_unregister_ring_fd; 53 | io_uring_register_files_sparse; 54 | io_uring_register_buffers_sparse; 55 | io_uring_register_buf_ring; 56 | io_uring_unregister_buf_ring; 57 | } LIBURING_2.1; 58 | 59 | LIBURING_2.3 { 60 | global: 61 | io_uring_register_sync_cancel; 62 | io_uring_register_file_alloc_range; 63 | io_uring_enter; 64 | io_uring_enter2; 65 | io_uring_setup; 66 | io_uring_register; 67 | io_uring_get_events; 68 | io_uring_submit_and_get_events; 69 | } LIBURING_2.2; 70 | 71 | LIBURING_2.4 { 72 | global: 73 | io_uring_major_version; 74 | io_uring_minor_version; 75 | io_uring_check_version; 76 | 77 | io_uring_close_ring_fd; 78 | io_uring_enable_rings; 79 | io_uring_register_restrictions; 80 | io_uring_setup_buf_ring; 81 | io_uring_free_buf_ring; 82 | } LIBURING_2.3; 83 | -------------------------------------------------------------------------------- /vendor/liburing/src/nolibc.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: MIT */ 2 | 3 | #ifndef CONFIG_NOLIBC 4 | #error "This file should only be compiled for no libc build" 5 | #endif 6 | 7 | #include "lib.h" 8 | #include "syscall.h" 9 | 10 | void *__uring_memset(void *s, int c, size_t n) 11 | { 12 | size_t i; 13 | unsigned char *p = s; 14 | 15 | for (i = 0; i < n; i++) { 16 | p[i] = (unsigned char) c; 17 | 18 | /* 19 | * An empty inline ASM to avoid auto-vectorization 20 | * because it's too bloated for liburing. 21 | */ 22 | __asm__ volatile (""); 23 | } 24 | 25 | return s; 26 | } 27 | 28 | struct uring_heap { 29 | size_t len; 30 | char user_p[] __attribute__((__aligned__)); 31 | }; 32 | 33 | void *__uring_malloc(size_t len) 34 | { 35 | struct uring_heap *heap; 36 | 37 | heap = __sys_mmap(NULL, sizeof(*heap) + len, PROT_READ | PROT_WRITE, 38 | MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); 39 | if (IS_ERR(heap)) 40 | return NULL; 41 | 42 | heap->len = sizeof(*heap) + len; 43 | return heap->user_p; 44 | } 45 | 46 | void __uring_free(void *p) 47 | { 48 | struct uring_heap *heap; 49 | 50 | if (uring_unlikely(!p)) 51 | return; 52 | 53 | heap = container_of(p, struct uring_heap, user_p); 54 | __sys_munmap(heap, heap->len); 55 | } 56 | -------------------------------------------------------------------------------- /vendor/liburing/src/syscall.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: MIT */ 2 | 3 | #include "syscall.h" 4 | #include 5 | 6 | int io_uring_enter(unsigned int fd, unsigned int to_submit, 7 | unsigned int min_complete, unsigned int flags, sigset_t *sig) 8 | { 9 | return __sys_io_uring_enter(fd, to_submit, min_complete, flags, sig); 10 | } 11 | 12 | int io_uring_enter2(unsigned int fd, unsigned int to_submit, 13 | unsigned int min_complete, unsigned int flags, 14 | sigset_t *sig, size_t sz) 15 | { 16 | return __sys_io_uring_enter2(fd, to_submit, min_complete, flags, sig, 17 | sz); 18 | } 19 | 20 | int io_uring_setup(unsigned int entries, struct io_uring_params *p) 21 | { 22 | return __sys_io_uring_setup(entries, p); 23 | } 24 | 25 | int io_uring_register(unsigned int fd, unsigned int opcode, const void *arg, 26 | unsigned int nr_args) 27 | { 28 | return __sys_io_uring_register(fd, opcode, arg, nr_args); 29 | } 30 | -------------------------------------------------------------------------------- /vendor/liburing/src/syscall.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: MIT */ 2 | #ifndef LIBURING_SYSCALL_H 3 | #define LIBURING_SYSCALL_H 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | /* 16 | * Don't put this below the #include "arch/$arch/syscall.h", that 17 | * file may need it. 18 | */ 19 | struct io_uring_params; 20 | 21 | static inline void *ERR_PTR(intptr_t n) 22 | { 23 | return (void *) n; 24 | } 25 | 26 | static inline int PTR_ERR(const void *ptr) 27 | { 28 | return (int) (intptr_t) ptr; 29 | } 30 | 31 | static inline bool IS_ERR(const void *ptr) 32 | { 33 | return uring_unlikely((uintptr_t) ptr >= (uintptr_t) -4095UL); 34 | } 35 | 36 | #if defined(__x86_64__) || defined(__i386__) 37 | #include "arch/x86/syscall.h" 38 | #elif defined(__aarch64__) 39 | #include "arch/aarch64/syscall.h" 40 | #else 41 | /* 42 | * We don't have native syscall wrappers 43 | * for this arch. Must use libc! 44 | */ 45 | #ifdef CONFIG_NOLIBC 46 | #error "This arch doesn't support building liburing without libc" 47 | #endif 48 | /* libc syscall wrappers. */ 49 | #include "arch/generic/syscall.h" 50 | #endif 51 | #endif 52 | -------------------------------------------------------------------------------- /vendor/liburing/src/version.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: MIT */ 2 | 3 | #include "liburing.h" 4 | #include "liburing/io_uring_version.h" 5 | 6 | int io_uring_major_version(void) 7 | { 8 | return IO_URING_VERSION_MAJOR; 9 | } 10 | 11 | int io_uring_minor_version(void) 12 | { 13 | return IO_URING_VERSION_MINOR; 14 | } 15 | 16 | bool io_uring_check_version(int major, int minor) 17 | { 18 | return major > io_uring_major_version() || 19 | (major == io_uring_major_version() && 20 | minor >= io_uring_minor_version()); 21 | } 22 | -------------------------------------------------------------------------------- /vendor/liburing/test/500f9fbadef8.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: MIT */ 2 | /* 3 | * Description: Single depth submit+wait poll hang test 4 | * 5 | */ 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include "helpers.h" 14 | #include "liburing.h" 15 | 16 | #define BLOCKS 4096 17 | 18 | int main(int argc, char *argv[]) 19 | { 20 | struct io_uring ring; 21 | struct io_uring_sqe *sqe; 22 | struct io_uring_cqe *cqe; 23 | struct iovec iov; 24 | char buf[32]; 25 | off_t offset; 26 | unsigned blocks; 27 | int ret, fd; 28 | 29 | if (argc > 1) 30 | return T_EXIT_SKIP; 31 | 32 | t_posix_memalign(&iov.iov_base, 4096, 4096); 33 | iov.iov_len = 4096; 34 | 35 | ret = io_uring_queue_init(1, &ring, IORING_SETUP_IOPOLL); 36 | if (ret) { 37 | fprintf(stderr, "ring setup failed\n"); 38 | return T_EXIT_FAIL; 39 | 40 | } 41 | 42 | sprintf(buf, "./XXXXXX"); 43 | fd = mkostemp(buf, O_WRONLY | O_DIRECT | O_CREAT); 44 | if (fd < 0) { 45 | if (errno == EINVAL) 46 | return T_EXIT_SKIP; 47 | perror("mkostemp"); 48 | return T_EXIT_FAIL; 49 | } 50 | 51 | offset = 0; 52 | blocks = BLOCKS; 53 | do { 54 | sqe = io_uring_get_sqe(&ring); 55 | if (!sqe) { 56 | fprintf(stderr, "get sqe failed\n"); 57 | goto err; 58 | } 59 | io_uring_prep_writev(sqe, fd, &iov, 1, offset); 60 | ret = io_uring_submit_and_wait(&ring, 1); 61 | if (ret < 0) { 62 | fprintf(stderr, "submit_and_wait: %d\n", ret); 63 | goto err; 64 | } 65 | ret = io_uring_wait_cqe(&ring, &cqe); 66 | if (ret < 0) { 67 | fprintf(stderr, "wait completion: %d\n", ret); 68 | goto err; 69 | } 70 | if (cqe->res != 4096) { 71 | if (cqe->res == -EOPNOTSUPP) 72 | goto skipped; 73 | goto err; 74 | } 75 | io_uring_cqe_seen(&ring, cqe); 76 | offset += 4096; 77 | } while (--blocks); 78 | 79 | close(fd); 80 | unlink(buf); 81 | return T_EXIT_PASS; 82 | err: 83 | close(fd); 84 | unlink(buf); 85 | return T_EXIT_FAIL; 86 | skipped: 87 | fprintf(stderr, "Polling not supported in current dir, test skipped\n"); 88 | close(fd); 89 | unlink(buf); 90 | return T_EXIT_SKIP; 91 | } 92 | -------------------------------------------------------------------------------- /vendor/liburing/test/8a9973408177.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: MIT */ 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include "liburing.h" 10 | #include "helpers.h" 11 | 12 | static int register_file(struct io_uring *ring) 13 | { 14 | char buf[32]; 15 | int ret, fd; 16 | 17 | sprintf(buf, "./XXXXXX"); 18 | fd = mkstemp(buf); 19 | if (fd < 0) { 20 | perror("open"); 21 | return 1; 22 | } 23 | 24 | ret = io_uring_register_files(ring, &fd, 1); 25 | if (ret) { 26 | fprintf(stderr, "file register %d\n", ret); 27 | return 1; 28 | } 29 | 30 | ret = io_uring_unregister_files(ring); 31 | if (ret) { 32 | fprintf(stderr, "file register %d\n", ret); 33 | return 1; 34 | } 35 | 36 | unlink(buf); 37 | close(fd); 38 | return 0; 39 | } 40 | 41 | static int test_single_fsync(struct io_uring *ring) 42 | { 43 | struct io_uring_cqe *cqe; 44 | struct io_uring_sqe *sqe; 45 | char buf[32]; 46 | int fd, ret; 47 | 48 | sprintf(buf, "./XXXXXX"); 49 | fd = mkstemp(buf); 50 | if (fd < 0) { 51 | perror("open"); 52 | return 1; 53 | } 54 | 55 | sqe = io_uring_get_sqe(ring); 56 | if (!sqe) { 57 | printf("get sqe failed\n"); 58 | goto err; 59 | } 60 | 61 | io_uring_prep_fsync(sqe, fd, 0); 62 | 63 | ret = io_uring_submit(ring); 64 | if (ret <= 0) { 65 | printf("sqe submit failed: %d\n", ret); 66 | goto err; 67 | } 68 | 69 | ret = io_uring_wait_cqe(ring, &cqe); 70 | if (ret < 0) { 71 | printf("wait completion %d\n", ret); 72 | goto err; 73 | } 74 | 75 | io_uring_cqe_seen(ring, cqe); 76 | unlink(buf); 77 | return 0; 78 | err: 79 | unlink(buf); 80 | return 1; 81 | } 82 | 83 | int main(int argc, char *argv[]) 84 | { 85 | struct io_uring ring; 86 | int ret; 87 | 88 | if (argc > 1) 89 | return T_EXIT_SKIP; 90 | 91 | ret = io_uring_queue_init(8, &ring, 0); 92 | if (ret) { 93 | printf("ring setup failed\n"); 94 | return T_EXIT_FAIL; 95 | } 96 | 97 | ret = register_file(&ring); 98 | if (ret) 99 | return ret; 100 | ret = test_single_fsync(&ring); 101 | if (ret) { 102 | printf("test_single_fsync failed\n"); 103 | return ret; 104 | } 105 | 106 | return T_EXIT_PASS; 107 | } 108 | -------------------------------------------------------------------------------- /vendor/liburing/test/917257daa0fe.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: MIT */ 2 | // autogenerated by syzkaller (https://github.com/google/syzkaller) 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include "liburing.h" 14 | #include "helpers.h" 15 | #include "../src/syscall.h" 16 | 17 | int main(int argc, char *argv[]) 18 | { 19 | if (argc > 1) 20 | return T_EXIT_SKIP; 21 | 22 | mmap((void *) 0x20000000, 0x1000000, 3, MAP_ANON|MAP_PRIVATE, -1, 0); 23 | 24 | *(uint32_t*)0x20000000 = 0; 25 | *(uint32_t*)0x20000004 = 0; 26 | *(uint32_t*)0x20000008 = 6; 27 | *(uint32_t*)0x2000000c = 0; 28 | *(uint32_t*)0x20000010 = 0x3af; 29 | *(uint32_t*)0x20000014 = 0; 30 | *(uint32_t*)0x20000018 = 0; 31 | *(uint32_t*)0x2000001c = 0; 32 | *(uint32_t*)0x20000020 = 0; 33 | *(uint32_t*)0x20000024 = 0; 34 | *(uint32_t*)0x20000028 = 0; 35 | *(uint32_t*)0x2000002c = 0; 36 | *(uint32_t*)0x20000030 = 0; 37 | *(uint32_t*)0x20000034 = 0; 38 | *(uint32_t*)0x20000038 = 0; 39 | *(uint32_t*)0x2000003c = 0; 40 | *(uint32_t*)0x20000040 = 0; 41 | *(uint32_t*)0x20000044 = 0; 42 | *(uint64_t*)0x20000048 = 0; 43 | *(uint32_t*)0x20000050 = 0; 44 | *(uint32_t*)0x20000054 = 0; 45 | *(uint32_t*)0x20000058 = 0; 46 | *(uint32_t*)0x2000005c = 0; 47 | *(uint32_t*)0x20000060 = 0; 48 | *(uint32_t*)0x20000064 = 0; 49 | *(uint32_t*)0x20000068 = 0; 50 | *(uint32_t*)0x2000006c = 0; 51 | *(uint64_t*)0x20000070 = 0; 52 | __sys_io_uring_setup(0x7a6, (struct io_uring_params *) 0x20000000UL); 53 | return T_EXIT_PASS; 54 | } 55 | -------------------------------------------------------------------------------- /vendor/liburing/test/a0908ae19763.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: MIT */ 2 | // autogenerated by syzkaller (https://github.com/google/syzkaller) 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include "liburing.h" 14 | #include "helpers.h" 15 | #include "../src/syscall.h" 16 | 17 | static uint64_t r[1] = {0xffffffffffffffff}; 18 | 19 | int main(int argc, char *argv[]) 20 | { 21 | if (argc > 1) 22 | return T_EXIT_SKIP; 23 | mmap((void *) 0x20000000, 0x1000000, 3, MAP_ANON|MAP_PRIVATE, -1, 0); 24 | intptr_t res = 0; 25 | *(uint32_t*)0x20000080 = 0; 26 | *(uint32_t*)0x20000084 = 0; 27 | *(uint32_t*)0x20000088 = 0; 28 | *(uint32_t*)0x2000008c = 0; 29 | *(uint32_t*)0x20000090 = 0; 30 | *(uint32_t*)0x20000094 = 0; 31 | *(uint32_t*)0x20000098 = 0; 32 | *(uint32_t*)0x2000009c = 0; 33 | *(uint32_t*)0x200000a0 = 0; 34 | *(uint32_t*)0x200000a4 = 0; 35 | *(uint32_t*)0x200000a8 = 0; 36 | *(uint32_t*)0x200000ac = 0; 37 | *(uint32_t*)0x200000b0 = 0; 38 | *(uint32_t*)0x200000b4 = 0; 39 | *(uint32_t*)0x200000b8 = 0; 40 | *(uint32_t*)0x200000bc = 0; 41 | *(uint32_t*)0x200000c0 = 0; 42 | *(uint32_t*)0x200000c4 = 0; 43 | *(uint64_t*)0x200000c8 = 0; 44 | *(uint32_t*)0x200000d0 = 0; 45 | *(uint32_t*)0x200000d4 = 0; 46 | *(uint32_t*)0x200000d8 = 0; 47 | *(uint32_t*)0x200000dc = 0; 48 | *(uint32_t*)0x200000e0 = 0; 49 | *(uint32_t*)0x200000e4 = 0; 50 | *(uint32_t*)0x200000e8 = 0; 51 | *(uint32_t*)0x200000ec = 0; 52 | *(uint64_t*)0x200000f0 = 0; 53 | res = __sys_io_uring_setup(0xa4, (struct io_uring_params *) 0x20000080); 54 | if (res != -1) 55 | r[0] = res; 56 | *(uint32_t*)0x20000280 = -1; 57 | __sys_io_uring_register(r[0], 2, (const void *) 0x20000280, 1); 58 | return T_EXIT_PASS; 59 | } 60 | -------------------------------------------------------------------------------- /vendor/liburing/test/accept-test.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: MIT */ 2 | /* 3 | * Description: Check to see if accept handles addr and addrlen 4 | */ 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include "liburing.h" 11 | #include "helpers.h" 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | struct io_uring_sqe *sqe; 16 | struct io_uring_cqe *cqe; 17 | struct io_uring ring; 18 | struct sockaddr_un addr; 19 | socklen_t addrlen = sizeof(addr); 20 | int ret, fd; 21 | struct __kernel_timespec ts = { 22 | .tv_sec = 0, 23 | .tv_nsec = 1000000 24 | }; 25 | 26 | if (argc > 1) 27 | return T_EXIT_SKIP; 28 | 29 | if (io_uring_queue_init(4, &ring, 0) != 0) { 30 | fprintf(stderr, "ring setup failed\n"); 31 | return T_EXIT_FAIL; 32 | } 33 | 34 | fd = socket(AF_UNIX, SOCK_STREAM, 0); 35 | assert(fd != -1); 36 | 37 | memset(&addr, 0, sizeof(addr)); 38 | addr.sun_family = AF_UNIX; 39 | memcpy(addr.sun_path, "\0sock2", 7); 40 | 41 | ret = bind(fd, (struct sockaddr *)&addr, addrlen); 42 | assert(ret != -1); 43 | ret = listen(fd, 128); 44 | assert(ret != -1); 45 | 46 | sqe = io_uring_get_sqe(&ring); 47 | if (!sqe) { 48 | fprintf(stderr, "get sqe failed\n"); 49 | return T_EXIT_FAIL; 50 | } 51 | io_uring_prep_accept(sqe, fd, (struct sockaddr*)&addr, &addrlen, 0); 52 | sqe->user_data = 1; 53 | 54 | ret = io_uring_submit(&ring); 55 | if (ret != 1) { 56 | fprintf(stderr, "Got submit %d, expected 1\n", ret); 57 | return T_EXIT_FAIL; 58 | } 59 | 60 | ret = io_uring_wait_cqe_timeout(&ring, &cqe, &ts); 61 | if (!ret) { 62 | if (cqe->res == -EBADF || cqe->res == -EINVAL) { 63 | fprintf(stdout, "Accept not supported, skipping\n"); 64 | goto skip; 65 | } else if (cqe->res < 0) { 66 | fprintf(stderr, "cqe error %d\n", cqe->res); 67 | goto err; 68 | } 69 | } else if (ret != -ETIME) { 70 | fprintf(stderr, "accept() failed to use addr & addrlen parameters!\n"); 71 | return T_EXIT_FAIL; 72 | } 73 | 74 | io_uring_queue_exit(&ring); 75 | return T_EXIT_PASS; 76 | 77 | skip: 78 | io_uring_queue_exit(&ring); 79 | return T_EXIT_SKIP; 80 | err: 81 | io_uring_queue_exit(&ring); 82 | return T_EXIT_FAIL; 83 | } 84 | -------------------------------------------------------------------------------- /vendor/liburing/test/b19062a56726.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: MIT */ 2 | // autogenerated by syzkaller (https://github.com/google/syzkaller) 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include "liburing.h" 14 | #include "helpers.h" 15 | #include "../src/syscall.h" 16 | 17 | int main(int argc, char *argv[]) 18 | { 19 | if (argc > 1) 20 | return T_EXIT_SKIP; 21 | 22 | mmap((void *) 0x20000000, 0x1000000, 3, MAP_ANON|MAP_PRIVATE, -1, 0); 23 | 24 | *(uint32_t*)0x20000200 = 0; 25 | *(uint32_t*)0x20000204 = 0; 26 | *(uint32_t*)0x20000208 = 5; 27 | *(uint32_t*)0x2000020c = 0x400; 28 | *(uint32_t*)0x20000210 = 0; 29 | *(uint32_t*)0x20000214 = 0; 30 | *(uint32_t*)0x20000218 = 0; 31 | *(uint32_t*)0x2000021c = 0; 32 | *(uint32_t*)0x20000220 = 0; 33 | *(uint32_t*)0x20000224 = 0; 34 | *(uint32_t*)0x20000228 = 0; 35 | *(uint32_t*)0x2000022c = 0; 36 | *(uint32_t*)0x20000230 = 0; 37 | *(uint32_t*)0x20000234 = 0; 38 | *(uint32_t*)0x20000238 = 0; 39 | *(uint32_t*)0x2000023c = 0; 40 | *(uint32_t*)0x20000240 = 0; 41 | *(uint32_t*)0x20000244 = 0; 42 | *(uint64_t*)0x20000248 = 0; 43 | *(uint32_t*)0x20000250 = 0; 44 | *(uint32_t*)0x20000254 = 0; 45 | *(uint32_t*)0x20000258 = 0; 46 | *(uint32_t*)0x2000025c = 0; 47 | *(uint32_t*)0x20000260 = 0; 48 | *(uint32_t*)0x20000264 = 0; 49 | *(uint32_t*)0x20000268 = 0; 50 | *(uint32_t*)0x2000026c = 0; 51 | *(uint64_t*)0x20000270 = 0; 52 | __sys_io_uring_setup(0xc9f, (struct io_uring_params *) 0x20000200); 53 | return T_EXIT_PASS; 54 | } 55 | -------------------------------------------------------------------------------- /vendor/liburing/test/b5837bd5311d.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: MIT */ 2 | /* 3 | * Description: Check to see if wait_nr is being honored. 4 | */ 5 | #include 6 | #include "liburing.h" 7 | #include "helpers.h" 8 | 9 | int main(int argc, char *argv[]) 10 | { 11 | struct io_uring_sqe *sqe; 12 | struct io_uring_cqe *cqe; 13 | struct io_uring ring; 14 | int ret; 15 | struct __kernel_timespec ts = { 16 | .tv_sec = 0, 17 | .tv_nsec = 10000000 18 | }; 19 | 20 | if (argc > 1) 21 | return T_EXIT_SKIP; 22 | 23 | if (io_uring_queue_init(4, &ring, 0) != 0) { 24 | fprintf(stderr, "ring setup failed\n"); 25 | return T_EXIT_FAIL; 26 | } 27 | 28 | /* 29 | * First, submit the timeout sqe so we can actually finish the test 30 | * if everything is in working order. 31 | */ 32 | sqe = io_uring_get_sqe(&ring); 33 | if (!sqe) { 34 | fprintf(stderr, "get sqe failed\n"); 35 | return T_EXIT_FAIL; 36 | } 37 | io_uring_prep_timeout(sqe, &ts, (unsigned)-1, 0); 38 | 39 | ret = io_uring_submit(&ring); 40 | if (ret != 1) { 41 | fprintf(stderr, "Got submit %d, expected 1\n", ret); 42 | return T_EXIT_FAIL; 43 | } 44 | 45 | /* 46 | * Next, submit a nop and wait for two events. If everything is working 47 | * as it should, we should be waiting for more than a millisecond and we 48 | * should see two cqes. Otherwise, execution continues immediately 49 | * and we see only one cqe. 50 | */ 51 | sqe = io_uring_get_sqe(&ring); 52 | if (!sqe) { 53 | fprintf(stderr, "get sqe failed\n"); 54 | return T_EXIT_FAIL; 55 | } 56 | io_uring_prep_nop(sqe); 57 | 58 | ret = io_uring_submit_and_wait(&ring, 2); 59 | if (ret != 1) { 60 | fprintf(stderr, "Got submit %d, expected 1\n", ret); 61 | return T_EXIT_FAIL; 62 | } 63 | 64 | if (io_uring_peek_cqe(&ring, &cqe) != 0) { 65 | fprintf(stderr, "Unable to peek cqe!\n"); 66 | return T_EXIT_FAIL; 67 | } 68 | 69 | io_uring_cqe_seen(&ring, cqe); 70 | 71 | if (io_uring_peek_cqe(&ring, &cqe) != 0) { 72 | fprintf(stderr, "Unable to peek cqe!\n"); 73 | return T_EXIT_FAIL; 74 | } 75 | 76 | io_uring_queue_exit(&ring); 77 | return T_EXIT_PASS; 78 | } 79 | -------------------------------------------------------------------------------- /vendor/liburing/test/config: -------------------------------------------------------------------------------- 1 | # Copy this to config.local, uncomment and define values 2 | # 3 | # Define tests to exclude from running 4 | # TEST_EXCLUDE="" 5 | # 6 | # Define raw test devices (or files) for test cases, if any 7 | # declare -A TEST_MAP=() 8 | # 9 | # If no TEST_MAP entry exists for a test, use the ones given in TEST_FILES 10 | # TEST_FILES="/dev/somedevice /data/somefile" 11 | -------------------------------------------------------------------------------- /vendor/liburing/test/cq-full.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: MIT */ 2 | /* 3 | * Description: test CQ ring overflow 4 | * 5 | */ 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include "liburing.h" 14 | #include "helpers.h" 15 | 16 | static int queue_n_nops(struct io_uring *ring, int n) 17 | { 18 | struct io_uring_sqe *sqe; 19 | int i, ret; 20 | 21 | for (i = 0; i < n; i++) { 22 | sqe = io_uring_get_sqe(ring); 23 | if (!sqe) { 24 | printf("get sqe failed\n"); 25 | goto err; 26 | } 27 | 28 | io_uring_prep_nop(sqe); 29 | } 30 | 31 | ret = io_uring_submit(ring); 32 | if (ret < n) { 33 | printf("Submitted only %d\n", ret); 34 | goto err; 35 | } else if (ret < 0) { 36 | printf("sqe submit failed: %d\n", ret); 37 | goto err; 38 | } 39 | 40 | return 0; 41 | err: 42 | return 1; 43 | } 44 | 45 | int main(int argc, char *argv[]) 46 | { 47 | struct io_uring_cqe *cqe; 48 | struct io_uring_params p; 49 | struct io_uring ring; 50 | int i, ret; 51 | 52 | if (argc > 1) 53 | return T_EXIT_SKIP; 54 | 55 | memset(&p, 0, sizeof(p)); 56 | ret = io_uring_queue_init_params(4, &ring, &p); 57 | if (ret) { 58 | printf("ring setup failed\n"); 59 | return T_EXIT_FAIL; 60 | 61 | } 62 | 63 | if (queue_n_nops(&ring, 4)) 64 | goto err; 65 | if (queue_n_nops(&ring, 4)) 66 | goto err; 67 | if (queue_n_nops(&ring, 4)) 68 | goto err; 69 | 70 | i = 0; 71 | do { 72 | ret = io_uring_peek_cqe(&ring, &cqe); 73 | if (ret < 0) { 74 | if (ret == -EAGAIN) 75 | break; 76 | printf("wait completion %d\n", ret); 77 | goto err; 78 | } 79 | io_uring_cqe_seen(&ring, cqe); 80 | if (!cqe) 81 | break; 82 | i++; 83 | } while (1); 84 | 85 | if (i < 8 || 86 | ((*ring.cq.koverflow != 4) && !(p.features & IORING_FEAT_NODROP))) { 87 | printf("CQ overflow fail: %d completions, %u overflow\n", i, 88 | *ring.cq.koverflow); 89 | goto err; 90 | } 91 | 92 | io_uring_queue_exit(&ring); 93 | return T_EXIT_PASS; 94 | err: 95 | io_uring_queue_exit(&ring); 96 | return T_EXIT_FAIL; 97 | } 98 | -------------------------------------------------------------------------------- /vendor/liburing/test/cq-ready.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: MIT */ 2 | /* 3 | * Description: test CQ ready 4 | * 5 | */ 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include "liburing.h" 14 | #include "helpers.h" 15 | 16 | static int queue_n_nops(struct io_uring *ring, int n) 17 | { 18 | struct io_uring_sqe *sqe; 19 | int i, ret; 20 | 21 | for (i = 0; i < n; i++) { 22 | sqe = io_uring_get_sqe(ring); 23 | if (!sqe) { 24 | printf("get sqe failed\n"); 25 | goto err; 26 | } 27 | 28 | io_uring_prep_nop(sqe); 29 | } 30 | 31 | ret = io_uring_submit(ring); 32 | if (ret < n) { 33 | printf("Submitted only %d\n", ret); 34 | goto err; 35 | } else if (ret < 0) { 36 | printf("sqe submit failed: %d\n", ret); 37 | goto err; 38 | } 39 | 40 | return 0; 41 | err: 42 | return 1; 43 | } 44 | 45 | #define CHECK_READY(ring, expected) do {\ 46 | ready = io_uring_cq_ready((ring));\ 47 | if (ready != expected) {\ 48 | printf("Got %d CQs ready, expected %d\n", ready, expected);\ 49 | goto err;\ 50 | }\ 51 | } while(0) 52 | 53 | int main(int argc, char *argv[]) 54 | { 55 | struct io_uring ring; 56 | int ret; 57 | unsigned ready; 58 | 59 | if (argc > 1) 60 | return T_EXIT_SKIP; 61 | 62 | ret = io_uring_queue_init(4, &ring, 0); 63 | if (ret) { 64 | printf("ring setup failed\n"); 65 | return T_EXIT_FAIL; 66 | 67 | } 68 | 69 | CHECK_READY(&ring, 0); 70 | if (queue_n_nops(&ring, 4)) 71 | goto err; 72 | 73 | CHECK_READY(&ring, 4); 74 | io_uring_cq_advance(&ring, 4); 75 | CHECK_READY(&ring, 0); 76 | if (queue_n_nops(&ring, 4)) 77 | goto err; 78 | 79 | CHECK_READY(&ring, 4); 80 | 81 | io_uring_cq_advance(&ring, 1); 82 | CHECK_READY(&ring, 3); 83 | 84 | io_uring_cq_advance(&ring, 2); 85 | CHECK_READY(&ring, 1); 86 | 87 | io_uring_cq_advance(&ring, 1); 88 | CHECK_READY(&ring, 0); 89 | 90 | io_uring_queue_exit(&ring); 91 | return T_EXIT_PASS; 92 | err: 93 | io_uring_queue_exit(&ring); 94 | return T_EXIT_FAIL; 95 | } 96 | -------------------------------------------------------------------------------- /vendor/liburing/test/cq-size.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: MIT */ 2 | /* 3 | * Description: test CQ ring sizing 4 | */ 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #include "liburing.h" 13 | #include "helpers.h" 14 | 15 | int main(int argc, char *argv[]) 16 | { 17 | struct io_uring_params p; 18 | struct io_uring ring; 19 | int ret; 20 | 21 | if (argc > 1) 22 | return T_EXIT_SKIP; 23 | 24 | memset(&p, 0, sizeof(p)); 25 | p.flags = IORING_SETUP_CQSIZE; 26 | p.cq_entries = 64; 27 | 28 | ret = io_uring_queue_init_params(4, &ring, &p); 29 | if (ret) { 30 | if (ret == -EINVAL) { 31 | printf("Skipped, not supported on this kernel\n"); 32 | goto done; 33 | } 34 | printf("ring setup failed\n"); 35 | return T_EXIT_FAIL; 36 | } 37 | 38 | if (p.cq_entries < 64) { 39 | printf("cq entries invalid (%d)\n", p.cq_entries); 40 | goto err; 41 | } 42 | io_uring_queue_exit(&ring); 43 | 44 | memset(&p, 0, sizeof(p)); 45 | p.flags = IORING_SETUP_CQSIZE; 46 | p.cq_entries = 0; 47 | 48 | ret = io_uring_queue_init_params(4, &ring, &p); 49 | if (ret >= 0) { 50 | printf("zero sized cq ring succeeded\n"); 51 | io_uring_queue_exit(&ring); 52 | goto err; 53 | } 54 | 55 | if (ret != -EINVAL) { 56 | printf("io_uring_queue_init_params failed, but not with -EINVAL" 57 | ", returned error %d (%s)\n", ret, strerror(-ret)); 58 | goto err; 59 | } 60 | 61 | done: 62 | return T_EXIT_PASS; 63 | err: 64 | return T_EXIT_FAIL; 65 | } 66 | -------------------------------------------------------------------------------- /vendor/liburing/test/d77a67ed5f27.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: MIT */ 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include "liburing.h" 8 | #include "helpers.h" 9 | 10 | static void sig_alrm(int sig) 11 | { 12 | fprintf(stderr, "Timed out!\n"); 13 | exit(1); 14 | } 15 | 16 | int main(int argc, char *argv[]) 17 | { 18 | struct io_uring_sqe *sqe; 19 | struct io_uring_cqe *cqe; 20 | struct io_uring_params p; 21 | struct io_uring ring; 22 | int ret, data; 23 | 24 | if (argc > 1) 25 | return T_EXIT_SKIP; 26 | 27 | signal(SIGALRM, sig_alrm); 28 | 29 | memset(&p, 0, sizeof(p)); 30 | p.sq_thread_idle = 100; 31 | p.flags = IORING_SETUP_SQPOLL; 32 | ret = t_create_ring_params(4, &ring, &p); 33 | if (ret == T_SETUP_SKIP) 34 | return T_EXIT_SKIP; 35 | else if (ret < 0) 36 | return T_EXIT_FAIL; 37 | 38 | /* make sure sq thread is sleeping at this point */ 39 | usleep(150000); 40 | alarm(1); 41 | 42 | sqe = io_uring_get_sqe(&ring); 43 | if (!sqe) { 44 | fprintf(stderr, "sqe get failed\n"); 45 | return T_EXIT_FAIL; 46 | } 47 | 48 | io_uring_prep_nop(sqe); 49 | io_uring_sqe_set_data(sqe, (void *) (unsigned long) 42); 50 | io_uring_submit_and_wait(&ring, 1); 51 | 52 | ret = io_uring_peek_cqe(&ring, &cqe); 53 | if (ret) { 54 | fprintf(stderr, "cqe get failed\n"); 55 | return 1; 56 | } 57 | 58 | data = (unsigned long) io_uring_cqe_get_data(cqe); 59 | if (data != 42) { 60 | fprintf(stderr, "invalid data: %d\n", data); 61 | return T_EXIT_FAIL; 62 | } 63 | 64 | return T_EXIT_PASS; 65 | } 66 | -------------------------------------------------------------------------------- /vendor/liburing/test/drop-submit.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: MIT */ 2 | /* 3 | * Description: test IORING_SETUP_SUBMIT_ALL 4 | * 5 | */ 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include "liburing.h" 12 | #include "helpers.h" 13 | 14 | static int test(struct io_uring *ring, int expect_drops) 15 | { 16 | struct io_uring_sqe *sqe; 17 | char buf[32]; 18 | int ret, i; 19 | 20 | for (i = 0; i < 4; i++) { 21 | sqe = io_uring_get_sqe(ring); 22 | if (!sqe) { 23 | fprintf(stderr, "get sqe failed\n"); 24 | goto err; 25 | } 26 | 27 | io_uring_prep_nop(sqe); 28 | } 29 | 30 | /* prep two invalid reads, these will fail */ 31 | for (i = 0; i < 2; i++) { 32 | sqe = io_uring_get_sqe(ring); 33 | if (!sqe) { 34 | fprintf(stderr, "get sqe failed\n"); 35 | goto err; 36 | } 37 | 38 | io_uring_prep_read(sqe, 128, buf, sizeof(buf), 0); 39 | sqe->ioprio = (short) -1; 40 | } 41 | 42 | 43 | ret = io_uring_submit(ring); 44 | if (expect_drops) { 45 | if (ret != 5) { 46 | fprintf(stderr, "drops submit failed: %d\n", ret); 47 | goto err; 48 | } 49 | } else { 50 | if (ret != 6) { 51 | fprintf(stderr, "no drops submit failed: %d\n", ret); 52 | goto err; 53 | } 54 | } 55 | 56 | return 0; 57 | err: 58 | return 1; 59 | } 60 | 61 | int main(int argc, char *argv[]) 62 | { 63 | struct io_uring ring; 64 | int ret; 65 | 66 | if (argc > 1) 67 | return T_EXIT_SKIP; 68 | 69 | ret = io_uring_queue_init(8, &ring, IORING_SETUP_SUBMIT_ALL); 70 | if (ret) 71 | return 0; 72 | 73 | ret = test(&ring, 0); 74 | if (ret) { 75 | fprintf(stderr, "test no drops failed\n"); 76 | return ret; 77 | } 78 | 79 | io_uring_queue_exit(&ring); 80 | 81 | ret = io_uring_queue_init(8, &ring, 0); 82 | if (ret) { 83 | fprintf(stderr, "ring setup failed\n"); 84 | return T_EXIT_FAIL; 85 | } 86 | 87 | ret = test(&ring, 1); 88 | if (ret) { 89 | fprintf(stderr, "test drops failed\n"); 90 | return ret; 91 | } 92 | 93 | return T_EXIT_PASS; 94 | } 95 | -------------------------------------------------------------------------------- /vendor/liburing/test/empty-eownerdead.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: MIT */ 2 | /* 3 | * Test if entering with nothing to submit/wait for SQPOLL returns an error. 4 | */ 5 | #include 6 | #include 7 | #include 8 | 9 | #include "liburing.h" 10 | #include "helpers.h" 11 | #include "../src/syscall.h" 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | struct io_uring_params p = {}; 16 | struct io_uring ring; 17 | int ret; 18 | 19 | if (argc > 1) 20 | return T_EXIT_SKIP; 21 | 22 | p.flags = IORING_SETUP_SQPOLL; 23 | p.sq_thread_idle = 100; 24 | 25 | ret = t_create_ring_params(1, &ring, &p); 26 | if (ret == T_SETUP_SKIP) 27 | return T_EXIT_SKIP; 28 | else if (ret < 0) 29 | goto err; 30 | 31 | ret = __sys_io_uring_enter(ring.ring_fd, 0, 0, 0, NULL); 32 | if (ret < 0) { 33 | int __e = errno; 34 | 35 | if (__e == EOWNERDEAD) 36 | fprintf(stderr, "sqe submit unexpected failure due old kernel bug: %s\n", strerror(__e)); 37 | else 38 | fprintf(stderr, "sqe submit unexpected failure: %s\n", strerror(__e)); 39 | goto err; 40 | } 41 | 42 | return T_EXIT_PASS; 43 | err: 44 | return T_EXIT_FAIL; 45 | } 46 | -------------------------------------------------------------------------------- /vendor/liburing/test/eploop.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: MIT */ 2 | /* 3 | * Test that we don't recursively generate completion events if an io_uring 4 | * fd is added to an epoll context, and the ring itself polls for events on 5 | * the epollfd. Older kernels will stop on overflow, newer kernels will 6 | * detect this earlier and abort correctly. 7 | */ 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include "liburing.h" 15 | #include "helpers.h" 16 | 17 | int main(int argc, char *argv[]) 18 | { 19 | struct io_uring ring; 20 | struct io_uring_sqe *sqe; 21 | struct io_uring_cqe *cqe; 22 | struct epoll_event ev = { }; 23 | int epollfd, ret, i; 24 | 25 | if (argc > 1) 26 | return T_EXIT_SKIP; 27 | 28 | ret = io_uring_queue_init(8, &ring, 0); 29 | if (ret) { 30 | fprintf(stderr, "Ring init failed: %d\n", ret); 31 | return T_EXIT_FAIL; 32 | } 33 | 34 | epollfd = epoll_create1(0); 35 | if (epollfd < 0) { 36 | perror("epoll_create"); 37 | return T_EXIT_FAIL; 38 | } 39 | 40 | ev.events = EPOLLIN; 41 | ev.data.fd = ring.ring_fd; 42 | ret = epoll_ctl(epollfd, EPOLL_CTL_ADD, ring.ring_fd, &ev); 43 | if (ret < 0) { 44 | perror("epoll_ctl"); 45 | return T_EXIT_FAIL; 46 | } 47 | 48 | sqe = io_uring_get_sqe(&ring); 49 | io_uring_prep_poll_multishot(sqe, epollfd, POLLIN); 50 | sqe->user_data = 1; 51 | io_uring_submit(&ring); 52 | 53 | sqe = io_uring_get_sqe(&ring); 54 | sqe->user_data = 2; 55 | io_uring_prep_nop(sqe); 56 | io_uring_submit(&ring); 57 | 58 | for (i = 0; i < 2; i++) { 59 | ret = io_uring_wait_cqe(&ring, &cqe); 60 | if (ret) { 61 | fprintf(stderr, "wait_cqe ret = %d\n", ret); 62 | break; 63 | } 64 | io_uring_cqe_seen(&ring, cqe); 65 | } 66 | 67 | ret = io_uring_peek_cqe(&ring, &cqe); 68 | if (!ret) { 69 | fprintf(stderr, "Generated too many events\n"); 70 | return T_EXIT_FAIL; 71 | } 72 | 73 | return T_EXIT_PASS; 74 | } 75 | -------------------------------------------------------------------------------- /vendor/liburing/test/eventfd-reg.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: MIT */ 2 | /* 3 | * Description: test eventfd registration+unregistration 4 | * 5 | */ 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | #include "liburing.h" 16 | #include "helpers.h" 17 | 18 | int main(int argc, char *argv[]) 19 | { 20 | struct io_uring_params p = {}; 21 | struct io_uring ring; 22 | int ret, evfd[2], i; 23 | 24 | if (argc > 1) 25 | return T_EXIT_SKIP; 26 | 27 | ret = io_uring_queue_init_params(8, &ring, &p); 28 | if (ret) { 29 | fprintf(stderr, "ring setup failed: %d\n", ret); 30 | return T_EXIT_FAIL; 31 | } 32 | 33 | evfd[0] = eventfd(0, EFD_CLOEXEC); 34 | evfd[1] = eventfd(0, EFD_CLOEXEC); 35 | if (evfd[0] < 0 || evfd[1] < 0) { 36 | perror("eventfd"); 37 | return T_EXIT_FAIL; 38 | } 39 | 40 | ret = io_uring_register_eventfd(&ring, evfd[0]); 41 | if (ret) { 42 | fprintf(stderr, "failed to register evfd: %d\n", ret); 43 | return T_EXIT_FAIL; 44 | } 45 | 46 | /* Check that registrering again will get -EBUSY */ 47 | ret = io_uring_register_eventfd(&ring, evfd[1]); 48 | if (ret != -EBUSY) { 49 | fprintf(stderr, "unexpected 2nd register: %d\n", ret); 50 | return T_EXIT_FAIL; 51 | } 52 | close(evfd[1]); 53 | 54 | ret = io_uring_unregister_eventfd(&ring); 55 | if (ret) { 56 | fprintf(stderr, "unexpected unregister: %d\n", ret); 57 | return T_EXIT_FAIL; 58 | } 59 | 60 | /* loop 100 registers/unregister */ 61 | for (i = 0; i < 100; i++) { 62 | ret = io_uring_register_eventfd(&ring, evfd[0]); 63 | if (ret) { 64 | fprintf(stderr, "failed to register evfd: %d\n", ret); 65 | return T_EXIT_FAIL; 66 | } 67 | 68 | ret = io_uring_unregister_eventfd(&ring); 69 | if (ret) { 70 | fprintf(stderr, "unexpected unregister: %d\n", ret); 71 | return T_EXIT_FAIL; 72 | } 73 | } 74 | 75 | close(evfd[0]); 76 | return T_EXIT_PASS; 77 | } 78 | -------------------------------------------------------------------------------- /vendor/liburing/test/evloop.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: MIT */ 2 | /* 3 | * Test that we don't recursively generate completion events if an io_uring 4 | * has an eventfd registered that triggers on completions, and we add a poll 5 | * request with multishot on the eventfd. Older kernels will stop on overflow, 6 | * newer kernels will detect this earlier and abort correctly. 7 | */ 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include "liburing.h" 17 | #include "helpers.h" 18 | 19 | int main(int argc, char *argv[]) 20 | { 21 | struct io_uring ring; 22 | struct io_uring_sqe *sqe; 23 | struct io_uring_cqe *cqe; 24 | int ret, efd, i; 25 | 26 | if (argc > 1) 27 | return T_EXIT_SKIP; 28 | 29 | ret = io_uring_queue_init(8, &ring, 0); 30 | if (ret) { 31 | fprintf(stderr, "Ring init failed: %d\n", ret); 32 | return T_EXIT_FAIL; 33 | } 34 | 35 | efd = eventfd(0, 0); 36 | if (efd < 0) { 37 | perror("eventfd"); 38 | return T_EXIT_FAIL; 39 | } 40 | 41 | ret = io_uring_register_eventfd(&ring, efd); 42 | if (ret) { 43 | fprintf(stderr, "Ring eventfd register failed: %d\n", ret); 44 | return T_EXIT_FAIL; 45 | } 46 | 47 | sqe = io_uring_get_sqe(&ring); 48 | io_uring_prep_poll_multishot(sqe, efd, POLLIN); 49 | sqe->user_data = 1; 50 | io_uring_submit(&ring); 51 | 52 | sqe = io_uring_get_sqe(&ring); 53 | sqe->user_data = 2; 54 | io_uring_prep_nop(sqe); 55 | io_uring_submit(&ring); 56 | 57 | for (i = 0; i < 2; i++) { 58 | ret = io_uring_wait_cqe(&ring, &cqe); 59 | if (ret) { 60 | fprintf(stderr, "wait_cqe ret = %d\n", ret); 61 | break; 62 | } 63 | io_uring_cqe_seen(&ring, cqe); 64 | } 65 | 66 | ret = io_uring_peek_cqe(&ring, &cqe); 67 | if (!ret) { 68 | fprintf(stderr, "Generated too many events\n"); 69 | return T_EXIT_FAIL; 70 | } 71 | 72 | return T_EXIT_PASS; 73 | } 74 | -------------------------------------------------------------------------------- /vendor/liburing/test/exec-target.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: MIT */ 2 | 3 | int main(int argc, char *argv[]) 4 | { 5 | return 0; 6 | } 7 | -------------------------------------------------------------------------------- /vendor/liburing/test/iopoll-leak.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: MIT */ 2 | /* 3 | * Description: test a mem leak with IOPOLL 4 | */ 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include "helpers.h" 14 | #include "liburing.h" 15 | 16 | #define FILE_SIZE (128 * 1024) 17 | #define BS 4096 18 | #define BUFFERS (FILE_SIZE / BS) 19 | 20 | static int do_iopoll(const char *fname) 21 | { 22 | struct io_uring_sqe *sqe; 23 | struct io_uring ring; 24 | struct iovec *iov; 25 | int fd; 26 | 27 | fd = open(fname, O_RDONLY | O_DIRECT); 28 | if (fd < 0) { 29 | perror("open"); 30 | return T_EXIT_SKIP; 31 | } 32 | 33 | iov = t_create_buffers(1, 4096); 34 | 35 | t_create_ring(2, &ring, IORING_SETUP_IOPOLL); 36 | 37 | sqe = io_uring_get_sqe(&ring); 38 | io_uring_prep_read(sqe, fd, iov->iov_base, iov->iov_len, 0); 39 | io_uring_submit(&ring); 40 | 41 | close(fd); 42 | return T_EXIT_PASS; 43 | } 44 | 45 | static int test(const char *fname) 46 | { 47 | if (fork()) { 48 | int stat; 49 | 50 | wait(&stat); 51 | return WEXITSTATUS(stat); 52 | } else { 53 | int ret; 54 | 55 | ret = do_iopoll(fname); 56 | exit(ret); 57 | } 58 | } 59 | 60 | int main(int argc, char *argv[]) 61 | { 62 | char buf[256]; 63 | char *fname; 64 | int i, ret; 65 | 66 | if (argc > 1) { 67 | fname = argv[1]; 68 | } else { 69 | srand((unsigned)time(NULL)); 70 | snprintf(buf, sizeof(buf), ".iopoll-leak-%u-%u", 71 | (unsigned)rand(), (unsigned)getpid()); 72 | fname = buf; 73 | t_create_file(fname, FILE_SIZE); 74 | } 75 | 76 | for (i = 0; i < 16; i++) { 77 | ret = test(fname); 78 | if (ret == T_EXIT_SKIP || ret == T_EXIT_FAIL) 79 | break; 80 | } 81 | 82 | if (fname != argv[1]) 83 | unlink(fname); 84 | return ret; 85 | } 86 | -------------------------------------------------------------------------------- /vendor/liburing/test/nolibc.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: MIT */ 2 | /* 3 | * Test liburing nolibc functionality. 4 | * 5 | * Currently, supported architectures are: 6 | * 1) x86 7 | * 2) x86-64 8 | * 3) aarch64 9 | * 10 | */ 11 | #include "helpers.h" 12 | 13 | #if !defined(__x86_64__) && !defined(__i386__) && !defined(__aarch64__) 14 | 15 | /* 16 | * This arch doesn't support nolibc. 17 | */ 18 | int main(void) 19 | { 20 | return T_EXIT_SKIP; 21 | } 22 | 23 | #else /* #if !defined(__x86_64__) && !defined(__i386__) && !defined(__aarch64__) */ 24 | 25 | #ifndef CONFIG_NOLIBC 26 | #define CONFIG_NOLIBC 27 | #endif 28 | 29 | #include 30 | #include 31 | #include "../src/lib.h" 32 | 33 | static int test_get_page_size(void) 34 | { 35 | long a, b; 36 | 37 | a = sysconf(_SC_PAGESIZE); 38 | b = get_page_size(); 39 | if (a != b) { 40 | fprintf(stderr, "get_page_size() fails, %ld != %ld", a, b); 41 | return -1; 42 | } 43 | return 0; 44 | } 45 | 46 | int main(int argc, char *argv[]) 47 | { 48 | int ret; 49 | 50 | if (argc > 1) 51 | return T_EXIT_SKIP; 52 | 53 | ret = test_get_page_size(); 54 | if (ret) 55 | return T_EXIT_FAIL; 56 | 57 | return T_EXIT_PASS; 58 | } 59 | 60 | #endif /* #if !defined(__x86_64__) && !defined(__i386__) && !defined(__aarch64__) */ 61 | -------------------------------------------------------------------------------- /vendor/liburing/test/nop-all-sizes.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: MIT */ 2 | /* 3 | * Description: exercise full filling of SQ and CQ ring 4 | * 5 | */ 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include "liburing.h" 14 | 15 | #define MAX_ENTRIES 32768 16 | 17 | static int fill_nops(struct io_uring *ring) 18 | { 19 | struct io_uring_sqe *sqe; 20 | int filled = 0; 21 | 22 | do { 23 | sqe = io_uring_get_sqe(ring); 24 | if (!sqe) 25 | break; 26 | 27 | io_uring_prep_nop(sqe); 28 | filled++; 29 | } while (1); 30 | 31 | return filled; 32 | } 33 | 34 | static int test_nops(struct io_uring *ring) 35 | { 36 | struct io_uring_cqe *cqe; 37 | int ret, nr, total = 0, i; 38 | 39 | nr = fill_nops(ring); 40 | 41 | ret = io_uring_submit(ring); 42 | if (ret != nr) { 43 | fprintf(stderr, "submit %d, wanted %d\n", ret, nr); 44 | goto err; 45 | } 46 | total += ret; 47 | 48 | nr = fill_nops(ring); 49 | 50 | ret = io_uring_submit(ring); 51 | if (ret != nr) { 52 | fprintf(stderr, "submit %d, wanted %d\n", ret, nr); 53 | goto err; 54 | } 55 | total += ret; 56 | 57 | for (i = 0; i < total; i++) { 58 | ret = io_uring_wait_cqe(ring, &cqe); 59 | if (ret < 0) { 60 | fprintf(stderr, "wait completion %d\n", ret); 61 | goto err; 62 | } 63 | 64 | io_uring_cqe_seen(ring, cqe); 65 | } 66 | return 0; 67 | err: 68 | return 1; 69 | } 70 | 71 | int main(int argc, char *argv[]) 72 | { 73 | struct io_uring ring; 74 | int ret, depth; 75 | 76 | if (argc > 1) 77 | return 0; 78 | 79 | depth = 1; 80 | while (depth <= MAX_ENTRIES) { 81 | ret = io_uring_queue_init(depth, &ring, 0); 82 | if (ret) { 83 | if (ret == -ENOMEM) 84 | break; 85 | fprintf(stderr, "ring setup failed: %d\n", ret); 86 | return 1; 87 | } 88 | 89 | ret = test_nops(&ring); 90 | if (ret) { 91 | fprintf(stderr, "test_single_nop failed\n"); 92 | return ret; 93 | } 94 | depth <<= 1; 95 | io_uring_queue_exit(&ring); 96 | } 97 | 98 | return 0; 99 | } 100 | -------------------------------------------------------------------------------- /vendor/liburing/test/pipe-eof.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: MIT */ 2 | 3 | /* 4 | * Test that closed pipe reads returns 0, instead of waiting for more 5 | * data. 6 | */ 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include "liburing.h" 14 | 15 | #define BUFSIZE 512 16 | 17 | struct data { 18 | char *str; 19 | int fds[2]; 20 | }; 21 | 22 | static void *t(void *data) 23 | { 24 | struct data *d = data; 25 | int ret; 26 | 27 | strcpy(d->str, "This is a test string"); 28 | ret = write(d->fds[1], d->str, strlen(d->str)); 29 | close(d->fds[1]); 30 | if (ret < 0) 31 | perror("write"); 32 | 33 | return NULL; 34 | } 35 | 36 | int main(int argc, char *argv[]) 37 | { 38 | static char buf[BUFSIZE]; 39 | struct io_uring ring; 40 | pthread_t thread; 41 | struct data d; 42 | int ret; 43 | 44 | if (pipe(d.fds) < 0) { 45 | perror("pipe"); 46 | return 1; 47 | } 48 | d.str = buf; 49 | 50 | io_uring_queue_init(8, &ring, 0); 51 | 52 | pthread_create(&thread, NULL, t, &d); 53 | 54 | while (1) { 55 | struct io_uring_sqe *sqe; 56 | struct io_uring_cqe *cqe; 57 | 58 | sqe = io_uring_get_sqe(&ring); 59 | io_uring_prep_read(sqe, d.fds[0], buf, BUFSIZE, 0); 60 | ret = io_uring_submit(&ring); 61 | if (ret != 1) { 62 | fprintf(stderr, "submit: %d\n", ret); 63 | return 1; 64 | } 65 | ret = io_uring_wait_cqe(&ring, &cqe); 66 | if (ret) { 67 | fprintf(stderr, "wait: %d\n", ret); 68 | return 1; 69 | } 70 | 71 | if (cqe->res < 0) { 72 | fprintf(stderr, "Read error: %s\n", strerror(-cqe->res)); 73 | return 1; 74 | } 75 | if (cqe->res == 0) 76 | break; 77 | io_uring_cqe_seen(&ring, cqe); 78 | } 79 | 80 | pthread_join(thread, NULL); 81 | io_uring_queue_exit(&ring); 82 | return 0; 83 | } 84 | -------------------------------------------------------------------------------- /vendor/liburing/test/poll-ring.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: MIT */ 2 | /* 3 | * Description: Test poll against ring itself. A buggy kernel will end up 4 | * having io_wq_* workers pending, as the circular reference 5 | * will prevent full exit. 6 | * 7 | */ 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | #include "liburing.h" 16 | 17 | int main(int argc, char *argv[]) 18 | { 19 | struct io_uring_sqe *sqe; 20 | struct io_uring ring; 21 | int ret; 22 | 23 | if (argc > 1) 24 | return 0; 25 | 26 | ret = io_uring_queue_init(1, &ring, 0); 27 | if (ret) { 28 | fprintf(stderr, "child: ring setup failed: %d\n", ret); 29 | return 1; 30 | } 31 | 32 | sqe = io_uring_get_sqe(&ring); 33 | if (!sqe) { 34 | fprintf(stderr, "get sqe failed\n"); 35 | return 1; 36 | } 37 | 38 | io_uring_prep_poll_add(sqe, ring.ring_fd, POLLIN); 39 | io_uring_sqe_set_data(sqe, sqe); 40 | 41 | ret = io_uring_submit(&ring); 42 | if (ret <= 0) { 43 | fprintf(stderr, "child: sqe submit failed: %d\n", ret); 44 | return 1; 45 | } 46 | 47 | return 0; 48 | } 49 | -------------------------------------------------------------------------------- /vendor/liburing/test/reg-hint.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: MIT */ 2 | /* 3 | * Test alloc hint sanity after unregistering the file table 4 | */ 5 | #include 6 | #include 7 | #include 8 | 9 | #include "liburing.h" 10 | #include "helpers.h" 11 | 12 | int main(int argc, char *argv[]) 13 | { 14 | struct io_uring_sqe *sqe; 15 | struct io_uring_cqe *cqe; 16 | struct io_uring ring; 17 | int ret; 18 | 19 | if (argc > 1) 20 | return T_EXIT_SKIP; 21 | 22 | io_uring_queue_init(1, &ring, 0); 23 | 24 | ret = io_uring_register_files_sparse(&ring, 16); 25 | if (ret) { 26 | if (ret == -EINVAL) 27 | return T_EXIT_SKIP; 28 | 29 | fprintf(stderr, "Failed to register file table: %d\n", ret); 30 | return T_EXIT_FAIL; 31 | } 32 | io_uring_unregister_files(&ring); 33 | 34 | sqe = io_uring_get_sqe(&ring); 35 | io_uring_prep_socket_direct_alloc(sqe, AF_UNIX, SOCK_DGRAM, 0, 0); 36 | 37 | ret = io_uring_submit(&ring); 38 | if (ret != 1) { 39 | fprintf(stderr, "submit %d\n", ret); 40 | return T_EXIT_FAIL; 41 | } 42 | 43 | ret = io_uring_wait_cqe(&ring, &cqe); 44 | if (ret) { 45 | fprintf(stderr, "wait cqe: %d\n", ret); 46 | return T_EXIT_FAIL; 47 | } 48 | 49 | if (cqe->res != -ENFILE) { 50 | fprintf(stderr, "Bad CQE res: %d\n", cqe->res); 51 | return T_EXIT_FAIL; 52 | } 53 | 54 | io_uring_cqe_seen(&ring, cqe); 55 | return T_EXIT_PASS; 56 | } 57 | -------------------------------------------------------------------------------- /vendor/liburing/test/runtests-loop.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | TESTS=("$@") 4 | ITER=0 5 | 6 | while true; do 7 | ./runtests.sh "${TESTS[@]}" 8 | RET="$?" 9 | if [ "${RET}" -ne 0 ]; then 10 | echo "Tests failed at loop $ITER" 11 | break 12 | fi 13 | echo "Finished loop $ITER" 14 | ((ITER++)) 15 | done 16 | 17 | -------------------------------------------------------------------------------- /vendor/liburing/test/runtests-quiet.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | TESTS=("$@") 4 | RESULT_FILE=$(mktemp) 5 | ./runtests.sh "${TESTS[@]}" > "$RESULT_FILE" 2>&1 6 | RET="$?" 7 | if [ "${RET}" -ne 0 ]; then 8 | cat "$RESULT_FILE" 9 | fi 10 | rm "$RESULT_FILE" 11 | exit $RET 12 | -------------------------------------------------------------------------------- /vendor/liburing/test/self.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: MIT */ 2 | /* 3 | * Description: test that pathname resolution works from async context when 4 | * using /proc/self/ which should be the original submitting task, not the 5 | * async worker. 6 | * 7 | */ 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | #include "liburing.h" 16 | 17 | static int io_openat2(struct io_uring *ring, const char *path, int dfd) 18 | { 19 | struct io_uring_cqe *cqe; 20 | struct io_uring_sqe *sqe; 21 | struct open_how how; 22 | int ret; 23 | 24 | sqe = io_uring_get_sqe(ring); 25 | if (!sqe) { 26 | fprintf(stderr, "get sqe failed\n"); 27 | goto err; 28 | } 29 | memset(&how, 0, sizeof(how)); 30 | how.flags = O_RDONLY; 31 | io_uring_prep_openat2(sqe, dfd, path, &how); 32 | 33 | ret = io_uring_submit(ring); 34 | if (ret <= 0) { 35 | fprintf(stderr, "sqe submit failed: %d\n", ret); 36 | goto err; 37 | } 38 | 39 | ret = io_uring_wait_cqe(ring, &cqe); 40 | if (ret < 0) { 41 | fprintf(stderr, "wait completion %d\n", ret); 42 | goto err; 43 | } 44 | ret = cqe->res; 45 | io_uring_cqe_seen(ring, cqe); 46 | return ret; 47 | err: 48 | return -1; 49 | } 50 | 51 | int main(int argc, char *argv[]) 52 | { 53 | struct io_uring ring; 54 | char buf[64]; 55 | int ret; 56 | 57 | if (argc > 1) 58 | return 0; 59 | 60 | ret = io_uring_queue_init(1, &ring, 0); 61 | if (ret) { 62 | fprintf(stderr, "ring setup failed\n"); 63 | return 1; 64 | } 65 | 66 | ret = io_openat2(&ring, "/proc/self/comm", -1); 67 | if (ret < 0) { 68 | if (ret == -EOPNOTSUPP) 69 | return 0; 70 | if (ret == -EINVAL) { 71 | fprintf(stdout, "openat2 not supported, skipping\n"); 72 | return 0; 73 | } 74 | fprintf(stderr, "openat2 failed: %s\n", strerror(-ret)); 75 | return 1; 76 | } 77 | 78 | memset(buf, 0, sizeof(buf)); 79 | ret = read(ret, buf, sizeof(buf)); 80 | if (ret < 0) { 81 | perror("read"); 82 | return 1; 83 | } 84 | 85 | if (strncmp(buf, "self", 4)) { 86 | fprintf(stderr, "got comm=<%s>, wanted \n", buf); 87 | return 1; 88 | } 89 | 90 | return 0; 91 | } 92 | -------------------------------------------------------------------------------- /vendor/liburing/test/shared-wq.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: MIT */ 2 | /* 3 | * Description: test wq sharing 4 | */ 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #include "liburing.h" 13 | 14 | static int test_attach_invalid(int ringfd) 15 | { 16 | struct io_uring_params p; 17 | struct io_uring ring; 18 | int ret; 19 | 20 | memset(&p, 0, sizeof(p)); 21 | p.flags = IORING_SETUP_ATTACH_WQ; 22 | p.wq_fd = ringfd; 23 | ret = io_uring_queue_init_params(1, &ring, &p); 24 | if (ret != -EINVAL) { 25 | fprintf(stderr, "Attach to zero: %d\n", ret); 26 | goto err; 27 | } 28 | return 0; 29 | err: 30 | return 1; 31 | } 32 | 33 | static int test_attach(int ringfd) 34 | { 35 | struct io_uring_params p; 36 | struct io_uring ring2; 37 | int ret; 38 | 39 | memset(&p, 0, sizeof(p)); 40 | p.flags = IORING_SETUP_ATTACH_WQ; 41 | p.wq_fd = ringfd; 42 | ret = io_uring_queue_init_params(1, &ring2, &p); 43 | if (ret == -EINVAL) { 44 | fprintf(stdout, "Sharing not supported, skipping\n"); 45 | return 0; 46 | } else if (ret) { 47 | fprintf(stderr, "Attach to id: %d\n", ret); 48 | goto err; 49 | } 50 | io_uring_queue_exit(&ring2); 51 | return 0; 52 | err: 53 | return 1; 54 | } 55 | 56 | int main(int argc, char *argv[]) 57 | { 58 | struct io_uring ring; 59 | int ret; 60 | 61 | if (argc > 1) 62 | return 0; 63 | 64 | ret = io_uring_queue_init(8, &ring, 0); 65 | if (ret) { 66 | fprintf(stderr, "ring setup failed\n"); 67 | return 1; 68 | } 69 | 70 | /* stdout is definitely not an io_uring descriptor */ 71 | ret = test_attach_invalid(2); 72 | if (ret) { 73 | fprintf(stderr, "test_attach_invalid failed\n"); 74 | return ret; 75 | } 76 | 77 | ret = test_attach(ring.ring_fd); 78 | if (ret) { 79 | fprintf(stderr, "test_attach failed\n"); 80 | return ret; 81 | } 82 | 83 | return 0; 84 | } 85 | -------------------------------------------------------------------------------- /vendor/liburing/test/short-read.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: MIT */ 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | 12 | #include "helpers.h" 13 | #include "liburing.h" 14 | 15 | #define BUF_SIZE 4096 16 | #define FILE_SIZE 1024 17 | 18 | int main(int argc, char *argv[]) 19 | { 20 | int ret, fd, save_errno; 21 | struct io_uring ring; 22 | struct io_uring_sqe *sqe; 23 | struct io_uring_cqe *cqe; 24 | struct iovec vec; 25 | 26 | if (argc > 1) 27 | return 0; 28 | 29 | vec.iov_base = t_malloc(BUF_SIZE); 30 | vec.iov_len = BUF_SIZE; 31 | 32 | t_create_file(".short-read", FILE_SIZE); 33 | 34 | fd = open(".short-read", O_RDONLY); 35 | save_errno = errno; 36 | unlink(".short-read"); 37 | errno = save_errno; 38 | if (fd < 0) { 39 | perror("file open"); 40 | return 1; 41 | } 42 | 43 | ret = io_uring_queue_init(32, &ring, 0); 44 | if (ret) { 45 | fprintf(stderr, "queue init failed: %d\n", ret); 46 | return ret; 47 | } 48 | 49 | sqe = io_uring_get_sqe(&ring); 50 | if (!sqe) { 51 | fprintf(stderr, "sqe get failed\n"); 52 | return 1; 53 | } 54 | io_uring_prep_readv(sqe, fd, &vec, 1, 0); 55 | 56 | ret = io_uring_submit(&ring); 57 | if (ret != 1) { 58 | fprintf(stderr, "submit failed: %d\n", ret); 59 | return 1; 60 | } 61 | 62 | ret = io_uring_wait_cqes(&ring, &cqe, 1, 0, 0); 63 | if (ret) { 64 | fprintf(stderr, "wait_cqe failed: %d\n", ret); 65 | return 1; 66 | } 67 | 68 | if (cqe->res != FILE_SIZE) { 69 | fprintf(stderr, "Read failed: %d\n", cqe->res); 70 | return 1; 71 | } 72 | 73 | io_uring_cqe_seen(&ring, cqe); 74 | return 0; 75 | } 76 | -------------------------------------------------------------------------------- /vendor/liburing/test/sigfd-deadlock.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: MIT */ 2 | /* 3 | * Description: test that sigfd reading/polling works. A regression test for 4 | * the upstream commit: 5 | * 6 | * fd7d6de22414 ("io_uring: don't recurse on tsk->sighand->siglock with signalfd") 7 | */ 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include "liburing.h" 14 | #include "helpers.h" 15 | 16 | static int setup_signal(void) 17 | { 18 | sigset_t mask; 19 | int sfd; 20 | 21 | sigemptyset(&mask); 22 | sigaddset(&mask, SIGINT); 23 | 24 | sigprocmask(SIG_BLOCK, &mask, NULL); 25 | sfd = signalfd(-1, &mask, SFD_NONBLOCK); 26 | if (sfd < 0) 27 | perror("signalfd"); 28 | return sfd; 29 | } 30 | 31 | static int test_uring(int sfd) 32 | { 33 | struct io_uring_sqe *sqe; 34 | struct io_uring_cqe *cqe; 35 | struct io_uring ring; 36 | int ret; 37 | 38 | ret = io_uring_queue_init(32, &ring, 0); 39 | if (ret) 40 | return T_EXIT_FAIL; 41 | 42 | sqe = io_uring_get_sqe(&ring); 43 | io_uring_prep_poll_add(sqe, sfd, POLLIN); 44 | ret = io_uring_submit(&ring); 45 | if (ret < 0) { 46 | ret = T_EXIT_FAIL; 47 | goto err_exit; 48 | } 49 | 50 | kill(getpid(), SIGINT); 51 | 52 | io_uring_wait_cqe(&ring, &cqe); 53 | if (cqe->res == -EOPNOTSUPP) { 54 | fprintf(stderr, "signalfd poll not supported\n"); 55 | ret = T_EXIT_SKIP; 56 | } else if (cqe->res < 0) { 57 | fprintf(stderr, "poll failed: %d\n", cqe->res); 58 | ret = T_EXIT_FAIL; 59 | } else if (cqe->res & POLLIN) { 60 | ret = T_EXIT_PASS; 61 | } else { 62 | fprintf(stderr, "Unexpected poll mask %x\n", cqe->res); 63 | ret = T_EXIT_FAIL; 64 | } 65 | io_uring_cqe_seen(&ring, cqe); 66 | err_exit: 67 | io_uring_queue_exit(&ring); 68 | return ret; 69 | } 70 | 71 | int main(int argc, char *argv[]) 72 | { 73 | int sfd, ret; 74 | 75 | if (argc > 1) 76 | return T_EXIT_PASS; 77 | 78 | sfd = setup_signal(); 79 | if (sfd < 0) 80 | return T_EXIT_FAIL; 81 | 82 | ret = test_uring(sfd); 83 | if (ret == T_EXIT_FAIL) 84 | fprintf(stderr, "test_uring signalfd failed\n"); 85 | 86 | close(sfd); 87 | return ret; 88 | } 89 | -------------------------------------------------------------------------------- /vendor/liburing/test/sq-full-cpp.cc: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: MIT */ 2 | /* 3 | * Description: test SQ queue full condition 4 | * 5 | */ 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include "liburing.h" 14 | 15 | int main(int argc, char *argv[]) 16 | { 17 | struct io_uring_sqe *sqe; 18 | struct io_uring ring; 19 | int ret, i; 20 | 21 | if (argc > 1) 22 | return 0; 23 | 24 | ret = io_uring_queue_init(8, &ring, 0); 25 | if (ret) { 26 | fprintf(stderr, "ring setup failed: %d\n", ret); 27 | return 1; 28 | 29 | } 30 | 31 | i = 0; 32 | while ((sqe = io_uring_get_sqe(&ring)) != NULL) 33 | i++; 34 | 35 | if (i != 8) { 36 | fprintf(stderr, "Got %d SQEs, wanted 8\n", i); 37 | goto err; 38 | } 39 | 40 | io_uring_queue_exit(&ring); 41 | return 0; 42 | err: 43 | io_uring_queue_exit(&ring); 44 | return 1; 45 | } 46 | -------------------------------------------------------------------------------- /vendor/liburing/test/sq-full.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: MIT */ 2 | /* 3 | * Description: test SQ queue full condition 4 | * 5 | */ 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include "liburing.h" 14 | 15 | int main(int argc, char *argv[]) 16 | { 17 | struct io_uring_sqe *sqe; 18 | struct io_uring ring; 19 | int ret, i; 20 | 21 | if (argc > 1) 22 | return 0; 23 | 24 | ret = io_uring_queue_init(8, &ring, 0); 25 | if (ret) { 26 | fprintf(stderr, "ring setup failed: %d\n", ret); 27 | return 1; 28 | 29 | } 30 | 31 | i = 0; 32 | while ((sqe = io_uring_get_sqe(&ring)) != NULL) 33 | i++; 34 | 35 | if (i != 8) { 36 | fprintf(stderr, "Got %d SQEs, wanted 8\n", i); 37 | goto err; 38 | } 39 | 40 | io_uring_queue_exit(&ring); 41 | return 0; 42 | err: 43 | io_uring_queue_exit(&ring); 44 | return 1; 45 | } 46 | -------------------------------------------------------------------------------- /vendor/liburing/test/sqpoll-exit-hang.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: MIT */ 2 | /* 3 | * Test that we exit properly with SQPOLL and having a request that 4 | * adds a circular reference to the ring itself. 5 | */ 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include "liburing.h" 13 | 14 | static unsigned long long mtime_since(const struct timeval *s, 15 | const struct timeval *e) 16 | { 17 | long long sec, usec; 18 | 19 | sec = e->tv_sec - s->tv_sec; 20 | usec = (e->tv_usec - s->tv_usec); 21 | if (sec > 0 && usec < 0) { 22 | sec--; 23 | usec += 1000000; 24 | } 25 | 26 | sec *= 1000; 27 | usec /= 1000; 28 | return sec + usec; 29 | } 30 | 31 | static unsigned long long mtime_since_now(struct timeval *tv) 32 | { 33 | struct timeval end; 34 | 35 | gettimeofday(&end, NULL); 36 | return mtime_since(tv, &end); 37 | } 38 | 39 | int main(int argc, char *argv[]) 40 | { 41 | struct io_uring_params p = {}; 42 | struct timeval tv; 43 | struct io_uring ring; 44 | struct io_uring_sqe *sqe; 45 | int ret; 46 | 47 | if (argc > 1) 48 | return 0; 49 | 50 | p.flags = IORING_SETUP_SQPOLL; 51 | p.sq_thread_idle = 100; 52 | 53 | ret = io_uring_queue_init_params(1, &ring, &p); 54 | if (ret) { 55 | if (geteuid()) { 56 | printf("%s: skipped, not root\n", argv[0]); 57 | return 0; 58 | } 59 | fprintf(stderr, "queue_init=%d\n", ret); 60 | return 1; 61 | } 62 | 63 | if (!(p.features & IORING_FEAT_SQPOLL_NONFIXED)) { 64 | fprintf(stdout, "Skipping\n"); 65 | return 0; 66 | } 67 | 68 | sqe = io_uring_get_sqe(&ring); 69 | io_uring_prep_poll_add(sqe, ring.ring_fd, POLLIN); 70 | io_uring_submit(&ring); 71 | 72 | gettimeofday(&tv, NULL); 73 | do { 74 | usleep(1000); 75 | } while (mtime_since_now(&tv) < 1000); 76 | 77 | return 0; 78 | } 79 | -------------------------------------------------------------------------------- /vendor/liburing/test/sqpoll-sleep.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: MIT */ 2 | /* 3 | * Test that the sqthread goes to sleep around the specified time, and that 4 | * the NEED_WAKEUP flag is then set. 5 | */ 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include "liburing.h" 12 | 13 | static unsigned long long mtime_since(const struct timeval *s, 14 | const struct timeval *e) 15 | { 16 | long long sec, usec; 17 | 18 | sec = e->tv_sec - s->tv_sec; 19 | usec = (e->tv_usec - s->tv_usec); 20 | if (sec > 0 && usec < 0) { 21 | sec--; 22 | usec += 1000000; 23 | } 24 | 25 | sec *= 1000; 26 | usec /= 1000; 27 | return sec + usec; 28 | } 29 | 30 | static unsigned long long mtime_since_now(struct timeval *tv) 31 | { 32 | struct timeval end; 33 | 34 | gettimeofday(&end, NULL); 35 | return mtime_since(tv, &end); 36 | } 37 | 38 | int main(int argc, char *argv[]) 39 | { 40 | struct io_uring_params p = {}; 41 | struct timeval tv; 42 | struct io_uring ring; 43 | int ret; 44 | 45 | if (argc > 1) 46 | return 0; 47 | 48 | p.flags = IORING_SETUP_SQPOLL; 49 | p.sq_thread_idle = 100; 50 | 51 | ret = io_uring_queue_init_params(1, &ring, &p); 52 | if (ret) { 53 | if (geteuid()) { 54 | printf("%s: skipped, not root\n", argv[0]); 55 | return 0; 56 | } 57 | fprintf(stderr, "queue_init=%d\n", ret); 58 | return 1; 59 | } 60 | 61 | gettimeofday(&tv, NULL); 62 | do { 63 | usleep(1000); 64 | if ((*ring.sq.kflags) & IORING_SQ_NEED_WAKEUP) 65 | return 0; 66 | } while (mtime_since_now(&tv) < 1000); 67 | 68 | return 1; 69 | } 70 | -------------------------------------------------------------------------------- /vendor/liburing/test/teardowns.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: MIT */ 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 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 | } 59 | -------------------------------------------------------------------------------- /vendor/liburing/test/test.h: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: MIT */ 2 | /* 3 | * Description: Test configs for tests. 4 | */ 5 | #ifndef LIBURING_TEST_H 6 | #define LIBURING_TEST_H 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | typedef struct io_uring_test_config { 13 | unsigned int flags; 14 | const char *description; 15 | } io_uring_test_config; 16 | 17 | __attribute__((__unused__)) 18 | static io_uring_test_config io_uring_test_configs[] = { 19 | { 0, "default" }, 20 | { IORING_SETUP_SQE128, "large SQE"}, 21 | { IORING_SETUP_CQE32, "large CQE"}, 22 | { IORING_SETUP_SQE128 | IORING_SETUP_CQE32, "large SQE/CQE" }, 23 | }; 24 | 25 | #define FOR_ALL_TEST_CONFIGS \ 26 | for (int i = 0; i < sizeof(io_uring_test_configs) / sizeof(io_uring_test_configs[0]); i++) 27 | 28 | #define IORING_GET_TEST_CONFIG_FLAGS() (io_uring_test_configs[i].flags) 29 | #define IORING_GET_TEST_CONFIG_DESCRIPTION() (io_uring_test_configs[i].description) 30 | 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /vendor/liburing/test/tty-write-dpoll.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: MIT */ 2 | /* 3 | * Test double poll tty write. A test case for the regression fixed by: 4 | * 5 | * commit 6e295a664efd083ac9a5c1a8130c45be1db0cde7 6 | * Author: Jens Axboe 7 | * Date: Tue Mar 22 13:11:28 2022 -0600 8 | * 9 | * io_uring: fix assuming triggered poll waitqueue is the single poll 10 | * 11 | */ 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | #include "liburing.h" 19 | #include "helpers.h" 20 | 21 | #define SQES 128 22 | #define BUFSIZE 512 23 | 24 | int main(int argc, char *argv[]) 25 | { 26 | static char buf[BUFSIZE]; 27 | struct iovec vecs[SQES]; 28 | struct io_uring ring; 29 | int ret, i, fd; 30 | 31 | if (argc > 1) 32 | return 0; 33 | 34 | fd = open("/dev/ttyS0", O_RDWR | O_NONBLOCK); 35 | if (fd < 0) 36 | return 0; 37 | 38 | ret = t_create_ring(SQES, &ring, 0); 39 | if (ret == T_SETUP_SKIP) 40 | return 0; 41 | else if (ret < 0) 42 | return 1; 43 | 44 | for (i = 0; i < SQES; i++) { 45 | struct io_uring_sqe *sqe; 46 | 47 | sqe = io_uring_get_sqe(&ring); 48 | vecs[i].iov_base = buf; 49 | vecs[i].iov_len = sizeof(buf); 50 | io_uring_prep_writev(sqe, fd, &vecs[i], 1, 0); 51 | } 52 | 53 | ret = io_uring_submit(&ring); 54 | if (ret != SQES) { 55 | fprintf(stderr, "submit: %d\n", ret); 56 | return 1; 57 | } 58 | 59 | return 0; 60 | } 61 | -------------------------------------------------------------------------------- /vendor/liburing/test/version.c: -------------------------------------------------------------------------------- 1 | /* SPDX-License-Identifier: MIT */ 2 | /* 3 | * Description: check version macros and runtime checks work 4 | * 5 | */ 6 | #include "liburing.h" 7 | #include "helpers.h" 8 | 9 | int main(int argc, char *argv[]) 10 | { 11 | if (!IO_URING_CHECK_VERSION(io_uring_major_version(), io_uring_minor_version())) 12 | return T_EXIT_FAIL; 13 | 14 | if (io_uring_major_version() != IO_URING_VERSION_MAJOR) 15 | return T_EXIT_FAIL; 16 | 17 | if (io_uring_minor_version() != IO_URING_VERSION_MINOR) 18 | return T_EXIT_FAIL; 19 | 20 | #if !IO_URING_CHECK_VERSION(IO_URING_VERSION_MAJOR, IO_URING_VERSION_MINOR) 21 | return T_EXIT_FAIL; 22 | #endif 23 | 24 | return T_EXIT_PASS; 25 | } 26 | --------------------------------------------------------------------------------