[1/2] futex: Remove not used futex_reltimed_wait{_cancelable}

Message ID 20201201121727.25155-1-lukma@denx.de
State Committed
Commit 4ec2e738032b5671b9a6e0987d7c7305a1c41f68
Headers
Series [1/2] futex: Remove not used futex_reltimed_wait{_cancelable} |

Commit Message

Lukasz Majewski Dec. 1, 2020, 12:17 p.m. UTC
  After gai_suspend and aio_suspend conversion to support 64 bit time and
hence rewriting the code to use only absolute variants of futex wait
functions (i.e. __futex_abstimed_wait64 and __futex_abstimed_wait_cancelable64)
futex_reltimed_wait{_cancelable} are not needed anymore and can be removed.

Build tests:
./src/scripts/build-many-glibcs.py glibcs
---
 sysdeps/nptl/futex-internal.h | 61 -----------------------------------
 1 file changed, 61 deletions(-)
  

Comments

Adhemerval Zanella Dec. 1, 2020, 12:52 p.m. UTC | #1
On 01/12/2020 09:17, Lukasz Majewski wrote:
> After gai_suspend and aio_suspend conversion to support 64 bit time and
> hence rewriting the code to use only absolute variants of futex wait
> functions (i.e. __futex_abstimed_wait64 and __futex_abstimed_wait_cancelable64)
> futex_reltimed_wait{_cancelable} are not needed anymore and can be removed.
> 
> Build tests:
> ./src/scripts/build-many-glibcs.py glibcs

LGTM, thanks.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

> ---
>  sysdeps/nptl/futex-internal.h | 61 -----------------------------------
>  1 file changed, 61 deletions(-)
> 
> diff --git a/sysdeps/nptl/futex-internal.h b/sysdeps/nptl/futex-internal.h
> index 1640da0ce8..31c5fad7d6 100644
> --- a/sysdeps/nptl/futex-internal.h
> +++ b/sysdeps/nptl/futex-internal.h
> @@ -177,67 +177,6 @@ futex_wait_simple (unsigned int *futex_word, unsigned int expected,
>    ignore_value (futex_wait (futex_word, expected, private));
>  }
>  
> -/* Like futex_wait, but will eventually time out (i.e., stop being
> -   blocked) after the duration of time provided (i.e., RELTIME) has
> -   passed.  The caller must provide a normalized RELTIME.  RELTIME can also
> -   equal NULL, in which case this function behaves equivalent to futex_wait.
> -
> -   Returns the same values as futex_wait under those same conditions;
> -   additionally, returns ETIMEDOUT if the timeout expired.
> -   */
> -static __always_inline int
> -futex_reltimed_wait (unsigned int* futex_word, unsigned int expected,
> -		     const struct timespec* reltime, int private)
> -{
> -  int err = lll_futex_timed_wait (futex_word, expected, reltime, private);
> -  switch (err)
> -    {
> -    case 0:
> -    case -EAGAIN:
> -    case -EINTR:
> -    case -ETIMEDOUT:
> -      return -err;
> -
> -    case -EFAULT: /* Must have been caused by a glibc or application bug.  */
> -    case -EINVAL: /* Either due to wrong alignment or due to the timeout not
> -		     being normalized.  Must have been caused by a glibc or
> -		     application bug.  */
> -    case -ENOSYS: /* Must have been caused by a glibc bug.  */
> -    /* No other errors are documented at this time.  */
> -    default:
> -      futex_fatal_error ();
> -    }
> -}
> -
> -/* Like futex_reltimed_wait but is a POSIX cancellation point.  */
> -static __always_inline int
> -futex_reltimed_wait_cancelable (unsigned int* futex_word,
> -				unsigned int expected,
> -			        const struct timespec* reltime, int private)
> -{
> -  int oldtype;
> -  oldtype = LIBC_CANCEL_ASYNC ();
> -  int err = lll_futex_timed_wait (futex_word, expected, reltime, private);
> -  LIBC_CANCEL_RESET (oldtype);
> -  switch (err)
> -    {
> -    case 0:
> -    case -EAGAIN:
> -    case -EINTR:
> -    case -ETIMEDOUT:
> -      return -err;
> -
> -    case -EFAULT: /* Must have been caused by a glibc or application bug.  */
> -    case -EINVAL: /* Either due to wrong alignment or due to the timeout not
> -		     being normalized.  Must have been caused by a glibc or
> -		     application bug.  */
> -    case -ENOSYS: /* Must have been caused by a glibc bug.  */
> -    /* No other errors are documented at this time.  */
> -    default:
> -      futex_fatal_error ();
> -    }
> -}
> -
>  /* Check whether the specified clockid is supported by
>     futex_abstimed_wait and futex_abstimed_wait_cancelable.  */
>  static __always_inline int
>
  
