Commit 72113c73 authored by Ramon Nou's avatar Ramon Nou
Browse files

mmap64 libc implementation

parent 4df2d4b5
Loading
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -2518,6 +2518,26 @@ mmap(void* addr, size_t length, int prot, int flags, int fd, off_t offset) {
    GKFS_FALLBACK(mmap, addr, length, prot, flags, fd, offset);
}

// mmap64 is the large-file alias for mmap on Linux x86_64.
// Python's built-in mmap module and NumPy memmap call this variant directly,
// bypassing plain mmap(). Without this interceptor, GekkoFS fds fall through
// to the kernel and return ENXIO.
#if defined(__USE_LARGEFILE64) || defined(_LARGEFILE64_SOURCE) ||              \
        defined(__linux__)
DLSYM_WRAPPER(void*, mmap64,
              (void* addr, size_t length, int prot, int flags, int fd,
               off_t offset),
              (addr, length, prot, flags, fd, offset), "mmap64")

void*
mmap64(void* addr, size_t length, int prot, int flags, int fd, off_t offset) {
    gkfs_init_routine_placeholder();
    // Delegate to gkfs_mmap when fd belongs to GekkoFS, otherwise fallback.
    GKFS_OPERATION(mmap, addr, length, prot, flags, fd, offset);
    GKFS_FALLBACK(mmap64, addr, length, prot, flags, fd, offset);
}
#endif

int
msync(void* addr, size_t length, int flags) {
    gkfs_init_routine_placeholder();