From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi1-x22c.google.com (mail-oi1-x22c.google.com [IPv6:2607:f8b0:4864:20::22c]) by sourceware.org (Postfix) with ESMTPS id E803E385840D for ; Fri, 10 Mar 2023 18:07:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E803E385840D Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-oi1-x22c.google.com with SMTP id q15so4860897oiw.11 for ; Fri, 10 Mar 2023 10:07:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678471673; h=content-transfer-encoding:in-reply-to:organization:from:references :to:content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=lZvQqG/hP72Lq8EYqGdBukw5FRNz314YDlT4eZBxCkM=; b=MJmhspKSBP9hZ2dO0tw+MSOG75d8CqlNpn0/w4s7TL1v+JmNwi4PzREeGgYP4T4Okd DXjp6RBol/1zE5qi05SK+37FZUEdZV4q8g6mGJ3xP/IYXM3t8lrFFqPYkY2TXm7HKSTt T6B6E3TSTV3DTGbafEj8zK0vT/mgtgeol7dbYwusGsu5rFZjmbbmHrl6/jjFma4ReNBW jioP6yNf1jkCkLy8SwlZyUGGkieZ5B5OVon/UIJ1OlAtHPcJZNJ21VSZgSHehDXiuceK 5ZadKwmNlfoXm2knKANjH/2uwkDM+2l9P3pXp1XVfzf3N3lTm0FEg9+N2ZP59nlznpZ2 8gdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678471673; h=content-transfer-encoding:in-reply-to:organization:from:references :to:content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=lZvQqG/hP72Lq8EYqGdBukw5FRNz314YDlT4eZBxCkM=; b=PZwOHHIvfW4b337fX7q+Q1wgnDkOu8dFoyJL+Z6e8+XQBCelFn7YS6iu1JdeMgJF4s qaYMS+u2fAbJexA4h7igEGD3s3P+cOUHxb558UEkUSWNQ61mJmdHAKYlc/EyYAsXcd/b GeYcJqIPWf8kfjaY8wg3tTTXJS/IEZG8KezXZy6Jwukkayqfy9n+WQgl7O6Pc1fuZ3Bn nTmFgAWac6DxTdiBvMDjJfY00irY1BnuyXtXnnQOOZ2htXssj+Z+j1KkKa4yLyNU2JS0 k32pu6cSx8DFujR766qj1WTu5KuNPgRta0cJqGokj55In+BG+O6cON7fFVcZK85553/H zOVg== X-Gm-Message-State: AO0yUKVwF5J3W1UOGAWZPD536gjLK7Cm3vAlHJpj3foKXkXNwY9FBUPJ NX2exHCgn1waR7LbfNnpS3yLzg== X-Google-Smtp-Source: AK7set/fZjwNxA+Dp2XReMzIQzLVcJqj7xwAM0lZBE8EmWL+uz+jQI4JGpQesJgjR7kCrYSFe41cbA== X-Received: by 2002:a54:410d:0:b0:384:a13:9516 with SMTP id l13-20020a54410d000000b003840a139516mr12397701oic.30.1678471673058; Fri, 10 Mar 2023 10:07:53 -0800 (PST) Received: from ?IPV6:2804:1b3:a7c0:544b:b0c2:33f9:720e:3b17? ([2804:1b3:a7c0:544b:b0c2:33f9:720e:3b17]) by smtp.gmail.com with ESMTPSA id v188-20020a4a5ac5000000b0052569fb1cfesm177394ooa.28.2023.03.10.10.07.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 10 Mar 2023 10:07:52 -0800 (PST) Message-ID: Date: Fri, 10 Mar 2023 15:07:49 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: [PATCH v3] linux: fix ntp_gettime abi break Content-Language: en-US To: =?UTF-8?Q?Kacper_Piwi=c5=84ski?= , =?UTF-8?Q?Kacper_Piwi=c5=84ski_via_Libc-alpha?= , Florian Weimer References: From: Adhemerval Zanella Netto Organization: Linaro In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 09/03/23 07:45, Kacper PiwiƄski wrote: > From c9130bbacfe66c1fe5f1ad7a40293523075b1c91 Mon Sep 17 00:00:00 2001 > From: =?UTF-8?q?Kacper=20Piwi=C5=84ski?= > Date: Thu, 9 Mar 2023 11:38:59 +0100 > Subject: [PATCH v3] linux: fix ntp_gettime abi break > > Between versions v2.11 and v2.12 struct ntptimeval got new fields. > That wasn't a problem because new function ntp_gettimex was created > (and made default) to support new struct. Old ntp_gettime was not > using new fields so it was safe to call with old struct > definition. Then commits 5613afe9e3dff and b6ad64b907a (added for > 64 bit time_t support), ntp_gettime start setting new fields. > > Sets fields manually to maintain compatibility with v2.11 struct > definition. > > Resolves #30156 LGTM, thanks Reviewed-by: Adhemerval Zanella PS: please next time do not send as attachment, but as inline. It is easy to work with patchwork as inline. > --- > sysdeps/unix/sysv/linux/ntp_gettime.c | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) > > diff --git a/sysdeps/unix/sysv/linux/ntp_gettime.c b/sysdeps/unix/sysv/linux/ntp_gettime.c > index 4879573530..af1ed920d3 100644 > --- a/sysdeps/unix/sysv/linux/ntp_gettime.c > +++ b/sysdeps/unix/sysv/linux/ntp_gettime.c > @@ -26,6 +26,11 @@ > # define modes mode > #endif > > +/* 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. */ > + > /* clock_adjtime64 with CLOCK_REALTIME does not trigger EINVAL, > ENODEV, or EOPNOTSUPP. It might still trigger EPERM. */ > > @@ -40,7 +45,7 @@ __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 +59,9 @@ __ntp_gettime (struct ntptimeval *ntv) > int result; > > result = __ntp_gettime64 (&ntv64); > - *ntv = valid_ntptimeval64_to_ntptimeval (ntv64); > + ntv->time = valid_timeval64_to_timeval (ntv64.time); > + ntv->maxerror = ntv64.maxerror; > + ntv->esterror = ntv64.esterror; > > return result; > } > -- > 2.34.1 >