mmap : fix fileno macro clash

ggml-ci
This commit is contained in:
Georgi Gerganov 2025-01-04 16:21:52 +02:00
parent 78c6785175
commit c98eb635d6
No known key found for this signature in database
GPG key ID: 449E073F9DC10735
2 changed files with 4 additions and 4 deletions

View file

@ -241,7 +241,7 @@ llama_file::~llama_file() = default;
size_t llama_file::tell() const { return pimpl->tell(); } size_t llama_file::tell() const { return pimpl->tell(); }
size_t llama_file::size() const { return pimpl->size; } size_t llama_file::size() const { return pimpl->size; }
int llama_file::fileno() const { int llama_file::file_id() const {
#ifdef _WIN32 #ifdef _WIN32
return _fileno(pimpl->fp); return _fileno(pimpl->fp);
#else #else
@ -265,7 +265,7 @@ struct llama_mmap::impl {
impl(struct llama_file * file, size_t prefetch, bool numa) { impl(struct llama_file * file, size_t prefetch, bool numa) {
size = file->size(); size = file->size();
int fd = file->fileno(); int fd = file->file_id();
int flags = MAP_SHARED; int flags = MAP_SHARED;
if (numa) { prefetch = 0; } if (numa) { prefetch = 0; }
#ifdef __linux__ #ifdef __linux__
@ -357,7 +357,7 @@ struct llama_mmap::impl {
size = file->size(); size = file->size();
HANDLE hFile = (HANDLE) _get_osfhandle(file->fileno()); HANDLE hFile = (HANDLE) _get_osfhandle(file->file_id());
HANDLE hMapping = CreateFileMappingA(hFile, NULL, PAGE_READONLY, 0, 0, NULL); HANDLE hMapping = CreateFileMappingA(hFile, NULL, PAGE_READONLY, 0, 0, NULL);

View file

@ -18,7 +18,7 @@ struct llama_file {
size_t tell() const; size_t tell() const;
size_t size() const; size_t size() const;
int fileno() const; int file_id() const; // fileno overload
void seek(size_t offset, int whence) const; void seek(size_t offset, int whence) const;