[CRIU] [PATCH 08/17] proc: delete parse_pid_stat_small() (v2)
Andrey Vagin
avagin at openvz.org
Fri Nov 7 00:32:45 PST 2014
It's unused now.
v2: remove the proc_pid_stat_small struct too.
Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
include/proc_parse.h | 10 ----------
proc_parse.c | 48 ------------------------------------------------
2 files changed, 58 deletions(-)
diff --git a/include/proc_parse.h b/include/proc_parse.h
index a0424bb..a75efe9 100644
--- a/include/proc_parse.h
+++ b/include/proc_parse.h
@@ -16,15 +16,6 @@
#define PROC_TASK_COMM_LEN 32
#define PROC_TASK_COMM_LEN_FMT "(%31s"
-struct proc_pid_stat_small {
- int pid;
- char comm[PROC_TASK_COMM_LEN];
- char state;
- int ppid;
- int pgid;
- int sid;
-};
-
struct proc_pid_stat {
int pid;
char comm[PROC_TASK_COMM_LEN];
@@ -164,7 +155,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);
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 8de6050..ad868b5 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;
--
1.9.3
More information about the CRIU
mailing list