On Fri, Jan 06, 2017 at 03:16:30PM +0800, JingPiao Chen wrote: [...] > +#include "defs.h" > +#include <ustat.h> > + > +SYS_FUNC(ustat) > +{ > + if (entering(tcp)) > + print_dev_t(tcp->u_arg[0]); > + else { > + struct ustat ust;
This structure is personality specific and therefore must be mpersified. > + tprints(", "); > + if (umoven_or_printaddr(tcp, tcp->u_arg[1], sizeof(ust), &ust)) > + return 0; Use umove_or_printaddr. > + tprintf("{f_tfree=%lld, f_tinode=%llu", > + sign_extend_unsigned_to_ll(ust.f_tfree)); Why sign extend it and print it as signed? It's the number of free blocks, it cannot be negative. Inside the kernel, struct kstatfs.f_bfree is of type u64. > + zero_extend_signed_to_ull(ust.f_tinode), > + tprints(", f_fname="); > + print_quoted_string(ust.f_fname, sizeof(ust.f_fname), > + QUOTE_0_TERMINATED); > + tprints(", f_fpack="); > + print_quoted_string(ust.f_fpack, sizeof(ust.f_fpack), > + QUOTE_0_TERMINATED); These fields are guaranteed by kernel to be zero, why bother printing them at all? -- ldv
pgpaV10yO7OKm.pgp
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