diff options
author | Tor Lillqvist <tml@collabora.com> | 2020-04-03 17:47:03 +0300 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2020-04-04 10:51:37 +0200 |
commit | 0050759cb9cf8ac337c0ecec48c009501de9fb0f (patch) | |
tree | dffb96a6e3c4c6f8a1d8c8512acb154ae99ffcb4 /sal | |
parent | 70de006670880df7931fb1c39966d181e2893a61 (diff) |
Add SAL_INFO with "sal.file" also for the pread, read, pwrite, and write calls
Change-Id: Ib8fe62614a87d7350bec195ff22ae5701558d967
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91678
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Diffstat (limited to 'sal')
-rw-r--r-- | sal/osl/unx/file.cxx | 44 |
1 files changed, 39 insertions, 5 deletions
diff --git a/sal/osl/unx/file.cxx b/sal/osl/unx/file.cxx index d8396f6279b6..b79fd415b214 100644 --- a/sal/osl/unx/file.cxx +++ b/sal/osl/unx/file.cxx @@ -347,17 +347,27 @@ oslFileError FileHandle_Impl::readAt( } ssize_t nBytes = ::pread(m_fd, pBuffer, nBytesRequested, nOffset); - if ((nBytes == -1) && (errno == EOVERFLOW)) + int saved_errno = errno; + if ((nBytes == -1) && (saved_errno == EOVERFLOW)) { /* Some 'pread()'s fail with EOVERFLOW when reading at (or past) * end-of-file, different from 'lseek() + read()' behaviour. * Returning '0 bytes read' and 'osl_File_E_None' instead. */ + SAL_INFO("sal.file", "pread(" << m_fd << "," << pBuffer << "," << nBytesRequested << "," << nOffset << "): " << UnixErrnoString(saved_errno)); nBytes = 0; } + else if (nBytes == -1) + { + SAL_INFO("sal.file", "pread(" << m_fd << "," << pBuffer << "," << nBytesRequested << "," << nOffset << "): " << UnixErrnoString(saved_errno)); + } + else + { + SAL_INFO("sal.file", "pread(" << m_fd << "," << pBuffer << "," << nBytesRequested << "," << nOffset << ") => " << nBytes); + } if (nBytes == -1) - return oslTranslateFileError(errno); + return oslTranslateFileError(saved_errno); *pBytesRead = nBytes; @@ -379,8 +389,16 @@ oslFileError FileHandle_Impl::writeAt( return osl_File_E_BADF; ssize_t nBytes = ::pwrite(m_fd, pBuffer, nBytesToWrite, nOffset); + int saved_errno = errno; if (nBytes == -1) - return oslTranslateFileError(errno); + { + SAL_INFO("sal.file", "pwrite(" << m_fd << "," << pBuffer << "," << nBytesToWrite << "," << nOffset << "): " << UnixErrnoString(saved_errno)); + return oslTranslateFileError(saved_errno); + } + else + { + SAL_INFO("sal.file", "pwrite(" << m_fd << "," << pBuffer << "," << nBytesToWrite << "," << nOffset << ") => " << nBytes); + } m_size = std::max(m_size, sal::static_int_cast< sal_uInt64 >(nOffset + nBytes)); @@ -399,8 +417,16 @@ oslFileError FileHandle_Impl::readFileAt( { // not seekable (pipe) ssize_t nBytes = ::read(m_fd, pBuffer, nBytesRequested); + int saved_errno = errno; if (nBytes == -1) - return oslTranslateFileError(errno); + { + SAL_INFO("sal.file", "read(" << m_fd << "," << pBuffer << "," << nBytesRequested << "): " << UnixErrnoString(saved_errno)); + return oslTranslateFileError(saved_errno); + } + else + { + SAL_INFO("sal.file", "read(" << m_fd << "," << pBuffer << "," << nBytesRequested << ") => " << nBytes); + } *pBytesRead = nBytes; @@ -480,8 +506,16 @@ oslFileError FileHandle_Impl::writeFileAt( { // not seekable (pipe) ssize_t nBytes = ::write(m_fd, pBuffer, nBytesToWrite); + int saved_errno = errno; if (nBytes == -1) - return oslTranslateFileError(errno); + { + SAL_INFO("sal.file", "write(" << m_fd << "," << pBuffer << "," << nBytesToWrite << "): " << UnixErrnoString(saved_errno)); + return oslTranslateFileError(saved_errno); + } + else + { + SAL_INFO("sal.file", "write(" << m_fd << "," << pBuffer << "," << nBytesToWrite << ") => " <<nBytes); + } *pBytesWritten = nBytes; |