diff options
author | Tor Lillqvist <tml@collabora.com> | 2018-10-11 21:14:12 +0300 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2018-10-11 22:00:35 +0200 |
commit | 6d18862629aaf9b8117f8a97187c1f82154a70b1 (patch) | |
tree | e7bcde28c8cb09d3b88e427cc4ac8ed24401bab2 /sal/osl/unx/uunxapi.cxx | |
parent | 4c30ebd44749c09157a23754ce68261eb9247931 (diff) |
Further SAL_INFO("sal.file",...) tweaks
Now it should be fairly close to the (IMHO) ideal: One
SAL_INFO("sal.file") per file system system call. (Not read() and
write().)
Sure, on Linux one could just use strace, but my interest at the
moment is debugging what goes on on iOS.
Change-Id: I19ec0404c0c15a957de96d98376b4338b48a8cbd
Reviewed-on: https://gerrit.libreoffice.org/61687
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Diffstat (limited to 'sal/osl/unx/uunxapi.cxx')
-rw-r--r-- | sal/osl/unx/uunxapi.cxx | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/sal/osl/unx/uunxapi.cxx b/sal/osl/unx/uunxapi.cxx index a6dd0954bf41..3d8fb144a255 100644 --- a/sal/osl/unx/uunxapi.cxx +++ b/sal/osl/unx/uunxapi.cxx @@ -24,6 +24,7 @@ #include <limits.h> #include <rtl/ustring.hxx> #include <osl/thread.h> +#include <sal/log.hxx> #ifdef ANDROID #include <osl/detail/android-bootstrap.h> @@ -288,6 +289,13 @@ int open_c(const char *cpPath, int oflag, int mode) accessFilePathState *state = prepare_to_access_file_path(cpPath); int result = open(cpPath, oflag, mode); + int saved_errno = errno; + if (result == -1) + { + SAL_INFO("sal.file", "open(" << cpPath << ",0" << std::oct << oflag << ",0" << mode << std::dec << "): errno " << saved_errno << ": " << strerror(saved_errno)); + } + else + SAL_INFO("sal.file", "open(" << cpPath << ",0" << std::oct << oflag << ",0" << mode << std::dec << ") => " << result); #if HAVE_FEATURE_MACOSX_SANDBOX if (isSandboxed && result != -1 && (oflag & O_CREAT) && (oflag & O_EXCL)) @@ -318,6 +326,8 @@ int open_c(const char *cpPath, int oflag, int mode) done_accessing_file_path(cpPath, state); + errno = saved_errno; + return result; } @@ -353,6 +363,14 @@ int ftruncate_with_name(int fd, sal_uInt64 uSize, rtl_String* path) int result = ftruncate(fd, uSize); + if (result < 0) + { + int e = errno; + SAL_INFO("sal.file", "ftruncate(" << fd << "," << uSize << "): errno " << e << ": " << strerror(e)); + } + else + SAL_INFO("sal.file", "ftruncate(" << fd << "," << uSize << "): OK"); + done_accessing_file_path(fn.getStr(), state); return result; |