From owner-freebsd-threads@FreeBSD.ORG Wed May 19 18:56:16 2004 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EDC7B16A4CE for ; Wed, 19 May 2004 18:56:16 -0700 (PDT) Received: from smtp01.syd.iprimus.net.au (smtp01.syd.iprimus.net.au [210.50.30.52]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3401643D2D for ; Wed, 19 May 2004 18:56:16 -0700 (PDT) (envelope-from tim@robbins.dropbear.id.au) Received: from robbins.dropbear.id.au (210.50.250.26) by smtp01.syd.iprimus.net.au (7.0.024) id 409956B40048EDBD for threads@freebsd.org; Thu, 20 May 2004 11:56:05 +1000 Received: by robbins.dropbear.id.au (Postfix, from userid 1000) id 8C6AB41CC; Thu, 20 May 2004 11:57:54 +1000 (EST) Date: Thu, 20 May 2004 11:57:54 +1000 From: Tim Robbins To: threads@freebsd.org Message-ID: <20040520015754.GA2572@cat.robbins.dropbear.id.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.1i Subject: execve() and KSE X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 May 2004 01:56:17 -0000 What is supposed to happen when a threaded process (linked with libpthread) calls execve()? The program attached to this message seems to execute "true" correctly, but it never returns to the shell I invoked it from. ^T shows it in the state "running", and the system load average approaches 1.00: load: 0.15 cmd: true 726 [running] 0.00u 0.00s 0% 200k load: 0.56 cmd: true 726 [running] 0.00u 0.00s 0% 200k load: 0.91 cmd: true 726 [running] 0.00u 0.00s 0% 200k However, it's not using any CPU according to %CPU: $ ps -Haxo pid,%cpu,mwchan,state,command -p 726 PID %CPU MWCHAN STAT COMMAND 726 0.0 - RL+ true The system is FreeBSD 5.2-CURRENT/amd64 with a kernel from May 9, and with WITNESS and INVARIANTS both turned off. I'll try updating and re-enabling the diagnostic options later today. Here's the code in question: #include #include #include #include static pthread_cond_t cond; void * thrstart(void *a) { pthread_cond_wait(&cond, NULL); if (execl("/usr/bin/true", "true", NULL) < 0) perror("execl"); return (NULL); } int main(int argc, char *argv[]) { void *v; pthread_t t1; pthread_cond_init(&cond, NULL); pthread_create(&t1, NULL, thrstart, NULL); pthread_cond_broadcast(&cond); pthread_join(t1, &v); exit(0); }