Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 Feb 2000 02:11:40 +1100 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Daniel Eischen <eischen@vigrid.com>
Cc:        Thimble Smith <tim@mysql.com>, current@FreeBSD.ORG, jasone@FreeBSD.ORG
Subject:   Re: pthread.h and unistd.h
Message-ID:  <Pine.BSF.4.21.0002180148220.59405-100000@alphplex.bde.org>
In-Reply-To: <Pine.SUN.3.91.1000217065254.23357A-100000@pcnet1.pcnet.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 17 Feb 2000, Daniel Eischen wrote:

> On Thu, 17 Feb 2000, Thimble Smith wrote:
> 
> > Hi.  I recently updated from -stable to -current.  I notice now that
> > pthread.h relies on #defines that are in unistd.h; so in order to use
> > pthread_attr_setscope you have to include unistd.h before pthread.h.
> > 
> > Is this standard behaviour?  I'm working with MySQL, and unistd.h is
> > included after pthread.h; should I have that code changed, or should
> > FreeBSD somehow compensate for this?
> 
> I've read the POSIX spec, and it looks like pthread.h should include
> unistd.h so that the #defines you refer to are properly defined. 

It can't include <unistd.h> or even <sys/unistd.h>, at least in
POSX.1-1996, because even the latter defines names that are not reserved
for <pthread.h>.  E.g., <sys/unistd.h> defines SEEK_SET, but the only
non-implementation reserved for <pthread.h> are ones beginning with
pthread_ or PTHREAD_, or ending with _t.

However, including <sys/unistd.h> wouldn't add much to the existing
namespace violation from including <sys/types.h>, <sys/time.h>,
<sys/signal.h>, <limits.h> and <sched.h>.

> Solaris 2.5.1 pthread.h doesn't include <unistd.h> directly, but does
> include <sys/signal.h> which includes <unistd.h>.

This seems to be a bug Solaris 2.5.1.  Our <sys/signal.h> avoids
including <sys/unistd.h> by including <sys/_posix.h> to get more
fundamental feature test macros for the visibility of the POSIX.1b
extensions.

Bruce



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0002180148220.59405-100000>