[review] hurd: Use __clock_gettime in _hurd_select

Message ID gerrit.1572857958000.Ia6da4045157a5bbccc67d79e881d7592e6f8a890@gnutoolchain-gerrit.osci.io
State Superseded
Headers show
Series
  • [review] hurd: Use __clock_gettime in _hurd_select
Related show

Commit Message

Simon Marchi (Code Review) Nov. 4, 2019, 8:59 a.m.
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/glibc/+/506
......................................................................

hurd: Use __clock_gettime in _hurd_select

The __gettimeofday references caused check-localplt failures after
commit 5e46749c64d5.

Fixes: 5e46749c64d51f50f8511ed99c1266d7c13e182b
Change-Id: Ia6da4045157a5bbccc67d79e881d7592e6f8a890
---
M hurd/hurdselect.c
1 file changed, 4 insertions(+), 7 deletions(-)




-- 
Gerrit-Project: glibc
Gerrit-Branch: master
Gerrit-Change-Id: Ia6da4045157a5bbccc67d79e881d7592e6f8a890
Gerrit-Change-Number: 506
Gerrit-PatchSet: 1
Gerrit-Owner: Florian Weimer <fweimer@redhat.com>
Gerrit-MessageType: newchange

Comments

Simon Marchi (Code Review) Nov. 4, 2019, 11:27 a.m. | #1
Adhemerval Zanella has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/glibc/+/506
......................................................................


Patch Set 1: Code-Review+1

LGTM.


-- 
Gerrit-Project: glibc
Gerrit-Branch: master
Gerrit-Change-Id: Ia6da4045157a5bbccc67d79e881d7592e6f8a890
Gerrit-Change-Number: 506
Gerrit-PatchSet: 1
Gerrit-Owner: Florian Weimer <fweimer@redhat.com>
Gerrit-Reviewer: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Gerrit-Comment-Date: Mon, 04 Nov 2019 11:27:11 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Simon Marchi (Code Review) Nov. 4, 2019, 1 p.m. | #2
Adhemerval Zanella has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/glibc/+/506
......................................................................


Patch Set 1: Code-Review+2


-- 
Gerrit-Project: glibc
Gerrit-Branch: master
Gerrit-Change-Id: Ia6da4045157a5bbccc67d79e881d7592e6f8a890
Gerrit-Change-Number: 506
Gerrit-PatchSet: 1
Gerrit-Owner: Florian Weimer <fweimer@redhat.com>
Gerrit-Reviewer: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Gerrit-Comment-Date: Mon, 04 Nov 2019 13:00:57 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Samuel Thibault Nov. 4, 2019, 7:32 p.m. | #3
Florian Weimer (Code Review), le lun. 04 nov. 2019 03:59:18 -0500, a ecrit:
> Change URL: https://gnutoolchain-gerrit.osci.io/r/c/glibc/+/506

> ......................................................................

> 

> hurd: Use __clock_gettime in _hurd_select

> 

> The __gettimeofday references caused check-localplt failures after

> commit 5e46749c64d5.

> 

> Fixes: 5e46749c64d51f50f8511ed99c1266d7c13e182b

> Change-Id: Ia6da4045157a5bbccc67d79e881d7592e6f8a890


Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>


Thanks!

> ---

> M hurd/hurdselect.c

> 1 file changed, 4 insertions(+), 7 deletions(-)

> 

> 

> 

> diff --git a/hurd/hurdselect.c b/hurd/hurdselect.c

> index 79cd20b..6a174bc 100644

> --- a/hurd/hurdselect.c

> +++ b/hurd/hurdselect.c

> @@ -88,7 +88,7 @@

>      reply_msgid = IO_SELECT_REPLY_MSGID;

>    else

>      {

> -      struct timeval now;

> +      struct timespec now;

>  

>        if (timeout->tv_sec < 0 || ! valid_nanoseconds (timeout->tv_nsec))

>  	{

> @@ -96,12 +96,12 @@

>  	  return -1;

>  	}

>  

> -      err = __gettimeofday(&now, NULL);

> +      err = __clock_gettime (CLOCK_REALTIME, &now);

>        if (err)

>  	return -1;

>  

>        ts.tv_sec = now.tv_sec + timeout->tv_sec;

> -      ts.tv_nsec = now.tv_usec * 1000 + timeout->tv_nsec;

> +      ts.tv_nsec = now.tv_nsec + timeout->tv_nsec;

>  

>        if (ts.tv_nsec >= 1000000000)

>  	{

> @@ -175,8 +175,7 @@

>        if (error)

>  	{

>  	  /* Set timeout to 0.  */

> -	  struct timeval now;

> -	  err = __gettimeofday(&now, NULL);

> +	  err = __clock_gettime (CLOCK_REALTIME, &ts);

>  	  if (err)

>  	    {

>  	      /* Really bad luck.  */

> @@ -192,8 +191,6 @@

>  	      errno = err;

>  	      return -1;

>  	    }

> -	  ts.tv_sec = now.tv_sec;

> -	  ts.tv_nsec = now.tv_usec * 1000;

>  	  reply_msgid = IO_SELECT_TIMEOUT_REPLY_MSGID;

>  	}

>  

> 

> -- 

> Gerrit-Project: glibc

> Gerrit-Branch: master

> Gerrit-Change-Id: Ia6da4045157a5bbccc67d79e881d7592e6f8a890

> Gerrit-Change-Number: 506

> Gerrit-PatchSet: 1

> Gerrit-Owner: Florian Weimer <fweimer@redhat.com>

> Gerrit-MessageType: newchange

> 


-- 
Samuel
       La  fonction  memfrob() crypte les n premiers octets de la
       zone de mémoire  s  en  effectuant  un  OU-exclusif  entre
       chaque  octet  et le nombre 42.
(extrait de la page de man de memfrob -- Manuel du programmeur Linux)

Patch

diff --git a/hurd/hurdselect.c b/hurd/hurdselect.c
index 79cd20b..6a174bc 100644
--- a/hurd/hurdselect.c
+++ b/hurd/hurdselect.c
@@ -88,7 +88,7 @@ 
     reply_msgid = IO_SELECT_REPLY_MSGID;
   else
     {
-      struct timeval now;
+      struct timespec now;
 
       if (timeout->tv_sec < 0 || ! valid_nanoseconds (timeout->tv_nsec))
 	{
@@ -96,12 +96,12 @@ 
 	  return -1;
 	}
 
-      err = __gettimeofday(&now, NULL);
+      err = __clock_gettime (CLOCK_REALTIME, &now);
       if (err)
 	return -1;
 
       ts.tv_sec = now.tv_sec + timeout->tv_sec;
-      ts.tv_nsec = now.tv_usec * 1000 + timeout->tv_nsec;
+      ts.tv_nsec = now.tv_nsec + timeout->tv_nsec;
 
       if (ts.tv_nsec >= 1000000000)
 	{
@@ -175,8 +175,7 @@ 
       if (error)
 	{
 	  /* Set timeout to 0.  */
-	  struct timeval now;
-	  err = __gettimeofday(&now, NULL);
+	  err = __clock_gettime (CLOCK_REALTIME, &ts);
 	  if (err)
 	    {
 	      /* Really bad luck.  */
@@ -192,8 +191,6 @@ 
 	      errno = err;
 	      return -1;
 	    }
-	  ts.tv_sec = now.tv_sec;
-	  ts.tv_nsec = now.tv_usec * 1000;
 	  reply_msgid = IO_SELECT_TIMEOUT_REPLY_MSGID;
 	}