Skip to content

Commit 5756980

Browse files
committed
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.
1 parent e4b8fd4 commit 5756980

File tree

5 files changed

+11
-18
lines changed

5 files changed

+11
-18
lines changed

libc-test/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2304,6 +2304,7 @@ fn test_freebsd(target: &str) {
23042304
"getlocalbase" if Some(13) > freebsd_ver => true,
23052305
"aio_readv" if Some(13) > freebsd_ver => true,
23062306
"aio_writev" if Some(13) > freebsd_ver => true,
2307+
"copy_file_range" if Some(13) > freebsd_ver => true,
23072308

23082309
_ => false,
23092310
}

libc-test/semver/freebsd.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1517,6 +1517,7 @@ clearerr
15171517
clock_getcpuclockid
15181518
clock_getres
15191519
clock_settime
1520+
copy_file_range
15201521
cmsgcred
15211522
cmsghdr
15221523
cpuset

src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -527,15 +527,6 @@ extern "C" {
527527
policy: ::c_int,
528528
) -> ::c_int;
529529

530-
pub fn copy_file_range(
531-
infd: ::c_int,
532-
inoffp: *mut ::off_t,
533-
outfd: ::c_int,
534-
outoffp: *mut ::off_t,
535-
len: ::size_t,
536-
flags: ::c_uint,
537-
) -> ::ssize_t;
538-
539530
pub fn dirname(path: *mut ::c_char) -> *mut ::c_char;
540531
pub fn basename(path: *mut ::c_char) -> *mut ::c_char;
541532
}

src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -527,15 +527,6 @@ extern "C" {
527527
policy: ::c_int,
528528
) -> ::c_int;
529529

530-
pub fn copy_file_range(
531-
infd: ::c_int,
532-
inoffp: *mut ::off_t,
533-
outfd: ::c_int,
534-
outoffp: *mut ::off_t,
535-
len: ::size_t,
536-
flags: ::c_uint,
537-
) -> ::ssize_t;
538-
539530
pub fn dirname(path: *mut ::c_char) -> *mut ::c_char;
540531
pub fn basename(path: *mut ::c_char) -> *mut ::c_char;
541532
}

src/unix/bsd/freebsdlike/freebsd/mod.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3954,6 +3954,15 @@ extern "C" {
39543954
pub fn aio_write(aiocbp: *mut aiocb) -> ::c_int;
39553955
pub fn aio_writev(aiocbp: *mut ::aiocb) -> ::c_int;
39563956

3957+
pub fn copy_file_range(
3958+
infd: ::c_int,
3959+
inoffp: *mut ::off_t,
3960+
outfd: ::c_int,
3961+
outoffp: *mut ::off_t,
3962+
len: ::size_t,
3963+
flags: ::c_uint,
3964+
) -> ::ssize_t;
3965+
39573966
pub fn devname_r(
39583967
dev: ::dev_t,
39593968
mode: ::mode_t,

0 commit comments

Comments
 (0)