From linux-cluster-bounce@nl.linux.org Sat Jun 15 02:59:40 2002
Received: from localhost.nl.linux.org ([IPv6:::ffff:127.0.0.1]:30863 "EHLO
	humbolt.") by humbolt.nl.linux.org with ESMTP id <S16492AbSFOA7b>;
	Sat, 15 Jun 2002 02:59:31 +0200
Received: with LISTAR (v1.0.0; list linux-cluster); Sat, 15 Jun 2002 02:58:35 +0200 (CEST)
Received: from jalon.able.es ([IPv6:::ffff:212.97.163.2]:58601 "EHLO
	jalon.able.es") by humbolt.nl.linux.org with ESMTP
	id <S16518AbSFOA6D>; Sat, 15 Jun 2002 02:58:03 +0200
Received: from werewolf.able.es (7296-cm.able.es
          [212.97.172.96]) by jalon.able.es (Netscape Messaging Server
          4.15) with ESMTP id GXQ2OX00.31U; Sat, 15 Jun 2002 02:58:09 +0200 
Date:	Sat, 15 Jun 2002 02:58:01 +0200
From:	"J.A. Magallon" <jamagallon@able.es>
To:	Lista Linux-Kernel <linux-kernel@vger.kernel.org>,
	Lista Mdk-Cooker <cooker@linux-mandrake.com>,
	Lista Mdk-Expert <expert@linux-mandrake.com>
Cc:	Lista Linux-BProc <bproc-users@lists.sourceforge.net>,
	Lista Linux-Cluster <linux-cluster@nl.linux.org>
Subject: Problems with clone and gcc
Message-ID: <20020615005801.GA1695@werewolf.able.es>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-15
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
X-Mailer: Balsa 1.3.6
Content-Length:	1389
Lines:	61
X-Spam-Status: No, hits=0.1 required=5.0 tests=PORN_10 version=2.20
X-Spam-Level: 
X-listar-version: Listar v1.0.0
Sender:	linux-cluster-bounce@nl.linux.org
Errors-to: linux-cluster-bounce@nl.linux.org
X-original-sender: jamagallon@able.es
Precedence: bulk
List-help: <mailto:listar@nl.linux.org?Subject=help>
List-unsubscribe: <mailto:linux-cluster-request@nl.linux.org?Subject=unsubscribe>
List-software: Listar version 1.0.0
X-List-ID: <linux-cluster.nl.linux.org>
List-subscribe:	<mailto:linux-cluster-request@nl.linux.org?Subject=subscribe>
List-owner: <mailto:riel@nl.linux.org>
List-post: <mailto:linux-cluster@nl.linux.org>
List-archive: <http://mail.nl.linux.org/linux-cluster/>
X-list:	linux-cluster
Return-Path: <linux-cluster-bounce@nl.linux.org>
X-Envelope-To: <"| /bin/marchive -a -m -f /home/majordomo/public_html/linux-cluster/folders/linux-cluster"> (uid 0)
X-Orcpt: rfc822;linux-cluster-archive@nl.linux.org
Original-Recipient: rfc822;linux-cluster-archive@nl.linux.org

Hi all.

I write this here to see if you can give me some clue on a strange behaviour
with the clone system call. Really I want a hint about if it is a kernel
issue, a glibc(pthreads) one or a gcc issue. If sometimes it works looks
like not a kernel issue, but who knows...

Abstract: compiling a program with 'gcc -pthread' or just linking with
-lpthread (even if I just do not call any pthread_xxx), makes the
'clone()' call (glibc) fail. It does not jump to the given function.
Checked on both:
gcc (GCC) 3.1.1 (Mandrake Linux 8.3 3.1.1-0.4mdk)
gcc version 2.96 20000731 (Mandrake Linux 8.2 2.96-0.76mdk)

Sample test:

#include <sched.h>
#include <signal.h>
#include <stdio.h>

#define STSZ (4*1024)

int pslave(void *data);

int main(int argc,char** argv)
{
	int		tid;
	char*	stack;

	stack = (char*)valloc(STSZ);
	puts("about to clone...");
	tid = clone(pslave,stack+STSZ-1,CLONE_VM|SIGCHLD,0);
	if (tid<0)
	{
		perror("clone");
		exit(1);
	}
	puts("clone ok");

	wait(0);

	free(stack);

	return 0;
}

int pslave(void *data)
{
	puts("slave running");
	sleep(1);
	puts("slave done");

	return 0;
}


-- 
J.A. Magallon             \   Software is like sex: It's better when it's free
mailto:jamagallon@able.es  \                    -- Linus Torvalds, FSF T-shirt
Linux werewolf 2.4.19-pre10-jam3, Mandrake Linux 8.3 (Cooker) for i586
gcc (GCC) 3.1.1 (Mandrake Linux 8.3 3.1.1-0.4mdk)
-
Linux-cluster: generic cluster infrastructure for Linux
Archive:       http://mail.nl.linux.org/linux-cluster/


