pthread_create fails under uClibc 0.9.29

mark roths mroths at gmail.com
Fri Jan 19 23:07:27 UTC 2007


I have built an RFS using buildroot and uClibc 0.9.29.  Within this, I am
trying to run a
thread-based application which fails at pthread_create.  I reduced the test
to thread_hello.c (below)
and this also fails at the same place.  Also below is some strace output.
thread_hello is statically linked
with uClibc.  The same code statically linked with glibc works fine.

Is there a problem with threads and uClibc??

#define __REENTRANT
#include <pthread.h>
#include <stdio.h>

void *threadhello(void *unused)
{
  printf("Hello, world!\n");
  return 0;
}

int main() {
  pthread_t thready;
  printf("hello start\n");

  pthread_create(&thready, NULL, &threadhello, NULL);
  sleep(10);
}

strace output:

brk(0)                                  = 0x3c9000
brk(0x3ca000)                           = 0x3ca000
brk(0x3cc000)                           = 0x3cc000
pipe([3, 4])                            = 0
clone(Process 302 attached
child_stack=0x3cb128, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND) =
302
[pid   301] write(4,
"\214\4\3\0\5\0\0\0\230o\1\0h\31\220\276\0\0\0\0000\351"..., 148) = 148
[pid   301] rt_sigprocmask(SIG_SETMASK, NULL, [RTMIN], 8) = 0
[pid   301] write(4,
"@\7\3\0\0\0\0\0\0\0\0\0\240\201\0\0\0\0\0\0\0\0\0\200\0"..., 148) = 148
[pid   301] rt_sigprocmask(SIG_SETMASK, NULL, [RTMIN], 8) = 0
[pid   301] rt_sigsuspend([] <unfinished ...>
[pid   302] rt_sigprocmask(SIG_SETMASK, ~[TRAP RT_1], NULL, 8) = 0
[pid   302] read(3,
"\214\4\3\0\5\0\0\0\230o\1\0h\31\220\276\0\0\0\0000\351"..., 148) = 148
[pid   302] poll([{fd=3, events=POLLIN, revents=POLLIN}], 1, 2000) = 1
[pid   302] getppid()                   = 301
[pid   302] read(3,
"@\7\3\0\0\0\0\0\0\0\0\0\240\201\0\0\0\0\0\0\0\0\0\200\0"..., 148) = 148
[pid   302] old_mmap(NULL, 0, PROT_NONE, MAP_FILE, 0, 0) = -1 ENODEV (No
such device)
[pid   302] old_mmap(ptrace: umoven: Input/output error
ptrace: umoven: Input/output error
)                  = -1 EFAULT (Bad address)
[pid   302] old_mmap(ptrace: umoven: Input/output error
ptrace: umoven: Input/output error

The last error repeats hundreds of times.

Thanks,
Mark Roths
Softair Microsystems
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.busybox.net/pipermail/uclibc/attachments/20070119/8645a85e/attachment-0001.htm 


More information about the uClibc mailing list