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
ba7c8c7b
Commit
ba7c8c7b
authored
Mar 14, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
f3cb4f8f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
7 deletions
+25
-7
bigarray/array_ram.py
bigarray/array_ram.py
+1
-1
wcfs/mman.pyx
wcfs/mman.pyx
+24
-0
wcfs/wcfs_test.py
wcfs/wcfs_test.py
+0
-6
No files found.
bigarray/array_ram.py
View file @
ba7c8c7b
...
...
@@ -62,7 +62,7 @@ class _RAMFileH(object):
# mmap(2) allows mmaping past the end, but python's mmap does not.
# we workaround it with explicitly growing file as needed.
# however we need to protect against races between concurrent .mmap() calls.
# ._mmapmu is used for this.
# ._mmapmu is used for this.
XXX -> our mmap?
self
.
_mmapmu
=
threading
.
Lock
()
def
mmap
(
self
,
pgoffset
,
pglen
):
...
...
wcfs/mman.pyx
View file @
ba7c8c7b
...
...
@@ -77,3 +77,27 @@ def munlock(const unsigned char[::1] mem not None):
cdef
err
=
mman
.
munlock
(
addr
,
size
)
if
err
:
PyErr_SetFromErrno
(
OSError
)
from
posix.types
cimport
off_t
# XXX PROT_READ | MAP_SHARED
def
mmap_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
)
if
addr
==
mman
.
MAP_FAILED
:
PyErr_SetFromErrno
(
OSError
)
return
<
unsigned
char
[:
size
:
1
]
>
addr
# munmap unmaps memory coverd by mem.
def
munmap
(
const
unsigned
char
[::
1
]
mem
not
None
):
cdef
const
void
*
addr
=
&
mem
[
0
]
cdef
size_t
size
=
mem
.
shape
[
0
]
cdef
err
=
mman
.
munmap
(
<
void
*>
addr
,
size
)
if
err
:
PyErr_SetFromErrno
(
OSError
)
# ok
wcfs/wcfs_test.py
View file @
ba7c8c7b
...
...
@@ -37,13 +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
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
...
...
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