public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
To: "Kacper Piwiński" <vfjpl1@gmail.com>
Cc: Carlos O'Donell <carlos@redhat.com>, libc-alpha@sourceware.org
Subject: Re: [PATCH] linux: fix ntp_gettime abi break
Date: Tue, 7 Mar 2023 11:11:04 -0300	[thread overview]
Message-ID: <86175abc-2553-f786-1b6d-cfe95fc869ef@linaro.org> (raw)
In-Reply-To: <CAKVti-AVW+b_QY6YGu6bzgYJ7ZPQJK=vzH+pWDY2H4sYMJGRaA@mail.gmail.com>



On 03/03/23 13:43, Kacper Piwiński wrote:
> From 64bbb7cc698c8e2c8d8c94247e0bc47ac3b18f77 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Kacper=20Piwi=C5=84ski?= <vfjpl1@gmail.com>
> Date: Wed, 22 Feb 2023 18:58:38 +0100
> Subject: [PATCH] linux: fix ntp_gettime abi break
> 
> ---
>  sysdeps/unix/sysv/linux/ntp_gettime.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/ntp_gettime.c
> b/sysdeps/unix/sysv/linux/ntp_gettime.c
> index 4879573530..a577314636 100644
> --- a/sysdeps/unix/sysv/linux/ntp_gettime.c
> +++ b/sysdeps/unix/sysv/linux/ntp_gettime.c
> @@ -40,7 +40,6 @@ __ntp_gettime64 (struct __ntptimeval64 *ntv)
>    ntv->time = tntx.time;
>    ntv->maxerror = tntx.maxerror;
>    ntv->esterror = tntx.esterror;
> -  ntv->tai = tntx.tai;
>    return result;
>  }
> 
> @@ -54,7 +53,10 @@ __ntp_gettime (struct ntptimeval *ntv)
>    int result;
> 
>    result = __ntp_gettime64 (&ntv64);
> -  *ntv = valid_ntptimeval64_to_ntptimeval (ntv64);
> +  //manually update fields to maintain abi with v2.11 struct definition

Sigh, so we decided to not add symbol versioning, and add ntp_gettimex
instead.

Comments should be in the form of '/* ... */', with first uppercase
and with final period.  

But I think we should make it clear that this function should not work
on 'struct ntptimeval', even though users might call glibc 2.12 version:

/* glibc 2.12 added the 'tai' field to follow along the kernel, but it did
   not add a compatibility symbol, instead it added __ntp_gettimex.  However
   ntptimeval was still used in both cases, so to keep compatibility it
   can not set all the new field.  */

struct old_ntptimeval
{
  struct timeval time;
  long int maxerror;
  long int esterror;
};

int
__old_ntp_gettime (struct old_ntptimeval *ntv)
{
  struct __ntptimeval64 ntv64;
  int result;

  result = __ntp_gettime64 (&ntv64);
  ntv->time = valid_timeval64_to_timeval (ntv64.time);
  ntv->maxerror = ntv64.maxerror;
  ntv->esterror = ntv64.esterror;

  return result;
}
strong_alias (__old_ntp_gettime, __ntp_gettime)


> +  ntv->time = valid_timeval64_to_timeval (ntv64.time);
> +  ntv->maxerror = ntv64.maxerror;
> +  ntv->esterror = ntv64.esterror;
> 
>    return result;
>  }


  reply	other threads:[~2023-03-07 14:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-21  4:04 Kacper Piwiński
2023-02-21 11:24 ` Andreas Schwab
2023-02-24 15:15   ` Kacper Piwiński
2023-03-02 17:47 ` Carlos O'Donell
2023-03-03  8:47   ` Kacper Piwiński
2023-03-03 13:03     ` Adhemerval Zanella Netto
2023-03-03 16:43       ` Kacper Piwiński
2023-03-07 14:11         ` Adhemerval Zanella Netto [this message]
2023-03-08  8:58 Kacper Piwiński

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=86175abc-2553-f786-1b6d-cfe95fc869ef@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=carlos@redhat.com \
    --cc=libc-alpha@sourceware.org \
    --cc=vfjpl1@gmail.com \
    /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).