git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: read() MAX_IO_SIZE bytes, more than SSIZE_MAX?

From
Joachim Schmitz <jojo@schmitz-digital.de>
Date
Feb 7, 2015, 18:36 UTC
Message-ID
<loom.20150207T193242-470@post.gmane.org>
In-Reply-To
<01f501d04302$bb9a46b0$32ced410$@nexbridge.com>
Randall S. Becker <rsbecker <at> nexbridge.com> writes:
> 
> On 2015-02-07 13:07PM Randall S. Becker wrote:
> >On 2015-02-07 12:30PM Torsten Bögershausen wrote:
> >>On 2015-02-07 17.45, Joachim Schmitz wrote:
<spip> 
Show 12 quoted lines
> Although I do agree with Jojo, that MAX_IO_SIZE seems to be a platform
> constant and should be defined in terms of SSIZE_MAX. So something like:
> 
> #ifndef MAX_IO_SIZE
> # ifdef SSIZE_MAX
> #  define MAX_IO_SIZE (SSIZE_MAX)
> # else
> #  define MAX_IO_SIZE (8*1024*1024)
> # endif
> #endif
> 
> would be desirable.

It would be way too large on some platforms. those 8MB had been chosen for a good reason, I assume:

/*
 * Limit size of IO chunks, because huge chunks only cause pain.  OS X
 * 64-bit is buggy, returning EINVAL if len >= INT_MAX; and even in
 * the absence of bugs, large chunks can result in bad latencies when
 * you decide to kill the process.
 */
However it should never be larger than SSIZE_MAX
Previous: Randall S. BeckerNext: Joachim Schmitz
Message 19 of 20 in “read() MAX_IO_SIZE bytes, more than SSIZE_MAX?”
  1. Joachim SchmitzFeb 7, 2015
  2. Joachim SchmitzFeb 7, 2015
  3. Torsten BögershausenFeb 7, 2015
  4. Joachim SchmitzFeb 7, 2015
  5. Joachim SchmitzFeb 7, 2015
  6. Torsten BögershausenFeb 7, 2015
  7. Junio C HamanoFeb 7, 2015
  8. Joachim SchmitzFeb 7, 2015
  9. Junio C HamanoFeb 8, 2015
  10. Randall S. BeckerFeb 8, 2015
  11. Joachim SchmitzFeb 8, 2015
  12. Eric SunshineFeb 8, 2015
  13. Junio C HamanoFeb 11, 2015
  14. Joachim SchmitzFeb 11, 2015
  15. Joachim SchmitzFeb 11, 2015
  16. Junio C HamanoFeb 11, 2015
  17. Randall S. BeckerFeb 7, 2015
  18. Randall S. BeckerFeb 7, 2015
  19. Joachim SchmitzFeb 7, 2015
  20. Joachim SchmitzFeb 7, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.