Subject: mit-threads don't work?
To: None <current-users@netbsd.org, tech-pkg@netbsd.org>
From: Christian Groessler <cpg@aladdin.de>
List: tech-pkg
Date: 07/21/2001 01:56:10
Hi,

sorry for the cross-posting, but I think it started recently
(therefore current-users, but I don't have an old version to verify)
and the problem is in a pkg (-> tech-pkg):

I'm not even using pthread stuff in this demo, just linking with the
pthread lib:

Program:

-------------
#include <sys/fcntl.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <unistd.h>
#include <string.h>


int main(int argc, char **argv)
{
    int ha;

    ha = open("/dev/usb0", O_RDONLY);
    if (ha == -1) {
        fprintf(stderr, "error: %s\n", strerror(errno));
        exit(1);
    }
    printf("success\n");
    close(ha);
    return(0);
}
-------------

How I compile:

cc -I /usr/pkg/pthreads/include -g pthreads.c -o pt -L/usr/pkg/pthreads/lib -Wl,-R,/usr/pkg/pthreads/lib -lpthread

(N.B. I get a warning when doing this:

/usr/pkg/pthreads/lib/libpthread.so: warning: reference to compatibility sys_errlist[]; include <errno.h> for correct reference
/usr/pkg/pthreads/lib/libpthread.so: warning: reference to compatibility sys_nerr; include <errno.h> for correct reference

)

The resulting program segfaults when doing the open:

gibbon:~/tmp$ ./pt 
Segmentation fault (core dumped)

This happens on both i386 and macppc. On alpha it seems to work,
but my real progam shows later funny behaviour.

Should I do a send-pr?

regards,
chris