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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Joshua
wendelin.core
Commits
7203f542
Commit
7203f542
authored
Jan 15, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
b37023b6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
10 deletions
+7
-10
wcfs/internal/wcfs.cpp
wcfs/internal/wcfs.cpp
+7
-10
No files found.
wcfs/internal/wcfs.cpp
View file @
7203f542
...
...
@@ -510,7 +510,9 @@ void _Mapping::remmap_blk(int64_t blk) {
if
(
!
ok
)
blkrev
=
TidHead
;
mmap
.
_remmapblk
(
blk
,
blkrev
);
// XXX err
error
err
=
mmap
.
_remmapblk
(
blk
,
blkrev
);
if
(
err
!=
nil
)
panic
(
v
(
err
));
// XXX
}
// unmap removes mapping memory from address space.
...
...
@@ -558,27 +560,22 @@ tuple<os::File, error> WCFS::_open(const string &path, int flags) {
// mmap_zero_into_ro mmaps read-only zeros into [addr +size) so that region as all zeros.
// created mapping, even after it is accessed, does not consume memory.
static
error
_mmap_zero_into_ro
(
void
*
addr
,
size_t
size
);
static
error
mmap_zero_into_ro
(
void
*
addr
,
size_t
size
)
{
error
err
=
_mmap_zero_into_ro
(
addr
,
size
);
if
(
err
!=
nil
)
err
=
fmt
::
errorf
(
"mmap zero"
);
// XXX -> xerr::contextf?
return
err
;
}
static
error
_mmap_zero_into_ro
(
void
*
addr
,
size_t
size
)
{
xerr
::
Contextf
E
(
"mmap zero"
);
// mmap /dev/zero with MAP_NORESERVE and MAP_SHARED
// this way the mapping will be able to be read, but no memory will be allocated to keep it.
os
::
File
z
;
error
err
;
tie
(
z
,
err
)
=
os
::
open
(
"/dev/zero"
);
if
(
err
!=
nil
)
return
err
;
return
E
(
err
)
;
defer
([
&
]()
{
z
->
close
();
});
err
=
mm
::
map_into
(
addr
,
size
,
PROT_READ
,
MAP_SHARED
|
MAP_NORESERVE
,
z
,
0
);
if
(
err
!=
nil
)
return
err
;
return
E
(
err
)
;
return
nil
;
}
...
...
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