[PATCH, libstdc++v3]: Fallback to read/write ops in case sendfile fails with ENOSYS or EINVAL.

Jonathan Wakely jwakely@redhat.com
Mon Aug 15 09:44:00 GMT 2016


On 11/08/16 21:27 +0200, Uros Bizjak wrote:
>Hello!
>
>Attached patch implements note from sendfile manpage:
>
><q>
>Applications may wish to fall back to read(2)/write(2) in the case
>where sendfile() fails with EINVAL or ENOSYS.
></q>
>
>Also, the patch fixes a small inconsistency in how
>_GLIBCXX_USE_FCHMODAT config flag is handled in do_copy_file function.
>
>2016-08-11  Uros Bizjak  <ubizjak@gmail.com>
>
>    * src/filesystem/ops.cc: Always include ostream and
>    ext/stdio_filebuf.h.
>    (do_copy_file): Check if _GLIBCXX_USE_FCHMODAT is defined.
>    [_GLIBCXX_USE_SENDFILE]: Fallback to read/write operations in case
>    sendfile fails with ENOSYS or EINVAL.
>
>Patch was bootstrapped and regression tested on x86_64-linux-gnu
>{,-m32} on CentOS 5.11 (where sendfile returns EINVAL for file->file
>copy) and Fedora 24. In addition, the patch was bootstraped and
>regression tested with _GLIBCXX_USE_SENDFILE manually disabled after
>configure.
>
>OK for mainline?

Yes, thanks.

The src/filesystem/ops.cc code is identical on the gcc-5 and gcc-6
branches, so could you backport it there too please? (After the 6.3
release though).




More information about the Libstdc++ mailing list