aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/truss/setup.c
diff options
context:
space:
mode:
authorBryan Drewery <bdrewery@FreeBSD.org>2015-10-05 18:08:35 +0000
committerBryan Drewery <bdrewery@FreeBSD.org>2015-10-05 18:08:35 +0000
commit6c61b0f3241319388031e5213d1fbf0a7f969d62 (patch)
tree53a718138dd748ebf142fbbbbb1f554f9aac8dda /usr.bin/truss/setup.c
parent89ef7a960ae93177b0923943aa2c4f86c45bc497 (diff)
downloadsrc-6c61b0f3241319388031e5213d1fbf0a7f969d62.tar.gz
src-6c61b0f3241319388031e5213d1fbf0a7f969d62.zip
Notes
Diffstat (limited to 'usr.bin/truss/setup.c')
-rw-r--r--usr.bin/truss/setup.c59
1 files changed, 23 insertions, 36 deletions
diff --git a/usr.bin/truss/setup.c b/usr.bin/truss/setup.c
index 4452f9f47c7f..74008e402582 100644
--- a/usr.bin/truss/setup.c
+++ b/usr.bin/truss/setup.c
@@ -341,17 +341,9 @@ enter_syscall(struct trussinfo *info, struct ptrace_lwpinfo *pl)
fprintf(info->outfile, "-- UNKNOWN %s SYSCALL %d --\n",
t->proc->abi->type, t->cs.number);
- sc = get_syscall(t->cs.name);
- if (sc) {
- t->cs.nargs = sc->nargs;
- assert(sc->nargs <= nitems(t->cs.s_args));
- } else {
-#if DEBUG
- fprintf(stderr, "unknown syscall %s -- setting "
- "args to %d\n", t->cs.name, t->cs.nargs);
-#endif
- t->cs.nargs = narg;
- }
+ sc = get_syscall(t->cs.name, narg);
+ t->cs.nargs = sc->nargs;
+ assert(sc->nargs <= nitems(t->cs.s_args));
t->cs.sc = sc;
@@ -372,7 +364,7 @@ enter_syscall(struct trussinfo *info, struct ptrace_lwpinfo *pl)
t->cs.args[sc->args[i].offset] : t->cs.args[i],
i < (t->cs.nargs - 1) ? "," : "");
#endif
- if (sc && !(sc->args[i].type & OUT)) {
+ if (!(sc->args[i].type & OUT)) {
t->cs.s_args[i] = print_arg(&sc->args[i],
t->cs.args, 0, info);
}
@@ -407,31 +399,26 @@ exit_syscall(struct trussinfo *info, struct ptrace_lwpinfo *pl)
}
sc = t->cs.sc;
- if (sc == NULL) {
- for (i = 0; i < t->cs.nargs; i++)
- asprintf(&t->cs.s_args[i], "0x%lx", t->cs.args[i]);
- } else {
- /*
- * Here, we only look for arguments that have OUT masked in --
- * otherwise, they were handled in enter_syscall().
- */
- for (i = 0; i < sc->nargs; i++) {
- char *temp;
-
- if (sc->args[i].type & OUT) {
- /*
- * If an error occurred, then don't bother
- * getting the data; it may not be valid.
- */
- if (errorp) {
- asprintf(&temp, "0x%lx",
- t->cs.args[sc->args[i].offset]);
- } else {
- temp = print_arg(&sc->args[i],
- t->cs.args, retval, info);
- }
- t->cs.s_args[i] = temp;
+ /*
+ * Here, we only look for arguments that have OUT masked in --
+ * otherwise, they were handled in enter_syscall().
+ */
+ for (i = 0; i < sc->nargs; i++) {
+ char *temp;
+
+ if (sc->args[i].type & OUT) {
+ /*
+ * If an error occurred, then don't bother
+ * getting the data; it may not be valid.
+ */
+ if (errorp) {
+ asprintf(&temp, "0x%lx",
+ t->cs.args[sc->args[i].offset]);
+ } else {
+ temp = print_arg(&sc->args[i],
+ t->cs.args, retval, info);
}
+ t->cs.s_args[i] = temp;
}
}