Why does write continuously leave 4K bytes in the buffer?

You can find the answer in man 2 write:

It is not an error if this number is smaller than the number of bytes
requested; this may happen for example because the disk device was
filled.


And from the write() man page description:

ssize_t write(int fd, const void *buf, size_t count);

According to POSIX.1, if count is greater than SSIZE_MAX, the result
is implementation-defined; see NOTES for the upper limit on Linux.

NOTES

On Linux, write() (and similar system calls) will transfer at most
0x7ffff000 (2,147,479,552) bytes, returning the number of bytes
actually transferred. (This is true on both 32-bit and 64-bit
systems.)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)