public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Lukasz Majewski <lukma@denx.de>
To: Joseph Myers <joseph@codesourcery.com>,
	Adhemerval Zanella <adhemerval.zanella@linaro.org>
Cc: Alistair Francis <alistair23@gmail.com>,
	Alistair Francis <alistair.francis@wdc.com>,
	GNU C Library <libc-alpha@sourceware.org>,
	Florian Weimer <fweimer@redhat.com>,
	Andreas Schwab <schwab@suse.de>, Lukasz Majewski <lukma@denx.de>
Subject: [PATCH v2 3/5] y2038: inet: Convert inet deadline to support 64 bit time
Date: Thu, 26 Mar 2020 09:06:39 +0100	[thread overview]
Message-ID: <20200326080641.10193-4-lukma@denx.de> (raw)
In-Reply-To: <20200326080641.10193-1-lukma@denx.de>

This change brings 64 bit time support to inet deadline related code for
architectures with __WORDSIZE == 32 && __TIMESIZE != 64.

It is also safe to replace struct timespec with struct __timespec64 in
deadline related structures as:

- The __deadline_to_ms () returns the number of miliseconds to deadline to
  be used with __poll (and hence it is a relative value).
- To calculate the deadline from timeval (which will be converted latter)
  the uintmax_t type is used (unsinged long long int).
---
 inet/deadline.c     | 4 ++--
 inet/net-internal.h | 5 +++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/inet/deadline.c b/inet/deadline.c
index ebf9a4f52c..eac7afd1a8 100644
--- a/inet/deadline.c
+++ b/inet/deadline.c
@@ -28,8 +28,8 @@ struct deadline_current_time
 __deadline_current_time (void)
 {
   struct deadline_current_time result;
-  if (__clock_gettime (CLOCK_MONOTONIC, &result.current) != 0)
-    __clock_gettime (CLOCK_REALTIME, &result.current);
+  if (__clock_gettime64 (CLOCK_MONOTONIC, &result.current) != 0)
+    __clock_gettime64 (CLOCK_REALTIME, &result.current);
   assert (result.current.tv_sec >= 0);
   return result;
 }
diff --git a/inet/net-internal.h b/inet/net-internal.h
index 3ca301a9be..50c7e1c482 100644
--- a/inet/net-internal.h
+++ b/inet/net-internal.h
@@ -24,6 +24,7 @@
 #include <stdint.h>
 #include <sys/time.h>
 #include <libc-diag.h>
+#include <struct___timespec64.h>
 
 int __inet6_scopeid_pton (const struct in6_addr *address,
                           const char *scope, uint32_t *result);
@@ -76,7 +77,7 @@ enum idna_name_classification __idna_name_classify (const char *name)
    timeouts and vice versa.  */
 struct deadline_current_time
 {
-  struct timespec current;
+  struct __timespec64 current;
 };
 
 /* Return the current time.  Terminates the process if the current
@@ -86,7 +87,7 @@ struct deadline_current_time __deadline_current_time (void) attribute_hidden;
 /* Computed absolute deadline.  */
 struct deadline
 {
-  struct timespec absolute;
+  struct __timespec64 absolute;
 };
 
 
-- 
2.20.1


  parent reply	other threads:[~2020-03-26  8:07 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-26  8:06 [PATCH v2 0/5] y2038: Replace __clock_gettime with __clock_gettime64 Lukasz Majewski
2020-03-26  8:06 ` [PATCH v2 1/5] y2038: Export __clock_gettime64 to be usable in other libraries Lukasz Majewski
2020-03-26  8:06 ` [PATCH v2 2/5] y2038: hurd: Provide __clock_gettime64 function Lukasz Majewski
2020-03-26  8:06 ` Lukasz Majewski [this message]
2020-04-30 20:51   ` [PATCH v2 3/5] y2038: inet: Convert inet deadline to support 64 bit time Adhemerval Zanella
2020-03-26  8:06 ` [PATCH v2 4/5] y2038: nscd: Modify nscd_helper to use __clock_gettime64 Lukasz Majewski
2020-04-30 20:54   ` Adhemerval Zanella
2020-05-01 11:30     ` Lukasz Majewski
2020-05-04 12:27       ` Adhemerval Zanella
2020-05-04 15:26         ` Lukasz Majewski
2020-05-04 16:36           ` Adhemerval Zanella
2020-03-26  8:06 ` [PATCH v2 5/5] y2038: Replace __clock_gettime with __clock_gettime64 Lukasz Majewski
2020-04-06 16:07   ` Florian Weimer
2020-04-06 21:03     ` Lukasz Majewski
2020-04-14 12:14       ` Lukasz Majewski
2020-04-21 13:48         ` Lukasz Majewski
2020-04-29 21:48           ` Lukasz Majewski
2020-04-30 21:03   ` Adhemerval Zanella
2020-05-01 11:56     ` Lukasz Majewski
2020-05-04 14:04       ` Adhemerval Zanella
2020-05-04 15:32         ` Lukasz Majewski
2020-05-04 16:37           ` Adhemerval Zanella
2020-05-05 18:31         ` Lukasz Majewski
2020-04-06 15:16 ` [PATCH v2 0/5] " Lukasz Majewski

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=20200326080641.10193-4-lukma@denx.de \
    --to=lukma@denx.de \
    --cc=adhemerval.zanella@linaro.org \
    --cc=alistair.francis@wdc.com \
    --cc=alistair23@gmail.com \
    --cc=fweimer@redhat.com \
    --cc=joseph@codesourcery.com \
    --cc=libc-alpha@sourceware.org \
    --cc=schwab@suse.de \
    /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).