Re: [RESEND PATCH 2/7] time: Change posix clocks ops interfaces to use timespec64

From: Thomas Gleixner
Date: Tue Mar 21 2017 - 05:05:16 EST


On Tue, 21 Mar 2017, Arnd Bergmann wrote:

> On Mon, Mar 20, 2017 at 9:40 PM, Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:
> > On Mon, 20 Mar 2017, Deepa Dinamani wrote:
> >> >> -static int ptp_clock_getres(struct posix_clock *pc, struct timespec *tp)
> >> >> +static int ptp_clock_getres(struct posix_clock *pc, struct timespec64 *tp)
> >> >
> >> > That's a pretty pointless exercise. getres() returns the resolution of the
> >> > clock which obviously can never be affected by Y2038.
> >>
> >> True, tv_sec does not need to be more than 32 bits here.
> >> We plan to limit the use of struct timespec to existing user interfaces only.
> >
> > This is an existing user space interface and there is no need to change it
> > at all.
>
> I think we should change it in the kernel, otherwise every libc implementation
> has to include a copy of this, to convert between the user space 16-byte
> timespec and the 8-byte kernel timespec. If we do it in the kernel, we only
> need one copy and the interface is consistent between 32-bit and 64-bit
> user space.

Fair enough. Please add a comment which explains why this uses a timespec64
as it is not obvious - as demonstrated :)

Thanks,

tglx