Changeset View
Changeset View
Standalone View
Standalone View
lib/libc/sys/mincore.2
Show All 22 Lines | |||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||||
.\" SUCH DAMAGE. | .\" SUCH DAMAGE. | ||||
.\" | .\" | ||||
.\" @(#)mincore.2 8.1 (Berkeley) 6/9/93 | .\" @(#)mincore.2 8.1 (Berkeley) 6/9/93 | ||||
.\" $FreeBSD$ | .\" $FreeBSD$ | ||||
.\" | .\" | ||||
.Dd January 7, 2019 | .Dd August 23, 2020 | ||||
.Dt MINCORE 2 | .Dt MINCORE 2 | ||||
.Os | .Os | ||||
.Sh NAME | .Sh NAME | ||||
.Nm mincore | .Nm mincore | ||||
.Nd determine residency of memory pages | .Nd determine residency of memory pages | ||||
.Sh LIBRARY | .Sh LIBRARY | ||||
.Lb libc | .Lb libc | ||||
.Sh SYNOPSIS | .Sh SYNOPSIS | ||||
Show All 28 Lines | |||||
.It Dv MINCORE_REFERENCED | .It Dv MINCORE_REFERENCED | ||||
Page has been referenced by us. | Page has been referenced by us. | ||||
.It Dv MINCORE_MODIFIED | .It Dv MINCORE_MODIFIED | ||||
Page has been modified by us. | Page has been modified by us. | ||||
.It Dv MINCORE_REFERENCED_OTHER | .It Dv MINCORE_REFERENCED_OTHER | ||||
Page has been referenced. | Page has been referenced. | ||||
.It Dv MINCORE_MODIFIED_OTHER | .It Dv MINCORE_MODIFIED_OTHER | ||||
Page has been modified. | Page has been modified. | ||||
.It Dv MINCORE_PSIND(i) | |||||
Page is part of a large | |||||
.Pq Dq super | |||||
page with size given by index | |||||
.Dv i | |||||
in the array returned by | |||||
.Xr getpagesizes 3 . | |||||
.It Dv MINCORE_SUPER | .It Dv MINCORE_SUPER | ||||
Page is part of a large | Page is part of a large | ||||
.Pq Dq super | .Pq Dq super | ||||
page. | page. | ||||
In particular, one of the | |||||
.Dv MINCORE_PSIND() | |||||
values is set. | |||||
alc: I would deprecate the use of MINCORE_SUPER and note that it is now a bit field. | |||||
Done Inline ActionsWhy deprecate? (vec[i] & MINCORE_SUPER) != 0 still tells you that the mapping is part of a superpage. It's a sort of union of all values of MINCORE_PSIND(i) for page size indices i > 0. markj: Why deprecate? `(vec[i] & MINCORE_SUPER) != 0` still tells you that the mapping is part of a… | |||||
Not Done Inline ActionsConsider (vec[i] & MINCORE_SUPER) == MINCORE_SUPER. While I think that it's more likely that someone writes (vec[i] & MINCORE_SUPER) != 0, the former is now (silently) broken. alc: Consider `(vec[i] & MINCORE_SUPER) == MINCORE_SUPER`. While I think that it's more likely that… | |||||
.El | .El | ||||
.Pp | .Pp | ||||
The information returned by | The information returned by | ||||
.Fn mincore | .Fn mincore | ||||
may be out of date by the time the system call returns. | may be out of date by the time the system call returns. | ||||
The only way to ensure that a page is resident is to lock it into memory | The only way to ensure that a page is resident is to lock it into memory | ||||
with the | with the | ||||
.Xr mlock 2 | .Xr mlock 2 | ||||
Show All 13 Lines | |||||
.Sh RETURN VALUES | .Sh RETURN VALUES | ||||
.Rv -std mincore | .Rv -std mincore | ||||
.Sh ERRORS | .Sh ERRORS | ||||
The | The | ||||
.Fn mincore | .Fn mincore | ||||
system call will fail if: | system call will fail if: | ||||
.Bl -tag -width Er | .Bl -tag -width Er | ||||
.It Bq Er ENOMEM | .It Bq Er ENOMEM | ||||
The virtual address range specified by the | The virtual address range specified by the | ||||
Not Done Inline Actions.Dv MINCORE_SUPER kib: .Dv MINCORE_SUPER | |||||
.Fa addr | .Fa addr | ||||
and | and | ||||
.Fa len | .Fa len | ||||
arguments is not fully mapped. | arguments is not fully mapped. | ||||
.It Bq Er EFAULT | .It Bq Er EFAULT | ||||
The | The | ||||
.Fa vec | .Fa vec | ||||
argument points to an illegal address. | argument points to an illegal address. | ||||
.El | .El | ||||
.Sh SEE ALSO | .Sh SEE ALSO | ||||
.Xr madvise 2 , | .Xr madvise 2 , | ||||
.Xr mlock 2 , | .Xr mlock 2 , | ||||
.Xr mprotect 2 , | .Xr mprotect 2 , | ||||
.Xr msync 2 , | .Xr msync 2 , | ||||
.Xr munmap 2 , | .Xr munmap 2 , | ||||
.Xr getpagesize 3 | .Xr getpagesize 3 , | ||||
.Xr getpagesizes 3 | |||||
.Sh HISTORY | .Sh HISTORY | ||||
The | The | ||||
.Fn mincore | .Fn mincore | ||||
system call first appeared in | system call first appeared in | ||||
.Bx 4.4 . | .Bx 4.4 . |
I would deprecate the use of MINCORE_SUPER and note that it is now a bit field.