Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
d022326d
Commit
d022326d
authored
Mar 15, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
ba7c8c7b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
11 deletions
+11
-11
wcfs/mm.pyx
wcfs/mm.pyx
+10
-10
wcfs/wcfs_test.py
wcfs/wcfs_test.py
+1
-1
No files found.
wcfs/mm
an
.pyx
→
wcfs/mm.pyx
View file @
d022326d
...
...
@@ -19,7 +19,7 @@
# cython: language_level=2
"""Module mm
an provides memory management utiliti
es like mlock and mincore."""
"""Module mm
provides access to OS memory management interfac
es 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
#
m
incore 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
m
incore
(
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
#
m
lock 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
m
lock
(
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
)
#
m
unlock unlocks mem pages from being pinned in RAM.
def
m
unlock
(
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
m
m
ap_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
#
m
unmap unmaps memory coverd by mem.
def
m
unmap
(
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
]
...
...
wcfs/wcfs_test.py
View file @
d022326d
...
...
@@ -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
mm
an
from
.
import
mm
# setup:
# - create test database, compute zurl and mountpoint for wcfs
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment