Commit d022326d authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent ba7c8c7b
......@@ -19,7 +19,7 @@
# cython: language_level=2
"""Module mman provides memory management utilities like mlock and mincore."""
"""Module mm provides access to OS memory management interfaces like mlock and mincore."""
from posix cimport mman
from cpython.exc cimport PyErr_SetFromErrno
......@@ -35,10 +35,10 @@ cpdef enum:
MCL_FUTURE = mman.MCL_FUTURE
MCL_ONFAULT = mman.MCL_ONFAULT
# mincore returns bytearray vector indicating whether page of mem is in core or not.
# incore returns bytearray vector indicating whether page of mem is in core or not.
#
# mem start must be page-aligned.
def mincore(const unsigned char[::1] mem not None) -> bytearray:
def incore(const unsigned char[::1] mem not None) -> bytearray:
cdef const void *addr = &mem[0]
cdef size_t size = mem.shape[0]
......@@ -57,10 +57,10 @@ def mincore(const unsigned char[::1] mem not None) -> bytearray:
return incore
# mlock locks mem pages to be resident in RAM.
# lock locks mem pages to be resident in RAM.
#
# see mlock2(2) for description of flags.
def mlock(const unsigned char[::1] mem not None, int flags):
def lock(const unsigned char[::1] mem not None, int flags):
cdef const void *addr = &mem[0]
cdef size_t size = mem.shape[0]
......@@ -69,8 +69,8 @@ def mlock(const unsigned char[::1] mem not None, int flags):
PyErr_SetFromErrno(OSError)
# munlock unlocks mem pages from being pinned in RAM.
def munlock(const unsigned char[::1] mem not None):
# unlock unlocks mem pages from being pinned in RAM.
def unlock(const unsigned char[::1] mem not None):
cdef const void *addr = &mem[0]
cdef size_t size = mem.shape[0]
......@@ -82,7 +82,7 @@ def munlock(const unsigned char[::1] mem not None):
from posix.types cimport off_t
# XXX PROT_READ | MAP_SHARED
def mmap_ro(int fd, off_t offset, size_t size):
def map_ro(int fd, off_t offset, size_t size):
cdef void *addr
addr = mman.mmap(NULL, size, mman.PROT_READ, mman.MAP_SHARED, fd, offset)
......@@ -92,8 +92,8 @@ def mmap_ro(int fd, off_t offset, size_t size):
return <unsigned char[:size:1]>addr
# munmap unmaps memory coverd by mem.
def munmap(const unsigned char[::1] mem not None):
# unmap unmaps memory coverd by mem.
def unmap(const unsigned char[::1] mem not None):
cdef const void *addr = &mem[0]
cdef size_t size = mem.shape[0]
......
......@@ -37,7 +37,7 @@ from errno import EINVAL
from golang import func, defer
from zodbtools.util import ashex as h, fromhex
from pytest import raises
from . import mman
from . import mm
# setup:
# - create test database, compute zurl and mountpoint for wcfs
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment