Skip to content

Patch src/replication.cpp to support FreeBSD (remove O_LARGEFILE in open(), like Apple/MacOS) #454

@daviddpd

Description

@daviddpd

FreeBSD also does not use O_LARGEFILE - like Apple/MaOS - working on updating / creating the FreeBSD port for databases/keydb to 6.3.1 and discovered this. The FreeBSD port will contain this patch. Since there are other ifdefs to accommodate FreeBSD, this seemed to the approperate fix.

KeyDB/src/replication.cpp

Lines 192 to 197 in aa032d3

std::string path = "./repl-backlog-temp" + std::to_string(gettid());
#ifdef __APPLE__
int fd = open(path.c_str(), O_CREAT | O_RDWR, S_IRUSR | S_IWUSR);
#else
int fd = open(path.c_str(), O_CREAT | O_RDWR | O_LARGEFILE, S_IRUSR | S_IWUSR);
#endif

--- src/replication.cpp.orig	2022-06-25 17:43:43.907971000 +0000
+++ src/replication.cpp	2022-06-25 17:54:11.991638000 +0000
@@ -190,7 +190,7 @@
 bool createDiskBacklog() {
     // Lets create some disk backed pages and add them here
     std::string path = "./repl-backlog-temp" + std::to_string(gettid());
-#ifdef __APPLE__
+#if (defined __APPLE__ || defined __FreeBSD__)
     int fd = open(path.c_str(), O_CREAT | O_RDWR, S_IRUSR | S_IWUSR);
 #else
     int fd = open(path.c_str(), O_CREAT | O_RDWR | O_LARGEFILE, S_IRUSR | S_IWUSR);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions