This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
Hi Arnd,
> On Thu, Jun 27, 2019 at 6:17 PM Lukasz Majewski <lukma@denx.de> wrote:
>
> > >
> > > Ok, so you redirect both __clock_settime64 to __clock_settime
> > > and __NR_settime64 to __NR_settime, in order to get back to the
> > > same definition that you have today on 64-bit.
> > >
> > > Sorry for taking so long to understand that.
> >
> > Not only you had a hard time to understand it.
>
> Here is how I had imagined it would be done in a way that I find
> easier to understand:
>
> #if __WORDSIZE == 32 /* yes, all of them including rv32 and x32 */
> __clock_settime64 (clockid_t clock_id, const struct __timespec64 *tp)
> {
> int ret;
>
> /* Make sure the time cvalue is OK. */
> if (tp->tv_nsec < 0 || tp->tv_nsec >= 1000000000)
> {
> __set_errno (EINVAL);
> return -1;
> }
> #ifdef __NR_clock_settime64
> ret = INLINE_SYSCALL_CALL (clock_settime64, clock_id, tp);
> #endif
>
> #ifndef __ASSUME_TIME64_SYSCALLS
> if (ret == 0 || errno != ENOSYS)
> return ret;
>
> if (! in_time_t_range (tp->tv_sec))
> {
> __set_errno (EOVERFLOW);
> return -1;
> }
>
> struct timespec ts32;
> valid_timespec64_to_timespec (tp, &ts32);
> ret = INLINE_SYSCALL_CALL (clock_settime, clock_id, &ts32);
> #endif
>
> return ret;
> }
> #endif
>
> This should be functionally identical to what you have, but avoid
> some of the complexity, especially once linux-5.1 becomes the
> minimum version.
The semantics for __ASSUME_TIME64_SYSCALLS is under the discussion for
some time [1].
Also the __clock_settime64() implementation from [2] takes into
account some corner cases (like support for all archs since 3.2
kernel, x32, legacy systems, etc). The implementation from [2] IMHO
seems to be more concise and fits into the 64 bit conversion paradigm
for glibc [3].
However, this is only my opinion and we shall wait for other community
members to express their opinions.
>
> Arnd
Note:
[1] - https://patchwork.ozlabs.org/patch/1117100/
[2] - https://patchwork.ozlabs.org/patch/1107235/
[3] -
https://www.gnu.org/software/libc/manual/html_mono/libc.html
"D.2.1 64-bit time symbol handling in the GNU C Library"
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
Attachment:
pgptRBvyULDz1.pgp
Description: OpenPGP digital signature
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |