Commit 3d3e312b authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

zdtm: Don't fail maps02 madvise when some kernel madv is not supported

Reported-by: 's avatarPavel Emelyanov <xemul@parallels.com>
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 9f90f2e5
...@@ -116,6 +116,9 @@ static int get_smaps_bits(unsigned long where, unsigned long *flags, unsigned lo ...@@ -116,6 +116,9 @@ static int get_smaps_bits(unsigned long where, unsigned long *flags, unsigned lo
FILE *smaps = NULL; FILE *smaps = NULL;
char buf[1024]; char buf[1024];
if (!where)
return 0;
smaps = fopen("/proc/self/smaps", "r"); smaps = fopen("/proc/self/smaps", "r");
if (!smaps) { if (!smaps) {
err("Can't open smaps: %m"); err("Can't open smaps: %m");
...@@ -153,8 +156,14 @@ static int alloc_anon_mmap(struct mmap_data *m, int flags, int adv) ...@@ -153,8 +156,14 @@ static int alloc_anon_mmap(struct mmap_data *m, int flags, int adv)
} }
if (madvise(m->start, MEM_SIZE, adv)) { if (madvise(m->start, MEM_SIZE, adv)) {
err("madvise failed: %m"); if (errno == EINVAL) {
return -1; test_msg("madvise failed, no kernel support\n");
munmap(m->start, MEM_SIZE);
*m = (struct mmap_data){ };
} else {
err("madvise failed: %m");
return -1;
}
} }
return 0; return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment