feature. See also
. The project being documented here (as the example) is the Zig library itself.
Uring.dirHardLink
fn dirHardLink(
userdata: ?*anyopaque,
old_dir: Dir,
old_sub_path: []const u8,
new_dir: Dir,
new_sub_path: []const u8,
options: Dir.HardLinkOptions,
) Dir.HardLinkError!void
File
Code
fn dirHardLink(
userdata: ?*anyopaque,
old_dir: Dir,
old_sub_path: []const u8,
new_dir: Dir,
new_sub_path: []const u8,
options: Dir.HardLinkOptions,
) Dir.HardLinkError!void {
const ev: *Evented = @ptrCast(@alignCast(userdata));
var old_path_buffer: [PATH_MAX]u8 = undefined;
var new_path_buffer: [PATH_MAX]u8 = undefined;
const old_sub_path_posix = try pathToPosix(old_sub_path, &old_path_buffer);
const new_sub_path_posix = try pathToPosix(new_sub_path, &new_path_buffer);
var cancel_region: CancelRegion = .init();
defer cancel_region.deinit();
return ev.linkat(
&cancel_region,
old_dir.handle,
old_sub_path_posix,
new_dir.handle,
new_sub_path_posix,
if (options.follow_symlinks) 0 else linux.AT.SYMLINK_NOFOLLOW,
);
}