Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
capnproto
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
capnproto
Commits
70d3ab46
Commit
70d3ab46
authored
Dec 22, 2017
by
Kenton Varda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix msync() usage in Unix filesystem implementation.
Apparently, msync()'s parameters must be page-aligned, bah.
parent
3f4beb3b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
6 deletions
+12
-6
filesystem-disk-test.c++
c++/src/kj/filesystem-disk-test.c++
+4
-4
filesystem-disk-unix.c++
c++/src/kj/filesystem-disk-unix.c++
+8
-2
No files found.
c++/src/kj/filesystem-disk-test.c++
View file @
70d3ab46
...
...
@@ -310,10 +310,10 @@ KJ_TEST("DiskFile") {
KJ_EXPECT
(
kj
::
str
(
writableMapping
->
get
().
slice
(
0
,
6
).
asChars
())
==
"foobaz"
);
KJ_EXPECT
(
kj
::
str
(
privateMapping
.
slice
(
0
,
6
).
asChars
())
==
"Foobaz"
);
writableMapping
->
get
()[
0
]
=
'D'
;
writableMapping
->
changed
(
writableMapping
->
get
().
slice
(
0
,
1
));
KJ_EXPECT
(
kj
::
str
(
mapping
.
slice
(
0
,
6
).
asChars
())
==
"
Do
obaz"
);
KJ_EXPECT
(
kj
::
str
(
writableMapping
->
get
().
slice
(
0
,
6
).
asChars
())
==
"
Do
obaz"
);
writableMapping
->
get
()[
1
]
=
'D'
;
writableMapping
->
changed
(
writableMapping
->
get
().
slice
(
1
,
2
));
KJ_EXPECT
(
kj
::
str
(
mapping
.
slice
(
0
,
6
).
asChars
())
==
"
fD
obaz"
);
KJ_EXPECT
(
kj
::
str
(
writableMapping
->
get
().
slice
(
0
,
6
).
asChars
())
==
"
fD
obaz"
);
KJ_EXPECT
(
kj
::
str
(
privateMapping
.
slice
(
0
,
6
).
asChars
())
==
"Foobaz"
);
file
->
write
(
0
,
StringPtr
(
"qux"
).
asBytes
());
...
...
c++/src/kj/filesystem-disk-unix.c++
View file @
70d3ab46
...
...
@@ -441,13 +441,19 @@ public:
void
changed
(
ArrayPtr
<
byte
>
slice
)
override
{
KJ_REQUIRE
(
slice
.
begin
()
>=
bytes
.
begin
()
&&
slice
.
end
()
<=
bytes
.
end
(),
"byte range is not part of this mapping"
);
KJ_SYSCALL
(
msync
(
slice
.
begin
(),
slice
.
size
(),
MS_ASYNC
));
// msync() requires page-alignment, apparently, so use getMmapRange() to accomplish that.
auto
range
=
getMmapRange
(
reinterpret_cast
<
uintptr_t
>
(
slice
.
begin
()),
slice
.
size
());
KJ_SYSCALL
(
msync
(
reinterpret_cast
<
void
*>
(
range
.
offset
),
range
.
size
,
MS_ASYNC
));
}
void
sync
(
ArrayPtr
<
byte
>
slice
)
override
{
KJ_REQUIRE
(
slice
.
begin
()
>=
bytes
.
begin
()
&&
slice
.
end
()
<=
bytes
.
end
(),
"byte range is not part of this mapping"
);
KJ_SYSCALL
(
msync
(
slice
.
begin
(),
slice
.
size
(),
MS_SYNC
));
// msync() requires page-alignment, apparently, so use getMmapRange() to accomplish that.
auto
range
=
getMmapRange
(
reinterpret_cast
<
uintptr_t
>
(
slice
.
begin
()),
slice
.
size
());
KJ_SYSCALL
(
msync
(
reinterpret_cast
<
void
*>
(
range
.
offset
),
range
.
size
,
MS_SYNC
));
}
private
:
...
...
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