Module Name:    src
Committed By:   dholland
Date:           Mon Feb 28 04:03:00 UTC 2011

Modified Files:
        src/lib/libc/sys: mlock.2

Log Message:
Improve discussion of alignment and rounding per PR 33527.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/lib/libc/sys/mlock.2

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/sys/mlock.2
diff -u src/lib/libc/sys/mlock.2:1.18 src/lib/libc/sys/mlock.2:1.19
--- src/lib/libc/sys/mlock.2:1.18	Thu May 13 10:20:58 2004
+++ src/lib/libc/sys/mlock.2	Mon Feb 28 04:03:00 2011
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mlock.2,v 1.18 2004/05/13 10:20:58 wiz Exp $
+.\"	$NetBSD: mlock.2,v 1.19 2011/02/28 04:03:00 dholland Exp $
 .\"
 .\" Copyright (c) 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -59,14 +59,7 @@
 call unlocks pages previously locked by one or more
 .Nm mlock
 calls.
-For both, the
-.Fa addr
-parameter should be aligned to a multiple of the page size.
-If the
-.Fa len
-parameter is not a multiple of the page size, it will be rounded up
-to be so.
-The entire range must be allocated.
+The entire range of memory must be allocated.
 .Pp
 After an
 .Nm mlock
@@ -99,6 +92,14 @@
 the per-process
 .Li RLIMIT_MEMLOCK
 resource limit.
+.Pp
+Portable code should ensure that the
+.Fa addr
+and
+.Fa len
+parameters are aligned to a multiple of the page size, even though the
+.Nx
+implementation will round as necessary.
 .Sh RETURN VALUES
 A return value of 0 indicates that the call
 succeeded and all pages in the range have either been locked or unlocked.
@@ -112,7 +113,10 @@
 will fail if:
 .Bl -tag -width Er
 .It Bq Er EINVAL
-The address given is not page aligned or the length is negative.
+The length is negative.
+.It Bq Er EINVAL
+The address or length given is not page aligned and the implementation
+does not round.
 .It Bq Er EAGAIN
 Locking the indicated range would exceed either the system or per-process
 limit for locked memory.
@@ -129,7 +133,10 @@
 will fail if:
 .Bl -tag -width Er
 .It Bq Er EINVAL
-The address given is not page aligned or the length is negative.
+The length is negative.
+.It Bq Er EINVAL
+The address or length given is not page aligned and the implementation
+does not round.
 .It Bq Er ENOMEM
 Some portion of the indicated address range is not allocated.
 Some portion of the indicated address range is not locked.

Reply via email to