Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F110197629
D33861.id101351.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D33861.id101351.diff
View Options
diff --git a/usr.bin/truss/setup.c b/usr.bin/truss/setup.c
--- a/usr.bin/truss/setup.c
+++ b/usr.bin/truss/setup.c
@@ -205,12 +205,25 @@
static void
detach_proc(pid_t pid)
{
+ int sig, status;
- /* stop the child so that we can detach */
+ /*
+ * Stop the child so that we can detach. Filter out possible
+ * lingering SIGTRAP events buffered in the threads.
+ */
kill(pid, SIGSTOP);
- if (waitpid(pid, NULL, 0) < 0)
- err(1, "Unexpected stop in waitpid");
-
+ for (;;) {
+ if (waitpid(pid, &status, 0) < 0)
+ err(1, "Unexpected error in waitpid");
+ sig = WIFSTOPPED(status) ? WSTOPSIG(status) : 0;
+ if (sig == SIGSTOP)
+ break;
+ if (sig == SIGTRAP)
+ sig = 0;
+ if (ptrace(PT_CONTINUE, pid, (caddr_t)1, sig) < 0)
+ err(1, "Can not continue for detach");
+ }
+
if (ptrace(PT_DETACH, pid, (caddr_t)1, 0) < 0)
err(1, "Can not detach the process");
diff --git a/usr.bin/truss/syscalls.c b/usr.bin/truss/syscalls.c
--- a/usr.bin/truss/syscalls.c
+++ b/usr.bin/truss/syscalls.c
@@ -1945,11 +1945,9 @@
fputs(strsig2(args[sc->offset]), fp);
break;
case Sigset: {
- long sig;
sigset_t ss;
int i, first;
- sig = args[sc->offset];
if (get_struct(pid, args[sc->offset], (void *)&ss,
sizeof(ss)) == -1) {
print_pointer(fp, args[sc->offset]);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Feb 15, 11:26 PM (8 h, 30 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16666401
Default Alt Text
D33861.id101351.diff (1 KB)
Attached To
Mode
D33861: truss(1): detach more carefully
Attached
Detach File
Event Timeline
Log In to Comment