This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug stdio/21210] New: Wide-orientated stdout to file does many write(2)s of length 16


https://sourceware.org/bugzilla/show_bug.cgi?id=21210

            Bug ID: 21210
           Summary: Wide-orientated stdout to file does many write(2)s of
                    length 16
           Product: glibc
           Version: 2.24
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: stdio
          Assignee: unassigned at sourceware dot org
          Reporter: ralph at inputplus dot co.uk
  Target Milestone: ---

A program that does nothing by call putwchar(3) twenty times and exit results
in two write(2)s when run with stdout not to a TTY.  First is length 16, second
it length 4.

col(1) from bsdmainutils and util-linux effectively does this.  man(1) passes
larges amount of data through col, e.g. for zshall(1), and col passes it all
on, sixteen slow bytes at a time.  Here's a line count of strace output for the
processes man kicks off.

       2693  1000.man
        735  1008.man-preconv
        724  1009.man-tbl
         76  1010.man-nroff
      83038  1011.man-col           All those write(2)s.
         53  1013.man-nroff-locale
         74  1016.man-nroff-groff
       2519  1018.man-nroff-groff-troff
       2353  1019.man-nroff-groff-grotty

Using setbuf(3) to declare stdout unbuffered results in write()s of length one,
as expected.  setbuffer(3) to give an explicitly large, 32KiB buffer still
results in tiny 16-byte writes.

On a byte-orientated stdout to a non-TTY, writes of 8KiB are seen, as expected.

Behaviour doesn't change between LC_ALL values of C and en_GB.utf8.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]