c - Strace with writev() function in Linux, what does the '@', '2w', and '240K' represent in the data? -
c - Strace with writev() function in Linux, what does the '@', '2w', and '240K' represent in the data? -
i have strace of programme interacts usb, , wondering next write command tells me. understand writev iovec construction consists of info array pointer followed length, "@\10\335 \320\2w\4\240k\252\0\7"
in info array denote? i'm particularly wondering @ symbol, 2w, , 240k means not hex info values expect them be.
i'm running on linux , here writev line:
writev(6, [{"@\10\335 \320\2w\4\240k\252\0\7", 13}, {"\0\0\0\4\0\0\0\4", 8}], 2) = 21
from man page of writev
:
ssize_t readv(int fd, const struct iovec *iov, int iovcnt);
that is, sec argument array of size value of 3rd argument (2
in case) elements of type struct iovec
.
when strace
prints octal escapes unprintable characters displays other can printed. hence, @
byte corresponding @
, k
byte corresponding k
, on.
answering questions in comment, @ man page shows
struct iovec { void *iov_base; /* starting address */ size_t iov_len; /* number of bytes transfer */ };
which means {"@\10\335 \320\2w\4\240k\252\0\7", 13}
read iov_len = 13
, iov_base
memory area containing bytes printed @\10\335 \320\2w\4\240k\252\0\7
. fire gdb
if want see binary values:
[mihai@winterfell 1]$ gdb -q (gdb) p/x "@\10\335 \320\2w\4\240k\252\0\7" $1 = {0x40, 0x8, 0xdd, 0x20, 0xd0, 0x2, 0x77, 0x4, 0xa0, 0x4b, 0xaa, 0x0, 0x7, 0x0}
where lastly 0x0
null terminator of string , should ignored.
c linux strace
Comments
Post a Comment