The man pages for copy_file_range()
and ioctl_ficlone()
document that the syscalls first appeared in Linux 4.5.
From this question: Is there a macro definition to check the Linux kernel version?, I found out how to detect the kernel version at compile-time:
#include <linux/version.h>#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,16)...#else...
But man page says 4.5, there's no third number (whatever minor, major, or patch it is). How do I then detect if the kernel version is 4.5 or above?
The use-case is:
#if KERNEL_VERSION >= 4.5 /* Use ioctl_ficlone()/copy_file_range(). */#else /* Fall back to sendfile(). */#endif