diff --git a/lib/std/c/darwin.zig b/lib/std/c/darwin.zig index b9fc59a1a7..b384fcf845 100644 --- a/lib/std/c/darwin.zig +++ b/lib/std/c/darwin.zig @@ -161,67 +161,13 @@ pub extern "c" fn _dyld_get_image_header(image_index: u32) ?*mach_header; pub extern "c" fn _dyld_get_image_vmaddr_slide(image_index: u32) usize; pub extern "c" fn _dyld_get_image_name(image_index: u32) [*:0]const u8; -pub const COPYFILE = struct { - pub const ACL = 1 << 0; - pub const STAT = 1 << 1; - pub const XATTR = 1 << 2; - pub const DATA = 1 << 3; - pub const SECURITY = COPYFILE.STAT | COPYFILE.ACL; - pub const METADATA = COPYFILE.SECURITY | COPYFILE.XATTR; - pub const ALL = COPYFILE.METADATA | COPYFILE.DATA; - pub const RECURSIVE = 1 << 15; - pub const CHECK = 1 << 16; - pub const EXCL = 1 << 17; - pub const NOFOLLOW_SRC = 1 << 18; - pub const NOFOLLOW_DST = 1 << 19; - pub const MOVE = 1 << 20; - pub const UNLINK = 1 << 21; - pub const NOFOLLOW = COPYFILE.NOFOLLOW_SRC | NOFOLLOW_DST; - pub const PACK = 1 << 22; - pub const UNPACK = 1 << 23; - pub const CLONE = 1 << 24; - pub const CLONE_FORCE = 1 << 25; - pub const RUN_IN_PLACE = 1 << 26; - pub const DATA_SPARSE = 1 << 27; - pub const PRESERVE_DST_TRACKED = 1 << 28; - pub const VERBOSE = 1 << 30; - pub const RECURSE_ERROR = 0; - pub const RECURSE_FILE = 1; - pub const RECURSE_DIR = 2; - pub const RECURSE_DIR_CLEANUP = 3; - pub const COPY_DATA = 4; - pub const COPY_XATTR = 5; - pub const START = 1; - pub const FINISH = 2; - pub const ERR = 3; - pub const PROGRESS = 4; - pub const CONTINUE = 0; - pub const SKIP = 1; - pub const QUIT = 2; - pub const STATE_SRC_FD = 1; - pub const STATE_SRC_FILENAME = 2; - pub const STATE_DST_FD = 3; - pub const STATE_DST_FILENAME = 4; - pub const STATE_QUARANTINE = 5; - pub const STATE_STATUS_CB = 6; - pub const STATE_STATUS_CTX = 7; - pub const STATE_COPIED = 8; - pub const STATE_XATTRNAME = 9; - pub const STATE_WAS_CLONED = 10; - pub const STATE_SRC_BSIZE = 11; - pub const STATE_DST_BSIZE = 12; - pub const STATE_BSIZE = 13; - pub const DISABLE_VAR: [*]u8 = "COPYFILE_DISABLE"; -}; +pub const COPYFILE_ACL = 1 << 0; +pub const COPYFILE_STAT = 1 << 1; +pub const COPYFILE_XATTR = 1 << 2; +pub const COPYFILE_DATA = 1 << 3; pub const copyfile_state_t = *opaque {}; -pub const copyfile_flags_t = u32; -pub extern "c" fn fcopyfile(from: fd_t, to: fd_t, state: ?copyfile_state_t, flags: copyfile_flags_t) c_int; -pub extern "c" fn copyfile(from: [*:0]u8, to: [*:0]u8, state: ?copyfile_state_t, flags: copyfile_flags_t) c_int; -pub extern "c" fn copyfile_state_alloc() copyfile_state_t; -pub extern "c" fn copyfile_state_free(state: copyfile_state_t) void; -pub extern "c" fn copyfile_state_get(s: copyfile_state_t, flag: u32, dst: ?*anyopaque) c_int; -pub extern "c" fn copyfile_state_set(s: copyfile_state_t, flag: u32, dst: ?*const anyopaque) c_int; +pub extern "c" fn fcopyfile(from: fd_t, to: fd_t, state: ?copyfile_state_t, flags: u32) c_int; pub extern "c" fn @"realpath$DARWIN_EXTSN"(noalias file_name: [*:0]const u8, noalias resolved_name: [*]u8) ?[*:0]u8; pub const realpath = @"realpath$DARWIN_EXTSN"; diff --git a/lib/std/fs.zig b/lib/std/fs.zig index 89a0d3ab6f..de18a085e4 100644 --- a/lib/std/fs.zig +++ b/lib/std/fs.zig @@ -3120,7 +3120,7 @@ const CopyFileRawError = error{SystemResources} || os.CopyFileRangeError || os.S // No metadata is transferred over. fn copy_file(fd_in: os.fd_t, fd_out: os.fd_t, maybe_size: ?u64) CopyFileRawError!void { if (comptime builtin.target.isDarwin()) { - const rc = os.system.fcopyfile(fd_in, fd_out, null, os.system.COPYFILE.DATA); + const rc = os.system.fcopyfile(fd_in, fd_out, null, os.system.COPYFILE_DATA); switch (os.errno(rc)) { .SUCCESS => return, .INVAL => unreachable,