[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Built-in printf Sits Awkwardly with UDP.
From: |
Ralph Corderoy |
Subject: |
Re: Built-in printf Sits Awkwardly with UDP. |
Date: |
Tue, 19 Jul 2011 02:26:45 +0100 |
Hi Chet,
> > On 7/18/2011 10:14 AM, Ralph Corderoy wrote:
> > > Is this happening because the built-in printf is using putchar(3)
> > > in the PC() macro and stdio thinks file descriptor 1 is still to a
> > > tty so it's persisting in line buffering? It would seem nicer if
> > > fewer write(2)s were done when stdout isn't a tty, and not just
> > > for UDP use.
>
> Almost exactly right, except replace "unbuffered" with "line-buffered
> output". Bash uses stdio and sets stdout and stderr to line-buffered.
> The advantage of fully-buffered mode shows itself when writing large
> amounts of data, which the shell does not do very often. The
> advantage of line-buffered mode is better response.
I see why it's line-buffered when writing to a terminal, but when bash
changes where stdout points it has the option to setvbuf(3) or similar
too based on what it knows about the destination, e.g. /dev/pts/3 versus
/tmp/foo versus /dev/udp/0x7f000001/4242. Does it never do this then,
and just leave things as line-buffered all the time?
Cheers, Ralph.
- Built-in printf Sits Awkwardly with UDP., Ralph Corderoy, 2011/07/18
- Re: Built-in printf Sits Awkwardly with UDP., Steven W. Orr, 2011/07/18
- Re: Built-in printf Sits Awkwardly with UDP., Sven Mascheck, 2011/07/18
- Re: Built-in printf Sits Awkwardly with UDP., Chet Ramey, 2011/07/18
- Re: Built-in printf Sits Awkwardly with UDP.,
Ralph Corderoy <=
- Re: Built-in printf Sits Awkwardly with UDP., Chet Ramey, 2011/07/19
- Re: Built-in printf Sits Awkwardly with UDP., Ralph Corderoy, 2011/07/19
- Re: Built-in printf Sits Awkwardly with UDP., Bob Proulx, 2011/07/19
- Re: Built-in printf Sits Awkwardly with UDP., Ralph Corderoy, 2011/07/20
- Re: Built-in printf Sits Awkwardly with UDP., Eric Blake, 2011/07/20
- Re: Built-in printf Sits Awkwardly with UDP., Ralph Corderoy, 2011/07/20
- Message not available
- Re: Built-in printf Sits Awkwardly with UDP., Ralph Corderoy, 2011/07/22
- Re: Built-in printf Sits Awkwardly with UDP., Chet Ramey, 2011/07/24
- Re: Built-in printf Sits Awkwardly with UDP., Ralph Corderoy, 2011/07/25
- Re: Built-in printf Sits Awkwardly with UDP., Chet Ramey, 2011/07/25