From: "christophe barbé" <christophe.barbe@lineo.fr>
To: linux-kernel@vger.kernel.org
Subject: Re: ptrace(), fork(), sleep(), exit(), SIGCHLD
Date: Tue, 14 Aug 2001 09:28:49 +0200 [thread overview]
Message-ID: <20010814092849.E13892@pc8.lineo.fr> (raw)
In-Reply-To: <20010813093116Z270036-761+611@vger.kernel.org>
In-Reply-To: <20010813093116Z270036-761+611@vger.kernel.org>; from bruce@cs.usyd.edu.au on lun, aoû 13, 2001 at 10:29:32 +0200
Have you receive off-line answers?
I guess that it's certainly more a strace issue and that it's perhaps
'trivial' for most people here. But I would be interesting in knowing the
why behind this.
Christophe
Le lun, 13 aoû 2001 10:29:32, Bruce Janson a écrit :
> Hi,
> The following program behaves incorrectly when traced:
>
> $ uname -a
> Linux dependo 2.4.2-2 #1 Sun Apr 8 19:37:14 EDT 2001 i686 unknown
> $ cc -v
> Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs
> gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-81)
> $ strace -V
> strace -- version 4.2
> $ cat t.c
> main()
> {
> switch (fork())
> {
> case -1:
> write(2, "fork\n", 5);
> break;
>
> case 0:
> usleep(1000000);
> break;
>
> default:
> if (usleep(5000000) == -1)
> write(2, "wrong\n", 6);
> break;
> }
>
> exit(0);
> }
> $ cc t.c
> $ time ./a.out
>
> real 0m5.011s
> user 0m0.000s
> sys 0m0.000s
> $ time strace -o /dev/null ./a.out
> wrong
>
> real 0m1.025s
> user 0m0.010s
> sys 0m0.010s
> $
>
> The problem appears to be that, when traced, the child process' exit()
> interrupts the parent's usleep() with a SIGCHLD, the latter returning
> EINTR.
> It also fails in the same way under Linux 2.2.16 and 2.2.19.
>
> What am I missing?
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel"
> in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
--
Christophe Barbé
Software Engineer - christophe.barbe@lineo.fr
Lineo France - Lineo High Availability Group
42-46, rue Médéric - 92110 Clichy - France
phone (33).1.41.40.02.12 - fax (33).1.41.40.02.01
http://www.lineo.com
next prev parent reply other threads:[~2001-08-14 7:29 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-08-13 8:29 ptrace(), fork(), sleep(), exit(), SIGCHLD Bruce Janson
2001-08-14 7:28 ` christophe barbé [this message]
2001-08-14 15:06 ` Bruce Janson
2001-08-15 15:46 ` george anzinger
2001-08-15 17:53 ` george anzinger
2001-08-15 18:02 ` george anzinger
2001-08-16 0:59 ` How should nano_sleep be fixed (was: ptrace(), fork(), sleep(), exit(), SIGCHLD) george anzinger
2001-08-16 10:17 ` christophe barbé
2001-08-16 10:29 ` Russell King
2001-08-16 14:16 ` george anzinger
2001-08-16 16:00 ` christophe barbé
2001-08-16 16:12 ` Russell King
2001-08-16 18:17 ` george anzinger
2001-08-17 18:25 ` george anzinger
2001-08-17 18:57 ` Victor Yodaiken
2001-08-17 19:56 ` george anzinger
2001-08-22 18:40 ` Russell King
2001-08-23 20:04 ` george anzinger
2001-08-23 20:11 ` Russell King
2001-08-23 21:13 ` george anzinger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20010814092849.E13892@pc8.lineo.fr \
--to=christophe.barbe@lineo.fr \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox