Commit 7158448d authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

timerfd: Implement check routine

Reported-by: Jenkins
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent ec351510
......@@ -27,6 +27,7 @@
#include "tty.h"
#include "ptrace.h"
#include "kerndat.h"
#include "timerfd.h"
#include "tun.h"
#include "namespaces.h"
#include "pstree.h"
......@@ -596,6 +597,7 @@ int cr_check(void)
ret |= check_mem_dirty_track();
ret |= check_posix_timers();
ret |= check_tun();
ret |= check_timerfd();
ret |= check_mnt_id();
if (!ret)
......
......@@ -26,6 +26,7 @@ static inline unsigned long rst_timerfd_len(void)
return sizeof(*rst_timerfd) * rst_timerfd_nr;
}
extern int check_timerfd(void);
extern int is_timerfd_link(char *link);
#ifndef TFD_TIMER_ABSTIME
......
......@@ -10,6 +10,7 @@
#include "proc_parse.h"
#include "rst-malloc.h"
#include "cr_options.h"
#include "restorer.h"
#include "timerfd.h"
#include "pstree.h"
......@@ -35,6 +36,33 @@ struct timerfd_info {
struct restore_timerfd *rst_timerfd;
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)
{
return is_anon_link_type(link, "[timerfd]");
......
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