From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3379 invoked by alias); 14 Aug 2009 21:17:28 -0000 Received: (qmail 3316 invoked by uid 22791); 14 Aug 2009 21:17:27 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_83 X-Spam-Check-By: sourceware.org Received: from smtp23.services.sfr.fr (HELO smtp23.services.sfr.fr) (93.17.128.20) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 14 Aug 2009 21:17:20 +0000 Received: from filter.sfr.fr (localhost [127.0.0.1]) by msfrf2324.sfr.fr (SMTP Server) with ESMTP id 0056D7000090; Fri, 14 Aug 2009 23:17:18 +0200 (CEST) Received: from [192.168.1.101] (197.156.90-79.rev.gaoland.net [79.90.156.197]) by msfrf2324.sfr.fr (SMTP Server) with ESMTP id 7DF107000087; Fri, 14 Aug 2009 23:17:17 +0200 (CEST) X-SFR-UUID: 20090814211717515.7DF107000087@msfrf2324.sfr.fr Subject: Re: Need some Unix and /bin/sh expertise for GCC testsuite From: Laurent GUERBY Reply-To: laurent@guerby.net To: Dave Korn Cc: gcc , Paolo Bonzini , Arnaud Charlet , Eric Botcazou In-Reply-To: <4A85D4EE.7040503@gmail.com> References: <1250283155.20287.116.camel@localhost> <4A85D4EE.7040503@gmail.com> Content-Type: text/plain Date: Fri, 14 Aug 2009 21:37:00 -0000 Message-Id: <1250284636.20287.123.camel@localhost> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2009-08/txt/msg00248.txt.bz2 On Fri, 2009-08-14 at 22:19 +0100, Dave Korn wrote: > Laurent GUERBY wrote: > > > 3/ Here is the point I find surprising: the "ps fauxww" run in the > > second "if" show that even if the script is fully sequential > > at least one gnatmake subprocess (collect-ld) is still marked as running > > *in parallel* with the ps command in the subsequent "if" of the script! > > > Any idea of why /bin/sh is running stuff in parallel instead > > of sequential? > > > > Could some code in > > gnatmake/gnatlink/xgcc/collect2/collect-ld cause it? > > I notice gnatmake.adb has a reference to GNAT.OS_Lib.Non_Blocking_Spawn in > it.... coincidence? gnatmake uses Non_Blocking_Spawn to call the compiler (gnatmake supports "-j N" like make), but for the gnatlink call (we see in the "ps fauxww") it uses in gcc/ada/make.adb: procedure Link ... GNAT.OS_Lib.Spawn (Gnatlink_Path.all, Link_Args, Success); end Link; which ends up calling gcc/ada/s-os_lib.adb Spawn_Internal (Program_Name, Args, Result, Junk, Blocking => True); ... function Portable_Spawn (Args : Address) return Integer; pragma Import (C, Portable_Spawn, "__gnat_portable_spawn"); which ends up calling in gcc/ada/adaint.c: int __gnat_portable_spawn (char *args[]) ... pid = fork (); if (pid < 0) return -1; if (pid == 0) { /* The child. */ if (execv (args[0], MAYBE_TO_PTR32 (args)) != 0) _exit (1); } /* The parent. */ finished = waitpid (pid, &status, 0); if (finished != pid || WIFEXITED (status) == 0) return -1; return WEXITSTATUS (status); } Thanks for your help :). Laurent