On Thu, Jun 15, 2017 at 10:54:59AM +0200, Miroslav Lichvar wrote: > 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?
If you print nothing, you'd end up with this on x86_64: msg_control=[{cmsg_len=28, cmsg_level=SOL_SOCKET, cmsg_type=SCM_TIMESTAMP, cmsg_data=}] It doesn't look nice, does it? > > A side note: new SCM_* constants are arch-specific. > > I think the values are the same on most archs. Yes, with parisc and sparc as exceptions. > 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? I've just added some ifdefery to xlat/scmvals.in, but tests/msg_control.c is going to use these constants, too, and if you ifdefed them there you'd effectively disable new tests because most of these constants hasn't been added to libc headers yet. -- ldv
signature.asc
Description: PGP signature
------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________ Strace-devel mailing list Strace-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/strace-devel