Thread: copy_file_range() conflict between pg_rewind and libc

copy_file_range() conflict between pg_rewind and libc

From
Andres Freund
Date:
Hi,

Animal caiman just revived and promptly failed:
https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=caiman&dt=2018-01-03%2003%3A13%3A54

copy_fetch.c:159:1: error: conflicting types for ‘copy_file_range’
 copy_file_range(const char *path, off_t begin, off_t end, bool trunc)
 ^~~~~~~~~~~~~~~
In file included from copy_fetch.c:15:0:
/usr/include/unistd.h:1110:9: note: previous declaration of ‘copy_file_range’ was here
 ssize_t copy_file_range (int __infd, __off64_t *__pinoff,
         ^~~~~~~~~~~~~~~

copy_file_range() is a new-ish syscall that does in-kernel copying of
data. Therefore I think we should rename pg_rewind's version to
something like rwnd_copy_file_range(). Better names welcome.

I think we need to do so in all pg_rewind containing branches, this is
going to become an actual problem once sufficiently new glibc's are
common. Currently this appears to be unreleased (caiman runs fedora
rawhide), but that's not going to continue be the case.

Greetings,

Andres Freund