2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-30 22:05:36 +00:00

proc_parse: parse fdinfo to get pos and flags

We are going to parse fdinfo for getting mnt_id,
so we can take there pos and flags and don't call
fcntl and lseek for that.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Andrey Vagin
2014-04-09 03:34:53 +04:00
committed by Pavel Emelyanov
parent d36e07aabe
commit 8bcffef6b9
3 changed files with 33 additions and 8 deletions

View File

@@ -1020,7 +1020,27 @@ static int parse_fdinfo_pid_s(char *pid, int fd, int type,
while (fgets(str, sizeof(str), f)) {
union fdinfo_entries entry;
if (fdinfo_field(str, "pos") || fdinfo_field(str, "counter"))
if (fdinfo_field(str, "pos") ||
fdinfo_field(str, "flags")) {
unsigned long long val;
struct fdinfo_common *fdinfo = arg;
if (type != FD_TYPES__UND)
continue;
ret = sscanf(str, "%*s %lli", &val);
if (ret != 1)
goto parse_err;
if (fdinfo_field(str, "pos"))
fdinfo->pos = val;
else if (fdinfo_field(str, "flags"))
fdinfo->flags = val;
entry_met = true;
continue;
}
if (type == FD_TYPES__UND)
continue;
if (fdinfo_field(str, "eventfd-count")) {