diff options
author | Tor Lillqvist <tml@collabora.com> | 2020-04-06 10:51:17 +0300 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2020-04-06 10:52:00 +0300 |
commit | 65621fc384b190d854df3bcf1629a829cdd29275 (patch) | |
tree | 038e4421c305e8dfd8a3f309dd28df076947d15b /sal | |
parent | c48a1d2c6ca0869680243fcea025e19981c57b54 (diff) |
Nah, let's revert that shite
This reverts commit 533f0094df9a591116b73dca63bc34ddab683bdd.
This reverts commit 96ae6bc47414194a477bf95a1f5a360b555884b3.
This reverts commit 0050759cb9cf8ac337c0ecec48c009501de9fb0f.
This reverts commit 70de006670880df7931fb1c39966d181e2893a61.
Diffstat (limited to 'sal')
-rw-r--r-- | sal/osl/unx/file.cxx | 106 | ||||
-rw-r--r-- | sal/osl/unx/file_misc.cxx | 4 | ||||
-rw-r--r-- | sal/osl/unx/profile.cxx | 10 | ||||
-rw-r--r-- | sal/osl/unx/uunxapi.cxx | 63 | ||||
-rw-r--r-- | sal/osl/unx/uunxapi.hxx | 152 |
5 files changed, 40 insertions, 295 deletions
diff --git a/sal/osl/unx/file.cxx b/sal/osl/unx/file.cxx index a2b6f84266ce..d8396f6279b6 100644 --- a/sal/osl/unx/file.cxx +++ b/sal/osl/unx/file.cxx @@ -276,32 +276,32 @@ oslFileError FileHandle_Impl::setSize(sal_uInt64 uSize) if (nCurPos == off_t(-1)) { int e = errno; - SAL_INFO("sal.file", "lseek(" << osl::fdAndPath(m_fd) << ",0,SEEK_CUR): " << UnixErrnoString(e)); + SAL_INFO("sal.file", "lseek(" << m_fd << ",0,SEEK_CUR): " << UnixErrnoString(e)); return result; } else - SAL_INFO("sal.file", "lseek(" << osl::fdAndPath(m_fd) << ",0,SEEK_CUR): OK"); + SAL_INFO("sal.file", "lseek(" << m_fd << ",0,SEEK_CUR): OK"); /* Try 'expand' via 'lseek()' and 'write()' */ if (lseek(m_fd, static_cast<off_t>(nSize - 1), SEEK_SET) == -1) { int e = errno; - SAL_INFO("sal.file", "lseek(" << osl::fdAndPath(m_fd) << "," << nSize - 1 << ",SEEK_SET): " << UnixErrnoString(e)); + SAL_INFO("sal.file", "lseek(" << m_fd << "," << nSize - 1 << ",SEEK_SET): " << UnixErrnoString(e)); return result; } else - SAL_INFO("sal.file", "lseek(" << osl::fdAndPath(m_fd) << "," << nSize - 1 << ",SEEK_SET): OK"); + SAL_INFO("sal.file", "lseek(" << m_fd << "," << nSize - 1 << ",SEEK_SET): OK"); if (write(m_fd, "", size_t(1)) == -1) { /* Failure. Restore saved position */ int e = errno; - SAL_INFO("sal.file", "write(" << osl::fdAndPath(m_fd) << ",\"\",1): " << UnixErrnoString(e)); + SAL_INFO("sal.file", "write(" << m_fd << ",\"\",1): " << UnixErrnoString(e)); (void) lseek(m_fd, nCurPos, SEEK_SET); return result; } else - SAL_INFO("sal.file", "write(" << osl::fdAndPath(m_fd) << ",\"\",1): OK"); + SAL_INFO("sal.file", "write(" << m_fd << ",\"\",1): OK"); /* Success. Restore saved position */ if (lseek(m_fd, nCurPos, SEEK_SET) == -1) @@ -347,27 +347,17 @@ oslFileError FileHandle_Impl::readAt( } ssize_t nBytes = ::pread(m_fd, pBuffer, nBytesRequested, nOffset); - int saved_errno = errno; - if ((nBytes == -1) && (saved_errno == EOVERFLOW)) + if ((nBytes == -1) && (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(" << osl::fdAndPath(m_fd) << "," << pBuffer << "," << nBytesRequested << "," << nOffset << "): " << UnixErrnoString(saved_errno)); nBytes = 0; } - else if (nBytes == -1) - { - SAL_INFO("sal.file", "pread(" << osl::fdAndPath(m_fd) << "," << pBuffer << "," << nBytesRequested << "," << nOffset << "): " << UnixErrnoString(saved_errno)); - } - else - { - SAL_INFO("sal.file", "pread(" << osl::fdAndPath(m_fd) << "," << pBuffer << "," << nBytesRequested << "," << nOffset << ") => " << nBytes); - } if (nBytes == -1) - return oslTranslateFileError(saved_errno); + return oslTranslateFileError(errno); *pBytesRead = nBytes; @@ -389,16 +379,8 @@ 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) - { - SAL_INFO("sal.file", "pwrite(" << osl::fdAndPath(m_fd) << "," << pBuffer << "," << nBytesToWrite << "," << nOffset << "): " << UnixErrnoString(saved_errno)); - return oslTranslateFileError(saved_errno); - } - else - { - SAL_INFO("sal.file", "pwrite(" << osl::fdAndPath(m_fd) << "," << pBuffer << "," << nBytesToWrite << "," << nOffset << ") => " << nBytes); - } + return oslTranslateFileError(errno); m_size = std::max(m_size, sal::static_int_cast< sal_uInt64 >(nOffset + nBytes)); @@ -417,16 +399,8 @@ oslFileError FileHandle_Impl::readFileAt( { // not seekable (pipe) ssize_t nBytes = ::read(m_fd, pBuffer, nBytesRequested); - int saved_errno = errno; if (nBytes == -1) - { - SAL_INFO("sal.file", "read(" << osl::fdAndPath(m_fd) << "," << pBuffer << "," << nBytesRequested << "): " << UnixErrnoString(saved_errno)); - return oslTranslateFileError(saved_errno); - } - else - { - SAL_INFO("sal.file", "read(" << osl::fdAndPath(m_fd) << "," << pBuffer << "," << nBytesRequested << ") => " << nBytes); - } + return oslTranslateFileError(errno); *pBytesRead = nBytes; @@ -506,16 +480,8 @@ oslFileError FileHandle_Impl::writeFileAt( { // not seekable (pipe) ssize_t nBytes = ::write(m_fd, pBuffer, nBytesToWrite); - int saved_errno = errno; if (nBytes == -1) - { - SAL_INFO("sal.file", "write(" << osl::fdAndPath(m_fd) << "," << pBuffer << "," << nBytesToWrite << "): " << UnixErrnoString(saved_errno)); - return oslTranslateFileError(saved_errno); - } - else - { - SAL_INFO("sal.file", "write(" << osl::fdAndPath(m_fd) << "," << pBuffer << "," << nBytesToWrite << ") => " <<nBytes); - } + return oslTranslateFileError(errno); *pBytesWritten = nBytes; @@ -1053,28 +1019,26 @@ oslFileError openFilePath(const char *cpFilePath, oslFileHandle* pHandle, if (f == -1) { int e = errno; - SAL_INFO("sal.file", "fcntl(" << osl::fdAndPath(fd) << ",F_GETFL,0): " << UnixErrnoString(e)); + SAL_INFO("sal.file", "fcntl(" << fd << ",F_GETFL,0): " << UnixErrnoString(e)); eRet = oslTranslateFileError(e); (void) close(fd); - SAL_INFO("sal.file", "close(" << osl::fdAndPath(fd) << ")"); - osl::unregisterPathForFd(fd); + SAL_INFO("sal.file", "close(" << fd << ")"); return eRet; } else - SAL_INFO("sal.file", "fcntl(" << osl::fdAndPath(fd) << ",F_GETFL,0): OK"); + SAL_INFO("sal.file", "fcntl(" << fd << ",F_GETFL,0): OK"); if (fcntl(fd, F_SETFL, (f & ~O_NONBLOCK)) == -1) { int e = errno; - SAL_INFO("sal.file", "fcntl(" << osl::fdAndPath(fd) << ",F_SETFL,(f & ~O_NONBLOCK)): " << UnixErrnoString(e)); + SAL_INFO("sal.file", "fcntl(" << fd << ",F_SETFL,(f & ~O_NONBLOCK)): " << UnixErrnoString(e)); eRet = oslTranslateFileError(e); (void) close(fd); - SAL_INFO("sal.file", "close(" << osl::fdAndPath(fd) << ")"); - osl::unregisterPathForFd(fd); + SAL_INFO("sal.file", "close(" << fd << ")"); return eRet; } else - SAL_INFO("sal.file", "fcntl(" << osl::fdAndPath(fd) << ",F_SETFL,(f & ~O_NONBLOCK)): OK"); + SAL_INFO("sal.file", "fcntl(" << fd << ",F_SETFL,(f & ~O_NONBLOCK)): OK"); } #endif @@ -1083,23 +1047,21 @@ oslFileError openFilePath(const char *cpFilePath, oslFileHandle* pHandle, if (fstat(fd, &aFileStat) == -1) { int e = errno; - SAL_INFO("sal.file", "fstat(" << osl::fdAndPath(fd) << "): " << UnixErrnoString(e)); + SAL_INFO("sal.file", "fstat(" << fd << "): " << UnixErrnoString(e)); eRet = oslTranslateFileError(e); (void) close(fd); - SAL_INFO("sal.file", "close(" << osl::fdAndPath(fd) << ")"); - osl::unregisterPathForFd(fd); + SAL_INFO("sal.file", "close(" << fd << ")"); return eRet; } else - SAL_INFO("sal.file", "fstat(" << osl::fdAndPath(fd) << "): OK"); + SAL_INFO("sal.file", "fstat(" << fd << "): OK"); if (!S_ISREG(aFileStat.st_mode)) { /* we only open regular files here */ SAL_INFO("sal.file", "osl_openFile(" << cpFilePath << "): not a regular file"); (void) close(fd); - SAL_INFO("sal.file", "close(" << osl::fdAndPath(fd) << ")"); - osl::unregisterPathForFd(fd); + SAL_INFO("sal.file", "close(" << fd << ")"); return osl_File_E_INVAL; } @@ -1109,7 +1071,7 @@ oslFileError openFilePath(const char *cpFilePath, oslFileHandle* pHandle, if (flock(fd, LOCK_EX | LOCK_NB) == -1) { int e = errno; - SAL_INFO("sal.file", "flock(" << osl::fdAndPath(fd) << ",LOCK_EX|LOCK_NB): " << UnixErrnoString(e)); + SAL_INFO("sal.file", "flock(" << fd << ",LOCK_EX|LOCK_NB): " << UnixErrnoString(e)); /* Mac OSX returns ENOTSUP for webdav drives. We should try read lock */ // Restore errno after possibly having been overwritten by the SAL_INFO above... @@ -1118,13 +1080,12 @@ oslFileError openFilePath(const char *cpFilePath, oslFileHandle* pHandle, { eRet = oslTranslateFileError(errno); (void) close(fd); - SAL_INFO("sal.file", "close(" << osl::fdAndPath(fd) << ")"); - osl::unregisterPathForFd(fd); + SAL_INFO("sal.file", "close(" << fd << ")"); return eRet; } } else - SAL_INFO("sal.file", "flock(" << osl::fdAndPath(fd) << ",LOCK_EX|LOCK_NB): OK"); + SAL_INFO("sal.file", "flock(" << fd << ",LOCK_EX|LOCK_NB): OK"); #else /* F_SETLK */ struct flock aflock; @@ -1136,11 +1097,10 @@ oslFileError openFilePath(const char *cpFilePath, oslFileHandle* pHandle, if (fcntl(fd, F_SETLK, &aflock) == -1) { int e = errno; - SAL_INFO("sal.file", "fcntl(" << osl::fdAndPath(fd) << ",F_SETLK): " << UnixErrnoString(e)); + SAL_INFO("sal.file", "fcntl(" << fd << ",F_SETLK): " << UnixErrnoString(e)); eRet = oslTranslateFileError(e); (void) close(fd); - SAL_INFO("sal.file", "close(" << osl::fdAndPath(fd) << ")"); - osl::unregisterPathForFd(fd); + SAL_INFO("sal.file", "close(" << fd << ")"); return eRet; } #endif /* F_SETLK */ @@ -1214,21 +1174,17 @@ oslFileError SAL_CALL osl_closeFile(oslFileHandle Handle) { /* close, ignoring double failure */ (void) close(pImpl->m_fd); - SAL_INFO("sal.file", "close(" << osl::fdAndPath(pImpl->m_fd) << ")"); - osl::unregisterPathForFd(pImpl->m_fd); + SAL_INFO("sal.file", "close(" << pImpl->m_fd << ")"); } else if (close(pImpl->m_fd) == -1) { int e = errno; - SAL_INFO("sal.file", "close(" << osl::fdAndPath(pImpl->m_fd) << "): " << UnixErrnoString(e)); + SAL_INFO("sal.file", "close(" << pImpl->m_fd << "): " << UnixErrnoString(e)); /* translate error code */ result = oslTranslateFileError(e); } else - { - SAL_INFO("sal.file", "close(" << osl::fdAndPath(pImpl->m_fd) << "): OK"); - osl::unregisterPathForFd(pImpl->m_fd); - } + SAL_INFO("sal.file", "close(" << pImpl->m_fd << "): OK"); (void) pthread_mutex_unlock(&(pImpl->m_mutex)); delete pImpl; @@ -1255,11 +1211,11 @@ oslFileError SAL_CALL osl_syncFile(oslFileHandle Handle) if (fsync(pImpl->m_fd) == -1) { int e = errno; - SAL_INFO("sal.file", "fsync(" << osl::fdAndPath(pImpl->m_fd) << "): " << UnixErrnoString(e)); + SAL_INFO("sal.file", "fsync(" << pImpl->m_fd << "): " << UnixErrnoString(e)); return oslTranslateFileError(e); } else - SAL_INFO("sal.file", "fsync(" << osl::fdAndPath(pImpl->m_fd) << "): OK"); + SAL_INFO("sal.file", "fsync(" << pImpl->m_fd << "): OK"); return osl_File_E_None; } diff --git a/sal/osl/unx/file_misc.cxx b/sal/osl/unx/file_misc.cxx index 31dd9157fd29..f9f316d8b5fb 100644 --- a/sal/osl/unx/file_misc.cxx +++ b/sal/osl/unx/file_misc.cxx @@ -1005,12 +1005,12 @@ static int oslDoCopyFile(const char* pszSourceFileName, const char* pszDestFileN if ( DestFileFD < 0 ) { nRet=errno; - SAL_INFO("sal.file", "open(" << pszDestFileName << "," << osl::openFlagsToString(O_WRONLY|O_CREAT) << "," << osl::openModeToString(mode) << "): " << UnixErrnoString(nRet)); + SAL_INFO("sal.file", "open(" << pszDestFileName << ",O_WRONLY|O_CREAT,0" << std::oct << mode << std::dec << "): " << UnixErrnoString(nRet)); osl_closeFile(SourceFileFH); return nRet; } else - SAL_INFO("sal.file", "open(" << pszDestFileName << "," << osl::openFlagsToString(O_WRONLY|O_CREAT) << "," << osl::openModeToString(mode) << "): OK"); + SAL_INFO("sal.file", "open(" << pszDestFileName << ",O_WRONLY|O_CREAT,0" << std::oct << mode << std::dec << "): OK"); size_t nRemains = nSourceSize; diff --git a/sal/osl/unx/profile.cxx b/sal/osl/unx/profile.cxx index db5c50717e14..edb76019ff5d 100644 --- a/sal/osl/unx/profile.cxx +++ b/sal/osl/unx/profile.cxx @@ -21,7 +21,6 @@ #include "readwrite_helper.hxx" #include "file_url.hxx" #include "unixerrnostring.hxx" -#include "uunxapi.hxx" #include <osl/diagnose.h> #include <osl/profile.h> @@ -948,10 +947,7 @@ static osl_TFile* openFileImpl(const char* pszFilename, oslProfileOption Profile SAL_INFO("sal.file", "open(" << pszFilename << ",O_RDONLY): " << UnixErrnoString(e)); } else - { SAL_INFO("sal.file", "open(" << pszFilename << ",O_RDONLY) => " << pFile->m_Handle); - osl::registerPathForFd(pFile->m_Handle, pszFilename); - } /* mfe: argghh!!! do not check if the file could be opened */ /* default mode expects it that way!!! */ @@ -967,10 +963,7 @@ static osl_TFile* openFileImpl(const char* pszFilename, oslProfileOption Profile return nullptr; } else - { SAL_INFO("sal.file", "open(" << pszFilename << ",...) => " << pFile->m_Handle); - osl::registerPathForFd(pFile->m_Handle, pszFilename); - } } /* set close-on-exec flag */ @@ -1014,8 +1007,7 @@ static osl_TStamp closeFileImpl(osl_TFile* pFile, oslProfileOption Flags) } close(pFile->m_Handle); - SAL_INFO("sal.file", "close(" << osl::fdAndPath(pFile->m_Handle) << ")"); - osl::unregisterPathForFd(pFile->m_Handle); + SAL_INFO("sal.file", "close(" << pFile->m_Handle << ")"); pFile->m_Handle = -1; } diff --git a/sal/osl/unx/uunxapi.cxx b/sal/osl/unx/uunxapi.cxx index 9f7e6d0c4635..e8901784c878 100644 --- a/sal/osl/unx/uunxapi.cxx +++ b/sal/osl/unx/uunxapi.cxx @@ -24,12 +24,9 @@ #include "unixerrnostring.hxx" #include <limits.h> #include <rtl/ustring.hxx> -#include <osl/file.h> #include <osl/thread.h> #include <sal/log.hxx> -#include <map> - #ifdef ANDROID #include <osl/detail/android-bootstrap.h> #endif @@ -186,9 +183,9 @@ int osl::access(const OString& pstrPath, int mode) int result = ::access(fn.getStr(), mode); int saved_errno = errno; if (result == -1) - SAL_INFO("sal.file", "access(" << fn << "," << osl::accessModeToString(mode) << "): " << UnixErrnoString(saved_errno)); + SAL_INFO("sal.file", "access(" << fn << ",0" << std::oct << mode << std::dec << "): " << UnixErrnoString(saved_errno)); else - SAL_INFO("sal.file", "access(" << fn << "," << osl::accessModeToString(mode) << "): OK"); + SAL_INFO("sal.file", "access(" << fn << ",0" << std::oct << mode << std::dec << "): OK"); done_accessing_file_path(fn.getStr(), state); @@ -363,12 +360,9 @@ int open_c(const char *cpPath, int oflag, int mode) int result = open(cpPath, oflag, mode); int saved_errno = errno; if (result == -1) - SAL_INFO("sal.file", "open(" << cpPath << "," << osl::openFlagsToString(oflag) << "," << osl::openModeToString(mode) << "): " << UnixErrnoString(saved_errno)); + SAL_INFO("sal.file", "open(" << cpPath << ",0" << std::oct << oflag << ",0" << mode << std::dec << "): " << UnixErrnoString(saved_errno)); else - { - SAL_INFO("sal.file", "open(" << cpPath << "," << osl::openFlagsToString(oflag) << "," << osl::openModeToString(mode) << ") => " << result); - osl::registerPathForFd(result, cpPath); - } + 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)) @@ -437,9 +431,9 @@ int ftruncate_with_name(int fd, sal_uInt64 uSize, rtl_String* path) int result = ftruncate(fd, uSize); int saved_errno = errno; if (result < 0) - SAL_INFO("sal.file", "ftruncate(" << osl::fdAndPath(fd) << "," << uSize << "): " << UnixErrnoString(saved_errno)); + SAL_INFO("sal.file", "ftruncate(" << fd << "," << uSize << "): " << UnixErrnoString(saved_errno)); else - SAL_INFO("sal.file", "ftruncate(" << osl::fdAndPath(fd) << "," << uSize << "): OK"); + SAL_INFO("sal.file", "ftruncate(" << fd << "," << uSize << "): OK"); done_accessing_file_path(fn.getStr(), state); @@ -899,49 +893,4 @@ std::string UnixErrnoString(int nErrno) } } -namespace osl -{ -#if defined SAL_LOG_INFO - static std::map<int, OUString> fdToPathMap; - - void registerPathForFd(int fd, const char *path) - { - OUString systemPath(OUString::fromUtf8(OString(path))); - OUString abbreviatedPath; - - oslFileError error = osl_abbreviateSystemPath(systemPath.pData, &abbreviatedPath.pData, 40, nullptr); - if (!error) - fdToPathMap[fd] = abbreviatedPath; - else - fdToPathMap[fd] = systemPath; - } - - void unregisterPathForFd(int fd) - { - fdToPathMap.erase(fd); -#if 0 - // Experimentation... - if (fdToPathMap.size() < 5) - dumpFdToPathMap(); -#endif - } - - OUString fdAndPath(int fd) - { - auto path = fdToPathMap.find(fd); - if (path != fdToPathMap.end()) - return OUString::number(fd) + "<" + path->second + ">"; - else - return OUString::number(fd); - } - - void dumpFdToPathMap() - { - SAL_INFO("sal.file", "Fd to path map (" << fdToPathMap.size() << "):"); - for (auto &i : fdToPathMap) - SAL_INFO("sal.file", " " << i.first << ": " << i.second); - } -#endif -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sal/osl/unx/uunxapi.hxx b/sal/osl/unx/uunxapi.hxx index 1c7a022a7c9a..f182b755e53b 100644 --- a/sal/osl/unx/uunxapi.hxx +++ b/sal/osl/unx/uunxapi.hxx @@ -20,7 +20,6 @@ #ifndef INCLUDED_SAL_OSL_UNX_UUNXAPI_HXX #define INCLUDED_SAL_OSL_UNX_UUNXAPI_HXX -#include <fcntl.h> #include <unistd.h> #include <stdlib.h> #include <sys/types.h> @@ -28,7 +27,6 @@ #include <rtl/ustring.h> #include <rtl/ustring.hxx> -#include <sal/log.hxx> int stat_c(const char *cpPath, struct stat* buf); @@ -74,156 +72,6 @@ namespace osl int lstat(const OString& strPath, struct stat& buf); int mkdir(const OString& aPath, mode_t aMode); - - // The following are for debugging output only, don't bother getting upset about performance etc. - inline OString openFlagsToString(int flags) - { - OString result; - switch (flags & O_ACCMODE) - { - case O_RDONLY: - result = "O_RDONLY"; - break; - case O_WRONLY: - result = "O_WRONLY"; - break; - break; - case O_RDWR: - result = "O_RDWR"; - break; - } - if (flags & O_CREAT) - result += "|O_CREAT"; - if (flags & O_EXCL) - result += "|O_EXCL"; - if (flags & O_NOCTTY) - result += "|O_NOCTTY"; - if (flags & O_TRUNC) - result += "|O_TRUNC"; - if (flags & O_NONBLOCK) - result += "|O_NONBLOCK"; - if (flags & O_NONBLOCK) - result += "|O_NONBLOCK"; - if ((flags & O_SYNC) == O_SYNC) - result += "|O_SYNC"; - if (flags & O_ASYNC) - result += "|O_ASYNC"; - -#if defined __O_LARGEFILE - if (flags & __O_LARGEFILE) - result += "|O_LARGEFILE"; -#endif - -#if defined __O_DIRECTORY - if (flags & __O_DIRECTORY) - result += "|O_DIRECTORY"; -#elif defined O_DIRECTORY - if (flags & O_DIRECTORY) - result += "|O_DIRECTORY"; -#endif - -#if defined __O_NOFOLLOW - if (flags & __O_NOFOLLOW) - result += "|O_NOFOLLOW"; -#elif defined O_NOFOLLOW - if (flags & O_NOFOLLOW) - result += "|O_NOFOLLOW"; -#endif - -#if defined __O_CLOEXEC - if (flags & __O_CLOEXEC) - result += "|O_CLOEXEC"; -#elif defined O_CLOEXEC - if (flags & O_CLOEXEC) - result += "|O_CLOEXEC"; -#endif - -#if defined __O_DIRECT - if (flags & __O_DIRECT) - result += "|O_DIRECT"; -#endif - -#if defined __O_NOATIME - if (flags & __O_NOATIME) - result += "|O_NOATIME"; -#endif - -#if defined __O_PATH - if (flags & __O_PATH) - result += "|O_PATH"; -#endif - -#if defined __O_DSYNC - if (flags & __O_DSYNC) - result += "|O_DSYNC"; -#endif - -#if defined __O_TMPFILE - if ((flags & __O_TMPFILE) == __O_TMPFILE) - result += "|O_TMPFILE"; -#endif - - return result; - } - - inline OString openModeToString(int mode) - { - if (mode == 0) - return "0"; - else - return "0" + OString::number(mode, 8); - } - - inline OString accessModeToString(int mode) - { - if (mode == F_OK) - return "F_OK"; - OString result; - if (mode & R_OK) - result = "R_OK"; - if (mode & W_OK) - { - if (!result.isEmpty()) - result += "|"; - result += "W_OK"; - } - if (mode & X_OK) - { - if (!result.isEmpty()) - result += "|"; - result += "X_OK"; - } - return result; - } - -#if defined SAL_LOG_INFO - void registerPathForFd(int fd, const char *path); - - void unregisterPathForFd(int fd); - - OUString fdAndPath(int fd); - - void dumpFdToPathMap(); -#else - inline void registerPathForFd(int, const char *) - { - } - - inline void unregisterPathForFd(int) - { - } - - inline OUString fdAndPath(int) - { - return ""; - } - - inline void dumpFdToPathMap() - { - } -#endif - - } // end namespace osl #endif // INCLUDED_SAL_OSL_UNX_UUNXAPI_HXX |