mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-23 18:20:50 +00:00
Fix build
This commit is contained in:
parent
51ee8fdbb0
commit
e59e833cc6
@ -11,6 +11,30 @@
|
||||
#include <linux/fs.h>
|
||||
#endif
|
||||
|
||||
/// For old versions of libc.
|
||||
#if !defined(RENAME_NOREPLACE)
|
||||
#define RENAME_NOREPLACE 1
|
||||
#endif
|
||||
|
||||
#if !defined(RENAME_EXCHANGE)
|
||||
#define RENAME_EXCHANGE 2
|
||||
#endif
|
||||
|
||||
#if !defined(__NR_renameat2)
|
||||
#if defined(__x86_64__)
|
||||
#define __NR_renameat2 316
|
||||
#elif defined(__aarch64__)
|
||||
#define __NR_renameat2 276
|
||||
#elif defined(__ppc64__)
|
||||
#define __NR_renameat2 357
|
||||
#elif defined(__riscv)
|
||||
#define __NR_renameat2 276
|
||||
#else
|
||||
#error "Unsupported architecture"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
namespace DB
|
||||
@ -27,17 +51,11 @@ namespace ErrorCodes
|
||||
|
||||
static bool supportsRenameat2Impl()
|
||||
{
|
||||
#if defined(__NR_renameat2)
|
||||
VersionNumber renameat2_minimal_version(3, 15, 0);
|
||||
VersionNumber linux_version(Poco::Environment::osVersion());
|
||||
return linux_version >= renameat2_minimal_version;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(__NR_renameat2)
|
||||
|
||||
static bool renameat2(const std::string & old_path, const std::string & new_path, int flags)
|
||||
{
|
||||
if (!supportsRenameat2())
|
||||
@ -69,16 +87,6 @@ static bool renameat2(const std::string & old_path, const std::string & new_path
|
||||
throwFromErrnoWithPath("Cannot rename " + old_path + " to " + new_path, new_path, ErrorCodes::SYSTEM_ERROR);
|
||||
}
|
||||
|
||||
#else
|
||||
#define RENAME_NOREPLACE -1
|
||||
#define RENAME_EXCHANGE -1
|
||||
|
||||
static bool renameat2(const std::string &, const std::string &, int)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static void renameNoReplaceFallback(const std::string & old_path, const std::string & new_path)
|
||||
{
|
||||
|
@ -30,6 +30,8 @@
|
||||
#define SYS_preadv2 286
|
||||
#elif defined(__ppc64__)
|
||||
#define SYS_preadv2 380
|
||||
#elif defined(__riscv)
|
||||
#define SYS_preadv2 286
|
||||
#else
|
||||
#error "Unsupported architecture"
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user