diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-06-03 17:58:24 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-03 17:58:24 +0200 |
commit | cbcf0a1dd7f9e87a837dae96ffb1b3d0ff8c5b91 (patch) | |
tree | 971ee453feb66298c773cd3975eae0715354866c /vendor/go.etcd.io/bbolt/mlock_unix.go | |
parent | 0f8ec8e366ce77c3309c560e471cc957851e1cf1 (diff) | |
parent | 735470ff234a319d2f02f634204bc74af77cc60e (diff) | |
download | podman-cbcf0a1dd7f9e87a837dae96ffb1b3d0ff8c5b91.tar.gz podman-cbcf0a1dd7f9e87a837dae96ffb1b3d0ff8c5b91.tar.bz2 podman-cbcf0a1dd7f9e87a837dae96ffb1b3d0ff8c5b91.zip |
Merge pull request #10545 from containers/dependabot/go_modules/go.etcd.io/bbolt-1.3.6
Bump go.etcd.io/bbolt from 1.3.5 to 1.3.6
Diffstat (limited to 'vendor/go.etcd.io/bbolt/mlock_unix.go')
-rw-r--r-- | vendor/go.etcd.io/bbolt/mlock_unix.go | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/vendor/go.etcd.io/bbolt/mlock_unix.go b/vendor/go.etcd.io/bbolt/mlock_unix.go new file mode 100644 index 000000000..6a6c7b353 --- /dev/null +++ b/vendor/go.etcd.io/bbolt/mlock_unix.go @@ -0,0 +1,36 @@ +// +build !windows + +package bbolt + +import "golang.org/x/sys/unix" + +// mlock locks memory of db file +func mlock(db *DB, fileSize int) error { + sizeToLock := fileSize + if sizeToLock > db.datasz { + // Can't lock more than mmaped slice + sizeToLock = db.datasz + } + if err := unix.Mlock(db.dataref[:sizeToLock]); err != nil { + return err + } + return nil +} + +//munlock unlocks memory of db file +func munlock(db *DB, fileSize int) error { + if db.dataref == nil { + return nil + } + + sizeToUnlock := fileSize + if sizeToUnlock > db.datasz { + // Can't unlock more than mmaped slice + sizeToUnlock = db.datasz + } + + if err := unix.Munlock(db.dataref[:sizeToUnlock]); err != nil { + return err + } + return nil +} |