Commit 9f9ed0c6 authored by Libo Chen's avatar Libo Chen Committed by Pavel Emelyanov

kerndat:fix compile err

Update to commit 78b8abe9
I find a compile err:

kerndat.c: In function 'kerndat_get_dirty_track':
kerndat.c:78:6: error: ignoring return value of 'read', declared with attribute warn_unused_result [-Werror=unused-result]
cc1: all warnings being treated as errors
make[2]: *** [kerndat.o] Error 1
make[1]: *** [built-in.o] Error 2
make[1]: Leaving directory `/home/clb/crtools'
make: *** [all] Error 2
Signed-off-by: 's avatarLibo Chen <libo.chen@huawei.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent f34d63bf
......@@ -58,12 +58,13 @@ int kerndat_get_dirty_track(void)
char *map;
int pm2;
u64 pmap = 0;
int ret = -1;
map = mmap(NULL, PAGE_SIZE, PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
if (map == MAP_FAILED) {
pr_perror("Can't mmap piggie2");
return -1;
return ret;
}
map[0] = '\0';
......@@ -71,11 +72,15 @@ int kerndat_get_dirty_track(void)
pm2 = open("/proc/self/pagemap2", O_RDONLY);
if (pm2 < 0) {
pr_perror("Can't open pagemap2 file");
return -1;
return ret;
}
lseek(pm2, (unsigned long)map / PAGE_SIZE * sizeof(u64), SEEK_SET);
read(pm2, &pmap, sizeof(pmap));
ret = read(pm2, &pmap, sizeof(pmap));
if (ret < 0){
pr_perror("Read pmap err!");
}
close(pm2);
munmap(map, PAGE_SIZE);
......
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