aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxloem <0xloem@gmail.com>2023-05-01 08:58:51 -0400
committerGitHub <noreply@github.com>2023-05-01 15:58:51 +0300
commitea3a0ad6b6b5ca4693b94acd4cb32e2803f66fae (patch)
tree6d3991d15bc0f69cf93431752ba382c76d04975b
parent2bdc09646d8c6cb74a6f573e9081586b4b83b9d1 (diff)
llama : update stubs for systems without mmap and mlock (#1266)
Co-authored-by: John Doe <john.doe@example.com>
-rw-r--r--llama-util.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/llama-util.h b/llama-util.h
index 5f9f70e..d531588 100644
--- a/llama-util.h
+++ b/llama-util.h
@@ -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
@@ -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) {}