summaryrefslogtreecommitdiffstats
path: root/usr.bin/truss
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2014-12-16 21:57:55 +0000
committerjhb <jhb@FreeBSD.org>2014-12-16 21:57:55 +0000
commit9adaeb545214b0236fb6cee72c68ecda8a52605c (patch)
tree488576a8e9270f897180c0b768f8c3d6f97c1f5d /usr.bin/truss
parent7cc43d5ff85217e4aff8929e976bc2a175891fca (diff)
downloadFreeBSD-src-9adaeb545214b0236fb6cee72c68ecda8a52605c.zip
FreeBSD-src-9adaeb545214b0236fb6cee72c68ecda8a52605c.tar.gz
MFC 273053:
Decode the arguments passed to _umtx_op(). In particular, decode the opcode.
Diffstat (limited to 'usr.bin/truss')
-rw-r--r--usr.bin/truss/syscall.h5
-rw-r--r--usr.bin/truss/syscalls.c21
2 files changed, 24 insertions, 2 deletions
diff --git a/usr.bin/truss/syscall.h b/usr.bin/truss/syscall.h
index 58520aa..b74eded 100644
--- a/usr.bin/truss/syscall.h
+++ b/usr.bin/truss/syscall.h
@@ -5,6 +5,7 @@
* Hex -- values that should be printed in hex (addresses)
* Octal -- Same as above, but octal
* Int -- normal integer values (file descriptors, for example)
+ * LongHex -- long value that should be printed in hex
* Name -- pointer to a NULL-terminated string.
* BinString -- pointer to an array of chars, printed via strvisx().
* Ptr -- pointer to some unspecified structure. Just print as hex for now.
@@ -35,13 +36,13 @@
* $FreeBSD$
*/
-enum Argtype { None = 1, Hex, Octal, Int, Name, Ptr, Stat, Ioctl, Quad,
+enum Argtype { None = 1, Hex, Octal, Int, LongHex, Name, Ptr, Stat, Ioctl, Quad,
Signal, Sockaddr, StringArray, Timespec, Timeval, Itimerval, Pollfd,
Fd_set, Sigaction, Fcntl, Mprot, Mmapflags, Whence, Readlinkres,
Umtx, Sigset, Sigprocmask, Kevent, Sockdomain, Socktype, Open,
Fcntlflag, Rusage, BinString, Shutdown, Resource, Rlimit, Timeval2,
Pathconf, Rforkflags, ExitStatus, Waitoptions, Idtype, Procctl,
- LinuxSockArgs };
+ LinuxSockArgs, Umtxop };
#define ARG_MASK 0xff
#define OUT 0x100
diff --git a/usr.bin/truss/syscalls.c b/usr.bin/truss/syscalls.c
index 585a8fa..f473be4 100644
--- a/usr.bin/truss/syscalls.c
+++ b/usr.bin/truss/syscalls.c
@@ -283,6 +283,9 @@ static struct syscall syscalls[] = {
{ Waitoptions, 3 }, { Rusage | OUT, 4 }, { Ptr, 5 } } },
{ .name = "procctl", .ret_type = 1, .nargs = 4,
.args = { { Idtype, 0 }, { Int, 1 }, { Procctl, 2 }, { Ptr, 3 } } },
+ { .name = "_umtx_op", .ret_type = 1, .nargs = 5,
+ .args = { { Ptr, 0 }, { Umtxop, 1 }, { LongHex, 2 }, { Ptr, 3 },
+ { Ptr, 4 } } },
{ .name = 0 },
};
@@ -416,6 +419,18 @@ static struct xlat procctl_arg[] = {
X(PROC_SPROTECT) XEND
};
+static struct xlat umtx_ops[] = {
+ X(UMTX_OP_LOCK) X(UMTX_OP_UNLOCK) X(UMTX_OP_WAIT)
+ X(UMTX_OP_WAKE) X(UMTX_OP_MUTEX_TRYLOCK) X(UMTX_OP_MUTEX_LOCK)
+ X(UMTX_OP_MUTEX_UNLOCK) X(UMTX_OP_SET_CEILING) X(UMTX_OP_CV_WAIT)
+ X(UMTX_OP_CV_SIGNAL) X(UMTX_OP_CV_BROADCAST) X(UMTX_OP_WAIT_UINT)
+ X(UMTX_OP_RW_RDLOCK) X(UMTX_OP_RW_WRLOCK) X(UMTX_OP_RW_UNLOCK)
+ X(UMTX_OP_WAIT_UINT_PRIVATE) X(UMTX_OP_WAKE_PRIVATE)
+ X(UMTX_OP_MUTEX_WAIT) X(UMTX_OP_MUTEX_WAKE) X(UMTX_OP_SEM_WAIT)
+ X(UMTX_OP_SEM_WAKE) X(UMTX_OP_NWAKE_PRIVATE) X(UMTX_OP_MUTEX_WAKE2)
+ XEND
+};
+
#undef X
#undef XEND
@@ -612,6 +627,9 @@ print_arg(struct syscall_args *sc, unsigned long *args, long retval,
case Int:
asprintf(&tmp, "%d", (int)args[sc->offset]);
break;
+ case LongHex:
+ asprintf(&tmp, "0x%lx", args[sc->offset]);
+ break;
case Name: {
/* NULL-terminated string. */
char *tmp2;
@@ -1288,6 +1306,9 @@ print_arg(struct syscall_args *sc, unsigned long *args, long retval,
case Procctl:
tmp = strdup(xlookup(procctl_arg, args[sc->offset]));
break;
+ case Umtxop:
+ tmp = strdup(xlookup(umtx_ops, args[sc->offset]));
+ break;
default:
errx(1, "Invalid argument type %d\n", sc->type & ARG_MASK);
}
OpenPOWER on IntegriCloud