summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2011-12-04 18:43:09 +0000
committerkib <kib@FreeBSD.org>2011-12-04 18:43:09 +0000
commitaebf2bbe921058ed247813d826b5362d33de3ab4 (patch)
tree55ab5767630d67a0609214a3e133218945f8ce84 /usr.bin
parente7537e29440bb79c1ae28bd4d17477b3eb4baaa7 (diff)
downloadFreeBSD-src-aebf2bbe921058ed247813d826b5362d33de3ab4.zip
FreeBSD-src-aebf2bbe921058ed247813d826b5362d33de3ab4.tar.gz
Use explicit information from the kernel to detect the traps due to
syscall entry and leave. Based on submision by: Dan Nelson <dnelson allantgroup com> MFC after: 1 month
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/truss/setup.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/usr.bin/truss/setup.c b/usr.bin/truss/setup.c
index 42c8235..5931983 100644
--- a/usr.bin/truss/setup.c
+++ b/usr.bin/truss/setup.c
@@ -202,9 +202,19 @@ waitevent(struct trussinfo *info)
find_thread(info, lwpinfo.pl_lwpid);
switch(WSTOPSIG(waitval)) {
case SIGTRAP:
- info->pr_why = info->curthread->in_syscall?S_SCX:S_SCE;
- info->curthread->in_syscall = 1 - info->curthread->in_syscall;
- break;
+ if (lwpinfo.pl_flags & PL_FLAG_SCE) {
+ info->pr_why = S_SCE;
+ info->curthread->in_syscall = 1;
+ break;
+ } else if (lwpinfo.pl_flags & PL_FLAG_SCX) {
+ info->pr_why = S_SCX;
+ info->curthread->in_syscall = 0;
+ break;
+ } else {
+ errx(1,
+ "pl_flags %x contains neither PL_FLAG_SCE nor PL_FLAG_SCX",
+ lwpinfo.pl_flags);
+ }
default:
info->pr_why = S_SIG;
info->pr_data = WSTOPSIG(waitval);
OpenPOWER on IntegriCloud