mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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
Date: Sat, 15 Jun 2002 02:58:01 +0200	[thread overview]
Message-ID: <20020615005801.GA1695@werewolf.able.es> (raw)

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)

                 reply	other threads:[~2002-06-15  0:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20020615005801.GA1695@werewolf.able.es \
    --to=jamagallon@able.es \
    --cc=bproc-users@lists.sourceforge.net \
    --cc=cooker@linux-mandrake.com \
    --cc=expert@linux-mandrake.com \
    --cc=linux-cluster@nl.linux.org \
    --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

all inboxes | Powered by JetHome®