mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Re: [PATCH v3] remaining steps for time64 switchover
Date: Sat, 2 Nov 2019 12:34:26 -0400	[thread overview]
Message-ID: <20191102163426.GS16318@brightrain.aerifal.cx> (raw)
In-Reply-To: <20191102013911.GA26175@brightrain.aerifal.cx>

[-- Attachment #1: Type: text/plain, Size: 1322 bytes --]

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...

[-- Attachment #2: 0001-compat-fixup-adjtimex_time32.patch --]
[-- Type: text/plain, Size: 1634 bytes --]

From a653b89da5ffcfe2c55588b297f05f7d673f70cb Mon Sep 17 00:00:00 2001
From: Rich Felker <dalias@aerifal.cx>
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 <time.h>
-#include <sys/time.h>
 #include <sys/timex.h>
-#include <string.h>
-#include <stddef.h>
 
-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


  parent reply	other threads:[~2019-11-02 16:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-02  1:39 Rich Felker
2019-11-02  1:40 ` Rich Felker
2019-11-02 16:34 ` Rich Felker [this message]
2019-11-02 21:37   ` Rich Felker

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=20191102163426.GS16318@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=musl@lists.openwall.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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).