Alistair Francis Dec. 1, 2020, 4:39 p.m. UTC | #2
On Tue, Dec 1, 2020 at 4:18 AM Lukasz Majewski <lukma@denx.de> wrote:
>
> After gai_suspend and aio_suspend conversion to support 64 bit time and
> hence rewriting the code to use only absolute variants of futex wait
> functions (i.e. __futex_abstimed_wait64 and __futex_abstimed_wait_cancelable64)
> futex_reltimed_wait{_cancelable} are not needed anymore and can be removed.
>
> Build tests:
> ./src/scripts/build-many-glibcs.py glibcs

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

> ---
>  sysdeps/nptl/futex-internal.h | 61 -----------------------------------
>  1 file changed, 61 deletions(-)
>
> diff --git a/sysdeps/nptl/futex-internal.h b/sysdeps/nptl/futex-internal.h
> index 1640da0ce8..31c5fad7d6 100644
> --- a/sysdeps/nptl/futex-internal.h
> +++ b/sysdeps/nptl/futex-internal.h
> @@ -177,67 +177,6 @@ futex_wait_simple (unsigned int *futex_word, unsigned int expected,
>    ignore_value (futex_wait (futex_word, expected, private));
>  }
>
> -/* Like futex_wait, but will eventually time out (i.e., stop being
> -   blocked) after the duration of time provided (i.e., RELTIME) has
> -   passed.  The caller must provide a normalized RELTIME.  RELTIME can also
> -   equal NULL, in which case this function behaves equivalent to futex_wait.
> -
> -   Returns the same values as futex_wait under those same conditions;
> -   additionally, returns ETIMEDOUT if the timeout expired.
> -   */
> -static __always_inline int
> -futex_reltimed_wait (unsigned int* futex_word, unsigned int expected,
> -                    const struct timespec* reltime, int private)
> -{
> -  int err = lll_futex_timed_wait (futex_word, expected, reltime, private);
> -  switch (err)
> -    {
> -    case 0:
> -    case -EAGAIN:
> -    case -EINTR:
> -    case -ETIMEDOUT:
> -      return -err;
> -
> -    case -EFAULT: /* Must have been caused by a glibc or application bug.  */
> -    case -EINVAL: /* Either due to wrong alignment or due to the timeout not
> -                    being normalized.  Must have been caused by a glibc or
> -                    application bug.  */
> -    case -ENOSYS: /* Must have been caused by a glibc bug.  */
> -    /* No other errors are documented at this time.  */
> -    default:
> -      futex_fatal_error ();
> -    }
> -}
> -
> -/* Like futex_reltimed_wait but is a POSIX cancellation point.  */
> -static __always_inline int
> -futex_reltimed_wait_cancelable (unsigned int* futex_word,
> -                               unsigned int expected,
> -                               const struct timespec* reltime, int private)
> -{
> -  int oldtype;
> -  oldtype = LIBC_CANCEL_ASYNC ();
> -  int err = lll_futex_timed_wait (futex_word, expected, reltime, private);
> -  LIBC_CANCEL_RESET (oldtype);
> -  switch (err)
> -    {
> -    case 0:
> -    case -EAGAIN:
> -    case -EINTR:
> -    case -ETIMEDOUT:
> -      return -err;
> -
> -    case -EFAULT: /* Must have been caused by a glibc or application bug.  */
> -    case -EINVAL: /* Either due to wrong alignment or due to the timeout not
> -                    being normalized.  Must have been caused by a glibc or
> -                    application bug.  */
> -    case -ENOSYS: /* Must have been caused by a glibc bug.  */
> -    /* No other errors are documented at this time.  */
> -    default:
> -      futex_fatal_error ();
> -    }
> -}
> -
>  /* Check whether the specified clockid is supported by
>     futex_abstimed_wait and futex_abstimed_wait_cancelable.  */
>  static __always_inline int
> --
> 2.20.1
>
  

