mirror of
https://github.com/containers/podman.git
synced 2025-08-06 19:44:14 +08:00
![dependabot[bot]](/assets/img/avatar_default.png)
Bumps [go.etcd.io/bbolt](https://github.com/etcd-io/bbolt) from 1.3.6 to 1.3.7. - [Release notes](https://github.com/etcd-io/bbolt/releases) - [Commits](https://github.com/etcd-io/bbolt/compare/v1.3.6...v1.3.7) --- updated-dependencies: - dependency-name: go.etcd.io/bbolt dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
38 lines
718 B
Go
38 lines
718 B
Go
//go:build !windows
|
|
// +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
|
|
}
|