The statement that the default pipe capacity is 65536 bytes
is accurate only on systems where the page size is 4096B.
See the use of PIPE_DEF_BUFFERS in the kernel source.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Move the second call to va_end(ap) to above the if-block that
precedes it, so that the va_list 'ap' will be cleaned up in
all cases.
Reported-by: Erik Roland van der Meer <ervdmeer@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Add a hint which buffer size is needed for
strerror_r() and strerror_l().
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Also, reword the description of bzero somewhat.
By now, over time, I've completely rewritten the page,
so change the copyright as well.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Escape hyphens when explaining how to escape hyphens.
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Note that open(2) + mmap(2) + mincore(2) to get a view of which
pages of a file are currently cached.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Looking at the code in mm/fadvise.c, we have
case POSIX_FADV_DONTNEED:
if (!inode_write_congested(mapping->host))
__filemap_fdatawrite_range(mapping, offset, endbyte,
WB_SYNC_NONE);
This suggests that *if* the backing device is not congested, then
__filemap_fdatawrite_range() is called. The comments for that
function say:
__filemap_fdatawrite_range - start writeback on mapping dirty pages in range
So, my reading of this is that *maybe* some dirty pages will be
written to the backing device by the time that POSIX_FADV_DONTNEED
gets to calling invalidate_mapping_pages() whose description says:
/**
* invalidate_mapping_pages - Invalidate all the unlocked pages of one inode
* @mapping: the address_space which holds the pages to invalidate
* @start: the offset 'from' which to invalidate
* @end: the offset 'to' which to invalidate (inclusive)
*
* This function only removes the unlocked pages, if you want to
* remove all the pages of one inode, you must call truncate_inode_pages.
*
* invalidate_mapping_pages() will not block on IO activity. It will not
* invalidate pages which are dirty, locked, under writeback or mapped into
* pagetables.
*/
So, my reading of this is that the handling of dirty pages is an
optimization. If some pages can be written in time, they will be
freed by POSIX_MADV_DONTFREE. But there are no guarantees.
All of that said, some experimentation suggests that, in a lot
of cases, POSIX_MADV_DONTFREE does often free dirty pages.
See https://bugzilla.kernel.org/show_bug.cgi?id=95421.
Reported-by: Maik Zumstrull <maik@zumstrull.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Details for various flags were hidden under NOTES.
Move them to DESCRIPTION, to make the details more
obvious.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>