Commit Graph

114 Commits

Author SHA1 Message Date
Max Kellermann 45644759fe io/uring/CancellableOperation: invoke OnUringCompletion() in destructor
This is important for operations that have complex cancellation
procedures (e.g. if they need to free buffers).  They might leave an
Operation instance in the queue.
2025-02-13 14:52:52 +01:00
Max Kellermann e014d31972 io/uring/Ring: add io_uring_submit_and_wait_timeout() wrapper 2025-02-13 14:52:37 +01:00
Max Kellermann b7655d38f7 io/uring/Queue: support IORING_CQE_F_MORE 2025-02-13 14:52:30 +01:00
Max Kellermann 2c7ca16c4e lib/fmt/ToBuffer: add constexpr 2025-01-29 18:12:08 +01:00
Max Kellermann 7c9a460786 io/uring/Ring: add method SetMaxWorkers() 2025-01-29 18:10:59 +01:00
Max Kellermann c644b7616a io/uring/Ring: add ctor wrapping io_uring_queue_init_params() 2025-01-29 18:10:20 +01:00
Max Kellermann badf7101e2 io/uring/Ring: use if with initializer 2025-01-29 18:10:04 +01:00
Max Kellermann 6fb91e661c io/uring/Queue: DispatchCompletions() returns bool 2025-01-29 18:09:57 +01:00
Max Kellermann ed819a05e3 io/uring/Ring: add SubmitAndGetEvents() 2025-01-29 18:09:52 +01:00
Max Kellermann 2e3a51a5da io/uring/Close: use IOSQE_CQE_SKIP_SUCCESS
We don't want to get any completion events for "close".  It's
fire-and-forget.
2025-01-29 18:09:29 +01:00
Max Kellermann 3f638bfa03 io/uring/Operation: add method GetUringData() 2025-01-29 18:07:55 +01:00
Max Kellermann 57e7fb3f62 tag/Id3Load, ...: use std::make_unique_for_overwrite()
Don't zero-initialize the buffers.  This removes some useless
overhead.
2025-01-29 12:01:27 +01:00
Max Kellermann 35dc1fc589 io/UniqueFileDescriptor: use AdoptTag in the constructors that adopt ownership 2025-01-23 16:57:39 +01:00
Max Kellermann 9a7a8ec137 io: always pass O_NONBLOCK to open()
Opening a FIFO may block indefinitely (until a writer connects).  This
is dangerous because it may be a DoS vulnerability in many programs
that do not expect open() to block.

