From 6d18862629aaf9b8117f8a97187c1f82154a70b1 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Thu, 11 Oct 2018 21:14:12 +0300 Subject: 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 --- sal/osl/unx/uunxapi.cxx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'sal/osl/unx/uunxapi.cxx') 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 #include #include +#include #ifdef ANDROID #include @@ -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; -- cgit