Documentation ¶
Overview ¶
Copyright 2022 Molecula Corp. (DBA FeatureBase). SPDX-License-Identifier: Apache-2.0 Package syswrap wraps syscalls (just mmap right now) in order to impose a global in-process limit on the maximum number of active mmaps.
Copyright 2022 Molecula Corp. (DBA FeatureBase). SPDX-License-Identifier: Apache-2.0
Index ¶
- Variables
- func CloseFile(f *os.File) error
- func Mmap(fd int, offset int64, length int, prot int, flags int) (data []byte, err error)
- func Munmap(b []byte) (err error)
- func OpenFile(name string, flag int, perm os.FileMode) (file *os.File, mustClose bool, err error)
- func SetMaxFileCount(max uint64) uint64
- func SetMaxMapCount(max uint64) uint64
Constants ¶
This section is empty.
Variables ¶
var ErrMaxMapCountReached = errors.New("maximum map count reached")
Functions ¶
func Mmap ¶
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 ¶
Munmap calls sycall.Munmap, and then decrements the global map count if there was no error.
func OpenFile ¶
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 ¶
func SetMaxMapCount ¶
SetMaxMapCount sets the maximum map count, and returns the previous maximum.
Types ¶
This section is empty.