Skip to content

Commit ea3a0ad

Browse files
xloemJohn Doe
and
John Doe
authored
llama : update stubs for systems without mmap and mlock (LostRuins#1266)
Co-authored-by: John Doe <[email protected]>
1 parent 2bdc096 commit ea3a0ad

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Diff for: llama-util.h

+8-2
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,8 @@ struct llama_mmap {
243243
#else
244244
static constexpr bool SUPPORTED = false;
245245

246-
llama_mmap(struct llama_file *) {
246+
llama_mmap(struct llama_file *, bool prefetch = true) {
247+
(void)prefetch;
247248
throw std::string("mmap not supported");
248249
}
249250
#endif
@@ -382,8 +383,13 @@ struct llama_mlock {
382383
#else
383384
static constexpr bool SUPPORTED = false;
384385

385-
void raw_lock(const void * addr, size_t size) {
386+
size_t lock_granularity() {
387+
return (size_t) 65536;
388+
}
389+
390+
bool raw_lock(const void * addr, size_t size) {
386391
fprintf(stderr, "warning: mlock not supported on this system\n");
392+
return false;
387393
}
388394

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

0 commit comments

Comments
 (0)