[CRIU] [PATCH 01/12] posix-timer: Add time_valid() function

Pavel Tikhomirov snorcht at gmail.com
Wed May 29 19:36:10 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 70c5e68..9dfaf1f 100644
--- a/cr-restore.c
+++ b/cr-restore.c
@@ -1378,6 +1378,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