Various cleanups: threads, STA_NANO

Matthew Selsky Matthew.Selsky at twosigma.com
Wed Jan 23 04:12:27 UTC 2019


On Tue, Jan 22, 2019 at 07:37:18PM -0800, Hal Murray via devel wrote:
> 
> We have various cruft associated with threads.  Can we add POSIX threads to 
> our list of requirements?  Or is it already included in POSIX.1-2001 and 
> ISO/IEC 9899:1999 (C99)?

POSIX threads are optional for POSIX.1-2001 per http://pubs.opengroup.org/onlinepubs/009695399/help/codes.html#THR

We currently require any POSIX-style library.  Either pthread or libthr.

> The idea is to remove HAVE_PTHREAD_H and HAVE_PTHREAD from config.h and remove 
> most of wafhelpers/check_pthread.py
> 
> wafhelpers/check_pthread.py says:
>     ctx.check_cc(lib="thr", mandatory=False,
>                  comment="thr library, required by some operating systems.")
> Is that (still?) correct?  If so, which systems?

libthr is a FreeBSD thing. See https://www.freebsd.org/cgi/man.cgi?query=libthr&apropos=0&sektion=0&manpath=FreeBSD+12.0-RELEASE&arch=default&format=html

The check was added in April 2016 per db86d9f65b1055f49219dda7fe36e9229cfba532

https://gitlab.com/NTPsec/ntpsec/-/jobs/149004468 shows:
Checking for library thr                                           : yes 

You can examine the artifact at https://gitlab.com/NTPsec/ntpsec/-/jobs/149004468/artifacts/browse/build/main/ntpd/ to see if the binary has libthr.so as a runtime dependency.

I haven't tested if it's possible to have a FreeBSD build with libthr, but without pthreads.  Or the other way around.  Our FreeBSD CI images are using the stock install.

The C code has no #ifdefs for HAVE_PTHREAD or HAVE_PTHREAD_H, so we're only talking about cleaning up some waf python code, correct?

> There is probably cruft in this area that I added to try to avoid libpthread 
> for the no-DNS case.  That doesn't work now since libcrypto needs pthread_once 
> and is less likely to work as we get NTS-KE working.
> 
> ----------
> 
> We have various ifdefs for STA_NANO.  We depend on clock_gettime which uses 
> timespec so all the systems we run on know about nanoseconds.  Can we upgrade 
> our requirement for ntp_adjtime to be requires ntp_adjtime with STA_NANO?

We added the STA_NANO checks to support systems that have some STA_ symbols, but not all.  See https://lists.ntpsec.org/pipermail/vc/2017-December/003604.html

We'd have to survey the platforms that we care about to see if they have these symbols now.

https://docs.ntpsec.org/latest/#platforms doesn't give many specifics on what platforms we support.

https://www.ntpsec.org/supported-platforms.html mentions specific (older) versions of distros and architectures. Maybe we want to replace that with "we support the current (and current - 1) versions of the following platforms/distros as long as they're supported by upstream"?  Or replace this section with a link to docs.ntpsec.org and the CI system?


Cheers,
-Matt


More information about the devel mailing list