|
Message-ID: <20201227215734.GC22981@brightrain.aerifal.cx> Date: Sun, 27 Dec 2020 16:57:34 -0500 From: Rich Felker <dalias@...ifal.cx> To: Alexander Lobakin <alobakin@...me> Cc: musl@...ts.openwall.com Subject: Re: [PATCH 03/18] clock_adjtime: try adjtimex at last On Sun, Dec 27, 2020 at 06:41:02PM +0000, Alexander Lobakin wrote: > Try to use deprecated adjtimex only after clock_adjtime_time64 or > clock_adjtime fail with -ENOSYS. > > Signed-off-by: Alexander Lobakin <alobakin@...me> > --- > src/linux/clock_adjtime.c | 12 +++++++----- > 1 file changed, 7 insertions(+), 5 deletions(-) > > diff --git a/src/linux/clock_adjtime.c b/src/linux/clock_adjtime.c > index d4d03d24df40..5a21d5625e59 100644 > --- a/src/linux/clock_adjtime.c > +++ b/src/linux/clock_adjtime.c > @@ -114,11 +114,11 @@ int clock_adjtime (clockid_t clock_id, struct timex *utx) > .stbcnt = utx->stbcnt, > .tai = utx->tai, > }; > + r = __syscall(SYS_clock_adjtime, clock_id, &ktx); > #ifdef SYS_adjtimex > - if (clock_id==CLOCK_REALTIME) r = __syscall(SYS_adjtimex, &ktx); > - else > + if (r == -ENOSYS && clock_id == CLOCK_REALTIME) > + r = __syscall(SYS_adjtimex, &ktx); > #endif > - r = __syscall(SYS_clock_adjtime, clock_id, &ktx); > if (r>=0) { > utx->modes = ktx.modes; > utx->offset = ktx.offset; > @@ -144,8 +144,10 @@ int clock_adjtime (clockid_t clock_id, struct timex *utx) > } > return __syscall_ret(r); > } > + r = __syscall(SYS_clock_adjtime, clock_id, utx); > #ifdef SYS_adjtimex > - if (clock_id==CLOCK_REALTIME) return syscall(SYS_adjtimex, utx); > + if (r == -ENOSYS && clock_id == CLOCK_REALTIME) > + r = __syscall(SYS_adjtimex, utx); > #endif > - return syscall(SYS_clock_adjtime, clock_id, utx); > + return __syscall_ret(r); > } > -- > 2.29.2 > This proposed change seems to have nothing to do with supporting CONFIG_COMPAT_32BIT_TIME=n and makes fallback behavior strictly worse for old kernels. Rich
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.