mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
Add register_file_alloc_range
This commit is contained in:
parent
a14352b0b2
commit
bbc21393b4
1 changed files with 21 additions and 0 deletions
|
|
@ -1208,6 +1208,27 @@ pub fn register_files_sparse(self: *IoUring, nr_files: u32) !void {
|
||||||
return handle_registration_result(res);
|
return handle_registration_result(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Registers range for fixed file allocations.
|
||||||
|
// Available since 6.0
|
||||||
|
pub fn register_file_alloc_range(self: *IoUring, offset: u32, len: u32) !void {
|
||||||
|
assert(self.fd >= 0);
|
||||||
|
|
||||||
|
const range = &linux.io_uring_file_index_range{
|
||||||
|
.off = offset,
|
||||||
|
.len = len,
|
||||||
|
.resv = 0,
|
||||||
|
};
|
||||||
|
|
||||||
|
const res = linux.io_uring_register(
|
||||||
|
self.fd,
|
||||||
|
.REGISTER_FILE_ALLOC_RANGE,
|
||||||
|
@ptrCast(range),
|
||||||
|
@as(u32, @sizeOf(linux.io_uring_file_index_range)),
|
||||||
|
);
|
||||||
|
|
||||||
|
return handle_registration_result(res);
|
||||||
|
}
|
||||||
|
|
||||||
/// Registers the file descriptor for an eventfd that will be notified of completion events on
|
/// Registers the file descriptor for an eventfd that will be notified of completion events on
|
||||||
/// an io_uring instance.
|
/// an io_uring instance.
|
||||||
/// Only a single a eventfd can be registered at any given point in time.
|
/// Only a single a eventfd can be registered at any given point in time.
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue