Decode the third argument of socket().

This commit is contained in:
tuexen 2017-05-03 09:23:13 +00:00
parent de22e2aa7e
commit 72a60419e7
2 changed files with 13 additions and 2 deletions

View File

@ -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,

View File

@ -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);