Bug 133734

Summary: 32 bit libthr failing pthread_create()
Product: Base System Reporter: Stephen Sanders <ssanders>
Component: threadsAssignee: freebsd-threads (Nobody) <threads>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
ssanders.vcf none

Description Stephen Sanders 2009-04-14 21:50:03 UTC
The following program will drop core in pthread_create() with an invalid
argument error:

#include <sys/types.h>
#include <signal.h>
#include <pthread.h>
#include <unistd.h>
#include <stdio.h>
#include <err.h>

void *thr(void *a)
{
    int *ip = (int *)a;
    printf("started thread %d\n", *ip);
    pause();
    return 0;
}

int main(int argc, char **argv)
{
    const int THREADCOUNT =4;
    int i;
    pthread_t threads[THREADCOUNT];

    for (i =0; i < THREADCOUNT; i++)
       if (pthread_create(&threads[i], 0, thr, (void *)&i) != 0)
           errx(-1, "cannot create thread");

    sleep(1);
    return 0;
}

** an example execution **

[root@vm7-1-64 ~/tmp]# ./threadcore 
Fatal error 'can not create signal daemon thread!
' at line 236 in file /usr/src/lib/libpthread/thread/thr_sig.c (errno = 22)

How-To-Repeat: Cut and paste the program in the description.  Compile it on a FreeBSD
6.3/32bit system and run the program on a FreeBSD 7.1 64 bit system.
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2009-04-14 22:37:23 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-threads

Over to maintainer(s).
Comment 2 David Xu freebsd_committer freebsd_triage 2009-04-15 02:27:36 UTC
libkse does not have 32 bit compatible shim on 64 bit platform,
you should use libmap.conf and map libkse to libthr.

Regards,
David Xu
Comment 3 Stephen Sanders 2009-04-15 16:34:54 UTC
Retesting by linking with libthr.so on the 6.3/32 bit system worked. 
Thanks.

David Xu wrote:
> libkse does not have 32 bit compatible shim on 64 bit platform,
> you should use libmap.conf and map libkse to libthr.
>
> Regards,
> David Xu
>
>
Comment 4 Bruce Cran freebsd_committer freebsd_triage 2011-02-18 09:54:04 UTC
State Changed
From-To: open->closed

Submitter reports that the problem was fixed by linking with libthr.