Re: [PATCH] getrandom.2: treatment of interrupts

From: Michael Kerrisk (man-pages)
Date: Sun Nov 16 2014 - 10:56:25 EST


Hi Heinrich,

On Tue, Nov 11, 2014 at 5:19 PM, Heinrich Schuchardt <xypron.glpk@xxxxxx> wrote:
> || pick 0ef180e getrandom.2: Add a sentence to clarify the default behavior...
> || pick 62342ef getrandom.2: Reword GRND_NONBLOCK description
> || pick 0c90d3d getrandom.2: Reword GRND_RANDOM description
> These patches look ok.
>
> || FIXME is the following paragraph correct?
> Paragraph is correct. FIXME removed.
>
> The appended patch removed two FIXMEs.
> The description of the treatment of interrupts is updated.
>
> || FIXME Here, I think there needs to be an opening paragraph ...
> The description of the treatment of interupts has been reworked.
> FIXME removed.
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@xxxxxx>
> ---
> man2/getrandom.2 | 21 ++++++++-------------
> 1 file changed, 8 insertions(+), 13 deletions(-)
>
> diff --git a/man2/getrandom.2 b/man2/getrandom.2
> index 59ebbe0..5bf57b7 100644
> --- a/man2/getrandom.2
> +++ b/man2/getrandom.2
> @@ -55,7 +55,6 @@ Therefore
> should not be used for Monte Carlo simulations or other
> programs/algorithms which are doing probabilistic sampling.
>
> -.\" FIXME is the following paragraph correct?
> By default,
> .BR getrandom ()
> draws entropy from the
> @@ -157,10 +156,14 @@ was introduced in version 3.17 of the Linux kernel.
> This system call is Linux-specific.
> .SH NOTES
> .SS Interruption by a signal handler
> -.\" FIXME Here, I think there needs to be an opening paragraph that describes
> -.\" the cases where getrandom() can block. This should cover the cases with
> -.\" GRND_RANDOM and without GRND_RANDOM. Reading the existing page, I am
> -.\" still not completely confident that I know what the cases are.
> +If a blocking call is interrupted by a signal
> +when reading from
> +.I /dev/random
> +.RB ( GRND_RANDOM
> +is set),
> +.B EINTR
> +will be returned.
> +.PP

What I was meaning with my FIXME was: please describe the various
cases where getrandom() can block, both with GRND_RANDOM and without
GRND_RANDOM. As I read the man page, I am not sure that I understand
which the cases are.

Thanks,

Michael



> The reaction of
> .BR getrandom ()
> in case of an interruption of a blocking call by a signal
> @@ -182,14 +185,6 @@ will not return
> .BR EINTR .
> Instead, it will return all of the bytes that have been requested.
> .PP
> -When reading from
> -.I /dev/random
> -.RB ( GRND_RANDOM
> -is set)
> -these guarantees do
> -.I not
> -apply.
> -.PP
> Calling
> .BR getrandom ()
> to read
> --
> 2.1.1
>



--
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-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/