*page_num = 0;
*page_num = (length + pagesize - 1) / pagesize;
*vec = (unsigned char *)calloc(*page_num, 1);
*page_num = 0;
*page_num = (length + pagesize - 1) / pagesize;
*vec = (unsigned char *)calloc(*page_num, 1);
/* Get information on whether pages are in core */
if (mincore(page, (size_t)length, *vec) == -1 ||
/* Get information on whether pages are in core */
if (mincore(page, (size_t)length, *vec) == -1 ||
/* Sync file for fadvise process */
if (sync_file_range(fd, offset,
(loff_t)pagesize * page_num, sync_flag) < 0)
return -1;
/* Sync file for fadvise process */
if (sync_file_range(fd, offset,
(loff_t)pagesize * page_num, sync_flag) < 0)
return -1;
/* Try to release buffer cache which this process used,
* then other process can use the released buffer
/* Try to release buffer cache which this process used,
* then other process can use the released buffer