powerpc uClibc0.9.32 threads ( old and NPTL)
Andrei
ayakimov at iptec-inc.com
Thu Dec 29 19:29:57 UTC 2011
On Thu, 2011-12-29 at 19:54 +0100, Bernhard Reutner-Fischer wrote:
>
> On Dec 29, 2011 12:10 AM, "Andrei" <ayakimov at iptec-inc.com> wrote:
> >
> > It looks broken for me.
> > You can build a uClibc 0.9.32 - no problem there.
> > it working fine with uClibc 0.9.30.3.
> > I have build uClibc 0.9.32 using buildroot2011.08 and
> > crosstool-ng-1.13.2 an crosstool-ng-1.13.0
> >
> > This test faling for me at two thread model (old and NPTL) in
> 0.9.32,
> > but working with uClibc 0.9.30.3. (old only - NPLT not supported for
> > powepc):
> >
> > #include <pthread.h>
> >
> > #include <stdio.h>
> > #include <string.h>
> > #include <unistd.h>
> > #include <sys/types.h>
> >
> > #include <errno.h>
> >
> >
> > pthread_t thread;
> >
> > int param = 1;
> >
> > void *test(void *hndl) {
> >
> > printf("Thread started with param: %d\n", *((int *)hndl));
> > while(1) ;
> > }
> >
> > int start_tread()
> > {
> > pthread_attr_t attr;
> > struct sched_param sched;
> > int res;
> >
> > sched.sched_priority= 10;
> >
> > pthread_attr_init(&attr);
> > pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
> >
> > res = pthread_attr_setstacksize (&attr, 16*1024);
> >
> > if(res != 0) {
> > printf("cannnot set a stack: %s.\n", strerror(res));
> > return 0;
> > }
> >
> > res = pthread_attr_setschedpolicy(&attr, SCHED_FIFO);
> > if(res != 0) {
> > printf("cannnot set policy: %s.\n", strerror(res));
> > return 0;
> > }
> > res = pthread_attr_setschedparam(&attr, &sched);
> > if(res != 0) {
> > printf("cannnot set sheduler: %s.\n", strerror(res));
> > return 0;
> > }
> > if(getuid() == 0){
> > res =
> > pthread_attr_setinheritsched(&attr,PTHREAD_EXPLICIT_SCHED);
> > if(res != 0) {
> > printf("cannnot set inherit: %s.\n", strerror(res));
> > return 0;
> > }
> > }
> >
> > res = pthread_create(&thread, &attr, test, ¶m);
> > if(res != 0) {
> > printf("cannnot start therad: %s.\n", strerror(res));
> > return 0;
> > }
> > return 1;
> > }
> >
> > int main ()
> > {
> > start_tread();
> >
> > while(1);
> > }
> >
> >
> > Any advise?
>
> How does it fail?
> Can you reproduce it with current master?
>
It sigfault.
Removing scheduling attribute make it run in NPTL case,
I did not without it in case of old.
1) NPTL sigfault at libptherad/nptl/sysdeps/pthread/createthread.c:line
92 - it intentional, but I do not see what is wrong.
2) old sigfault at libptherad/linuxthreads.old/pthread.c: line 622 - it
looks like stack corrupt after clone() - manager_pipe[xx] - contain
garbage.
I will try this on master if buldroot pooling snapshot properly later
today, but I am really would like to use released version of uClibc.
Andrei
More information about the uClibc
mailing list