Gnu PTH on FreeBSD 6.0

Douglas K. Rand rand at meridian-enviro.com
Fri Apr 21 21:20:55 UTC 2006


I've been trying to get Nagios to use the pthreads implementation from
GNU's PTH library rather than FreeBSD's. Even a trivial program, such
as:

   #include <stdio.h>
   #include <sys/types.h>
   #include <pthread.h>

produces syntax errors:

$ cc -c -I/usr/local/include/pth x.c
In file included from x.c:3:
/usr/local/include/pth/pthread.h:285: error: conflicting types for 'pthread_t'
/usr/include/sys/_pthreadtypes.h:64: error: previous declaration of 'pthread_t' was here
/usr/local/include/pth/pthread.h:286: error: conflicting types for 'pthread_attr_t'
/usr/include/sys/_pthreadtypes.h:65: error: previous declaration of 'pthread_attr_t' was here
/usr/local/include/pth/pthread.h:288: error: conflicting types for 'pthread_once_t'
/usr/include/sys/_pthreadtypes.h:71: error: previous declaration of 'pthread_once_t' was here
/usr/local/include/pth/pthread.h:289: error: conflicting types for 'pthread_mutexattr_t'
/usr/include/sys/_pthreadtypes.h:67: error: previous declaration of 'pthread_mutexattr_t' was here
/usr/local/include/pth/pthread.h:290: error: conflicting types for 'pthread_mutex_t'
/usr/include/sys/_pthreadtypes.h:66: error: previous declaration of 'pthread_mutex_t' was here
/usr/local/include/pth/pthread.h:291: error: conflicting types for 'pthread_condattr_t'
/usr/include/sys/_pthreadtypes.h:69: error: previous declaration of 'pthread_condattr_t' was here
/usr/local/include/pth/pthread.h:292: error: conflicting types for 'pthread_cond_t'
/usr/include/sys/_pthreadtypes.h:68: error: previous declaration of 'pthread_cond_t' was here
/usr/local/include/pth/pthread.h:293: error: conflicting types for 'pthread_rwlockattr_t'
/usr/include/sys/_pthreadtypes.h:73: error: previous declaration of 'pthread_rwlockattr_t' was here
/usr/local/include/pth/pthread.h:294: error: conflicting types for 'pthread_rwlock_t'
/usr/include/sys/_pthreadtypes.h:72: error: previous declaration of 'pthread_rwlock_t' was here

It seems that revision 1.92 of sys/types.h now includes
sys/_pthreadtypes.h, which conflicts with PTH's pth/pthread.h.

Is there anyway to use GNU PTH's pthread implementation on FreeBSD 6.1?

History as to why I'm trying this can be found at:

  http://www.freebsd.org/cgi/getmsg.cgi?fetch=165398+171880+/usr/local/www/db/text/2005/freebsd-hackers/20050821.freebsd-hackers



More information about the freebsd-threads mailing list