This is the mail archive of the 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]

Re: [PATCH][BZ #12723] Fix pathconf and fpathconf on Linux

On 03/01/2013 02:23 PM, Siddhesh Poyarekar wrote:
The pathconf(_PC_PIPE_BUF) gets the pipe buffer size on Linux using
F_GETPIPE_SZ on the file, or falls back to returning the default
PIPE_BUF.  The fallback is incorrect since the default pipe buffer
size for Linux is not PIPE_BUF.  Linux pipe buffer size is
configurable using F_SETPIPE_SZ and is initially set to
fallback should return this value.  Patch below does that and also
includes a test case to verify that pathconf on a fifo and a directory
are the same.

I think both the patch and the original code are wrong because Linux does not guarantee atomic delivery beyond PAGE_SIZE (at least that's how I read the code). So pathconf(_PC_PIPE_BUF) should return PAGE_SIZE unconditionally.

F_SETPIPE_SZ increases the amount of data which can ideally be written without blocking, but not the size of atomically delivered chunks.

Florian Weimer / Red Hat Product Security Team

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