Commit f3cb4f8f authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 4952bf86
......@@ -29,13 +29,11 @@ cdef extern from "<sys/user.h>":
cpdef enum:
PAGE_SIZE
cdef extern from "<sys/mman.h>":
cpdef enum:
MLOCK_ONFAULT
# XXX not in posix.mman
int mlock2(const void *addr, size_t len, int flags)
cpdef enum:
MLOCK_ONFAULT = mman.MLOCK_ONFAULT
MCL_CURRENT = mman.MCL_CURRENT
MCL_FUTURE = mman.MCL_FUTURE
MCL_ONFAULT = mman.MCL_ONFAULT
# mincore returns bytearray vector indicating whether page of mem is in core or not.
#
......@@ -66,7 +64,7 @@ def mlock(const unsigned char[::1] mem not None, int flags):
cdef const void *addr = &mem[0]
cdef size_t size = mem.shape[0]
cdef err = mlock2(addr, size, flags)
cdef err = mman.mlock2(addr, size, flags)
if err:
PyErr_SetFromErrno(OSError)
......
......@@ -39,8 +39,11 @@ from zodbtools.util import ashex as h, fromhex
from pytest import raises
from . import mman
#print(mman.PAGE_SIZE)
#mman.mincore(bytearray(b'hello world'))
print(mman.PAGE_SIZE)
print(mman.MLOCK_ONFAULT)
print(mman.MCL_CURRENT)
print(mman.MCL_ONFAULT)
mman.mincore(bytearray(b'hello world'))
# 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