[PATCH] msghdr: print SCM_TIMESTAMP* control messages

Miroslav Lichvar mlichvar at redhat.com
Thu Jun 15 08:54:59 UTC 2017


On Thu, Jun 15, 2017 at 11:43:37AM +0300, Dmitry V. Levin wrote:
> On Thu, Jun 15, 2017 at 10:06:47AM +0200, Miroslav Lichvar wrote:
> > Ok. I guess I need to add new printing functions and check the length
> > there, but I'm not sure how to name them. Would the following work?
> > 
> > MPERS_PRINTER_DECL(void, print_timeval_data,
> > 		   const void *arg, const size_t size)
> > MPERS_PRINTER_DECL(void, print_timespec_data,
> > 		   const void *arg, const size_t size)
> > MPERS_PRINTER_DECL(void, print_timespec_array, const void *arg,
> > 		   const unsigned int nmemb, const size_t size)
> 
> If they were regular pure printers, nowadays they would be called
> - print_struct_timeval,
> - print_struct_timespec,
> - print_struct_timespec_array
> In fact, print_struct_timeval already exists and does exactly that.
> 
> If you are going to add modifications of these functions that also accept
> data length along with data pointer, ideally this should be reflected
> in their name, e.g. print_struct_timeval_data_size.

Ok.

> What do you think these functions should print in case the data size
> is smaller than necessary?

Nothing. Is there a better option?

> A side note: new SCM_* constants are arch-specific.

I think the values are the same on most archs. If they don't have a
default value, the compilation will fail on systems that don't have
them yet. Would it be preferred to check for them in configure and
disable the printers if missing?

-- 
Miroslav Lichvar




More information about the Strace-devel mailing list