Commit f3cb4f8f authored by Kirill Smelkov's avatar Kirill Smelkov

.

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