This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] abort: Only flush file-based stdio streams before termination
On 17/08/2017 12:52, Florian Weimer wrote:
> On 08/17/2017 05:31 PM, Carlos O'Donell wrote:
>
>> I'm OK with this change if we clearly document what we're doing in the
>> glibc manual, and explain the alternative solution of flushing from the
>> abort handler.
>
> The manual currently does not list abort as an action which flushes any
> buffers:
>
> <http://www.gnu.org/software/libc/manual/html_node/Flushing-Buffers.html>
>
> I think you are making up an implementation constraint which does not
> actually exist.
>
> What I'm trying to do is to get rid of the flushing (to get a cleaner
> process termination sequence) while preserving the legacy behavior that
> stdout/stderr and other file buffers are flushed on termination because
> that's easily user-visible. Considering that flushing streams which are
> not file-backed can allocate memory using malloc and that abort can be
> called from all kinds of contexts (including malloc itself), I think
> that's a reasonable precaution.
I will double-check, but I recall that at least for open_memstream with
my BZ#21735 flushing on about did *not* allocate memory. And I am
aware it is a different issue, but we will add different semantics for
flushing (even though it is not POSIX).
But I agree with Carlos it should be ok with a proper documentation
about this flushing behaviour.