summaryrefslogtreecommitdiffstats
path: root/usr.bin/truss
diff options
context:
space:
mode:
authorsjg <sjg@FreeBSD.org>2013-09-05 20:18:59 +0000
committersjg <sjg@FreeBSD.org>2013-09-05 20:18:59 +0000
commit62bb1062226d3ce6a2350808256a25508978352d (patch)
tree22b131dceb13c3df96da594fbaadb693504797c7 /usr.bin/truss
parent72ab90509b3a51ab361bf710338f2ef44a4e360d (diff)
parent04932445481c2cb89ff69a83b961bdef3d64757e (diff)
downloadFreeBSD-src-62bb1062226d3ce6a2350808256a25508978352d.zip
FreeBSD-src-62bb1062226d3ce6a2350808256a25508978352d.tar.gz
Merge from head
Diffstat (limited to 'usr.bin/truss')
-rw-r--r--usr.bin/truss/syscall.h2
-rw-r--r--usr.bin/truss/syscalls.c51
2 files changed, 48 insertions, 5 deletions
diff --git a/usr.bin/truss/syscall.h b/usr.bin/truss/syscall.h
index 49ff9a4..94776a0 100644
--- a/usr.bin/truss/syscall.h
+++ b/usr.bin/truss/syscall.h
@@ -40,7 +40,7 @@ enum Argtype { None = 1, Hex, Octal, Int, Name, Ptr, Stat, Ioctl, Quad,
Fd_set, Sigaction, Fcntl, Mprot, Mmapflags, Whence, Readlinkres,
Umtx, Sigset, Sigprocmask, Kevent, Sockdomain, Socktype, Open,
Fcntlflag, Rusage, BinString, Shutdown, Resource, Rlimit, Timeval2,
- Pathconf };
+ Pathconf, Rforkflags };
#define ARG_MASK 0xff
#define OUT 0x100
diff --git a/usr.bin/truss/syscalls.c b/usr.bin/truss/syscalls.c
index 0afd083..f5e2c46 100644
--- a/usr.bin/truss/syscalls.c
+++ b/usr.bin/truss/syscalls.c
@@ -93,6 +93,9 @@ static struct syscall syscalls[] = {
{ .name = "fcntl", .ret_type = 1, .nargs = 3,
.args = { { Int, 0 } , { Fcntl, 1 }, { Fcntlflag | OUT, 2 } } },
{ .name = "fork", .ret_type = 1, .nargs = 0 },
+ { .name = "vfork", .ret_type = 1, .nargs = 0 },
+ { .name = "rfork", .ret_type = 1, .nargs = 1,
+ .args = { { Rforkflags, 0 } } },
{ .name = "getegid", .ret_type = 1, .nargs = 0 },
{ .name = "geteuid", .ret_type = 1, .nargs = 0 },
{ .name = "getgid", .ret_type = 1, .nargs = 0 },
@@ -293,7 +296,7 @@ static struct xlat mmap_flags[] = {
X(MAP_SHARED) X(MAP_PRIVATE) X(MAP_FIXED) X(MAP_RENAME)
X(MAP_NORESERVE) X(MAP_RESERVED0080) X(MAP_RESERVED0100)
X(MAP_HASSEMAPHORE) X(MAP_STACK) X(MAP_NOSYNC) X(MAP_ANON)
- X(MAP_NOCORE) XEND
+ X(MAP_NOCORE) X(MAP_PREFAULT_READ) XEND
};
static struct xlat mprot_flags[] = {
@@ -343,7 +346,7 @@ static struct xlat open_flags[] = {
X(O_RDONLY) X(O_WRONLY) X(O_RDWR) X(O_ACCMODE) X(O_NONBLOCK)
X(O_APPEND) X(O_SHLOCK) X(O_EXLOCK) X(O_ASYNC) X(O_FSYNC)
X(O_NOFOLLOW) X(O_CREAT) X(O_TRUNC) X(O_EXCL) X(O_NOCTTY)
- X(O_DIRECT) XEND
+ X(O_DIRECT) X(O_DIRECTORY) X(O_EXEC) X(O_TTY_INIT) X(O_CLOEXEC) XEND
};
static struct xlat shutdown_arg[] = {
@@ -369,6 +372,11 @@ static struct xlat pathconf_arg[] = {
XEND
};
+static struct xlat rfork_flags[] = {
+ X(RFPROC) X(RFNOWAIT) X(RFFDG) X(RFCFDG) X(RFTHREAD) X(RFMEM)
+ X(RFSIGSHARE) X(RFTSIGZMB) X(RFLINUXTHPN) XEND
+};
+
#undef X
#undef XEND
@@ -885,9 +893,41 @@ print_arg(struct syscall_args *sc, unsigned long *args, long retval,
case Mprot:
tmp = strdup(xlookup_bits(mprot_flags, args[sc->offset]));
break;
- case Mmapflags:
- tmp = strdup(xlookup_bits(mmap_flags, args[sc->offset]));
+ case Mmapflags: {
+ char *base, *alignstr;
+ int align, flags;
+
+ /*
+ * MAP_ALIGNED can't be handled by xlookup_bits(), so
+ * generate that string manually and prepend it to the
+ * string from xlookup_bits(). Have to be careful to
+ * avoid outputting MAP_ALIGNED|0 if MAP_ALIGNED is
+ * the only flag.
+ */
+ flags = args[sc->offset] & ~MAP_ALIGNMENT_MASK;
+ align = args[sc->offset] & MAP_ALIGNMENT_MASK;
+ if (align != 0) {
+ if (align == MAP_ALIGNED_SUPER)
+ alignstr = strdup("MAP_ALIGNED_SUPER");
+ else
+ asprintf(&alignstr, "MAP_ALIGNED(%d)",
+ align >> MAP_ALIGNMENT_SHIFT);
+ if (flags == 0) {
+ tmp = alignstr;
+ break;
+ }
+ } else
+ alignstr = NULL;
+ base = strdup(xlookup_bits(mmap_flags, flags));
+ if (alignstr == NULL) {
+ tmp = base;
+ break;
+ }
+ asprintf(&tmp, "%s|%s", alignstr, base);
+ free(alignstr);
+ free(base);
break;
+ }
case Whence:
tmp = strdup(xlookup(whence_arg, args[sc->offset]));
break;
@@ -906,6 +946,9 @@ print_arg(struct syscall_args *sc, unsigned long *args, long retval,
case Pathconf:
tmp = strdup(xlookup(pathconf_arg, args[sc->offset]));
break;
+ case Rforkflags:
+ tmp = strdup(xlookup_bits(rfork_flags, args[sc->offset]));
+ break;
case Sockaddr: {
struct sockaddr_storage ss;
char addr[64];
OpenPOWER on IntegriCloud