authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-07-31 10:57:06-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-07-31 10:57:06-07:00
logfaa6daef9981060eccf832b1c21d50929aa327dd
tree829f12d802af518aff135de365606cbdf847a20c
parent833af381f018de02dfc5180b8d6d5bd0cfe0f495

Revert "std.c: darwin's *copyfile api update."

This reverts commit 40e8c2243c139dc499298645a2b387e30ae09cba.

2 files changed, 6 insertions(+), 60 deletions(-)

lib/std/c/darwin.zig+5-59
...@@ -161,67 +161,13 @@ pub extern "c" fn _dyld_get_image_header(image_index: u32) ?*mach_header;...@@ -161,67 +161,13 @@ pub extern "c" fn _dyld_get_image_header(image_index: u32) ?*mach_header;
161pub extern "c" fn _dyld_get_image_vmaddr_slide(image_index: u32) usize;161pub extern "c" fn _dyld_get_image_vmaddr_slide(image_index: u32) usize;
162pub extern "c" fn _dyld_get_image_name(image_index: u32) [*:0]const u8;162pub extern "c" fn _dyld_get_image_name(image_index: u32) [*:0]const u8;
163163
164pub const COPYFILE = struct {164pub const COPYFILE_ACL = 1 << 0;
165 pub const ACL = 1 << 0;165pub const COPYFILE_STAT = 1 << 1;
166 pub const STAT = 1 << 1;166pub const COPYFILE_XATTR = 1 << 2;
167 pub const XATTR = 1 << 2;167pub const COPYFILE_DATA = 1 << 3;
168 pub const DATA = 1 << 3;
169 pub const SECURITY = COPYFILE.STAT | COPYFILE.ACL;
170 pub const METADATA = COPYFILE.SECURITY | COPYFILE.XATTR;
171 pub const ALL = COPYFILE.METADATA | COPYFILE.DATA;
172 pub const RECURSIVE = 1 << 15;
173 pub const CHECK = 1 << 16;
174 pub const EXCL = 1 << 17;
175 pub const NOFOLLOW_SRC = 1 << 18;
176 pub const NOFOLLOW_DST = 1 << 19;
177 pub const MOVE = 1 << 20;
178 pub const UNLINK = 1 << 21;
179 pub const NOFOLLOW = COPYFILE.NOFOLLOW_SRC | NOFOLLOW_DST;
180 pub const PACK = 1 << 22;
181 pub const UNPACK = 1 << 23;
182 pub const CLONE = 1 << 24;
183 pub const CLONE_FORCE = 1 << 25;
184 pub const RUN_IN_PLACE = 1 << 26;
185 pub const DATA_SPARSE = 1 << 27;
186 pub const PRESERVE_DST_TRACKED = 1 << 28;
187 pub const VERBOSE = 1 << 30;
188 pub const RECURSE_ERROR = 0;
189 pub const RECURSE_FILE = 1;
190 pub const RECURSE_DIR = 2;
191 pub const RECURSE_DIR_CLEANUP = 3;
192 pub const COPY_DATA = 4;
193 pub const COPY_XATTR = 5;
194 pub const START = 1;
195 pub const FINISH = 2;
196 pub const ERR = 3;
197 pub const PROGRESS = 4;
198 pub const CONTINUE = 0;
199 pub const SKIP = 1;
200 pub const QUIT = 2;
201 pub const STATE_SRC_FD = 1;
202 pub const STATE_SRC_FILENAME = 2;
203 pub const STATE_DST_FD = 3;
204 pub const STATE_DST_FILENAME = 4;
205 pub const STATE_QUARANTINE = 5;
206 pub const STATE_STATUS_CB = 6;
207 pub const STATE_STATUS_CTX = 7;
208 pub const STATE_COPIED = 8;
209 pub const STATE_XATTRNAME = 9;
210 pub const STATE_WAS_CLONED = 10;
211 pub const STATE_SRC_BSIZE = 11;
212 pub const STATE_DST_BSIZE = 12;
213 pub const STATE_BSIZE = 13;
214 pub const DISABLE_VAR: [*]u8 = "COPYFILE_DISABLE";
215};
216168
217pub const copyfile_state_t = *opaque {};169pub const copyfile_state_t = *opaque {};
218pub const copyfile_flags_t = u32;170pub extern "c" fn fcopyfile(from: fd_t, to: fd_t, state: ?copyfile_state_t, flags: u32) c_int;
219pub extern "c" fn fcopyfile(from: fd_t, to: fd_t, state: ?copyfile_state_t, flags: copyfile_flags_t) c_int;
220pub extern "c" fn copyfile(from: [*:0]u8, to: [*:0]u8, state: ?copyfile_state_t, flags: copyfile_flags_t) c_int;
221pub extern "c" fn copyfile_state_alloc() copyfile_state_t;
222pub extern "c" fn copyfile_state_free(state: copyfile_state_t) void;
223pub extern "c" fn copyfile_state_get(s: copyfile_state_t, flag: u32, dst: ?*anyopaque) c_int;
224pub extern "c" fn copyfile_state_set(s: copyfile_state_t, flag: u32, dst: ?*const anyopaque) c_int;
225171
226pub extern "c" fn @"realpath$DARWIN_EXTSN"(noalias file_name: [*:0]const u8, noalias resolved_name: [*]u8) ?[*:0]u8;172pub extern "c" fn @"realpath$DARWIN_EXTSN"(noalias file_name: [*:0]const u8, noalias resolved_name: [*]u8) ?[*:0]u8;
227pub const realpath = @"realpath$DARWIN_EXTSN";173pub const realpath = @"realpath$DARWIN_EXTSN";
lib/std/fs.zig+1-1
...@@ -3120,7 +3120,7 @@ const CopyFileRawError = error{SystemResources} || os.CopyFileRangeError || os.S...@@ -3120,7 +3120,7 @@ const CopyFileRawError = error{SystemResources} || os.CopyFileRangeError || os.S
3120// No metadata is transferred over.3120// No metadata is transferred over.
3121fn copy_file(fd_in: os.fd_t, fd_out: os.fd_t, maybe_size: ?u64) CopyFileRawError!void {3121fn copy_file(fd_in: os.fd_t, fd_out: os.fd_t, maybe_size: ?u64) CopyFileRawError!void {
3122 if (comptime builtin.target.isDarwin()) {3122 if (comptime builtin.target.isDarwin()) {
3123 const rc = os.system.fcopyfile(fd_in, fd_out, null, os.system.COPYFILE.DATA);3123 const rc = os.system.fcopyfile(fd_in, fd_out, null, os.system.COPYFILE_DATA);
3124 switch (os.errno(rc)) {3124 switch (os.errno(rc)) {
3125 .SUCCESS => return,3125 .SUCCESS => return,
3126 .INVAL => unreachable,3126 .INVAL => unreachable,