|
From: J.A. M. <jam...@ab...> - 2002-07-01 23:32:44
|
On 2002.07.02 Erik Arjan Hendriks wrote:
>
>Ok... Hunted this one down. The problem is with the linuxthreads
>library as far as I can tell. What they've done is provided a new
>fork function in place of libc's fork function. The pthreads fork
>does some magical stuff that bproc_rfork (obviously) doesn't do.
>
>You can create the same problem w/o bproc by replacing the bproc_rfork
>call with a call to __libc_fork(). That will bypass the pthreads
>magic too.
>
Someone in the kernel list suggested that, pthreads was overwriting something
But my tests show that what is getting overwritten is the 'clone()' call.
AFAIK, everything in based on the clone() system call: fork uses
clone() internally, pthreads are (quote) 'a simple POSIX threads library
implemented directly on top of clone()'.
And my test also breaks if I use clone():
void nslave()
{
...
for (i=0; i<nprocs; i++)
{
puts("about to clone...");
tid[i] = clone(pslave,
stack[i]+STSZ-1,CLONE_VM|SIGCHLD,
spawned);
puts("done");
spawned++;
}
...
}
I do not use any pthreads call. I just use clone. If I link with
-lpthread, it breaks. If not, it works. So I will look at clone.
A possible workaround could be to use NPTHREADS from IBM.
--
J.A. Magallon \ Software is like sex: It's better when it's free
mailto:jam...@ab... \ -- Linus Torvalds, FSF T-shirt
Linux werewolf 2.4.19-rc1-jam1, Mandrake Linux 8.3 (Cooker) for i586
gcc (GCC) 3.1.1 (Mandrake Linux 8.3 3.1.1-0.7mdk)
|