From 27459358ed4d9060525ff02148eba0939ab4dc04 Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Sat, 18 Mar 2017 18:21:41 +0000 Subject: [PATCH] Decode file flags passed to *chflags*(). While here, decode arguments passed to fchflags() and chflagsat(). --- usr.bin/truss/syscall.h | 2 +- usr.bin/truss/syscalls.c | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/usr.bin/truss/syscall.h b/usr.bin/truss/syscall.h index 0bd96b3373a..878e85f7fc6 100644 --- a/usr.bin/truss/syscall.h +++ b/usr.bin/truss/syscall.h @@ -45,7 +45,7 @@ enum Argtype { None = 1, Hex, Octal, Int, UInt, LongHex, Name, Ptr, Stat, Ioctl, Pathconf, Rforkflags, ExitStatus, Waitoptions, Idtype, Procctl, LinuxSockArgs, Umtxop, Atfd, Atflags, Timespec2, Accessmode, Long, Sysarch, ExecArgs, ExecEnv, PipeFds, QuadHex, Utrace, IntArray, Pipe2, - CapFcntlRights, Fadvice, + CapFcntlRights, Fadvice, FileFlags, CloudABIAdvice, CloudABIClockID, ClouduABIFDSFlags, CloudABIFDStat, CloudABIFileStat, CloudABIFileType, diff --git a/usr.bin/truss/syscalls.c b/usr.bin/truss/syscalls.c index c9d6c1314d4..7207ba68f6f 100644 --- a/usr.bin/truss/syscalls.c +++ b/usr.bin/truss/syscalls.c @@ -99,7 +99,10 @@ static struct syscall decoded_syscalls[] = { { .name = "chdir", .ret_type = 1, .nargs = 1, .args = { { Name, 0 } } }, { .name = "chflags", .ret_type = 1, .nargs = 2, - .args = { { Name | IN, 0 }, { Hex, 1 } } }, + .args = { { Name | IN, 0 }, { FileFlags, 1 } } }, + { .name = "chflagsat", .ret_type = 1, .nargs = 4, + .args = { { Atfd, 0 }, { Name | IN, 1 }, { FileFlags, 2 }, + { Atflags, 3 } } }, { .name = "chmod", .ret_type = 1, .nargs = 2, .args = { { Name, 0 }, { Octal, 1 } } }, { .name = "chown", .ret_type = 1, .nargs = 3, @@ -125,6 +128,8 @@ static struct syscall decoded_syscalls[] = { { .name = "faccessat", .ret_type = 1, .nargs = 4, .args = { { Atfd, 0 }, { Name | IN, 1 }, { Accessmode, 2 }, { Atflags, 3 } } }, + { .name = "fchflags", .ret_type = 1, .nargs = 2, + .args = { { Int, 0 }, { FileFlags, 1 } } }, { .name = "fchmod", .ret_type = 1, .nargs = 2, .args = { { Int, 0 }, { Octal, 1 } } }, { .name = "fchmodat", .ret_type = 1, .nargs = 4, @@ -189,7 +194,7 @@ static struct syscall decoded_syscalls[] = { { .name = "kse_release", .ret_type = 0, .nargs = 1, .args = { { Timespec, 0 } } }, { .name = "lchflags", .ret_type = 1, .nargs = 2, - .args = { { Name | IN, 0 }, { Hex, 1 } } }, + .args = { { Name | IN, 0 }, { FileFlags, 1 } } }, { .name = "lchmod", .ret_type = 1, .nargs = 2, .args = { { Name, 0 }, { Octal, 1 } } }, { .name = "lchown", .ret_type = 1, .nargs = 3, @@ -1868,6 +1873,15 @@ print_arg(struct syscall_args *sc, unsigned long *args, long *retval, case Fadvice: print_integer_arg(sysdecode_fadvice, fp, args[sc->offset]); break; + case FileFlags: { + fflags_t rem; + + if (!sysdecode_fileflags(fp, args[sc->offset], &rem)) + fprintf(fp, "0x%x", rem); + else if (rem != 0) + fprintf(fp, "|0x%x", rem); + break; + } case CloudABIAdvice: fputs(xlookup(cloudabi_advice, args[sc->offset]), fp);