On Fri, Nov 19, 2021 at 08:38:27PM -0700, Todd C. Miller wrote: > On Fri, 19 Nov 2021 21:31:12 -0600, Scott Cheloha wrote: > > > Is there a nicer way to pick a "reasonable" buffer size when we just > > want to move as many bytes as possible on a given platform without > > hogging the machine? > > Not really. But I don't think you need to worry about "hogging the > machine" with a 64K buffer.
Right. > One advantage to using stdio is that > it will use the optimal I/O blocksize automatically so you could > try using that instead of write(2) and see how it performs. tee(1) needs to write input to N drains, N >= 1. If we use stdio that means we're doing N additional userspace copies, no? > > I thought MAXBSIZE was that constant, because we use it elsewhere, > > e.g. in cat(1) and wc(1), but if not then what is the right thing? > > Is it BUFSIZ? > > BUFSIZ is only 1K on OpenBSD, which is its own problem. That seems a bit small... hmmm...
