Index | Thread | Search

From:
Philip Guenther <guenther@gmail.com>
Subject:
Re: pthread_cond_timedwait(3): negative absolute timeouts are not EINVAL
To:
Scott Cheloha <scottcheloha@gmail.com>
Cc:
tech@openbsd.org
Date:
Sun, 7 Jan 2024 20:26:22 -0800

Download raw body.

Thread
Yeah sure.  ok guenther

On Sun, Jan 7, 2024 at 5:00 PM Scott Cheloha <scottcheloha@gmail.com> wrote:

> All values of tv_sec are valid for absolute timeouts.
>
> ok?
>
> Index: rthread_cond.c
> ===================================================================
> RCS file: /cvs/src/lib/libc/thread/rthread_cond.c,v
> diff -u -p -r1.5 rthread_cond.c
> --- rthread_cond.c      29 Jan 2019 17:40:26 -0000      1.5
> +++ rthread_cond.c      8 Jan 2024 00:55:09 -0000
> @@ -142,8 +142,7 @@ pthread_cond_timedwait(pthread_cond_t *c
>         }
>
>         cond = *condp;
> -       if (abs == NULL || abs->tv_sec < 0 || abs->tv_nsec < 0 ||
> -           abs->tv_nsec >= 1000000000)
> +       if (abs == NULL || abs->tv_nsec < 0 || abs->tv_nsec >= 1000000000)
>                 return (EINVAL);
>
>         return (_rthread_cond_timedwait(cond, mutexp, abs));
> Index: rthread_sync.c
> ===================================================================
> RCS file: /cvs/src/lib/libc/thread/rthread_sync.c,v
> diff -u -p -r1.5 rthread_sync.c
> --- rthread_sync.c      24 Apr 2018 16:28:42 -0000      1.5
> +++ rthread_sync.c      8 Jan 2024 00:55:09 -0000
> @@ -317,7 +317,7 @@ pthread_cond_timedwait(pthread_cond_t *c
>                         abort();
>         }
>
> -       if (abstime == NULL || abstime->tv_sec < 0 || abstime->tv_nsec < 0
> ||
> +       if (abstime == NULL || abstime->tv_nsec < 0 ||
>             abstime->tv_nsec >= 1000000000)
>                 return (EINVAL);
>
>
>