Skip to content

Commit

Permalink
Add macos clonefile functions
Browse files Browse the repository at this point in the history
  • Loading branch information
nthery committed Apr 17, 2021
1 parent 2c40088 commit c8539f5
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
2 changes: 2 additions & 0 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,8 @@ fn test_apple(target: &str) {
"stdio.h",
"stdlib.h",
"string.h",
"sys/attr.h",
"sys/clonefile.h",
"sys/event.h",
"sys/file.h",
"sys/ioctl.h",
Expand Down
3 changes: 3 additions & 0 deletions libc-test/semver/apple.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1514,6 +1514,8 @@ chflags
chroot
clearerr
clock_getres
clonefile
clonefileat
cmsghdr
connectx
cpu_subtype_t
Expand All @@ -1531,6 +1533,7 @@ exchangedata
faccessat
fchdir
fchflags
fclonefileat
fdopendir
fgetxattr
flistxattr
Expand Down
18 changes: 18 additions & 0 deletions src/unix/bsd/apple/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3835,6 +3835,24 @@ extern "C" {
outbytesleft: *mut ::size_t,
) -> ::size_t;
pub fn iconv_close(cd: iconv_t) -> ::c_int;

// Copy-on-write functions.
// According to the man page `flags` is an `int` but in the header
// this is a `uint32_t`.
pub fn clonefile(src: *const ::c_char, dst: *const ::c_char, flags: u32) -> ::c_int;
pub fn clonefileat(
src_dirfd: ::c_int,
src: *const ::c_char,
dst_dirfd: ::c_int,
dst: *const ::c_char,
flags: u32,
) -> ::c_int;
pub fn fclonefileat(
srcfd: ::c_int,
dst_dirfd: ::c_int,
dst: *const ::c_char,
flags: u32,
) -> ::c_int;
}

cfg_if! {
Expand Down

0 comments on commit c8539f5

Please sign in to comment.