[CRIU] [PATCH 1/4] posix-timer: Add time_valid() function
Pavel Tikhomirov
snorcht at gmail.com
Sun May 19 18:24:24 EDT 2013
This renames and changes function to check if time represented by two
numbers is valid. I.e. for timespec(sec, nsec), sec and nsec must be
> 0 and nsec must be less when NSEC_PER_SEC
Signed-off-by: Pavel Tikhomirov <snorcht at gmail.com>
---
cr-restore.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/cr-restore.c b/cr-restore.c
index c76eed8..9afd2ae 100644
--- a/cr-restore.c
+++ b/cr-restore.c
@@ -1370,6 +1370,10 @@ static long restorer_get_vma_hint(pid_t pid, struct list_head *tgt_vma_list,
return -1;
}
+static inline int time_valid(unsigned long sec, unsigned long xsec, unsigned long xsec_per_sec){
+ return (sec >= 0) && (xsec < xsec_per_sec);
+}
+
static inline int timeval_valid(struct timeval *tv)
{
return (tv->tv_sec >= 0) && ((unsigned long)tv->tv_usec < USEC_PER_SEC);
--
1.7.9.5
More information about the CRIU
mailing list