mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-22 09:58:09 +00:00
timerfd: Implement check routine
Reported-by: Jenkins Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
ec3515107c
commit
7158448dd6
@ -27,6 +27,7 @@
|
|||||||
#include "tty.h"
|
#include "tty.h"
|
||||||
#include "ptrace.h"
|
#include "ptrace.h"
|
||||||
#include "kerndat.h"
|
#include "kerndat.h"
|
||||||
|
#include "timerfd.h"
|
||||||
#include "tun.h"
|
#include "tun.h"
|
||||||
#include "namespaces.h"
|
#include "namespaces.h"
|
||||||
#include "pstree.h"
|
#include "pstree.h"
|
||||||
@ -596,6 +597,7 @@ int cr_check(void)
|
|||||||
ret |= check_mem_dirty_track();
|
ret |= check_mem_dirty_track();
|
||||||
ret |= check_posix_timers();
|
ret |= check_posix_timers();
|
||||||
ret |= check_tun();
|
ret |= check_tun();
|
||||||
|
ret |= check_timerfd();
|
||||||
ret |= check_mnt_id();
|
ret |= check_mnt_id();
|
||||||
|
|
||||||
if (!ret)
|
if (!ret)
|
||||||
|
@ -26,6 +26,7 @@ static inline unsigned long rst_timerfd_len(void)
|
|||||||
return sizeof(*rst_timerfd) * rst_timerfd_nr;
|
return sizeof(*rst_timerfd) * rst_timerfd_nr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern int check_timerfd(void);
|
||||||
extern int is_timerfd_link(char *link);
|
extern int is_timerfd_link(char *link);
|
||||||
|
|
||||||
#ifndef TFD_TIMER_ABSTIME
|
#ifndef TFD_TIMER_ABSTIME
|
||||||
|
28
timerfd.c
28
timerfd.c
@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
#include "proc_parse.h"
|
#include "proc_parse.h"
|
||||||
#include "rst-malloc.h"
|
#include "rst-malloc.h"
|
||||||
|
#include "cr_options.h"
|
||||||
#include "restorer.h"
|
#include "restorer.h"
|
||||||
#include "timerfd.h"
|
#include "timerfd.h"
|
||||||
#include "pstree.h"
|
#include "pstree.h"
|
||||||
@ -35,6 +36,33 @@ struct timerfd_info {
|
|||||||
struct restore_timerfd *rst_timerfd;
|
struct restore_timerfd *rst_timerfd;
|
||||||
unsigned int rst_timerfd_nr;
|
unsigned int rst_timerfd_nr;
|
||||||
|
|
||||||
|
int check_timerfd(void)
|
||||||
|
{
|
||||||
|
int fd, ret = -1;
|
||||||
|
|
||||||
|
if (opts.check_ms_kernel) {
|
||||||
|
pr_warn("Skipping timerfd support check\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
fd = timerfd_create(CLOCK_MONOTONIC, 0);
|
||||||
|
if (fd < 0) {
|
||||||
|
pr_perror("timerfd_create failed");
|
||||||
|
return -1;
|
||||||
|
} else {
|
||||||
|
ret = ioctl(fd, TFD_IOC_SET_TICKS, NULL);
|
||||||
|
if (ret < 0) {
|
||||||
|
if (errno != EFAULT)
|
||||||
|
pr_perror("No timerfd support for c/r");
|
||||||
|
else
|
||||||
|
ret = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
close(fd);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
int is_timerfd_link(char *link)
|
int is_timerfd_link(char *link)
|
||||||
{
|
{
|
||||||
return is_anon_link_type(link, "[timerfd]");
|
return is_anon_link_type(link, "[timerfd]");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user