[v2,1/2] support: Add xpthread_cond_signal wrapper

Message ID 20220930121951.30671-1-peterlin@andestech.com (mailing list archive)
State Committed
Commit 3bea50ccbc925d4fc5f85ec402b6154cbe770b71
Headers
Series [v2,1/2] support: Add xpthread_cond_signal wrapper |

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent

Commit Message

Yu-Chien Peter Lin Sept. 30, 2022, 12:19 p.m. UTC
  Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
---
 support/Makefile               |  1 +
 support/xpthread_cond_signal.c | 26 ++++++++++++++++++++++++++
 support/xthread.h              |  1 +
 3 files changed, 28 insertions(+)
 create mode 100644 support/xpthread_cond_signal.c
  

Comments

Adhemerval Zanella Netto Sept. 30, 2022, 2:09 p.m. UTC | #1
LGTM, thanks.

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

On 30/09/22 09:19, Yu Chien Peter Lin wrote:
> Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
> ---
>  support/Makefile               |  1 +
>  support/xpthread_cond_signal.c | 26 ++++++++++++++++++++++++++
>  support/xthread.h              |  1 +
>  3 files changed, 28 insertions(+)
>  create mode 100644 support/xpthread_cond_signal.c
> 
> diff --git a/support/Makefile b/support/Makefile
> index 551d02941f..4046b12fbd 100644
> --- a/support/Makefile
> +++ b/support/Makefile
> @@ -159,6 +159,7 @@ libsupport-routines = \
>    xpthread_cancel \
>    xpthread_check_return \
>    xpthread_cond_wait \
> +  xpthread_cond_signal \
>    xpthread_create \
>    xpthread_detach \
>    xpthread_join \
> diff --git a/support/xpthread_cond_signal.c b/support/xpthread_cond_signal.c
> new file mode 100644
> index 0000000000..ed0be1a8ab
> --- /dev/null
> +++ b/support/xpthread_cond_signal.c
> @@ -0,0 +1,26 @@
> +/* pthread_cond_signal with error checking.
> +   Copyright (C) 2022 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library; if not, see
> +   <https://www.gnu.org/licenses/>.  */
> +
> +#include <support/xthread.h>
> +
> +void
> +xpthread_cond_signal (pthread_cond_t *cond)
> +{
> +  xpthread_check_return
> +    ("pthread_cond_signal", pthread_cond_signal (cond));
> +}
> diff --git a/support/xthread.h b/support/xthread.h
> index af06715f46..ae09649325 100644
> --- a/support/xthread.h
> +++ b/support/xthread.h
> @@ -62,6 +62,7 @@ void xpthread_mutex_consistent (pthread_mutex_t *);
>  void xpthread_spin_lock (pthread_spinlock_t *lock);
>  void xpthread_spin_unlock (pthread_spinlock_t *lock);
>  void xpthread_cond_wait (pthread_cond_t * cond, pthread_mutex_t * mutex);
> +void xpthread_cond_signal (pthread_cond_t *cond);
>  pthread_t xpthread_create (pthread_attr_t *attr,
>                             void *(*thread_func) (void *), void *closure);
>  void xpthread_detach (pthread_t thr);
  
Sunil Pandey Jan. 11, 2025, 10:41 p.m. UTC | #2
On Fri, Sep 30, 2022 at 7:09 AM Adhemerval Zanella Netto via Libc-alpha <
libc-alpha@sourceware.org> wrote:

