Skip to content

Commit

Permalink
Merge pull request #10 from TUM-I5/macos
Browse files Browse the repository at this point in the history
 ifdef open64/lseek64
  • Loading branch information
davschneller authored Sep 22, 2023
2 parents a156c1f + 1cd00a8 commit fcc666c
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions backends/Posix.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,15 +183,24 @@ class Posix : public Base<T>

static int open(const char* filename)
{
int fh = open64(filename, O_WRONLY | O_CREAT,
#ifdef __APPLE__
int fh = ::open(filename, O_WRONLY | O_CREAT,
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
#else
int fh = open64(filename, O_WRONLY | O_CREAT,
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
#endif // __APPLE__
checkErr(fh);
return fh;
}

static void write(int fh, const void* buffer, size_t offset, size_t size)
{
checkErr(lseek64(fh, offset, SEEK_SET));
#ifdef __APPLE__
checkErr(lseek(fh, offset, SEEK_SET));
#else
checkErr(lseek64(fh, offset, SEEK_SET));
#endif

const char* buf = reinterpret_cast<const char*>(buffer);
while (size > 0) {
Expand Down

0 comments on commit fcc666c

Please sign in to comment.