* [PATCH] <stdio.h>: fcloseall, fopencookie, vasprintf, asprintf by default
@ 2022-11-24 14:32 Florian Weimer
2022-11-24 15:13 ` Cristian Rodríguez
0 siblings, 1 reply; 3+ messages in thread
From: Florian Weimer @ 2022-11-24 14:32 UTC (permalink / raw)
To: libc-alpha
FreeBSD makes these functions available by default, so we should
not treat them as GNU-specific and restrict them to _GNU_SOURCE.
Tested on x86_64-linux-gnu.
---
libio/stdio.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/libio/stdio.h b/libio/stdio.h
index 0e0f16b464..0def214651 100644
--- a/libio/stdio.h
+++ b/libio/stdio.h
@@ -42,7 +42,7 @@ __BEGIN_DECLS
#include <bits/types/FILE.h>
#include <bits/types/struct_FILE.h>
-#ifdef __USE_GNU
+#ifdef __USE_MISC
# include <bits/types/cookie_io_functions_t.h>
#endif
@@ -239,7 +239,7 @@ extern int fflush (FILE *__stream);
extern int fflush_unlocked (FILE *__stream);
#endif
-#ifdef __USE_GNU
+#ifdef __USE_MISC
/* Close all streams.
This function is not part of POSIX and therefore no official
@@ -294,7 +294,7 @@ extern FILE *fdopen (int __fd, const char *__modes) __THROW
__attribute_malloc__ __attr_dealloc_fclose __wur;
#endif
-#ifdef __USE_GNU
+#ifdef __USE_MISC
/* Create a new stream that refers to the given magic cookie,
and uses the given functions for input and output. */
extern FILE *fopencookie (void *__restrict __magic_cookie,
@@ -384,7 +384,7 @@ extern int vsnprintf (char *__restrict __s, size_t __maxlen,
__THROWNL __attribute__ ((__format__ (__printf__, 3, 0)));
#endif
-#if __GLIBC_USE (LIB_EXT2)
+#if defined (__USE_MISC) || __GLIBC_USE (LIB_EXT2)
/* Write formatted output to a string dynamically allocated with `malloc'.
Store the address of the string in *PTR. */
extern int vasprintf (char **__restrict __ptr, const char *__restrict __f,
base-commit: 5bb4b51a76cc9bec72f67f702b5bf2fce30f0f7c
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] <stdio.h>: fcloseall, fopencookie, vasprintf, asprintf by default
2022-11-24 14:32 [PATCH] <stdio.h>: fcloseall, fopencookie, vasprintf, asprintf by default Florian Weimer
@ 2022-11-24 15:13 ` Cristian Rodríguez
2022-11-24 15:55 ` Florian Weimer
0 siblings, 1 reply; 3+ messages in thread
From: Cristian Rodríguez @ 2022-11-24 15:13 UTC (permalink / raw)
To: Florian Weimer; +Cc: libc-alpha
On Thu, Nov 24, 2022 at 11:32 AM Florian Weimer via Libc-alpha
<libc-alpha@sourceware.org> wrote:
>
> FreeBSD makes these functions available by default, so we should
> not treat them as GNU-specific and restrict them to _GNU_SOURCE.
>
> Tested on x86_64-linux-gnu.
It would be great if fcloseall worked before exposing it by default. :-)
https://sourceware.org/bugzilla/show_bug.cgi?id=28099
(this is last time I tested, it didn't close anything whatsoever)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] <stdio.h>: fcloseall, fopencookie, vasprintf, asprintf by default
2022-11-24 15:13 ` Cristian Rodríguez
@ 2022-11-24 15:55 ` Florian Weimer
0 siblings, 0 replies; 3+ messages in thread
From: Florian Weimer @ 2022-11-24 15:55 UTC (permalink / raw)
To: Cristian Rodríguez; +Cc: libc-alpha
* Cristian Rodríguez:
> On Thu, Nov 24, 2022 at 11:32 AM Florian Weimer via Libc-alpha
> <libc-alpha@sourceware.org> wrote:
>>
>> FreeBSD makes these functions available by default, so we should
>> not treat them as GNU-specific and restrict them to _GNU_SOURCE.
>>
>> Tested on x86_64-linux-gnu.
>
> It would be great if fcloseall worked before exposing it by default. :-)
>
> https://sourceware.org/bugzilla/show_bug.cgi?id=28099
>
> (this is last time I tested, it didn't close anything whatsoever)
Hmm, okay, I see the current implementation can't really work. Closing
the standard buffers is rather unsafe, too. So I think we should
deprecate it. I'll send a separate patch for that soon.
I've also sent a v2 without fcloseall.
Thanks,
Florian
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-11-24 15:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-24 14:32 [PATCH] <stdio.h>: fcloseall, fopencookie, vasprintf, asprintf by default Florian Weimer
2022-11-24 15:13 ` Cristian Rodríguez
2022-11-24 15:55 ` Florian Weimer
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).