[PATCH, libstdc++]: Fix PR 70975, experimental/filesystem/operations/copy.cc FAILs on Solaris 12
Jonathan Wakely
jwakely@redhat.com
Thu Oct 27 18:43:00 GMT 2016
On 27/10/16 19:41 +0100, Jonathan Wakely wrote:
>On 27/10/16 20:33 +0200, Uros Bizjak wrote:
>>Attached patch improves sendfile syscall compatibility with (older)
>>Solaris 12, where non-null third argument is required. It also paves
>>the way for compatibility with Solaris 10/11, where otherwise
>>additional -lsendfile is needed to link with libsendfile library. The
>>change has no effect on linux.
>>
>>
>>2016-10-27 Uros Bizjak <ubizjak@gmail.com>
>>
>> PR libstdc++/70975
>> * src/filesystem/ops.cc (do_copy_file) [_GLIBCXX_USE_SENDFILE]:
>> Use pointer to zero as non-null third argument of sendfile call.
>>
>>Bootstrapped and regression tested on x86_64-linux-gnu {,-m32} CentOS
>>5 and Fedora 24. Also tested by Rainer on older Solaris 12, where the
>>patch fixes testsuite failure.
>>
>>OK for mainline?
>>
>>Uros.
>
>>diff --git a/libstdc++-v3/src/filesystem/ops.cc b/libstdc++-v3/src/filesystem/ops.cc
>>index 9abcee0..b709858 100644
>>--- a/libstdc++-v3/src/filesystem/ops.cc
>>+++ b/libstdc++-v3/src/filesystem/ops.cc
>>@@ -444,7 +444,9 @@ namespace
>> }
>>
>>#ifdef _GLIBCXX_USE_SENDFILE
>>- const auto n = ::sendfile(out.fd, in.fd, nullptr, from_st->st_size);
>>+ off_t always_zero_offset = 0;
>>+ const auto n = ::sendfile(out.fd, in.fd,
>>+ &always_zero_offset, from_st->st_size);
>> if (n < 0 && (errno == ENOSYS || errno == EINVAL))
>> {
>>#endif
>
>Is there a good reason to call it "always_zero_offset" rather than
>something that fits on one line, like "offset"?
>
>OK for trunk anyway, thanks.
(I actually already sent a similar patch, see
https://gcc.gnu.org/ml/gcc-patches/2016-10/msg02276.html but I didn't
commit it yet due to some network issues I've been having today).
More information about the Libstdc++
mailing list