Skip to contentSkip to conversation

Possible typo in madvise(2)

DISCUSSION Alex Roper 2 participants 4 messages Mar 27, 2014 – Apr 1, 2014 3 messages not in the archive Man-pages: manual pages for Linux -- Sections 2, 3, 4, 5, and 7

lore
Share & tools
lore

Alex Roper

author
#0 lore raw

Version: Current git repo

The first paragraph of DESCRIPTION states that madvise does not change the semantics of an application except in the case of MADV_DONTNEED, which I believe should read MADV_DONTFORK.

Thanks,
Alex
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 5 lines · Alex Roper

Version: Current git repo

The first paragraph of DESCRIPTION states that madvise does not change the semantics of an application except in the case of MADV_DONTNEED, which I believe should read MADV_DONTFORK.

Alex,

MADV_DONTNEED does change the semantics. But, could you say more about wht you think MADV_DONTFORK should have been written here instead? (Perhaps some fix is needed to the page.)

Thanks,

Michael

Signature · 7 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#4 lore raw

Sorry for my confusion.

Checking other sources I see MADV_DONTNEED results in modifications to private mappings being lost (the section on zero-filling non-file-backed pages address this, in retrospect) which clearly changes semantics.

I had noticed that MADV_DONTFORK can result in different behavior after a fork (eg, a parent mmaps a file, madvises dontfork, then forks, and the child writes to the page -- with madvise, the page is updated, visible to both processes, as is the backing file, without it the child will segfault) and thought there might be a simple typo.

Alex

Quoted 9 lines · Michael Kerrisk (man-pages)
Quoted 5 lines · Alex Roper

Version: Current git repo

The first paragraph of DESCRIPTION states that madvise does not change the semantics of an application except in the case of MADV_DONTNEED, which I believe should read MADV_DONTFORK.

Alex,

Quoted 8 lines

MADV_DONTNEED does change the semantics. But, could you say more about wht you think MADV_DONTFORK should have been written here instead? (Perhaps some fix is needed to the page.)

Thanks,

Michael

--
To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#6 lore raw
Quoted 5 lines

I had noticed that MADV_DONTFORK can result in different behavior after a fork (eg, a parent mmaps a file, madvises dontfork, then forks, and the child writes to the page -- with madvise, the page is updated, visible to both processes, as is the backing file, without it the child will segfault) and thought there might be a simple typo.

Typo: I flipped with and without madvise cases here.
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html