Skip to content

update stubs for systems without mmap and mlock #1266

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions llama-util.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,8 @@ struct llama_mmap {
#else
static constexpr bool SUPPORTED = false;

llama_mmap(struct llama_file *) {
llama_mmap(struct llama_file *, bool prefetch = true) {
(void)prefetch;
throw std::string("mmap not supported");
}
#endif
Expand Down Expand Up @@ -382,8 +383,13 @@ struct llama_mlock {
#else
static constexpr bool SUPPORTED = false;

void raw_lock(const void * addr, size_t size) {
size_t lock_granularity() {
return (size_t) 65536;
}

bool raw_lock(const void * addr, size_t size) {
fprintf(stderr, "warning: mlock not supported on this system\n");
return false;
}

void raw_unlock(const void * addr, size_t size) {}
Expand Down