Commit 9508e39e authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

crtools: use pit_t for PIDs

Here is a bit mess, because we used unsigned int instead of pid_t.
A negative value is used for uninitialized PID's variables.
Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 7a65c701
...@@ -954,11 +954,11 @@ static int check_threads(const struct pstree_item *item) ...@@ -954,11 +954,11 @@ static int check_threads(const struct pstree_item *item)
return 0; return 0;
} }
static int parse_children(int pid, u32 **_c, int *_n) static int parse_children(pid_t pid, pid_t **_c, int *_n)
{ {
FILE *file; FILE *file;
char *tok; char *tok;
u32 *ch = NULL; pid_t *ch = NULL;
int nr = 1; int nr = 1;
DIR *dir; DIR *dir;
struct dirent *de; struct dirent *de;
...@@ -984,7 +984,7 @@ static int parse_children(int pid, u32 **_c, int *_n) ...@@ -984,7 +984,7 @@ static int parse_children(int pid, u32 **_c, int *_n)
tok = strtok(loc_buf, " \n"); tok = strtok(loc_buf, " \n");
while (tok) { while (tok) {
u32 *tmp = xrealloc(ch, nr * sizeof(u32)); pid_t *tmp = xrealloc(ch, nr * sizeof(pid_t));
if (!tmp) if (!tmp)
goto err; goto err;
ch = tmp; ch = tmp;
...@@ -1008,7 +1008,7 @@ err: ...@@ -1008,7 +1008,7 @@ err:
static int get_children(struct pstree_item *item) static int get_children(struct pstree_item *item)
{ {
u32 *ch; pid_t *ch;
int ret, i, nr_children; int ret, i, nr_children;
struct pstree_item *c; struct pstree_item *c;
...@@ -1150,7 +1150,7 @@ err: ...@@ -1150,7 +1150,7 @@ err:
static int check_subtree(const struct pstree_item *item) static int check_subtree(const struct pstree_item *item)
{ {
u32 *ch; pid_t *ch;
int nr, ret, i; int nr, ret, i;
struct pstree_item *child; struct pstree_item *child;
......
...@@ -203,8 +203,8 @@ struct rst_info { ...@@ -203,8 +203,8 @@ struct rst_info {
struct pid struct pid
{ {
u32 real; /* used to peek/poke tasks during dump stage */ pid_t real; /* used to peek/poke tasks during dump stage */
u32 virt; /* used all over in the images and saved after restore */ pid_t virt; /* used all over in the images and saved after restore */
}; };
static inline int in_vma_area(struct vma_area *vma, unsigned long addr) static inline int in_vma_area(struct vma_area *vma, unsigned long addr)
......
...@@ -35,7 +35,7 @@ extern int parasite_dump_pages_seized(struct parasite_ctl *ctl, ...@@ -35,7 +35,7 @@ extern int parasite_dump_pages_seized(struct parasite_ctl *ctl,
struct cr_fdset *cr_fdset); struct cr_fdset *cr_fdset);
struct parasite_dump_tid_info; struct parasite_dump_tid_info;
extern int parasite_dump_thread_seized(struct parasite_ctl *ctl, pid_t pid, extern int parasite_dump_thread_seized(struct parasite_ctl *ctl, pid_t pid,
unsigned int **tid_add, u32 *tid); unsigned int **tid_add, pid_t *tid);
struct parasite_drain_fd; struct parasite_drain_fd;
struct fd_opts; struct fd_opts;
......
...@@ -435,7 +435,7 @@ err: ...@@ -435,7 +435,7 @@ err:
} }
int parasite_dump_thread_seized(struct parasite_ctl *ctl, pid_t pid, int parasite_dump_thread_seized(struct parasite_ctl *ctl, pid_t pid,
unsigned int **tid_addr, u32 *tid) unsigned int **tid_addr, pid_t *tid)
{ {
struct parasite_dump_tid_info args = { }; struct parasite_dump_tid_info args = { };
int ret; int ret;
......
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