> LGTM, thanks.
>
> Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
>
> On 30/09/22 09:19, Yu Chien Peter Lin wrote:
> > Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
> > ---
> >  support/Makefile               |  1 +
> >  support/xpthread_cond_signal.c | 26 ++++++++++++++++++++++++++
> >  support/xthread.h              |  1 +
> >  3 files changed, 28 insertions(+)
> >  create mode 100644 support/xpthread_cond_signal.c
> >
> > diff --git a/support/Makefile b/support/Makefile
> > index 551d02941f..4046b12fbd 100644
> > --- a/support/Makefile
> > +++ b/support/Makefile
> > @@ -159,6 +159,7 @@ libsupport-routines = \
> >    xpthread_cancel \
> >    xpthread_check_return \
> >    xpthread_cond_wait \
> > +  xpthread_cond_signal \
> >    xpthread_create \
> >    xpthread_detach \
> >    xpthread_join \
> > diff --git a/support/xpthread_cond_signal.c
> b/support/xpthread_cond_signal.c
> > new file mode 100644
> > index 0000000000..ed0be1a8ab
> > --- /dev/null
> > +++ b/support/xpthread_cond_signal.c
> > @@ -0,0 +1,26 @@
> > +/* pthread_cond_signal with error checking.
> > +   Copyright (C) 2022 Free Software Foundation, Inc.
> > +   This file is part of the GNU C Library.
> > +
> > +   The GNU C Library is free software; you can redistribute it and/or
> > +   modify it under the terms of the GNU Lesser General Public
> > +   License as published by the Free Software Foundation; either
> > +   version 2.1 of the License, or (at your option) any later version.
> > +
> > +   The GNU C Library is distributed in the hope that it will be useful,
> > +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> > +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> > +   Lesser General Public License for more details.
> > +
> > +   You should have received a copy of the GNU Lesser General Public
> > +   License along with the GNU C Library; if not, see
> > +   <https://www.gnu.org/licenses/>.  */
> > +
> > +#include <support/xthread.h>
> > +
> > +void
> > +xpthread_cond_signal (pthread_cond_t *cond)
> > +{
> > +  xpthread_check_return
> > +    ("pthread_cond_signal", pthread_cond_signal (cond));
> > +}
> > diff --git a/support/xthread.h b/support/xthread.h
> > index af06715f46..ae09649325 100644
> > --- a/support/xthread.h
> > +++ b/support/xthread.h
> > @@ -62,6 +62,7 @@ void xpthread_mutex_consistent (pthread_mutex_t *);
> >  void xpthread_spin_lock (pthread_spinlock_t *lock);
> >  void xpthread_spin_unlock (pthread_spinlock_t *lock);
> >  void xpthread_cond_wait (pthread_cond_t * cond, pthread_mutex_t *
> mutex);
> > +void xpthread_cond_signal (pthread_cond_t *cond);
> >  pthread_t xpthread_create (pthread_attr_t *attr,
> >                             void *(*thread_func) (void *), void
> *closure);
> >  void xpthread_detach (pthread_t thr);
>

I would like to backport this path to release branches. Without this patch
I get testing errors like this in 2.36 and earlier branches.

In file included from ../test-skeleton.c:45:0,
                 from tst-setuid2.c:145:
../support/check.h:29:0: error: "FAIL" redefined [-Werror]
 #define FAIL(...) \

tst-setuid2.c:33:0: note: this is the location of the previous definition
 #define FAIL(fmt, ...) \

cc1: all warnings being treated as errors

Any comments or objections?

--Sunil
  

Patch

diff --git a/support/Makefile b/support/Makefile
index 551d02941f..4046b12fbd 100644
--- a/support/Makefile
+++ b/support/Makefile
@@ -159,6 +159,7 @@  libsupport-routines = \
   xpthread_cancel \
   xpthread_check_return \
   xpthread_cond_wait \
+  xpthread_cond_signal \
   xpthread_create \
   xpthread_detach \
   xpthread_join \
diff --git a/support/xpthread_cond_signal.c b/support/xpthread_cond_signal.c
new file mode 100644
index 0000000000..ed0be1a8ab
--- /dev/null
+++ b/support/xpthread_cond_signal.c
@@ -0,0 +1,26 @@ 
+/* pthread_cond_signal with error checking.
+   Copyright (C) 2022 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <support/xthread.h>
+
+void
+xpthread_cond_signal (pthread_cond_t *cond)
+{
+  xpthread_check_return
+    ("pthread_cond_signal", pthread_cond_signal (cond));
+}
diff --git a/support/xthread.h b/support/xthread.h
index af06715f46..ae09649325 100644
--- a/support/xthread.h
+++ b/support/xthread.h
@@ -62,6 +62,7 @@  void xpthread_mutex_consistent (pthread_mutex_t *);
 void xpthread_spin_lock (pthread_spinlock_t *lock);
 void xpthread_spin_unlock (pthread_spinlock_t *lock);
 void xpthread_cond_wait (pthread_cond_t * cond, pthread_mutex_t * mutex);
+void xpthread_cond_signal (pthread_cond_t *cond);
 pthread_t xpthread_create (pthread_attr_t *attr,
                            void *(*thread_func) (void *), void *closure);
 void xpthread_detach (pthread_t thr);