[CRIU] [PATCH 08/17] proc: delete parse_pid_stat_small()

Pavel Emelyanov xemul at parallels.com
Thu Nov 6 03:38:44 PST 2014


On 10/31/2014 01:14 PM, Andrey Vagin wrote:
> It's unused now.
> 
> Signed-off-by: Andrey Vagin <avagin at openvz.org>
> ---
>  include/proc_parse.h |  1 -
>  proc_parse.c         | 48 ------------------------------------------------
>  2 files changed, 49 deletions(-)
> 
> diff --git a/include/proc_parse.h b/include/proc_parse.h
> index a0424bb..a2141bb 100644
> --- a/include/proc_parse.h
> +++ b/include/proc_parse.h
> @@ -164,7 +164,6 @@ struct vm_area_list;
>  
>  extern struct mount_info *parse_mountinfo(pid_t pid, struct ns_id *nsid);
>  extern int parse_pid_stat(pid_t pid, struct proc_pid_stat *s);
> -extern int parse_pid_stat_small(pid_t pid, struct proc_pid_stat_small *s);

Plz, remove the proc_pid_stat_small struct too.

>  extern int parse_smaps(pid_t pid, struct vm_area_list *vma_area_list, bool use_map_files);
>  extern int parse_self_maps_lite(struct vm_area_list *vms);
>  extern int parse_pid_status(pid_t pid, struct proc_status_creds *);
> diff --git a/proc_parse.c b/proc_parse.c
> index f9f1a88..389cb72 100644
> --- a/proc_parse.c
> +++ b/proc_parse.c
> @@ -555,54 +555,6 @@ err_bogus_mapfile:
>  	goto err;
>  }
>  
> -int parse_pid_stat_small(pid_t pid, struct proc_pid_stat_small *s)
> -{
> -	char *tok, *p;
> -	int fd;
> -	int n;
> -
> -	fd = open_proc(pid, "stat");
> -	if (fd < 0)
> -		return -1;
> -
> -	n = read(fd, buf, BUF_SIZE);
> -	if (n < 1) {
> -		pr_err("stat for %d is corrupted\n", pid);
> -		close(fd);
> -		return -1;
> -	}
> -	close(fd);
> -
> -	memset(s, 0, sizeof(*s));
> -
> -	tok = strchr(buf, ' ');
> -	if (!tok)
> -		goto err;
> -	*tok++ = '\0';
> -	if (*tok != '(')
> -		goto err;
> -
> -	s->pid = atoi(buf);
> -
> -	p = strrchr(tok + 1, ')');
> -	if (!p)
> -		goto err;
> -	*tok = '\0';
> -	*p = '\0';
> -
> -	strncpy(s->comm, tok + 1, sizeof(s->comm));
> -
> -	n = sscanf(p + 1, " %c %d %d %d", &s->state, &s->ppid, &s->pgid, &s->sid);
> -	if (n < 4)
> -		goto err;
> -
> -	return 0;
> -
> -err:
> -	pr_err("Parsing %d's stat failed (#fields do not match)\n", pid);
> -	return -1;
> -}
> -
>  int parse_pid_stat(pid_t pid, struct proc_pid_stat *s)
>  {
>  	char *tok, *p;
> 



More information about the CRIU mailing list