public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix __fp_lock_all() and __fp_unlock_all()
@ 2022-05-18 17:13 Sebastian Huber
  2022-05-18 17:13 ` [PATCH] Fix __sFILE::_lock initialization Sebastian Huber
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Sebastian Huber @ 2022-05-18 17:13 UTC (permalink / raw)
  To: newlib

For _REENT_GLOBAL_STDIO_STREAMS, lock/unlock all FILE objects.  In the
repository, this function is only used by Cygwin during process forks.  Since
Cygwin enabled _REENT_GLOBAL_STDIO_STREAMS recently, without this fix no FILE
object at all was locked.
---
 newlib/libc/stdio/findfp.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/newlib/libc/stdio/findfp.c b/newlib/libc/stdio/findfp.c
index 6933ff1db..a39082387 100644
--- a/newlib/libc/stdio/findfp.c
+++ b/newlib/libc/stdio/findfp.c
@@ -333,6 +333,8 @@ __fp_lock_all (void)
 #ifndef _REENT_GLOBAL_STDIO_STREAMS
   ptr = _REENT;
   (void) _fwalk_sglue (ptr, __fp_lock, &ptr->__sglue);
+#else
+  (void) _fwalk_sglue (NULL, __fp_lock, &__sglue);
 #endif
 }
 
@@ -344,6 +346,8 @@ __fp_unlock_all (void)
 
   ptr = _REENT;
   (void) _fwalk_sglue (ptr, __fp_unlock, &ptr->__sglue);
+#else
+  (void) _fwalk_sglue (NULL, __fp_unlock, &__sglue);
 #endif
 
   __sfp_lock_release ();
-- 
2.35.3


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-05-19 17:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-18 17:13 [PATCH] Fix __fp_lock_all() and __fp_unlock_all() Sebastian Huber
2022-05-18 17:13 ` [PATCH] Fix __sFILE::_lock initialization Sebastian Huber
2022-05-19 12:04   ` Corinna Vinschen
2022-05-18 17:13 ` [PATCH] Use weak reference for _REENT_SMALL Sebastian Huber
2022-05-19 12:05   ` Corinna Vinschen
2022-05-19 12:02 ` [PATCH] Fix __fp_lock_all() and __fp_unlock_all() Corinna Vinschen
2022-05-19 17:08   ` Sebastian Huber

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).