[devel] system(3) blocks alarm(2) under strace(1)
Dmitry V. Levin
ldv на altlinux.org
Ср Июн 23 17:29:34 MSD 2004
On Wed, Jun 23, 2004 at 12:39:37PM +0400, Alexey Tourbin wrote:
> Столкнулся в перле, но воспроизводится без всякого перла.
>
> $ gcc alarm.c
> $ ./a.out
> diff=3 seconds
> $ strace -o /dev/null ./a.out
> diff=3 seconds
> $ strace -f -o /dev/null ./a.out
> diff=6 seconds
> $
>
> В чем здесь секрет?
В strace(1) про -f написано:
Trace child processes as they are created by currently traced processes
as a result of the fork(2) system call. The new process is attached
to as soon as its pid is known (through the return value of fork(2) in
the parent process). This means that such children may run uncontrolled
for a while (especially in the case of a vfork(2)), until the parent is
scheduled again to complete its (v)fork(2) call.
If the parent process decides to wait(2) for a child that is currently
being traced, it is suspended until an appropriate child process either
terminates or incurs a signal that would cause it to terminate (as
determined from the child's current signal disposition).
--
ldv
----------- следущая часть -----------
Было удалено вложение не в текстовом формате...
Имя : отсутствует
Тип : application/pgp-signature
Размер : 189 байтов
Описание: отсутствует
Url : http://lists.altlinux.ru/pipermail/devel/attachments/20040623/cea7c722/attachment.bin
Подробная информация о списке рассылки Devel