copy_file_range(2) is implemented natively since r350315, make it available for Linux binaries too.
Details
- Reviewers
mjg kib trasz manu - Group Reviewers
Linux Emulation - Commits
- rS356206: linux(4): implement copy_file_range(2)
root@u64:~/ltp-install# ./runltp -s copy_file_range
INFO: creating /root/ltp-install/results directory
INFO: no command files were provided. Executing following runtest scenario files:
syscalls fs fs_perms_simple fsx dio io mm ipc sched math nptl pty containers fs_bind controllers filecaps cap_bounds fcntl-locktests connectors timers power_management_tests hugetlb commands hyperthreading kernel_misc fs_ext4 can cpuhotplug net.ipv6_lib input cve crypto
Checking for required user/group ids
'nobody' user id and group found.
'bin' user id and group found.
'daemon' user id and group found.
Users group found.
Sys group found.
Required users/groups exist.
If some fields are empty or look unusual you may have an old version.
Compare to the current minimal requirements in Documentation/Changes.
/etc/lsb-release
/etc/os-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=19.04
DISTRIB_CODENAME=disco
DISTRIB_DESCRIPTION="Ubuntu 19.04"
NAME="Ubuntu"
VERSION="19.04 (Disco Dingo)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 19.04"
VERSION_ID="19.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=disco
UBUNTU_CODENAME=disco
uname:
Linux u64 3.2.0 FreeBSD 13.0-CURRENT #0 r356179M: Sun Dec 29 17:30:40 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
/proc/cmdline
BOOT_IMAGE=/boot/kernel/kernel ro root=302
Gnu C gcc (Ubuntu 8.3.0-6ubuntu1) 8.3.0
Clang
Gnu make 4.2.1
util-linux linux 2.33.1
mount linux 2.33.1 (libmount 2.33.1: selinux, smack, btrfs, namespaces, assert, debug)
modutils 25
e2fsprogs 1.44.6
ELF binary type "0" not known.
awk: run time error: negative field index $-1
FILENAME="-" FNR=1 NR=1
Dynamic linker (ldd) 2.29
Procps 3.3.15
iproute2 iproute2-ss180813
iputils iputils-s20180629
Kbd 2.0.4
Sh-utils 8.30
Modules Loaded
free reports:
total used free shared buff/cache available
Mem: 67068484 640144 66411244 0 17096 66411244
Swap: 67108832 0 67108832
cpuinfo:
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
Address sizes: 48 bits physical, 48 bits virtual
CPU(s): 24
On-line CPU(s) list: 0-23
Vendor ID: AuthenticAMD
CPU family: 23
Model: 1
Model name: AMD EPYC 7401P 24-Core Processor
Stepping: 2
CPU MHz: 1996.27
BogoMIPS: 1996.27
Virtualization: AMD-V
Hypervisor vendor: KVM
Virtualization type: full
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 mmx fxsr sse sse2 syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm pni pclmulqdq ssse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm cmp_legacy svm cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw fsgsbase tsc_adjust bmi1 avx2 smep bmi2 rdseed adx smap clflushopt sha_ni
AppArmor disabled
SELinux mode: unknown
Failed to create loopback device image, please check disk space and re-run
no block device was specified on commandline.
Block device could not be created using loopback device
Tests which require block device are disabled.
You can specify it with option -b
no big block device was specified on commandline.
Tests which require a big block device are disabled.
You can specify it with option -z
COMMAND: /root/ltp-install/bin/ltp-pan -e -S -a 67370 -n 67370 -p -f /tmp/ltp-U2dkaPGA8l/alltests -l /root/ltp-install/results/LTP_RUN_ON-2019_12_29-17h_53m_37s.log -C /root/ltp-install/output/LTP_RUN_ON-2019_12_29-17h_53m_37s.failed -T /root/ltp-install/output/LTP_RUN_ON-2019_12_29-17h_53m_37s.tconf
INFO: Restricted to copy_file_range
LOG File: /root/ltp-install/results/LTP_RUN_ON-2019_12_29-17h_53m_37s.log
FAILED COMMAND File: /root/ltp-install/output/LTP_RUN_ON-2019_12_29-17h_53m_37s.failed
TCONF COMMAND File: /root/ltp-install/output/LTP_RUN_ON-2019_12_29-17h_53m_37s.tconf
Running tests.......
<<<test_start>>>
tag=copy_file_range01 stime=1577642018
cmdline="copy_file_range01"
contacts=""
analysis=exit
<<<test_output>>>
incrementing stop
tst_test.c:1096: INFO: Timeout per run is 0h 05m 00s
copy_file_range01.c:199: PASS: off_in: NULL, off_out: NULL, len: 11
copy_file_range01.c:199: PASS: off_in: NULL, off_out: 0, len: 11
copy_file_range01.c:199: PASS: off_in: NULL, off_out: 17, len: 11
copy_file_range01.c:199: PASS: off_in: NULL, off_out: 4095, len: 11
copy_file_range01.c:199: PASS: off_in: NULL, off_out: 4096, len: 11
copy_file_range01.c:199: PASS: off_in: NULL, off_out: 4097, len: 11
copy_file_range01.c:199: PASS: off_in: 0, off_out: NULL, len: 11
copy_file_range01.c:199: PASS: off_in: 0, off_out: 0, len: 11
copy_file_range01.c:199: PASS: off_in: 0, off_out: 17, len: 11
copy_file_range01.c:199: PASS: off_in: 0, off_out: 4095, len: 11
copy_file_range01.c:199: PASS: off_in: 0, off_out: 4096, len: 11
copy_file_range01.c:199: PASS: off_in: 0, off_out: 4097, len: 11
copy_file_range01.c:199: PASS: off_in: 17, off_out: NULL, len: 11
copy_file_range01.c:199: PASS: off_in: 17, off_out: 0, len: 11
copy_file_range01.c:199: PASS: off_in: 17, off_out: 17, len: 11
copy_file_range01.c:199: PASS: off_in: 17, off_out: 4095, len: 11
copy_file_range01.c:199: PASS: off_in: 17, off_out: 4096, len: 11
copy_file_range01.c:199: PASS: off_in: 17, off_out: 4097, len: 11
copy_file_range01.c:199: PASS: off_in: 4095, off_out: NULL, len: 11
copy_file_range01.c:199: PASS: off_in: 4095, off_out: 0, len: 11
copy_file_range01.c:199: PASS: off_in: 4095, off_out: 17, len: 11
copy_file_range01.c:199: PASS: off_in: 4095, off_out: 4095, len: 11
copy_file_range01.c:199: PASS: off_in: 4095, off_out: 4096, len: 11
copy_file_range01.c:199: PASS: off_in: 4095, off_out: 4097, len: 11
copy_file_range01.c:199: PASS: off_in: 4096, off_out: NULL, len: 11
copy_file_range01.c:199: PASS: off_in: 4096, off_out: 0, len: 11
copy_file_range01.c:199: PASS: off_in: 4096, off_out: 17, len: 11
copy_file_range01.c:199: PASS: off_in: 4096, off_out: 4095, len: 11
copy_file_range01.c:199: PASS: off_in: 4096, off_out: 4096, len: 11
copy_file_range01.c:199: PASS: off_in: 4096, off_out: 4097, len: 11
copy_file_range01.c:199: PASS: off_in: 4097, off_out: NULL, len: 11
copy_file_range01.c:199: PASS: off_in: 4097, off_out: 0, len: 11
copy_file_range01.c:199: PASS: off_in: 4097, off_out: 17, len: 11
copy_file_range01.c:199: PASS: off_in: 4097, off_out: 4095, len: 11
copy_file_range01.c:199: PASS: off_in: 4097, off_out: 4096, len: 11
copy_file_range01.c:199: PASS: off_in: 4097, off_out: 4097, len: 11
copy_file_range01.c:199: PASS: off_in: NULL, off_out: NULL, len: 4095
copy_file_range01.c:199: PASS: off_in: NULL, off_out: 0, len: 4095
copy_file_range01.c:199: PASS: off_in: NULL, off_out: 17, len: 4095
copy_file_range01.c:199: PASS: off_in: NULL, off_out: 4095, len: 4095
copy_file_range01.c:199: PASS: off_in: NULL, off_out: 4096, len: 4095
copy_file_range01.c:199: PASS: off_in: NULL, off_out: 4097, len: 4095
copy_file_range01.c:199: PASS: off_in: 0, off_out: NULL, len: 4095
copy_file_range01.c:199: PASS: off_in: 0, off_out: 0, len: 4095
copy_file_range01.c:199: PASS: off_in: 0, off_out: 17, len: 4095
copy_file_range01.c:199: PASS: off_in: 0, off_out: 4095, len: 4095
copy_file_range01.c:199: PASS: off_in: 0, off_out: 4096, len: 4095
copy_file_range01.c:199: PASS: off_in: 0, off_out: 4097, len: 4095
copy_file_range01.c:199: PASS: off_in: 17, off_out: NULL, len: 4095
copy_file_range01.c:199: PASS: off_in: 17, off_out: 0, len: 4095
copy_file_range01.c:199: PASS: off_in: 17, off_out: 17, len: 4095
copy_file_range01.c:199: PASS: off_in: 17, off_out: 4095, len: 4095
copy_file_range01.c:199: PASS: off_in: 17, off_out: 4096, len: 4095
copy_file_range01.c:199: PASS: off_in: 17, off_out: 4097, len: 4095
copy_file_range01.c:199: PASS: off_in: 4095, off_out: NULL, len: 4095
copy_file_range01.c:199: PASS: off_in: 4095, off_out: 0, len: 4095
copy_file_range01.c:199: PASS: off_in: 4095, off_out: 17, len: 4095
copy_file_range01.c:199: PASS: off_in: 4095, off_out: 4095, len: 4095
copy_file_range01.c:199: PASS: off_in: 4095, off_out: 4096, len: 4095
copy_file_range01.c:199: PASS: off_in: 4095, off_out: 4097, len: 4095
copy_file_range01.c:199: PASS: off_in: 4096, off_out: NULL, len: 4095
copy_file_range01.c:199: PASS: off_in: 4096, off_out: 0, len: 4095
copy_file_range01.c:199: PASS: off_in: 4096, off_out: 17, len: 4095
copy_file_range01.c:199: PASS: off_in: 4096, off_out: 4095, len: 4095
copy_file_range01.c:199: PASS: off_in: 4096, off_out: 4096, len: 4095
copy_file_range01.c:199: PASS: off_in: 4096, off_out: 4097, len: 4095
copy_file_range01.c:199: PASS: off_in: 4097, off_out: NULL, len: 4095
copy_file_range01.c:199: PASS: off_in: 4097, off_out: 0, len: 4095
copy_file_range01.c:199: PASS: off_in: 4097, off_out: 17, len: 4095
copy_file_range01.c:199: PASS: off_in: 4097, off_out: 4095, len: 4095
copy_file_range01.c:199: PASS: off_in: 4097, off_out: 4096, len: 4095
copy_file_range01.c:199: PASS: off_in: 4097, off_out: 4097, len: 4095
copy_file_range01.c:199: PASS: off_in: NULL, off_out: NULL, len: 4096
copy_file_range01.c:199: PASS: off_in: NULL, off_out: 0, len: 4096
copy_file_range01.c:199: PASS: off_in: NULL, off_out: 17, len: 4096
copy_file_range01.c:199: PASS: off_in: NULL, off_out: 4095, len: 4096
copy_file_range01.c:199: PASS: off_in: NULL, off_out: 4096, len: 4096
copy_file_range01.c:199: PASS: off_in: NULL, off_out: 4097, len: 4096
copy_file_range01.c:199: PASS: off_in: 0, off_out: NULL, len: 4096
copy_file_range01.c:199: PASS: off_in: 0, off_out: 0, len: 4096
copy_file_range01.c:199: PASS: off_in: 0, off_out: 17, len: 4096
copy_file_range01.c:199: PASS: off_in: 0, off_out: 4095, len: 4096
copy_file_range01.c:199: PASS: off_in: 0, off_out: 4096, len: 4096
copy_file_range01.c:199: PASS: off_in: 0, off_out: 4097, len: 4096
copy_file_range01.c:199: PASS: off_in: 17, off_out: NULL, len: 4096
copy_file_range01.c:199: PASS: off_in: 17, off_out: 0, len: 4096
copy_file_range01.c:199: PASS: off_in: 17, off_out: 17, len: 4096
copy_file_range01.c:199: PASS: off_in: 17, off_out: 4095, len: 4096
copy_file_range01.c:199: PASS: off_in: 17, off_out: 4096, len: 4096
copy_file_range01.c:199: PASS: off_in: 17, off_out: 4097, len: 4096
copy_file_range01.c:199: PASS: off_in: 4095, off_out: NULL, len: 4096
copy_file_range01.c:199: PASS: off_in: 4095, off_out: 0, len: 4096
copy_file_range01.c:199: PASS: off_in: 4095, off_out: 17, len: 4096
copy_file_range01.c:199: PASS: off_in: 4095, off_out: 4095, len: 4096
copy_file_range01.c:199: PASS: off_in: 4095, off_out: 4096, len: 4096
copy_file_range01.c:199: PASS: off_in: 4095, off_out: 4097, len: 4096
copy_file_range01.c:199: PASS: off_in: 4096, off_out: NULL, len: 4096
copy_file_range01.c:199: PASS: off_in: 4096, off_out: 0, len: 4096
copy_file_range01.c:199: PASS: off_in: 4096, off_out: 17, len: 4096
copy_file_range01.c:199: PASS: off_in: 4096, off_out: 4095, len: 4096
copy_file_range01.c:199: PASS: off_in: 4096, off_out: 4096, len: 4096
copy_file_range01.c:199: PASS: off_in: 4096, off_out: 4097, len: 4096
copy_file_range01.c:199: PASS: off_in: 4097, off_out: NULL, len: 4096
copy_file_range01.c:199: PASS: off_in: 4097, off_out: 0, len: 4096
copy_file_range01.c:199: PASS: off_in: 4097, off_out: 17, len: 4096
copy_file_range01.c:199: PASS: off_in: 4097, off_out: 4095, len: 4096
copy_file_range01.c:199: PASS: off_in: 4097, off_out: 4096, len: 4096
copy_file_range01.c:199: PASS: off_in: 4097, off_out: 4097, len: 4096
copy_file_range01.c:199: PASS: off_in: NULL, off_out: NULL, len: 4097
copy_file_range01.c:199: PASS: off_in: NULL, off_out: 0, len: 4097
copy_file_range01.c:199: PASS: off_in: NULL, off_out: 17, len: 4097
copy_file_range01.c:199: PASS: off_in: NULL, off_out: 4095, len: 4097
copy_file_range01.c:199: PASS: off_in: NULL, off_out: 4096, len: 4097
copy_file_range01.c:199: PASS: off_in: NULL, off_out: 4097, len: 4097
copy_file_range01.c:199: PASS: off_in: 0, off_out: NULL, len: 4097
copy_file_range01.c:199: PASS: off_in: 0, off_out: 0, len: 4097
copy_file_range01.c:199: PASS: off_in: 0, off_out: 17, len: 4097
copy_file_range01.c:199: PASS: off_in: 0, off_out: 4095, len: 4097
copy_file_range01.c:199: PASS: off_in: 0, off_out: 4096, len: 4097
copy_file_range01.c:199: PASS: off_in: 0, off_out: 4097, len: 4097
copy_file_range01.c:199: PASS: off_in: 17, off_out: NULL, len: 4097
copy_file_range01.c:199: PASS: off_in: 17, off_out: 0, len: 4097
copy_file_range01.c:199: PASS: off_in: 17, off_out: 17, len: 4097
copy_file_range01.c:199: PASS: off_in: 17, off_out: 4095, len: 4097
copy_file_range01.c:199: PASS: off_in: 17, off_out: 4096, len: 4097
copy_file_range01.c:199: PASS: off_in: 17, off_out: 4097, len: 4097
copy_file_range01.c:199: PASS: off_in: 4095, off_out: NULL, len: 4097
copy_file_range01.c:199: PASS: off_in: 4095, off_out: 0, len: 4097
copy_file_range01.c:199: PASS: off_in: 4095, off_out: 17, len: 4097
copy_file_range01.c:199: PASS: off_in: 4095, off_out: 4095, len: 4097
copy_file_range01.c:199: PASS: off_in: 4095, off_out: 4096, len: 4097
copy_file_range01.c:199: PASS: off_in: 4095, off_out: 4097, len: 4097
copy_file_range01.c:199: PASS: off_in: 4096, off_out: NULL, len: 4097
copy_file_range01.c:199: PASS: off_in: 4096, off_out: 0, len: 4097
copy_file_range01.c:199: PASS: off_in: 4096, off_out: 17, len: 4097
copy_file_range01.c:199: PASS: off_in: 4096, off_out: 4095, len: 4097
copy_file_range01.c:199: PASS: off_in: 4096, off_out: 4096, len: 4097
copy_file_range01.c:199: PASS: off_in: 4096, off_out: 4097, len: 4097
copy_file_range01.c:199: PASS: off_in: 4097, off_out: NULL, len: 4097
copy_file_range01.c:199: PASS: off_in: 4097, off_out: 0, len: 4097
copy_file_range01.c:199: PASS: off_in: 4097, off_out: 17, len: 4097
copy_file_range01.c:199: PASS: off_in: 4097, off_out: 4095, len: 4097
copy_file_range01.c:199: PASS: off_in: 4097, off_out: 4096, len: 4097
copy_file_range01.c:199: PASS: off_in: 4097, off_out: 4097, len: 4097
•Summary:
passed 144
failed 0
skipped 0
warnings 0
<<<execution_status>>>
initiation_status="ok"
duration=3 termination_type=exited termination_id=0 corefile=no
cutime=0 cstime=26
<<<test_end>>>
INFO: ltp-pan reported all tests PASS
LTP Version: 20190517
- Done executing testcases. LTP Version: 20190517 ###############
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Skipped - Unit
Tests Skipped
Event Timeline
compat/linux/linux_file.c | ||
---|---|---|
1590 | What about flags translation ? I do not like the idea of passing the bits as is, even if the currently defined flags have identical values between FreeBSD and Linux. |
I seem to remember Rick made the effort to make them the same, and we already do that for eg stat(2) constants. A comment could be useful - both here and in the header that defines them, something like “please keep them in sync with Linux; linux(4) depends on it”.
There are no flags defined for now and kern_copy_file_range explicitly checks for flags != 0.
But if it's a problem, I can add a local flag variable and set it to 0 because this is what we support for now anyway.
I would prefer that we check args->flags and return appropriate error before calling into kern_copy_file_range().
For stat(2), do you mean stat.st_mode or something else ? Modes are arguably user-visible numbers so it is not surprising that Linux uses the same layout, remember chown(1). If you mean something else, please point it out, it probably should be fixed.
sys/compat/linux/linux_file.c | ||
---|---|---|
1576 ↗ | (On Diff #66124) | Look at style(9) how multi-line comment should be formatted. Basically it is /* * copy_file_range(2) ... * ... */ |