From https://github.com/kovidgoyal/calibre/commit/ae83537ef8b338724d389520ad6fbbebe83d1b0a Mon Sep 17 00:00:00 2001
From: Kovid Goyal <kovid@kovidgoyal.net>
Date: Sat, 7 Jun 2025 07:55:59 +0530
Subject: [PATCH] pread64() -> pread()

We dont support 32 bit architectures anymore anyway, but define
_FILE_OFFSET_BITS to be safe, only in speedups.c to minimize an
side-effect risks.

Fixes #2769 (Define _FILE_OFFSET_BITS=64 and replace usage of pread64)
--- a/src/calibre/utils/speedup.c
+++ b/src/calibre/utils/speedup.c
@@ -1,5 +1,8 @@
 #define UNICODE
 #define PY_SSIZE_T_CLEAN
+#ifndef _FILE_OFFSET_BITS
+#define _FILE_OFFSET_BITS 64
+#endif
 
 #include <Python.h>
 #include <datetime.h>
@@ -747,12 +750,8 @@ pread_all(PyObject *self, PyObject *args) {
             if (err != ERROR_HANDLE_EOF) saved_errno = err;
             break;
         }
-#else
-#ifdef __linux__
-        ssize_t nr = pread64(fd, buf + pos, n - pos, offset);
 #else
         ssize_t nr = pread(fd, buf + pos, n - pos, offset);
-#endif
         if (nr < 0) {
             if (errno == EINTR || errno == EAGAIN) continue;
             saved_errno = errno;
