From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/14900 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH v3] remaining steps for time64 switchover Date: Sat, 2 Nov 2019 12:34:26 -0400 Message-ID: <20191102163426.GS16318@brightrain.aerifal.cx> References: <20191102013911.GA26175@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="B3NBd8mrXZtPJEYR" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="87860"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.5.21 (2010-09-15) To: musl@lists.openwall.com Original-X-From: musl-return-14916-gllmg-musl=m.gmane.org@lists.openwall.com Sat Nov 02 17:34:45 2019 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.89) (envelope-from ) id 1iQwMM-000Mii-Bm for gllmg-musl@m.gmane.org; Sat, 02 Nov 2019 17:34:42 +0100 Original-Received: (qmail 24483 invoked by uid 550); 2 Nov 2019 16:34:39 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 24465 invoked from network); 2 Nov 2019 16:34:39 -0000 Content-Disposition: inline In-Reply-To: <20191102013911.GA26175@brightrain.aerifal.cx> Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:14900 Archived-At: --B3NBd8mrXZtPJEYR Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Nov 01, 2019 at 09:39:11PM -0400, Rich Felker wrote: > A couple errors in the v2 patchset motivated me to factor the changes > to sys/socket.h and arch/generic/ioctl.h out of the main switchover > commit, so that the latter only touches arch dirs, and acts uniformly > on them. The final result with all patches applied is almost the same, > except now the powerpc and mips[n32] socket.h bits omit the time64 > socket options, letting the top-level header's defaults take effect. > > All archs I have toolchains handy for, which includes the oddballs > (mips, powerpc) and a few 64-bit ones, have been tested to build > successfully and get the right values of the sockopt and ioctl macros, > utilizing a horrible hack (uncommitted of course) dropped into the > source tree while building. > > Hopefully this is "final" now and ready for push. compat/time32/adjtimex_time32.c was inconsistent with what was later done for struct timex (see commit 928674dcd0c5c643b8a4440466103be841151f5e). Two very helpful reviewers on #musl pointed this out, and I'll be squashing the attached fix. (I tried to avoid having many time32 compat shims call each other rather than directly calling the real functions in libc, but this one would involve a lot of duplication (and the duplication initially led to this error) so... --B3NBd8mrXZtPJEYR Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="0001-compat-fixup-adjtimex_time32.patch" >From a653b89da5ffcfe2c55588b297f05f7d673f70cb Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Sat, 2 Nov 2019 00:36:26 -0400 Subject: [PATCH] compat fixup: adjtimex_time32 --- compat/time32/adjtimex_time32.c | 33 +++------------------------------ 1 file changed, 3 insertions(+), 30 deletions(-) diff --git a/compat/time32/adjtimex_time32.c b/compat/time32/adjtimex_time32.c index d7541da8..9c6f190a 100644 --- a/compat/time32/adjtimex_time32.c +++ b/compat/time32/adjtimex_time32.c @@ -1,37 +1,10 @@ #include "time32.h" #include -#include #include -#include -#include -struct oldtimex { - unsigned modes; - long offset, freq, maxerror, esterror; - int status; - long constant, precision, tolerance; - long time_sec, time_usec; - long tick, ppsfreq, jitter; - int shift; - long stabil, jitcnt, calcnt, errcnt, stbcnt; - int tai; - int __padding[11]; -}; +struct timex32; -int __adjtimex_time32(struct timex *tx32) +int __adjtimex_time32(struct timex32 *tx32) { - struct timex utx; - memcpy(&utx, tx32, sizeof(struct oldtimex)); - utx.time.tv_sec = - *(long *)((char *)tx32 + offsetof(struct oldtimex,time_sec)); - utx.time.tv_usec = - *(long *)((char *)tx32 + offsetof(struct oldtimex,time_usec)); - int r = adjtimex(&utx); - if (r<0) return r; - memcpy(tx32, &utx, sizeof(struct oldtimex)); - *(long *)((char *)tx32 + offsetof(struct oldtimex,time_sec)) = - utx.time.tv_sec; - *(long *)((char *)tx32 + offsetof(struct oldtimex,time_usec)) = - utx.time.tv_usec; - return r; + return __clock_adjtime32(CLOCK_REALTIME, tx32); } -- 2.21.0 --B3NBd8mrXZtPJEYR--