Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 16420

Checking if copy_file_range() and ioctl_ficlone() are available on linux

$
0
0

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

Viewing all articles
Browse latest Browse all 16420

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>