eina_file: Ensure populate is safe to call
Fix map_populate on the global map
This patch includes two commits
1) [PATCH] eina file: Ensure populate is safe to call
(commit
05c051405e89ef595f117f637dbbb0104262c218)
This makes sure that the call to madvise is safe. On Linux it's not too
much of an issue as checks are made inside madvise, and the worst that
can happen is an error is returned (EINVAL). Not great.
But if MAP_POPULATE is not present, as is the case on *BSD, then the
internal function _eina_file_map_populate() is used for the populate
rule. In that case actual data is read and we should make sure not to
trigger a segfault or bus error.
Also, this makes sure that in case of HugeTLB we actually populate all
pages, rather than one page out of 8 (we were jumping by 16Mb instead of
2Mb).
Note: Can we get the size of a HugeTLB at runtime? We're assuming 2Mb
which might very well not be the case!
See: https://wiki.debian.org/Hugepages
Tested by disabling MAP_POPULATE and observing crashes :)
@fix
2) [PATCH] eina file: Fix map_populate on the global map
(commit
b2ea60691e45674a4e283e0535634bdd699544ea)
If eina_file_map_all() is called, the map isn't added to the internal
hash "rmap" and so _eina_file_map_rule_apply() would never be called.
@fix
Change-Id: Ib074aff31e3498fb7fca7c5ca792d5bdf8e8bd17