From ecac235bb0253f5a08371f565eac9468946c973b Mon Sep 17 00:00:00 2001 From: Michael Tuexen Date: Wed, 3 May 2017 09:23:13 +0000 Subject: [PATCH] Decode the third argument of socket(). --- usr.bin/truss/syscall.h | 2 +- usr.bin/truss/syscalls.c | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/usr.bin/truss/syscall.h b/usr.bin/truss/syscall.h index e703d434f315..e4c3beeb292e 100644 --- a/usr.bin/truss/syscall.h +++ b/usr.bin/truss/syscall.h @@ -46,7 +46,7 @@ enum Argtype { None = 1, Hex, Octal, Int, UInt, LongHex, Name, Ptr, Stat, Ioctl, LinuxSockArgs, Umtxop, Atfd, Atflags, Timespec2, Accessmode, Long, Sysarch, ExecArgs, ExecEnv, PipeFds, QuadHex, Utrace, IntArray, Pipe2, CapFcntlRights, Fadvice, FileFlags, Flockop, Getfsstatmode, Kldsymcmd, - Kldunloadflags, Sizet, Madvice, Socklent, + Kldunloadflags, Sizet, Madvice, Socklent, Sockprotocol, CloudABIAdvice, CloudABIClockID, ClouduABIFDSFlags, CloudABIFDStat, CloudABIFileStat, CloudABIFileType, diff --git a/usr.bin/truss/syscalls.c b/usr.bin/truss/syscalls.c index 1254f3b25214..61554115824f 100644 --- a/usr.bin/truss/syscalls.c +++ b/usr.bin/truss/syscalls.c @@ -317,7 +317,7 @@ static struct syscall decoded_syscalls[] = { { .name = "sigwaitinfo", .ret_type = 1, .nargs = 2, .args = { { Sigset | IN, 0 }, { Ptr, 1 } } }, { .name = "socket", .ret_type = 1, .nargs = 3, - .args = { { Sockdomain, 0 }, { Socktype, 1 }, { Int, 2 } } }, + .args = { { Sockdomain, 0 }, { Socktype, 1 }, { Sockprotocol, 2 } } }, { .name = "stat", .ret_type = 1, .nargs = 2, .args = { { Name | IN, 0 }, { Stat | OUT, 1 } } }, { .name = "statfs", .ret_type = 1, .nargs = 2, @@ -1917,6 +1917,17 @@ print_arg(struct syscall_args *sc, unsigned long *args, long *retval, case Socklent: fprintf(fp, "%u", (socklen_t)args[sc->offset]); break; + case Sockprotocol: { + int protocol; + + protocol = args[sc->offset]; + if (protocol == 0) { + fputs("0", fp); + } else { + print_integer_arg(sysdecode_ipproto, fp, protocol); + } + break; + } case CloudABIAdvice: fputs(xlookup(cloudabi_advice, args[sc->offset]), fp);