mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-22 01:51:51 +00:00
criu: dump and restore notify_thread_id of posix timer
When sigev_notify_thread_id is not set, get_pid will return a NULL pointer and do_timer_create will return -EINVAL in kernel. So criu will failed to create posix timer: (09.806760) pie: 41301: Error (criu/pie/restorer.c:1998): Can't restore posix timers -22 (09.806824) pie: 41301: Error (criu/pie/restorer.c:2133): Restorer fail 41301 (09.891880) Error (criu/cr-restore.c:2596): Restoring FAILED. Signed-off-by: Liu Chao <liuchao173@huawei.com>
This commit is contained in:
parent
6be9345fb1
commit
80079fbb0d
@ -2798,6 +2798,7 @@ static inline int decode_posix_timer(PosixTimerEntry *pte,
|
||||
pt->spt.si_signo = pte->si_signo;
|
||||
pt->spt.it_sigev_notify = pte->it_sigev_notify;
|
||||
pt->spt.sival_ptr = decode_pointer(pte->sival_ptr);
|
||||
pt->spt.notify_thread_id = pte->notify_thread_id;
|
||||
pt->overrun = pte->overrun;
|
||||
|
||||
return 0;
|
||||
|
@ -8,6 +8,7 @@ struct str_posix_timer {
|
||||
int clock_id;
|
||||
int si_signo;
|
||||
int it_sigev_notify;
|
||||
int notify_thread_id;
|
||||
void * sival_ptr;
|
||||
};
|
||||
|
||||
|
@ -325,6 +325,7 @@ static void encode_posix_timer(struct posix_timer *v,
|
||||
pte->clock_id = vp->spt.clock_id;
|
||||
pte->si_signo = vp->spt.si_signo;
|
||||
pte->it_sigev_notify = vp->spt.it_sigev_notify;
|
||||
pte->notify_thread_id = vp->spt.notify_thread_id;
|
||||
pte->sival_ptr = encode_pointer(vp->spt.sival_ptr);
|
||||
|
||||
pte->overrun = v->overrun;
|
||||
|
@ -1069,6 +1069,11 @@ static int create_posix_timers(struct task_restore_args *args)
|
||||
for (i = 0; i < args->posix_timers_n; i++) {
|
||||
sev.sigev_notify = args->posix_timers[i].spt.it_sigev_notify;
|
||||
sev.sigev_signo = args->posix_timers[i].spt.si_signo;
|
||||
#ifdef __GLIBC__
|
||||
sev._sigev_un._tid = args->posix_timers[i].spt.notify_thread_id;
|
||||
#else
|
||||
sev.sigev_notify_thread_id = args->posix_timers[i].spt.notify_thread_id;
|
||||
#endif
|
||||
sev.sigev_value.sival_ptr = args->posix_timers[i].spt.sival_ptr;
|
||||
|
||||
while (1) {
|
||||
|
@ -2342,6 +2342,7 @@ int parse_posix_timers(pid_t pid, struct proc_posix_timers_stat *args)
|
||||
|
||||
if ( tidpid[0] == 't') {
|
||||
timer->spt.it_sigev_notify = SIGEV_THREAD_ID;
|
||||
timer->spt.notify_thread_id = pid_t;
|
||||
} else {
|
||||
switch (sigpid[0]) {
|
||||
case 's' :
|
||||
|
@ -21,6 +21,7 @@ message posix_timer_entry {
|
||||
required uint64 insec = 8;
|
||||
required uint64 vsec = 9;
|
||||
required uint64 vnsec = 10;
|
||||
optional int32 notify_thread_id= 11;
|
||||
}
|
||||
|
||||
message task_timers_entry {
|
||||
|
Loading…
x
Reference in New Issue
Block a user