[devel] system(3) blocks alarm(2) under strace(1)
Dmitry V. Levin
=?iso-8859-1?q?ldv_=CE=C1_altlinux=2Eorg?=
Ср Июн 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
----------- следующая часть -----------
Было удалено вложение не в текстовом формате...
Имя : =?iso-8859-1?q?=CF=D4=D3=D5=D4=D3=D4=D7=D5=C5=D4?=
Тип : application/pgp-signature
Размер : 189 байтов
Описание: =?iso-8859-1?q?=CF=D4=D3=D5=D4=D3=D4=D7=D5=C5=D4?=
Url : <http://lists.altlinux.org/pipermail/devel/attachments/20040623/cea7c722/attachment-0001.bin>
Подробная информация о списке рассылки Devel