The documentation of uClibc-ng does not mention linux support beyond 4.x.

Maybe a check should be added to the header file enabling time64 support?

Dmitriy Chestnykh wrote:
> linux 4.x doesn't support time64 syscalls
> 
> вс, 22 дек. 2024 г., 13:00 Nadav Tasher <tasherna...@gmail.com>:
> 
> > Interesting - I have been able to reproduce the bug when compiling like
> > so:
> > make CROSS_COMPILE=mips-linux-gnu- TARGET_ARCH=mips
> > KERNEL_HEADERS=~/linux-headers-4.19.325/include/ -j4 clean
> > make CROSS_COMPILE=mips-linux-gnu- TARGET_ARCH=mips
> > KERNEL_HEADERS=~/linux-headers-4.19.325/include/ -j4
> >
> > Note that this also reproduces in the existing toolchain at
> > https://toolchains.bootlin.com/downloads/releases/toolchains/mips32/tarballs/mips32--uclibc--stable-2024.05-1.tar.xz
> > (this is actually how I encountered the bug).
> >
> > Dmitriy Chestnykh wrote:
> > > Cannot reproduce it with the latest uclibc.
> > > Config in attachment
> > >
> > >
> > > сб, 21 дек. 2024 г. в 14:20, Nadav Tasher <tasherna...@gmail.com>:
> > >
> > > > Hi Waldemar,
> > > >
> > > > The following snippet should do it when compiled statically for MIPS32
> > > > and emulated using qemu-user-static:
> > > >
> > > > #include <time.h>
> > > > #include <stddef.h>
> > > > #include <unistd.h>
> > > >
> > > > int main(int argc, char **argv) {
> > > >
> > > >         time_t start = time(NULL);
> > > >         sleep(2);
> > > >         time_t end = time(NULL);
> > > >
> > > >         return end != start;
> > > > }
> > > >
> > > > When I strace the resulting binary, I saw:
> > > > [pid 2271212] rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
> > > > [pid 2271212] clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=2},
> > > > 0x7ffca592a250) = 0
> > > > [pid 2271212] brk(0x611d0d49b000)       = 0x611d0d49b000
> > > > [pid 2271212] exit_group(1)             = ?
> > > >
> > > > But I expected to see:
> > > > [pid 2271212] rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
> > > > [pid 2271212] clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=2, tv_nsec=0},
> > > > 0x7ffca592a250) = 0
> > > > [pid 2271212] brk(0x611d0d49b000)       = 0x611d0d49b000
> > > > [pid 2271212] exit_group(1)             = ?
> > > >
> > > > kind regards
> > > >  Nadav
> > > >
> > > > Waldemar Brodkorb wrote,
> > > > > Hi Nadav,
> > > > >
> > > > > do you have some test code showing the issue?
> > > > >
> > > > > best regards
> > > > >  Waldemar
> > > > >
> > > > > Nadav Tasher wrote,
> > > > >
> > > > > > Without this change `timespec` is too large for the
> > `clock_nanosleep`
> > > > syscall,
> > > > > > which translates to sleep(0) on 32bit systems when TIME64 is
> > enabled
> > > > (the default).
> > > > > >
> > > > > > Tested on MIPS.
> > > > > >
> > > > > > Signed-off-by: Nadav Tasher <tasherna...@gmail.com>
> > > > > > ---
> > > > > >  include/time.h | 2 +-
> > > > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > > > >
> > > > > > diff --git a/include/time.h b/include/time.h
> > > > > > index 1a1408990..25dfb9e2e 100644
> > > > > > --- a/include/time.h
> > > > > > +++ b/include/time.h
> > > > > > @@ -118,7 +118,7 @@ typedef __timer_t timer_t;
> > > > > >     has nanoseconds instead of microseconds.  */
> > > > > >  struct timespec
> > > > > >    {
> > > > > > -    __time_t tv_sec;               /* Seconds.  */
> > > > > > +    int tv_sec;            /* Seconds.  */
> > > > > >      long int tv_nsec;              /* Nanoseconds.  */
> > > > > >    };
> > > > > >
> > > > > > --
> > > > > > 2.34.1
> > > > > >
> > > > > > _______________________________________________
> > > > > > devel mailing list -- devel@uclibc-ng.org
> > > > > > To unsubscribe send an email to devel-le...@uclibc-ng.org
> > > > > >
> > > > _______________________________________________
> > > > devel mailing list -- devel@uclibc-ng.org
> > > > To unsubscribe send an email to devel-le...@uclibc-ng.org
> > > >
> >
> >
> >
_______________________________________________
devel mailing list -- devel@uclibc-ng.org
To unsubscribe send an email to devel-le...@uclibc-ng.org

Reply via email to