MCPcopy
hub / github.com/etcd-io/bbolt / mlock

Function mlock

mlock_unix.go:8–18  ·  view source on GitHub ↗

mlock locks memory of db file

(db *DB, fileSize int)

Source from the content-addressed store, hash-verified

6
7// mlock locks memory of db file
8func mlock(db *DB, fileSize int) error {
9 sizeToLock := fileSize
10 if sizeToLock > db.datasz {
11 // Can't lock more than mmaped slice
12 sizeToLock = db.datasz
13 }
14 if err := unix.Mlock(db.dataref[:sizeToLock]); err != nil {
15 return err
16 }
17 return nil
18}
19
20// munlock unlocks memory of db file
21func munlock(db *DB, fileSize int) error {

Callers 1

mlockMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected