Re: Simplified version of read_binary_file (src/backend/utils/adt/genfile.c)
| От | Ranier Vilela |
|---|---|
| Тема | Re: Simplified version of read_binary_file (src/backend/utils/adt/genfile.c) |
| Дата | |
| Msg-id | CAEudQAqB1-EMd7JDoxHVYnB_z8WOsEGt8WsD-VgK_63NAgJAuQ@mail.gmail.com обсуждение исходный текст |
| Ответ на | Re: Simplified version of read_binary_file (src/backend/utils/adt/genfile.c) (Alvaro Herrera <alvherre@2ndquadrant.com>) |
| Список | pgsql-hackers |
Em ter., 15 de set. de 2020 às 14:54, Alvaro Herrera <alvherre@2ndquadrant.com> escreveu:
I think you meant _IONBF instead of _IOFBF -- otherwise it's at odds
with the comment you add. But what is the justification for that
addition? I don't see us doing that anywhere else.
No.
| _IOFBF | Full buffering: On output, data is written once the buffer is full (or flushed). On Input, the buffer is filled when an input operation is requested and the buffer is empty. |
_IONBF No buffering: No buffer is used. Each I/O operation is written as soon as possible. In this case, the buffer and size parameters are ignored.
_IONBF ignores buffer and size.
Without setvbuf, fread uses an internal buffer, default 4096 bytes (OS dependent).
If fread uses an internal buffer, then it needs a copy to the buffer provided by the function.
setvbuf, does the same as read function low level, copies directly to the final buffer.
regards,
Ranier Vilela
В списке pgsql-hackers по дате отправления: