linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michael Kerrisk (man-pages)" <mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Heinrich Schuchardt <xypron.glpk-Mmb7MZpHnFY@public.gmane.org>
Cc: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Theodore Ts'o <tytso-3s7WtUTddSA@public.gmane.org>
Subject: Re: [PATCH 1/1] random.4: describe handling of O_NONBLOCK
Date: Sat, 10 Jan 2015 14:32:18 +0100	[thread overview]
Message-ID: <54B129E2.3040407@gmail.com> (raw)
In-Reply-To: <1417042565-16707-1-git-send-email-xypron.glpk-Mmb7MZpHnFY@public.gmane.org>

On 11/26/2014 11:56 PM, Heinrich Schuchardt wrote:
> /dev/random and /dev/urandom treat O_NONBLOCK differently.
> This should be described in the manpage.

Thanks, Heinrich. Applied.

Cheers,

Michael


> Signed-off-by: Heinrich Schuchardt <xypron.glpk-Mmb7MZpHnFY@public.gmane.org>
> ---
>  man4/random.4 | 25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
> 
> diff --git a/man4/random.4 b/man4/random.4
> index a193ddf..44d9e34 100644
> --- a/man4/random.4
> +++ b/man4/random.4
> @@ -44,6 +44,22 @@ pool.
>  high quality randomness such as one-time pad or key generation.
>  When the entropy pool is empty, reads from \fI/dev/random\fP will block
>  until additional environmental noise is gathered.
> +If
> +.BR open (2)
> +is called for
> +.I /dev/random
> +with flag
> +.BR O_NONBLOCK ,
> +a subsequent
> +.BR read (2)
> +will not block if the requested number of bytes is not available.
> +Instead the available bytes are returned.
> +If no byte is available
> +.BR read (2)
> +will return -1 and
> +.I errno
> +will be set to
> +.BR EAGAIN .
>  .LP
>  A read from the \fI/dev/urandom\fP device will not block
>  waiting for more entropy.
> @@ -55,6 +71,15 @@ literature, but it is theoretically possible that such an attack may
>  exist.
>  If this is a concern in your application, use \fI/dev/random\fP
>  instead.
> +.B O_NONBLOCK
> +has no effect when opening
> +.IR /dev/urandom .
> +When calling
> +.BR read (2)
> +for device
> +.I /dev/urandom
> +signals will not be handled until after the requested random bytes
> +have been generated.
>  .LP
>  Writing to \fI/dev/random\fP or \fI/dev/urandom\fP will update the
>  entropy pool with the data written, but this will not result in a
> 


-- 
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-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

      parent reply	other threads:[~2015-01-10 13:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-26 22:56 [PATCH 1/1] random.4: describe handling of O_NONBLOCK Heinrich Schuchardt
     [not found] ` <1417042565-16707-1-git-send-email-xypron.glpk-Mmb7MZpHnFY@public.gmane.org>
2015-01-10 13:32   ` Michael Kerrisk (man-pages) [this message]

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=54B129E2.3040407@gmail.com \
    --to=mtk.manpages-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=tytso-3s7WtUTddSA@public.gmane.org \
    --cc=xypron.glpk-Mmb7MZpHnFY@public.gmane.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 NNTP newsgroup(s).