From eda393df1ef88e586f3cbeabf7e40d8945500b83 Mon Sep 17 00:00:00 2001 From: Naoki Takano Date: Fri, 23 Feb 2018 09:54:47 -0800 Subject: [PATCH] make madvise call optional --- bolt_unix.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bolt_unix.go b/bolt_unix.go index 06592a080..add3bd882 100644 --- a/bolt_unix.go +++ b/bolt_unix.go @@ -56,7 +56,9 @@ func mmap(db *DB, sz int) error { } // Advise the kernel that the mmap is accessed randomly. - if err := madvise(b, syscall.MADV_RANDOM); err != nil { + err = madvise(b, syscall.MADV_RANDOM) + if err != nil && err != syscall.ENOSYS { + // Ignore not implemented error in kernel because it still works. return fmt.Errorf("madvise: %s", err) }