Skip to content

Commit

Permalink
Auto merge of #3023 - asomers:copy_file_range, r=JohnTitor
Browse files Browse the repository at this point in the history
Enable copy_file_range on FreeBSD

PR #2479 did this, but only in the freebsd13 and freebsd14 modules, which was incorrect.  Those modules should only be used for functions that change across FreeBSD versions, and therefore need different ELF symbol versions.  Functions that were newly added since FreeBSD 11 can still go in the base freebsd module.  It will cause no problems for them to be there, and users will see an error at link time if they try to use such a function in an environment that is too old to support it.
  • Loading branch information
bors committed Nov 30, 2022
2 parents d6fe782 + 5756980 commit 15d2795
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 18 deletions.
1 change: 1 addition & 0 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2304,6 +2304,7 @@ fn test_freebsd(target: &str) {
"getlocalbase" if Some(13) > freebsd_ver => true,
"aio_readv" if Some(13) > freebsd_ver => true,
"aio_writev" if Some(13) > freebsd_ver => true,
"copy_file_range" if Some(13) > freebsd_ver => true,

_ => false,
}
Expand Down
1 change: 1 addition & 0 deletions libc-test/semver/freebsd.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1534,6 +1534,7 @@ clearerr
clock_getcpuclockid
clock_getres
clock_settime
copy_file_range
cmsgcred
cmsghdr
cpuset
Expand Down
9 changes: 0 additions & 9 deletions src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -527,15 +527,6 @@ extern "C" {
policy: ::c_int,
) -> ::c_int;

pub fn copy_file_range(
infd: ::c_int,
inoffp: *mut ::off_t,
outfd: ::c_int,
outoffp: *mut ::off_t,
len: ::size_t,
flags: ::c_uint,
) -> ::ssize_t;

pub fn dirname(path: *mut ::c_char) -> *mut ::c_char;
pub fn basename(path: *mut ::c_char) -> *mut ::c_char;
}
Expand Down
9 changes: 0 additions & 9 deletions src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -527,15 +527,6 @@ extern "C" {
policy: ::c_int,
) -> ::c_int;

pub fn copy_file_range(
infd: ::c_int,
inoffp: *mut ::off_t,
outfd: ::c_int,
outoffp: *mut ::off_t,
len: ::size_t,
flags: ::c_uint,
) -> ::ssize_t;

pub fn dirname(path: *mut ::c_char) -> *mut ::c_char;
pub fn basename(path: *mut ::c_char) -> *mut ::c_char;
}
Expand Down
9 changes: 9 additions & 0 deletions src/unix/bsd/freebsdlike/freebsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3954,6 +3954,15 @@ extern "C" {
pub fn aio_write(aiocbp: *mut aiocb) -> ::c_int;
pub fn aio_writev(aiocbp: *mut ::aiocb) -> ::c_int;

pub fn copy_file_range(
infd: ::c_int,
inoffp: *mut ::off_t,
outfd: ::c_int,
outoffp: *mut ::off_t,
len: ::size_t,
flags: ::c_uint,
) -> ::ssize_t;

pub fn devname_r(
dev: ::dev_t,
mode: ::mode_t,
Expand Down

0 comments on commit 15d2795

Please sign in to comment.