Hi Zijun, Elliott, On 5/19/23 01:30, enh wrote:
should probably remove the "The compilation warning looks to be going away in glibc 2.17 see glibc commit 4b7634a5e03b0da6f8875de9d3f74c1cf6f2a6e8" above, since this patch fixes that, but leave the FIXME because it looks like there are more FIXMEs below? On Thu, May 18, 2023 at 4:27 PM Zijun Zhao <zijunzhao@xxxxxxxxxx> wrote:Hi there, We are annotating settimeofday(), gettimeofday() and we will make tv Nonnull if compilation warnings will result. But after checking https://elixir.bootlin.com/linux/latest/source/kernel/time/time.c#L199 nd https://elixir.bootlin.com/linux/latest/source/kernel/time/time.c#L224, we think tv is okay to be nullable. So we make the fix to make it more clear. Best, Zijun Zhao
You'll also need to add _Nullable to the function prototypes in the SYNOPSIS. BTW, I see that glibc still requires nonnull in gettimeofday(3). It's only settimeofday(3) that is nullable. See: $ grepc gettimeofday /usr/include/*/sys/time.h /usr/include/x86_64-linux-gnu/sys/time.h:67: extern int gettimeofday (struct timeval *__restrict __tv, void *__restrict __tz) __THROW __nonnull ((1)); /usr/include/x86_64-linux-gnu/sys/time.h:75: # define gettimeofday __gettimeofday64 $ grepc settimeofday /usr/include/*/sys/time.h /usr/include/x86_64-linux-gnu/sys/time.h:86: extern int settimeofday (const struct timeval *__tv, const struct timezone *__tz) __THROW; /usr/include/x86_64-linux-gnu/sys/time.h:106: # define settimeofday __settimeofday64 And while NULL may be non-UB, the manual page is not very clear on why someone would want to call these functions with NULL. Could you please also explain why would someone want to call these functions with NULL? (Let's discuss it in the list, and then we see what wording we use for the page.) Thanks! Alex -- <http://www.alejandro-colomar.es/> GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5
Attachment:
OpenPGP_signature
Description: OpenPGP digital signature