mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@aerifal.cx>
To: Alexander Lobakin <alobakin@pm.me>
Cc: musl@lists.openwall.com
Subject: Re: [musl] [PATCH 03/18] clock_adjtime: try adjtimex at last
Date: Sun, 27 Dec 2020 16:57:34 -0500	[thread overview]
Message-ID: <20201227215734.GC22981@brightrain.aerifal.cx> (raw)
In-Reply-To: <20201227184032.22413-3-alobakin@pm.me>

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

  reply	other threads:[~2020-12-27 21:57 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-27 18:39 [musl] [PATCH 00/18] time64: always prefer time64 syscalls Alexander Lobakin
2020-12-27 18:40 ` [musl] [PATCH 01/18] clock_gettime: prefer time64 variant if available Alexander Lobakin
2020-12-27 18:40   ` [musl] [PATCH 02/18] clock_settime: " Alexander Lobakin
2020-12-27 18:41   ` [musl] [PATCH 03/18] clock_adjtime: try adjtimex at last Alexander Lobakin
2020-12-27 21:57     ` Rich Felker [this message]
2020-12-27 18:41   ` [musl] [PATCH 04/18] clock_getres: use time64 variant by default Alexander Lobakin
2020-12-27 18:41   ` [musl] [PATCH 05/18] clock_nanosleep: prefer time64 variant if available Alexander Lobakin
2020-12-27 18:41   ` [musl] [PATCH 06/18] timer_gettime: " Alexander Lobakin
2020-12-27 18:41   ` [musl] [PATCH 07/18] timer_settime: " Alexander Lobakin
2020-12-27 18:41   ` [musl] [PATCH 08/18] timerfd_gettime: " Alexander Lobakin
2020-12-27 18:41   ` [musl] [PATCH 09/18] timerfd_settime: " Alexander Lobakin
2020-12-27 18:41   ` [musl] [PATCH 10/18] utimensat: " Alexander Lobakin
2020-12-27 18:42   ` [musl] [PATCH 11/18] pselect, select: prefer time64 variant of pselect6 " Alexander Lobakin
2020-12-27 18:42   ` [musl] [PATCH 12/18] poll, ppoll: prefer time64 variant of ppoll " Alexander Lobakin
2020-12-27 18:42   ` [musl] [PATCH 13/18] mq_timedsend: prefer time64 variant " Alexander Lobakin
2020-12-27 18:42   ` [musl] [PATCH 14/18] mq_timedreceive: " Alexander Lobakin
2020-12-27 18:42   ` [musl] [PATCH 15/18] semtimedop: prefer time64 variant of semtimedop " Alexander Lobakin
2020-12-27 18:42   ` [musl] [PATCH 16/18] [rt_]sigtimedwait: prefer time64 variant " Alexander Lobakin
2020-12-27 18:42   ` [musl] [PATCH 17/18] futex: " Alexander Lobakin
2020-12-27 22:18     ` Rich Felker
2020-12-27 18:42   ` [musl] [PATCH 18/18] sched_rr_get_interval: use " Alexander Lobakin
2020-12-27 21:54   ` [musl] [PATCH 01/18] clock_gettime: prefer " Rich Felker
2020-12-27 21:52 ` [musl] [PATCH 00/18] time64: always prefer time64 syscalls Rich Felker
2020-12-28 11:11 ` Alexander Lobakin

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=20201227215734.GC22981@brightrain.aerifal.cx \
    --to=dalias@aerifal.cx \
    --cc=alobakin@pm.me \
    --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).