[PATCH v5 3/3] Linux: Only generate 64 bit timestamps for 64 bit time_t recvmsg/recvmmsg
Adhemerval Zanella
adhemerval.zanella@linaro.org
Fri Jan 28 16:42:31 GMT 2022
On 28/01/2022 11:02, Florian Weimer wrote:
> * Adhemerval Zanella:
>
>> diff --git a/sysdeps/unix/sysv/linux/tst-socket-timestamp-compat.c b/sysdeps/unix/sysv/linux/tst-socket-timestamp-compat.c
>
>> +/* Check if recvmsg create the additional 64 bit timestamp if only 32 bit
>> + is enabled for 64 bit recvmsg symbol. */
>> +static void
>> +do_test_large_buffer (bool mc)
>> +{
>> + struct mmsghdr mmhdr = { 0 };
>> + /* It should be large enought for either timeval/timespec and the
>> + 64 time type as well. */
>> + char msgbuf[512];
>
> I think this needs a union with struct cmsgbuf to ensure alignment.
> Alternatively, use malloc.
Yeah, it does require to setup the alignment. I will change to use an union.
>
>
>> +static void
>> +do_test_small_buffer (bool mc)
>> +{
>> + struct mmsghdr mmhdr = { 0 };
>> +
>> + /* Enable 32 bit timeval precision and check if no 64 bit timeval stamp
>> + is created. */
>> + {
>> + char msgbuf[CMSG_SPACE (sizeof (struct timeval))];
>
> Likewise.
>
> Rest looks okay. The kernel does not pass on whether a time32 or time64
> system call was used, so implementing time32 recvmsg with recvmsg_time64
> is fine in that regard.
>
> Thanks,
> Florian
>
More information about the Libc-alpha
mailing list