Skip to content

Commit 6570c66

Browse files
committed
Auto merge of #2147 - nthery:clonefile, r=JohnTitor
Add macos clonefile functions
2 parents dafd08d + c8539f5 commit 6570c66

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

libc-test/build.rs

+2
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,8 @@ fn test_apple(target: &str) {
217217
"stdio.h",
218218
"stdlib.h",
219219
"string.h",
220+
"sys/attr.h",
221+
"sys/clonefile.h",
220222
"sys/event.h",
221223
"sys/file.h",
222224
"sys/ioctl.h",

libc-test/semver/apple.txt

+3
Original file line numberDiff line numberDiff line change
@@ -1514,6 +1514,8 @@ chflags
15141514
chroot
15151515
clearerr
15161516
clock_getres
1517+
clonefile
1518+
clonefileat
15171519
cmsghdr
15181520
connectx
15191521
cpu_subtype_t
@@ -1531,6 +1533,7 @@ exchangedata
15311533
faccessat
15321534
fchdir
15331535
fchflags
1536+
fclonefileat
15341537
fdopendir
15351538
fgetxattr
15361539
flistxattr

src/unix/bsd/apple/mod.rs

+18
Original file line numberDiff line numberDiff line change
@@ -3835,6 +3835,24 @@ extern "C" {
38353835
outbytesleft: *mut ::size_t,
38363836
) -> ::size_t;
38373837
pub fn iconv_close(cd: iconv_t) -> ::c_int;
3838+
3839+
// Copy-on-write functions.
3840+
// According to the man page `flags` is an `int` but in the header
3841+
// this is a `uint32_t`.
3842+
pub fn clonefile(src: *const ::c_char, dst: *const ::c_char, flags: u32) -> ::c_int;
3843+
pub fn clonefileat(
3844+
src_dirfd: ::c_int,
3845+
src: *const ::c_char,
3846+
dst_dirfd: ::c_int,
3847+
dst: *const ::c_char,
3848+
flags: u32,
3849+
) -> ::c_int;
3850+
pub fn fclonefileat(
3851+
srcfd: ::c_int,
3852+
dst_dirfd: ::c_int,
3853+
dst: *const ::c_char,
3854+
flags: u32,
3855+
) -> ::c_int;
38383856
}
38393857

38403858
cfg_if! {

0 commit comments

Comments
 (0)