This obsoletes the method FileDescriptor::OpenNonBlocking() which
wasn't used anyway.
2024-12-03 12:28:17 +01:00
Max Kellermann 6dce8dcaa5 io/FileDescriptor: add readv()/writev() wrappers 2024-11-13 10:44:03 +01:00
Max Kellermann fc4a579d83 io/FileDescriptor: remove Read()/Write() with void pointers
Obsolete and unsafe.
2024-11-13 10:43:34 +01:00
Max Kellermann 370df37596 io/uring/Ring: add more API documentation 2024-11-11 19:04:24 +01:00
Max Kellermann 84e3501084 io/uring/Queue: remove redundant include 2024-11-11 19:04:21 +01:00
Max Kellermann d7b4634e5e io/FileLineReader: add missing include 2024-10-30 21:47:37 +01:00
Max Kellermann c7b80b0828 io/FileDescriptor: add method WriteAt() 2024-08-30 12:29:32 +02:00
Max Kellermann 59199b5620 io/FileDescriptor: pass std::span to ReadAt() 2024-08-30 12:29:27 +02:00
Max Kellermann ebfc83dac5 io/FileDescriptor: add method SetPipeCapacity() 2024-08-30 12:28:51 +02:00
Max Kellermann 49ad4e9f3c io/FileDescriptor: remove unnecessary operator!=()
The compiler must generate this implicitly from operator==().
2024-07-23 13:05:02 +02:00
Max Kellermann 39c9e92f42 lib/fmt: require libfmt 9
Version 9 added the "debug format" which I'd like to use.
2024-04-16 11:50:18 +02:00
Max Kellermann 1e4bf90c60 io, net, evnet: quote file names in error messages 2024-04-10 13:36:05 +02:00
Max Kellermann be84b189dc util, io, net, ...: use "#pragma once" 2024-03-11 15:32:24 +01:00
Max Kellermann b63a794fbe io/FileDescriptor: add [[nodiscard]] 2024-01-13 22:31:16 +01:00
Max Kellermann 08a5768764 fs/io/TextFile: split into class FileLineReader and AutoGunzipFileLineReader
Detangle dependencies.
2023-11-25 22:50:32 +01:00
Max Kellermann d888bb1902 io/meson.build: move libfmt dependency to libio.a 2023-11-25 22:16:47 +01:00
Max Kellermann a073db1e52 util/SpanCast: add ReferenceAsBytes() 2023-11-02 10:50:00 +01:00
Max Kellermann ccbacb369b io/linux/ProcPath: new library 2023-10-15 10:55:32 +02:00
Max Kellermann e521b58b01 io/PeekReader: fix offset/size mixup
Regression by commit 7ccc4ddf0d
2023-10-08 09:55:59 +02:00
Max Kellermann 34182990ef fs/FileInfo: add fstat() wrapper 2023-10-07 12:49:07 +02:00
Max Kellermann 1ca5d6baa6 io/FileReader: do not copy the path 2023-10-07 12:48:03 +02:00
Max Kellermann 9365f68454 io/FileReader: use GetFileInfoByHandle() 2023-10-07 12:47:57 +02:00
Max Kellermann 19c73680cf io/FileReader: use uint_least64_t 2023-10-07 08:49:04 +02:00
Max Kellermann a9ba9a5f92 io/Reader: add [[nodiscard]] 2023-10-07 08:45:59 +02:00
Max Kellermann 3032792563 io/Reader: add method ReadFull() 2023-10-07 08:45:52 +02:00
Max Kellermann 7ccc4ddf0d io/Reader: use std::span 2023-10-07 08:44:42 +02:00
Max Kellermann b9704715fb io/FileOutputStream: pass dfd=-1 for absolute /proc/self/fd/N path 2023-10-07 08:42:35 +02:00
Max Kellermann 496184b1bc io/Reader: add method ReadT() 2023-10-07 08:27:13 +02:00
Max Kellermann cad35a83fb io/FileDescriptor: add Read()/Write() overloads with std::span 2023-09-27 11:14:23 +02:00
Max Kellermann 09a2da89a2 io/FileDescriptor: pass std::span to Full{Read,Write}() 2023-09-27 10:14:02 +02:00
Max Kellermann ce2965b5bc io/uring/meson.build: disable io_uring on Android
On Android, the feature is forbidden by a seccomp filter, see

 https://security.googleblog.com/2023/06/learnings-from-kctf-vrps-42-linux.html
2023-09-16 22:39:03 +02:00
Max Kellermann 18000ff499 io/uring/Handler: remove unused header 2023-09-16 22:39:03 +02:00
Max Kellermann c994fe4879 io/uring/meson.build: detect liburing with include_type=system
This avoids breakages due to `-Wgnu-anonymous-struct`.
2023-09-12 10:20:58 +02:00
Max Kellermann 11c49da871 io/FileReader: remove unused method Close()
It's enough to have the destructor.
2023-09-12 09:53:06 +02:00
Max Kellermann 678828b56f io/FileOutputStream: remove obsolete maybe_unused 2023-09-12 09:43:14 +02:00
Max Kellermann 859ffddea3 io/BufferedReader: fix ReadFullT() after std::span migration 2023-09-12 09:32:20 +02:00
Max Kellermann d9b1f6223e io/uring/Close: wrapper for io_uring_prep_close() 2023-05-22 21:59:44 +02:00