This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [PATCH, libstdc++]: Fix PR 70975, experimental/filesystem/operations/copy.cc FAILs on Solaris 12
- From: Jonathan Wakely <jwakely at redhat dot com>
- To: Uros Bizjak <ubizjak at gmail dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, libstdc++ <libstdc++ at gcc dot gnu dot org>, Rainer Orth <ro at cebitec dot uni-bielefeld dot de>
- Date: Thu, 27 Oct 2016 19:41:44 +0100
- Subject: Re: [PATCH, libstdc++]: Fix PR 70975, experimental/filesystem/operations/copy.cc FAILs on Solaris 12
- Authentication-results: sourceware.org; auth=none
- References: <CAFULd4ZXugSW4_buBE8YvpTQU25FCRY1Zf9L3mYTB3Cbcb5VFA@mail.gmail.com>
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.