From: Rical Jasan <ricaljasan@pacific.net>
To: Florian Weimer <fweimer@redhat.com>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH] Implement the mlock2 function
Date: Mon, 27 Nov 2017 09:25:00 -0000 [thread overview]
Message-ID: <d6356826-8fe4-2a11-dbc0-a0c81fb86c50@pacific.net> (raw)
In-Reply-To: <20171124165936.9CEC94071C775@oldenburg.str.redhat.com>
On 11/24/2017 08:59 AM, Florian Weimer wrote:
> diff --git a/manual/memory.texi b/manual/memory.texi
> index 3f5dd90260..1b431bf5da 100644
> --- a/manual/memory.texi
> +++ b/manual/memory.texi
> @@ -3337,6 +3337,36 @@ The calling process is not superuser.
> The kernel does not provide @code{mlock} capability.
>
> @end table
> +@end deftypefun
> +
> +@deftypefun int mlock2 (const void *@var{addr}, size_t @var{len}, unsigned int @var{flags})
> +@standards{Linux, sys/mman.h}
> +@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
> +
> +This function is similar to @code{mlock}. If @var{flags} is zero, a
> +call to @code{mlock2} behaves exactly as the equivalent call to @code{mlock}.
This is fine. As a matter of form, I think it would be nice to say
something about how mlock2 is different from mlock, but I'm not sure
there is much to else to say than, "..., but it accepts a flags
argument", so I guess that's obvious enough.
> +
> +The @var{flags} argument must be a combination of zero or more of the
> +following flags:
> +
> +@vtable @code
> +@item MLOCK_ONFAULT
> +@standards{Linux, sys/mman.h}
> +Only those pages in the specified address range which are already in
> +memory are locked immediately. Additional pages in the range are
> +automatically locked in case of a page fault and allocation of memory.
> +@end vtable
> +
> +Like @code{mlock}, @code{mlock2} returns zero on success and @code{-1}
I thought you were in the @math camp for return values. :P
> +on failure, setting @code{errno} accordingly. Additional @code{errno}
> +values defined for @code{mlock2} are:
> +
> +@table @code
> +@item EINVAL
> +The specified (non-zero) @var{flags} argument is not supported by this
> +system.
> +@end table
> +@end deftypefun
>
> You can lock @emph{all} a process' memory with @code{mlockall}. You
> unlock memory with @code{munlock} or @code{munlockall}.
> @@ -3346,8 +3376,6 @@ To avoid all page faults in a C program, you have to use
> from the C code, e.g. the stack and automatic variables, and you
> wouldn't know what address to tell @code{mlock}.
>
> -@end deftypefun
> -
Good catch.
> @deftypefun int munlock (const void *@var{addr}, size_t @var{len})
> @standards{POSIX.1b, sys/mman.h}
> @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
The rest of the patch looked OK to me, but I'm not able to give an
authoritative ACK on it. Seemed straightforward though.
Rical
next prev parent reply other threads:[~2017-11-27 9:25 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-24 16:59 Florian Weimer
2017-11-24 17:02 ` Joseph Myers
2017-11-24 17:09 ` Florian Weimer
2017-11-24 17:24 ` Adhemerval Zanella
2017-11-24 19:20 ` Florian Weimer
2017-11-27 13:12 ` Adhemerval Zanella
2017-11-27 16:07 ` Florian Weimer
2017-11-27 16:35 ` Adhemerval Zanella
2017-11-27 16:43 ` Florian Weimer
2017-11-27 18:40 ` Adhemerval Zanella
2017-11-27 18:46 ` Florian Weimer
2017-11-28 13:38 ` Adhemerval Zanella
2017-11-27 9:25 ` Rical Jasan [this message]
2017-11-27 10:25 ` Florian Weimer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d6356826-8fe4-2a11-dbc0-a0c81fb86c50@pacific.net \
--to=ricaljasan@pacific.net \
--cc=fweimer@redhat.com \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).