2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 14:25:49 +00:00

Revert "parse: add a helper to obtain an uptime"

This reverts commit cf2f035d9f.

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
This commit is contained in:
Pavel Tikhomirov
2018-04-06 10:31:26 +03:00
committed by Andrei Vagin
parent ae6de318e5
commit 9b0003676a
2 changed files with 0 additions and 25 deletions

View File

@@ -108,6 +108,5 @@ int parse_children(pid_t pid, pid_t **_c, int *_n);
extern bool is_vma_range_fmt(char *line);
extern void parse_vmflags(char *buf, u32 *flags, u64 *madv, int *io_pf);
extern int parse_uptime(struct timeval *_tv);
#endif /* __CR_PROC_PARSE_H__ */

View File

@@ -2712,27 +2712,3 @@ err:
xfree(ch);
return -1;
}
__maybe_unused int parse_uptime(struct timeval *_tv)
{
unsigned long sec, csec;
FILE *f;
f = fopen("/proc/uptime", "r");
if (!f) {
pr_perror("Failed to fopen /proc/uptime");
return -1;
}
if (fscanf(f, "%lu.%2lu", &sec, &csec) != 2) {
pr_perror("Failed to parse /proc/uptime");
fclose(f);
return -1;
}
_tv->tv_sec = sec;
_tv->tv_usec = csec * (USEC_PER_SEC / 100);
fclose(f);
return 0;
}