Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/sys Improve discussion of alignment and rounding pe...



details:   https://anonhg.NetBSD.org/src/rev/6b78d43fb49c
branches:  trunk
changeset: 762775:6b78d43fb49c
user:      dholland <dholland%NetBSD.org@localhost>
date:      Mon Feb 28 04:03:00 2011 +0000

description:
Improve discussion of alignment and rounding per PR 33527.

diffstat:

 lib/libc/sys/mlock.2 |  29 ++++++++++++++++++-----------
 1 files changed, 18 insertions(+), 11 deletions(-)

diffs (64 lines):

diff -r 1963ef248516 -r 6b78d43fb49c lib/libc/sys/mlock.2
--- a/lib/libc/sys/mlock.2      Mon Feb 28 03:40:45 2011 +0000
+++ b/lib/libc/sys/mlock.2      Mon Feb 28 04:03:00 2011 +0000
@@ -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.



Home | Main Index | Thread Index | Old Index