[CRIU] [PATCH 1/2] proc: add vma_area in a list after parsing all parameters

Cyrill Gorcunov gorcunov at openvz.org
Tue May 21 07:09:15 EDT 2013


On Tue, May 21, 2013 at 02:37:52PM +0400, Andrey Vagin wrote:
>  
> -	while (fgets(buf, BUF_SIZE, smaps)) {
> +	while (1) {
>  		int num;
>  		char file_path[6];
> +		bool eof;
> +
> +		eof = (fgets(buf, BUF_SIZE, smaps) == NULL);
>  
> -		if (!is_vma_range_fmt(buf)) {
> +		if (!eof && !is_vma_range_fmt(buf)) {
>  			if (!strncmp(buf, "Nonlinear", 9)) {
>  				BUG_ON(!vma_area);
>  				pr_err("Nonlinear mapping found %016"PRIx64"-%016"PRIx64"\n",
> @@ -190,6 +193,21 @@ int parse_smaps(pid_t pid, struct vm_area_list *vma_area_list, bool use_map_file
>  				continue;
>  		}
>  

Andrew, correct me please, if I'm mistaken -- the vma_area is the last vma
allocated, iow it's last from the &vma_area_list->h, right? Thus maybe
we could do this handling out of cycle at all instead of this eof game?


More information about the CRIU mailing list