Re: [PATCH 09/13] tools/nolibc: sys_poll: riscv: use __NR_ppoll_time64 for rv32

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, May 28, 2023, at 10:25, Zhangjin Wu wrote:
>> On Fri, May 26, 2023, at 09:15, Thomas Wei=C3=9Fschuh wrote:

> * Use __NR_*time64 for all 32bit platforms
> * Use __NR_pselect6/ppoll/clock_gettime only for 64bit platforms
> * New sizeof tests added to verify off_t, time_t, timespec, itimerspec...
>
>    	CASE_TEST(sizeof_time_t);           EXPECT_EQ(1, 8,   
> sizeof(time_t)); break;
>     	CASE_TEST(sizeof_timespec);         EXPECT_EQ(1, 16,  
> sizeof(struct timespec)); break;
>     #ifdef NOLIBC
>     	CASE_TEST(sizeof_itimerspec);       EXPECT_EQ(1, 32,  
> sizeof(struct itimerspec)); break;
>     #endif
>     	CASE_TEST(sizeof_timeval);          EXPECT_EQ(1, 16,  
> sizeof(struct timeval)); break;
>     	CASE_TEST(sizeof_itimerval);        EXPECT_EQ(1, 32,  
> sizeof(struct itimerval)); break;
>     	CASE_TEST(sizeof_off_t);            EXPECT_EQ(1, 8,   
> sizeof(off_t)); break;
>
>
> @Arnd, the above timeval/itimerval definitions are used to override the ones
> from linux/time.h to avoid such error:
>
>     error: redefinition of ‘struct timeval’
>
>     nolibc/sysroot/riscv/include/types.h:225:8: error: redefinition of 
> ‘struct timeval’
>       225 | struct timeval {
>           |        ^~~~~~~
>     In file included from nolibc/sysroot/riscv/include/types.h:11,
>                      from nolibc/sysroot/riscv/include/nolibc.h:98,
>                      from nolibc/sysroot/riscv/include/errno.h:26,
>                      from nolibc/sysroot/riscv/include/stdio.h:14,
>                      from 
> tools/testing/selftests/nolibc/nolibc-test.c:12:
>     nolibc/sysroot/riscv/include/linux/time.h:16:8: note: originally 
> defined here
>        16 | struct timeval {
>
> @Arnd, As you commented in another reply, is it time for us to update
> include/uapi/linux/time.h together and let it provide time64 timeval/itimerval
> instead of the old ones? perhaps some libc's are still using them.

It's hard to know if anything is using it until we try. On the other
hand, we also know that anything still relying on it is going to be
increasingly broken on 32-bit architectures over as we get closer to
y2038, so we can just try removing these here to see what happens.

> Or perhaps we can add a switch like __ARCH_WANT_TIME32_SYSCALLS, add a
> __ARCH_WANT_TIME32_STRUCTS and simply bind it with __ARCH_WANT_TIME32_SYSCALLS?

I don't like that idea: __ARCH_WANT_TIME32_SYSCALLS tells us that
an architeture still provides those syscalls for compatibility, so
that is architecture specific, but __ARCH_WANT_TIME32_STRUCTS is not
something that is an architecture specific decision at all, it's
only needed for old source code.

> About the above ugly override code, What's your suggestion in v2? ;-)

Can you maybe just remove the "#include <linux/time.h>" from all
include/uapi/ and nolibc headers so it just never gets seen?

Unfortunately I see the header contains a few other definitions,
which might have to get moved out of the way, possibly to
linux/time_types.h.

       Arnd




[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux