decoding of input/output args ?

Dmitry V. Levin ldv at altlinux.org
Wed Aug 19 19:36:18 UTC 2015


On Wed, Aug 19, 2015 at 03:17:39PM -0400, Mike Frysinger wrote:
> some syscalls have arguments that are read/write.  for example, getsockopt 
> passes in a pointer to a length that has to be set correctly first, and then
> the kernel will adjust it when returning.  being able to see both values is
> important when getting an error so you can see what the user sent up and what
> the kernel sent back.
> 
> are there examples in strace to look at ?  perhaps something like:
> getsockopt(4, SOL_IP, IPT_SO_GET_ENTRIES, "...", [2900->2804]) = 0
> and when you get an error it'd be:
> getsockopt(4, SOL_IP, IPT_SO_GET_ENTRIES, 0x12345, [2900->2900]) = EINVAL

I think there is no need to print it in case of an error,
when it's known to be unchanged.

We have several examples in the code:
$ git grep '[^a-z] => ' *.c
mtd.c:			tprints(" => ");
mtd.c:			tprints(" => ");
sendfile.c:			tprints(" => ");
sendfile.c:			tprints(" => ");
sock.c:	tprints(" => ");
v4l2.c:			tprints(exiting(tcp) && code != VIDIOC_G_FMT ? " => " : ", ");
v4l2.c:		tprints(exiting(tcp) && code == VIDIOC_S_PARM ? " => {" : ", {");
v4l2.c:			tprints(exiting(tcp) ? " => " : ", {id=");
v4l2.c:		tprints(code != VIDIOC_G_EXT_CTRLS && exiting(tcp) ? " => " : ", ");

The most recent one is from commits v4.10-319-g22f8b27 and
v4.10-320-g4918285.


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20150819/62cd562f/attachment.bin>


More information about the Strace-devel mailing list