mirror of https://github.com/etcd-io/bbolt.git
Fix Linux build.
parent
4380d543c5
commit
7c2ec1a575
|
@ -0,0 +1,16 @@
|
||||||
|
package bolt
|
||||||
|
|
||||||
|
import (
|
||||||
|
"syscall"
|
||||||
|
)
|
||||||
|
|
||||||
|
type _syscall interface {
|
||||||
|
Mmap(fd int, offset int64, length int, prot int, flags int) (data []byte, err error)
|
||||||
|
}
|
||||||
|
|
||||||
|
type syssyscall struct{}
|
||||||
|
|
||||||
|
func (o *syssyscall) Mmap(fd int, offset int64, length int, prot int, flags int) (data []byte, err error) {
|
||||||
|
// err = (EACCES, EBADF, EINVAL, ENODEV, ENOMEM, ENXIO, EOVERFLOW)
|
||||||
|
return syscall.Mmap(fd, offset, length, prot, flags)
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package bolt
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/stretchr/testify/mock"
|
||||||
|
)
|
||||||
|
|
||||||
|
type mocksyscall struct {
|
||||||
|
mock.Mock
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *mocksyscall) Mmap(fd int, offset int64, length int, prot int, flags int) (data []byte, err error) {
|
||||||
|
args := m.Called(fd, offset, length, prot, flags)
|
||||||
|
return args.Get(0).([]byte), args.Error(1)
|
||||||
|
}
|
Loading…
Reference in New Issue