Re: [PATCH v2 0/6] Force pipes to flush immediately on NonStop platform
- From
Stefan Beller <sbeller@google.com>
- Date
- Jan 19, 2018, 19:34 UTC
- Message-ID
- <CAGZ79kYUBRueisw2exRC7E-mpHZYE0Y07nnT4CNF_daAYMna9g@mail.gmail.com>
- In-Reply-To
- <20180119173406.13324-1-randall.s.becker@rogers.com>
On Fri, Jan 19, 2018 at 9:33 AM, <randall.s.becker@rogers.com> wrote:
Show 5 quoted lines
> From: "Randall S. Becker" <rsbecker@nexbridge.com> > > * wrapper.c: called setbuf(stream,0) to force pipe flushes not enabled by > default on the NonStop platform. >
Due to my review of a previous patch, I now know about the __TANDEM directive and why we use this to guard this line. :)
The setbuf(0) is easier than sprinkling (guarded) flushes all over the code, so that seems like a clean solution, which we currently don't use. (it occurred twice in history, see eac14f8909 (Win32: Thread-safe windows console output, 2012-01-14) for its introduction and fcd428f4a9 (Win32: fix broken pipe detection, 2012-03-01) for its deletion).
Show 15 quoted lines
> Signed-off-by: Randall S. Becker <rsbecker@nexbridge.com>
> ---
> wrapper.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/wrapper.c b/wrapper.c
> index d20356a77..671cbb4b4 100644
> --- a/wrapper.c
> +++ b/wrapper.c
> @@ -403,6 +403,9 @@ FILE *xfdopen(int fd, const char *mode)
> FILE *stream = fdopen(fd, mode);
> if (stream == NULL)
> die_errno("Out of memory? fdopen failed");
> +#ifdef __TANDEM
> + setbuf(stream,0);My man page tells me the second arg is a pointer, so we'd prefer NULL instead?
Thanks, Stefan
Show 7 quoted lines
> +#endif > return stream; > } > > -- > 2.16.0.31.gf1a482c >