pilosa: github.com/pilosa/pilosa/syswrap Index | Files

package syswrap

import "github.com/pilosa/pilosa/syswrap"

Package syswrap wraps syscalls (just mmap right now) in order to impose a global in-process limit on the maximum number of active mmaps.

Index

Package Files

mmap.go os.go

Variables

var ErrMaxMapCountReached = errors.New("maximum map count reached")

func CloseFile Uses

func CloseFile(f *os.File) error

CloseFile decrements the global count of open files and closes the file.

func Mmap Uses

func Mmap(fd int, offset int64, length int, prot int, flags int) (data []byte, err error)

Mmap increments the global map count, and then calls syscall.Mmap. It decrements the map count and returns an error if the count was over the limit. If syscall.Mmap returns an error it also decrements the count.

func Munmap Uses

func Munmap(b []byte) (err error)

Munmap calls sycall.Munmap, and then decrements the global map count if there was no error.

func OpenFile Uses

func OpenFile(name string, flag int, perm os.FileMode) (file *os.File, mustClose bool, err error)

OpenFile passes the arguments along to os.OpenFile while incrementing a counter. If the counter is above the maximum, it returns mustClose true to signal the calling function that it should not keep the file open indefinitely. Files opened with this function should be closed by syswrap.CloseFile.

func SetMaxFileCount Uses

func SetMaxFileCount(max uint64)

func SetMaxMapCount Uses

func SetMaxMapCount(max uint64)

Package syswrap imports 5 packages (graph) and is imported by 5 packages. Updated 2019-05-13. Refresh now. Tools for package owners.