Skip to content

Commit

Permalink
Use shared mapping to reserve memory when creating locale archive
Browse files Browse the repository at this point in the history
  • Loading branch information
Aurelien Jarno authored and Andreas Schwab committed Mar 18, 2010
1 parent 2f95f8a commit a4889ed
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
2009-10-27 Aurelien Jarno <aurelien@aurel32.net>

[BZ #10855]
* locale/programs/locarchive.c: use MMAP_SHARED to reserve memory
used later with MMAP_FIXED | MMAP_SHARED to cope with different
alignment restrictions.

2009-11-24 Ulrich Drepper <drepper@redhat.com>

* sysdeps/unix/grantpt.c (grantpt): Use CLOSE_ALL_FDS is available
Expand Down
6 changes: 3 additions & 3 deletions locale/programs/locarchive.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ create_archive (const char *archivefname, struct locarhandle *ah)
size_t reserved = RESERVE_MMAP_SIZE;
int xflags = 0;
if (total < reserved
&& ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_PRIVATE | MAP_ANON,
&& ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_SHARED | MAP_ANON,
-1, 0)) != MAP_FAILED))
xflags = MAP_FIXED;
else
Expand Down Expand Up @@ -396,7 +396,7 @@ enlarge_archive (struct locarhandle *ah, const struct locarhead *head)
size_t reserved = RESERVE_MMAP_SIZE;
int xflags = 0;
if (total < reserved
&& ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_PRIVATE | MAP_ANON,
&& ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_SHARED | MAP_ANON,
-1, 0)) != MAP_FAILED))
xflags = MAP_FIXED;
else
Expand Down Expand Up @@ -614,7 +614,7 @@ open_archive (struct locarhandle *ah, bool readonly)
int xflags = 0;
void *p;
if (st.st_size < reserved
&& ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_PRIVATE | MAP_ANON,
&& ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_SHARED | MAP_ANON,
-1, 0)) != MAP_FAILED))
xflags = MAP_FIXED;
else
Expand Down

0 comments on commit a4889ed

Please sign in to comment.