Documentation
¶
Index ¶
- Constants
- Variables
- func GenKey() int
- func Log() *slog.Logger
- func Mlock(b []byte) (err error)
- func Mmap(fd int, offset int64, length int, prot int, flags int) (data []byte, err error)
- func Munmap(b []byte) (err error)
- type MapFile
- func (f *MapFile) At(i int) byte
- func (f *MapFile) Close() error
- func (f *MapFile) Fd() uintptr
- func (f *MapFile) Len() int
- func (f *MapFile) Read(p []byte) (int, error)
- func (f *MapFile) ReadAt(p []byte, off int64) (int, error)
- func (f *MapFile) ReadByte() (byte, error)
- func (f *MapFile) Seek(offset int64, whence int) (int64, error)
- func (f *MapFile) Stat() (os.FileInfo, error)
- func (f *MapFile) Sync() error
- func (f *MapFile) Write(p []byte) (int, error)
- func (f *MapFile) WriteAt(p []byte, off int64) (int, error)
- func (f *MapFile) WriteByte(c byte) error
- type MapMem
- func (f *MapMem) Cap() int
- func (f *MapMem) Close() (err error)
- func (f *MapMem) ID() int
- func (f *MapMem) IsOwner() bool
- func (f *MapMem) Len() int
- func (f *MapMem) Read(p []byte) (int, error)
- func (f *MapMem) ReadAt(p []byte, off int64) (n int, err error)
- func (f *MapMem) ReadByte() (byte, error)
- func (f *MapMem) Seek(offset int64, whence int) (int64, error)
- func (f *MapMem) Write(p []byte) (int, error)
- func (f *MapMem) WriteAt(p []byte, off int64) (n int, err error)
- func (f *MapMem) WriteByte(c byte) error
Constants ¶
const ( EINVAL = syscall.EINVAL ENOENT = syscall.ENOENT )
const ( PROT_NONE = syscall.PROT_NONE PROT_READ = syscall.PROT_READ PROT_WRITE = syscall.PROT_WRITE PROT_EXEC = syscall.PROT_EXEC MAP_SHARED = syscall.MAP_SHARED )
const (
MapMemKeyInvalid = -1
)
Variables ¶
var ( ErrBadFileDesc = errors.New("bad file descriptor") ErrShortWrite = io.ErrShortWrite ErrInvalid = os.ErrInvalid EOF = io.EOF )
Functions ¶
func Mlock ¶
Mlock locks the given byte slice.
It takes a byte slice as a parameter and returns an error.
func Mmap ¶
Mmap maps length bytes of the file represented by the file descriptor fd into memory, starting at the byte offset.
fd int - file descriptor offset int64 - byte offset length int - length in bytes prot int - memory protection flags int - mapping flags []byte, error - mapped data and an error
Types ¶
type MapFile ¶
type MapFile struct {
// contains filtered or unexported fields
}
MapFile reads/writes a memory-mapped file.
func OpenFile ¶
OpenFile memory-maps the named file for reading/writing, depending on the flag value.
func OpenFileS ¶
OpenFileS memory-maps the named file for reading/writing, depending on the flag value.
func (*MapFile) Stat ¶
Stat returns the MapFileInfo structure describing file. If there is an error, it will be of type *os.PathError.