|
Message-ID: <20201227184032.22413-3-alobakin@pm.me> Date: Sun, 27 Dec 2020 18:41:02 +0000 From: Alexander Lobakin <alobakin@...me> To: Rich Felker <dalias@...ifal.cx>, musl@...ts.openwall.com Cc: Alexander Lobakin <alobakin@...me> Subject: [PATCH 03/18] clock_adjtime: try adjtimex at last 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
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.