Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 11 Jun 2017 09:33:09 +0000 (UTC)
From:      Dmitry Chagin <dchagin@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r319823 - stable/11/sys/compat/linux
Message-ID:  <201706110933.v5B9X9QJ006148@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dchagin
Date: Sun Jun 11 09:33:09 2017
New Revision: 319823
URL: https://svnweb.freebsd.org/changeset/base/319823

Log:
  MFC r319571:
  
  On success, getrandom() Linux system call returns the number of bytes that
  were copied to the buffer supplied by the user.
  
  PR:		219464
  Submitted by:	Maciej Pasternacki
  Reported by:	Maciej Pasternacki
  Approved by:	re (kib)

Modified:
  stable/11/sys/compat/linux/linux_misc.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linux/linux_misc.c
==============================================================================
--- stable/11/sys/compat/linux/linux_misc.c	Sun Jun 11 04:03:09 2017	(r319822)
+++ stable/11/sys/compat/linux/linux_misc.c	Sun Jun 11 09:33:09 2017	(r319823)
@@ -2516,6 +2516,7 @@ linux_getrandom(struct thread *td, struct linux_getran
 {
 	struct uio uio;
 	struct iovec iov;
+	int error;
 
 	if (args->flags & ~(LINUX_GRND_NONBLOCK|LINUX_GRND_RANDOM))
 		return (EINVAL);
@@ -2532,7 +2533,10 @@ linux_getrandom(struct thread *td, struct linux_getran
 	uio.uio_rw = UIO_READ;
 	uio.uio_td = td;
 
-	return (read_random_uio(&uio, args->flags & LINUX_GRND_NONBLOCK));
+	error = read_random_uio(&uio, args->flags & LINUX_GRND_NONBLOCK);
+	if (error == 0)
+		td->td_retval[0] = args->count - uio.uio_resid;
+	return (error);
 }
 
 int



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201706110933.v5B9X9QJ006148>