[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Specification vs. Implementation
On 8/27/05, Michael Sperber <sperber@xxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
> >> Can you show me how the C library does it? I can't find it offhand.
> > See the O_DIRECT option to open(2).
> But this is about cache at the OS level (at least that's what the
> FreeBSD man page says), not buffering at the C library level, which
> deals with FILE* descriptors. What does this have to do with seeking?
Sorry, was thinking at the file descriptor level.
The way to control buffering at the stream level is with setvbuf(3). This
gives you control over full buffering, line buffering and no buffering. The
ability to disable buffering is needed when you have multiple threads or
processes accessing the same file. This level of flexibility would be
difficult to obtain in Scheme if ports are built on stream objects with their
own buffering semantics.