strace problem w/2.1.x

Dean Gaudet (dgaudet-list-linux-kernel@arctic.org)
Mon, 6 Apr 1998 21:35:50 -0700 (PDT)


strace 3.1, with the -p option to attach to a pid, exits after a signal is
received under 2.1.84 and 2.1.93 kernels, but not under a 2.0.34pre4
kernel.

See the pause.c program below. Here's a sample of its odd behaviour under
2.1.84:

% gcc -Wall pause.c
% ./a.out &
[6] 14388
% strace -p 14388 &
[7] 14479
pause(
% kill -USR1 14388
) = ? ERESTARTNOHAND (To be restarted)
--- SIGUSR1 (User defined signal 1) ---
[7] Done strace -p 14388
% kill 14388
%
[6] Terminated ./a.out
%

Notice how strace exited when the signal was received, but the program
is still running. On a 2.0.34p4 system the strace continues to run.

Dean

--- pause.c ---

#include <stdio.h>
#include <signal.h>
#include <unistd.h>

void usr1(int s)
{
}

void main(void)
{
struct sigaction sa;

sa.sa_flags = 0;
sa.sa_handler = usr1;
sigemptyset(&sa.sa_mask);
if (sigaction(SIGUSR1, &sa, NULL) == -1) {
perror("sigaction");
exit(1);
}
while(1) {
pause();
}
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu