mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-31 06:15:24 +00:00
eventpoll: parse_fdinfo_pid_s() returns allocated object for eventpol tfd
We are going to collect all objects in a list and write them into the eventpoll image. The eventpoll tfd image will be depricated. Signed-off-by: Andrey Vagin <avagin@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
committed by
Pavel Emelyanov
parent
78a54bd87c
commit
33c75d0df9
@@ -299,7 +299,8 @@ static int check_fdinfo_signalfd(void)
|
||||
|
||||
static int check_one_epoll(union fdinfo_entries *e, void *arg)
|
||||
{
|
||||
*(int *)arg = e->epl.tfd;
|
||||
*(int *)arg = e->epl.e.tfd;
|
||||
free_event_poll_entry(e);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@@ -59,12 +59,16 @@ static void pr_info_eventpoll(char *action, EventpollFileEntry *e)
|
||||
|
||||
static int dump_eventpoll_entry(union fdinfo_entries *e, void *arg)
|
||||
{
|
||||
EventpollTfdEntry *efd = &e->epl;
|
||||
EventpollTfdEntry *efd = &e->epl.e;
|
||||
int ret;
|
||||
|
||||
efd->id = *(u32 *)arg;
|
||||
pr_info_eventpoll_tfd("Dumping: ", efd);
|
||||
return pb_write_one(fdset_fd(glob_fdset, CR_FD_EVENTPOLL_TFD),
|
||||
ret = pb_write_one(fdset_fd(glob_fdset, CR_FD_EVENTPOLL_TFD),
|
||||
efd, PB_EVENTPOLL_TFD);
|
||||
|
||||
free_event_poll_entry(e);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int dump_one_eventpoll(int lfd, u32 id, const struct fd_parms *p)
|
||||
|
@@ -182,17 +182,23 @@ struct fanotify_mark_entry {
|
||||
};
|
||||
};
|
||||
|
||||
struct eventpoll_tfd_entry {
|
||||
EventpollTfdEntry e;
|
||||
struct list_head node;
|
||||
};
|
||||
|
||||
union fdinfo_entries {
|
||||
EventfdFileEntry efd;
|
||||
EventpollTfdEntry epl;
|
||||
SignalfdEntry sfd;
|
||||
struct inotify_wd_entry ify;
|
||||
struct fanotify_mark_entry ffy;
|
||||
struct eventpoll_tfd_entry epl;
|
||||
TimerfdEntry tfy;
|
||||
};
|
||||
|
||||
extern void free_inotify_wd_entry(union fdinfo_entries *e);
|
||||
extern void free_fanotify_mark_entry(union fdinfo_entries *e);
|
||||
extern void free_event_poll_entry(union fdinfo_entries *e);
|
||||
|
||||
struct fdinfo_common {
|
||||
off64_t pos;
|
||||
|
22
proc_parse.c
22
proc_parse.c
@@ -1051,6 +1051,11 @@ void free_fanotify_mark_entry(union fdinfo_entries *e)
|
||||
xfree(e);
|
||||
}
|
||||
|
||||
void free_event_poll_entry(union fdinfo_entries *e)
|
||||
{
|
||||
xfree(e);
|
||||
}
|
||||
|
||||
static void parse_fhandle_encoded(char *tok, FhEntry *fh)
|
||||
{
|
||||
char *d = (char *)fh->handle;
|
||||
@@ -1195,15 +1200,24 @@ static int parse_fdinfo_pid_s(char *pid, int fd, int type,
|
||||
continue;
|
||||
}
|
||||
if (fdinfo_field(str, "tfd")) {
|
||||
eventpoll_tfd_entry__init(&entry.epl);
|
||||
union fdinfo_entries *e;
|
||||
|
||||
if (type != FD_TYPES__EVENTPOLL)
|
||||
goto parse_err;
|
||||
|
||||
e = xmalloc(sizeof(union fdinfo_entries));
|
||||
if (!e)
|
||||
goto out;
|
||||
|
||||
eventpoll_tfd_entry__init(&e->epl.e);
|
||||
|
||||
ret = sscanf(str, "tfd: %d events: %x data: %"PRIx64,
|
||||
&entry.epl.tfd, &entry.epl.events, &entry.epl.data);
|
||||
if (ret != 3)
|
||||
&e->epl.e.tfd, &e->epl.e.events, &e->epl.e.data);
|
||||
if (ret != 3) {
|
||||
free_event_poll_entry(e);
|
||||
goto parse_err;
|
||||
ret = cb(&entry, arg);
|
||||
}
|
||||
ret = cb(e, arg);
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
|
Reference in New Issue
Block a user