X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=wrapper%2Fsplice.c;h=282bd863e2cb849ec57ec4336c43539d7a495858;hb=e12ef7eee8f880aa30eeb1998428282f1414bea5;hp=44a4d6b87b2b8062b571ed6270b4556006e8572a;hpb=9f36eaed6f91d5897924b551b44d1edd8cee00e2;p=lttng-modules.git diff --git a/wrapper/splice.c b/wrapper/splice.c index 44a4d6b8..282bd863 100644 --- a/wrapper/splice.c +++ b/wrapper/splice.c @@ -4,12 +4,15 @@ * * wrapper around splice_to_pipe. Using KALLSYMS to get its address when * available, else we need to have a kernel that exports this function to GPL - * modules. + * modules. The export was introduced in kernel 4.2. * * Copyright (C) 2011-2012 Mathieu Desnoyers */ -#ifdef CONFIG_KALLSYMS +#include + +#if (defined(CONFIG_KALLSYMS) \ + && (LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0))) #include #include @@ -33,6 +36,21 @@ ssize_t wrapper_splice_to_pipe(struct pipe_inode_info *pipe, } } +/* + * Canary function to check for 'splice_to_pipe()' at compile time. + * + * From 'include/linux/splice.h': + * + * extern ssize_t splice_to_pipe(struct pipe_inode_info *, + * struct splice_pipe_desc *spd); + */ +__attribute__((unused)) static +ssize_t __canary__splice_to_pipe(struct pipe_inode_info *pipe, + struct splice_pipe_desc *spd) +{ + return splice_to_pipe(pipe, spd); +} + #else #include