diff options
author | jhb <jhb@FreeBSD.org> | 2015-08-17 17:57:01 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2015-08-17 17:57:01 +0000 |
commit | 8dd86f34b38615b27645c2314e8256fef9087d46 (patch) | |
tree | a24d1c68c3db387bb01b437fc70add54591a9ed4 /usr.bin/truss | |
parent | 5c8f8904c2ccd3bdc55ed206c42640cba1d5b982 (diff) | |
download | FreeBSD-src-8dd86f34b38615b27645c2314e8256fef9087d46.zip FreeBSD-src-8dd86f34b38615b27645c2314e8256fef9087d46.tar.gz |
Decode the optional SOCK_NONBLOCK and SOCK_CLOEXEC flags passed in a
socket type.
Diffstat (limited to 'usr.bin/truss')
-rw-r--r-- | usr.bin/truss/syscalls.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/usr.bin/truss/syscalls.c b/usr.bin/truss/syscalls.c index e1f166c..26c90b8 100644 --- a/usr.bin/truss/syscalls.c +++ b/usr.bin/truss/syscalls.c @@ -1228,9 +1228,22 @@ print_arg(struct syscall_args *sc, unsigned long *args, long retval, case Sockdomain: tmp = strdup(xlookup(sockdomain_arg, args[sc->offset])); break; - case Socktype: - tmp = strdup(xlookup(socktype_arg, args[sc->offset])); + case Socktype: { + FILE *fp; + size_t len; + int type, flags; + + flags = args[sc->offset] & (SOCK_CLOEXEC | SOCK_NONBLOCK); + type = args[sc->offset] & ~flags; + fp = open_memstream(&tmp, &len); + fputs(xlookup(socktype_arg, type), fp); + if (flags & SOCK_CLOEXEC) + fprintf(fp, "|SOCK_CLOEXEC"); + if (flags & SOCK_NONBLOCK) + fprintf(fp, "|SOCK_NONBLOCK"); + fclose(fp); break; + } case Shutdown: tmp = strdup(xlookup(shutdown_arg, args[sc->offset])); break; |