On Wed, Aug 04, 2021 at 08:04:35PM -0400, Alex Xu (Hello71) wrote:
Before this patch, the following program prints 4096 and hangs.
Afterwards, it prints 8192 and exits successfully. Note that you may
need to increase your RLIMIT_NOFILE before running the program.
int main() {
int pipefd[2];
for (int i = 0; i < 1025; i++)
if (pipe(pipefd) == -1)
return 1;
size_t bufsz = fcntl(pipefd[1], F_GETPIPE_SZ);
printf("%zd\n", bufsz);
char *buf = calloc(bufsz, 1);
write(pipefd[1], buf, bufsz);
read(pipefd[0], buf, bufsz-1);
write(pipefd[1], buf, 1);
}
Signed-off-by: Alex Xu (Hello71) <redacted>
---
Is this due to the changes that happened in 5.5? If so, a cc: stable
and a fixes tag would be nice to have :)
See discussion at https://lore.kernel.org/lkml/1628086770.5rn8p04n6j.none@localhost/ (local).
This can go up in the changelog text too.
thanks,
greg k-h