Patch

diff --git a/sysdeps/nptl/futex-internal.h b/sysdeps/nptl/futex-internal.h
index 1640da0ce8..31c5fad7d6 100644
--- a/sysdeps/nptl/futex-internal.h
+++ b/sysdeps/nptl/futex-internal.h
@@ -177,67 +177,6 @@  futex_wait_simple (unsigned int *futex_word, unsigned int expected,
   ignore_value (futex_wait (futex_word, expected, private));
 }
 
-/* Like futex_wait, but will eventually time out (i.e., stop being
-   blocked) after the duration of time provided (i.e., RELTIME) has
-   passed.  The caller must provide a normalized RELTIME.  RELTIME can also
-   equal NULL, in which case this function behaves equivalent to futex_wait.
-
-   Returns the same values as futex_wait under those same conditions;
-   additionally, returns ETIMEDOUT if the timeout expired.
-   */
-static __always_inline int
-futex_reltimed_wait (unsigned int* futex_word, unsigned int expected,
-		     const struct timespec* reltime, int private)
-{
-  int err = lll_futex_timed_wait (futex_word, expected, reltime, private);
-  switch (err)
-    {
-    case 0:
-    case -EAGAIN:
-    case -EINTR:
-    case -ETIMEDOUT:
-      return -err;
-
-    case -EFAULT: /* Must have been caused by a glibc or application bug.  */
-    case -EINVAL: /* Either due to wrong alignment or due to the timeout not
-		     being normalized.  Must have been caused by a glibc or
-		     application bug.  */
-    case -ENOSYS: /* Must have been caused by a glibc bug.  */
-    /* No other errors are documented at this time.  */
-    default:
-      futex_fatal_error ();
-    }
-}
-
-/* Like futex_reltimed_wait but is a POSIX cancellation point.  */
-static __always_inline int
-futex_reltimed_wait_cancelable (unsigned int* futex_word,
-				unsigned int expected,
-			        const struct timespec* reltime, int private)
-{
-  int oldtype;
-  oldtype = LIBC_CANCEL_ASYNC ();
-  int err = lll_futex_timed_wait (futex_word, expected, reltime, private);
-  LIBC_CANCEL_RESET (oldtype);
-  switch (err)
-    {
-    case 0:
-    case -EAGAIN:
-    case -EINTR:
-    case -ETIMEDOUT:
-      return -err;
-
-    case -EFAULT: /* Must have been caused by a glibc or application bug.  */
-    case -EINVAL: /* Either due to wrong alignment or due to the timeout not
-		     being normalized.  Must have been caused by a glibc or
-		     application bug.  */
-    case -ENOSYS: /* Must have been caused by a glibc bug.  */
-    /* No other errors are documented at this time.  */
-    default:
-      futex_fatal_error ();
-    }
-}
-
 /* Check whether the specified clockid is supported by
    futex_abstimed_wait and futex_abstimed_wait_cancelable.  */
 static __always_inline int