Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Apr 2006 10:30:23 GMT
From:      Bruce Evans <bde@zeta.org.au>
To:        freebsd-standards@FreeBSD.org
Subject:   Re: standards/96016: clock_getres et al should be in <time.h>
Message-ID:  <200604191030.k3JAUNL1044161@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR standards/96016; it has been noted by GNATS.

From: Bruce Evans <bde@zeta.org.au>
To: Robert Millan <rmh@aybabtu.com>
Cc: FreeBSD-gnats-submit@FreeBSD.org, freebsd-standards@FreeBSD.org
Subject: Re: standards/96016: clock_getres et al should be in <time.h>
Date: Wed, 19 Apr 2006 20:22:11 +1000 (EST)

 On Tue, 18 Apr 2006, Robert Millan wrote:
 
 >> Description:
 > POSIX says that the following functions should be declared in <time.h>, rather
 > than <sys/time.h>:
 >
 >  clock_getres, clock_gettime, clock_settime
 
 Er, that's why they _are_ in declared in <time.h>.  From
 "cvs ann src/include/time.h":
 
 % 1.24         (wollman  27-Jun-02): #if __POSIX_VISIBLE >= 199309
 % 1.24         (wollman  27-Jun-02): int clock_getres(clockid_t, struct timespec *);
 % 1.24         (wollman  27-Jun-02): int clock_gettime(clockid_t, struct timespec *);
 % 1.24         (wollman  27-Jun-02): int clock_settime(clockid_t, const struct timespec *);
 % 1.32         (das      02-Apr-05): /* XXX missing: clock_nanosleep() */
 % 1.24         (wollman  27-Jun-02): int nanosleep(const struct timespec *, struct timespec *);
 % 1.24         (wollman  27-Jun-02): #endif /* __POSIX_VISIBLE >= 199309 */
 
 The main bugs in this area are:
 - <sys/time.h> includes <time.h> in the !_KERNEL case.  This gives lots of
    namespace pollution in <sys/time.h> including clock_getres() etc., and
    worse, struct tm etc.  Lots of FreeBSD sources depend on this pollution.
    When I last tried removing this include (almost 4 years ago), there were
    several hundred lines of error output.
 - all CLOCK_* ids are declared in <sys/time.h> where they cause namespace
    pollution due to not being under any visibility ifdefs.
 - the visibility ifdefs for the declarations of the CLOCK_* ids in <time.h>
    are mostly wrong.
 - all CLOCK_* ids are declared with style bugs in <sys/time.h> and <time.h>.
 
 Duplication should be avoided by declaring the CLOCK_* ids in a little
 namespace-nonpolluting header in <sys>, but there are already too many of
 those, especially for times (there are <sys/timespec.h>, sys/<_timespec.h>
 and <_sys/_timeval.h>).
 
 Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200604191030.k3JAUNL1044161>