requires <<config_temporary_dir,*temporary_dir*>> to be located on a local
filesystem of a supported type.
+
-NOTE: Support for the inode cache feature on Windows is experimental. On Windows the default is false.
+NOTE: Support for the inode cache feature on Windows is experimental. On Windows
+the default is false.
[#config_keep_comments_cpp]
*keep_comments_cpp* (*CCACHE_COMMENTS* or *CCACHE_NOCOMMENTS*, see _<<Boolean values>>_ above)::
-// Copyright (C) 2019-2023 Joel Rosdahl and other contributors
+// Copyright (C) 2019-2024 Joel Rosdahl and other contributors
//
// See doc/AUTHORS.adoc for a complete list of contributors.
//
#ifndef _WIN32
bool m_inode_cache = true;
#else
- // Support is experimental on Windows so usage is off by default
+ // Support is experimental on Windows so usage is off by default.
bool m_inode_cache = false;
#endif
bool m_keep_comments_cpp = false;
-// Copyright (C) 2020-2023 Joel Rosdahl and other contributors
+// Copyright (C) 2020-2024 Joel Rosdahl and other contributors
//
// See doc/AUTHORS.adoc for a complete list of contributors.
//
#include <type_traits>
#include <vector>
+using pstr = util::PathString;
+
// The inode cache resides on a file that is mapped into shared memory by
// running processes. It is implemented as a two level structure, where the top
// level is a hash table consisting of buckets. Each bucket contains entries
return false;
}
- // Try to get information about remote protocol for this file.
- // If the call succeeds, this is a remote file.
- // If the call fails with invalid parameter error, consider that it is a local
- // file
+ // Try to get information about remote protocol for this file. If the call
+ // succeeds, this is a remote file. If the call fails with invalid parameter
+ // error, consider whether it is a local file.
FILE_REMOTE_PROTOCOL_INFO infos;
if (GetFileInformationByHandleEx(
file, FileRemoteProtocolInfo, &infos, sizeof(infos))) {
key.st_ino = de.inode();
key.st_mode = de.mode();
// Note: Manually copying sec and nsec of mtime and ctime to prevent copying
- // the padding bytes
+ // the padding bytes.
auto mtime = de.mtime().to_timespec();
key.st_mtim.tv_sec = mtime.tv_sec;
key.st_mtim.tv_nsec = mtime.tv_nsec;
return false;
}
- util::Finalizer temp_file_remover(
- [&] { unlink(util::PathString(tmp_file->path).c_str()); });
+ util::Finalizer temp_file_remover([&] { unlink(pstr(tmp_file->path)); });
if (!fd_is_on_known_to_work_file_system(*tmp_file->fd)) {
return false;
unsigned error = GetLastError();
if (error == ERROR_FILE_EXISTS) {
// Not an error, another process won the race. Remove the file we just
- // created
+ // created.
DeleteFileA(util::PathString(tmp_file->path).c_str());
LOG("Another process created inode cache {}", filename);
return true;