lkml.org 
[lkml]   [1998]   [Sep]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: clone() and dl library incompatible?
From
Date
Steve Jacobson <sdj@franz.com> writes:

> Following is a simple example that works when the dl library isn't involved
> at link time, but fails when it is.

This has nothing to do with dl, it's just bad fortune that the crash
happens only in this situation.

> void *stk = malloc( 1024 * 1024 );
>
> clone( foo, stk, CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND, 0 );

Clone expects the *end* of the stack as the argument. I.e.,

clone (foo, stk + 1024 * 1024, ...)


But you shouldn't use clone() in the first place. The libc will not
be thread safe unless you link against libpthread (or use define the
needed magic in your programs as well).

--
---------------. drepper at gnu.org ,-. 1325 Chesapeake Terrace
Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA
Cygnus Solutions `--' drepper at cygnus.com `------------------------

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:44    [W:0.054 / U:3.348 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site