[CRIU] [PATCH 01/12] posix-timer: Add time_valid() function
Pavel Emelyanov
xemul at parallels.com
Thu May 30 06:44:03 EDT 2013
On 05/30/2013 03:36 AM, Pavel Tikhomirov wrote:
> 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){
1. Coding style (brace should be on next line).
2. Function should look similar to the below timerval_valie, i.e.
static inline int timespec_valid(struct timespec *ts)
{
return (ts->tv_sec >= 0) && (tv->tv_nsec < NSEC_PER_SEC);
}
with NSEC_PER_SEC declared next to USEC_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);
>
More information about the CRIU
mailing list