Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/checkpoint-restore/criu.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Tkhai <ktkhai@virtuozzo.com>2017-05-03 15:48:25 +0300
committerAndrei Vagin <avagin@virtuozzo.com>2017-05-10 04:26:56 +0300
commit08ca20e29e30a776d7c6f627e8d1f85f40fb8adb (patch)
tree840d098fa75264108cd4840dc2f133ee5de58b7f /compel/src
parent0469a46a55e4c311e5c11db2a2cef68a72e619c2 (diff)
compel: Add more arguments to compel_wait_task()
Some get_status() methods may allocate data, because not all of the fields in /proc/[pid]/status file have the fixed size. For example, NSpid, which size may vary. Introduce new method free_status() in counterweight for such type get_status() methods. it will be called in case of we go to try_again and need to free allocated data. Also, introduce data parameter for a use in the future. Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Diffstat (limited to 'compel/src')
-rw-r--r--compel/src/lib/infect.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/compel/src/lib/infect.c b/compel/src/lib/infect.c
index 7f6d2f3f1..07200a7a6 100644
--- a/compel/src/lib/infect.c
+++ b/compel/src/lib/infect.c
@@ -52,7 +52,7 @@ static inline void close_safe(int *pfd)
}
}
-static int parse_pid_status(int pid, struct seize_task_status *ss)
+static int parse_pid_status(int pid, struct seize_task_status *ss, void *data)
{
char aux[128];
FILE *f;
@@ -107,7 +107,7 @@ int compel_stop_task(int pid)
ret = compel_interrupt_task(pid);
if (ret == 0)
- ret = compel_wait_task(pid, -1, parse_pid_status, &ss);
+ ret = compel_wait_task(pid, -1, parse_pid_status, NULL, &ss, NULL);
return ret;
}
@@ -192,8 +192,9 @@ static int skip_sigstop(int pid, int nr_signals)
* up with someone else.
*/
int compel_wait_task(int pid, int ppid,
- int (*get_status)(int pid, struct seize_task_status *),
- struct seize_task_status *ss)
+ int (*get_status)(int pid, struct seize_task_status *, void *),
+ void (*free_status)(int pid, struct seize_task_status *, void *),
+ struct seize_task_status *ss, void *data)
{
siginfo_t si;
int status, nr_sigstop;
@@ -220,7 +221,7 @@ try_again:
wait_errno = errno;
}
- ret2 = get_status(pid, ss);
+ ret2 = get_status(pid, ss, data);
if (ret2)
goto err;
@@ -271,6 +272,8 @@ try_again:
}
ret = 0;
+ if (free_status)
+ free_status(pid, ss, data);
goto try_again;
}