mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-19 01:40:13 +00:00
1. Updated etcd/protobuf/grpc dependencies: echo " hack/pin-dependency.sh github.com/golang/protobuf latest hack/pin-dependency.sh google.golang.org/protobuf latest hack/pin-dependency.sh go.etcd.io/etcd/api/v3 v3.5.0-rc.0 hack/pin-dependency.sh go.etcd.io/etcd/client/v3 v3.5.0-rc.0 hack/pin-dependency.sh go.etcd.io/etcd/client/pkg/v3 v3.5.0-rc.0 hack/pin-dependency.sh go.etcd.io/etcd/pkg/v3 v3.5.0-rc.0 hack/pin-dependency.sh go.etcd.io/etcd/server/v3 v3.5.0-rc.0 hack/pin-dependency.sh go.etcd.io/etcd/tests/v3 v3.5.0-rc.0 hack/pin-dependency.sh google.golang.org/grpc latest " | bash 2. Linted transitive dependencies until versions are clean: hack/lint-dependencies.sh | grep " hack/pin-dependency.sh" | bash 3. Linted dependencies until dropped versions are clean: hack/lint-dependencies.sh | grep "dropreplace" | bash 4. Updated vendor and internal modules: hack/update-vendor.sh hack/update-internal-modules.sh Repeated steps 2-4 until clean
37 lines
697 B
Go
37 lines
697 B
Go
// +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
|
|
}
|