mirror of
https://github.com/facebook/sapling.git
synced 2024-10-05 06:18:07 +03:00
159e446d4d
Summary: The checkout code was designed with the assumption that concurrent reads/writes to the working copy would block on locks that checkout holds, thus preventing races. On Windows, this assumption is slightly broken as reads to the working copy are served by the tree hierarchy not by the inode hierarchy. Reads are then reflected back to the inode hierarchy in a background manner to increment the FS refcount. If, somehow a directory is read at the same time as the corresponding directory entry for it is being invalidated in checkout, checkout will attempt to invalidate the directory, but since the directory isn't empty the invalidation would fail, failing checkout. To solve this, we could simply pretend that the directory is loaded and recursively run checkout on it. Reviewed By: kmancini Differential Revision: D39596117 fbshipit-source-id: 95a42553b8779d904f57f9d168197398f5d45436
31 lines
718 B
C++
31 lines
718 B
C++
/*
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This software may be used and distributed according to the terms of the
|
|
* GNU General Public License version 2.
|
|
*/
|
|
|
|
#include "eden/fs/utils/SysctlUtil.h"
|
|
|
|
#ifdef __APPLE__
|
|
|
|
#include <sys/sysctl.h> // @manual
|
|
#include <sys/types.h>
|
|
|
|
#include <folly/Exception.h>
|
|
|
|
std::string getSysCtlByName(const char* name, size_t size) {
|
|
if (size == 0) {
|
|
return std::string{};
|
|
}
|
|
std::string buffer(size, 0);
|
|
size_t returnedSize = size - 1;
|
|
auto ret = sysctlbyname(name, &buffer[0], &returnedSize, nullptr, 0);
|
|
if (ret != 0) {
|
|
folly::throwSystemError("failed to retrieve sysctl ", name);
|
|
}
|
|
buffer.resize(returnedSize);
|
|
return buffer;
|
|
}
|
|
#endif
|