Module Name: src Committed By: martin Date: Fri Jun 30 17:13:50 UTC 2023
Modified Files: src/external/cddl/osnet/dist/tools/ctf/cvt [netbsd-10]: barrier.c barrier.h ctfmerge.c tdata.c src/external/cddl/osnet/sys/sys [netbsd-10]: opentypes.h src/tools/compat [netbsd-10]: configure configure.ac nbtool_config.h.in Log Message: Pull up following revision(s) (requested by riastradh in ticket #221): external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c: revision 1.18 external/cddl/osnet/sys/sys/opentypes.h: revision 1.7 tools/compat/configure: revision 1.100 external/cddl/osnet/dist/tools/ctf/cvt/barrier.c: revision 1.6 external/cddl/osnet/dist/tools/ctf/cvt/barrier.h: revision 1.4 external/cddl/osnet/dist/tools/ctf/cvt/barrier.c: revision 1.7 external/cddl/osnet/dist/tools/ctf/cvt/barrier.c: revision 1.8 tools/compat/configure.ac: revision 1.100 external/cddl/osnet/dist/tools/ctf/cvt/tdata.c: revision 1.10 tools/compat/nbtool_config.h.in: revision 1.54 ctfmerge: error check sem_*() and pthread_*() APIs terminate() if sem_*() returns -1 or pthread_*() returns != 0. (Set errno from pthread_*() so terminate() prints the strerror message). Note: Failing on errors instead of ignoring them helps identify reasons for intermittent failures, such as those on macOS host builds: ERROR: nbctfmerge: barrier_init: sem_init(bar_sem): Function not implemented ctfmerge: fix macOS semaphore implementation Use dispatch_semaphore_create() if present instead of sem_init(). macOS doesn't actually implement sem_init() (et al) (even though it provides the prototypes as deprecated). This was detected by the previous commit to ctfmerge that added error handling. Implement ctfmerge's barrier operations in terms of dispatch(3) APIs such as dispatch_semaphore_create() (et al). Update tools/compat/configure.ac to find dispatch_semaphore_create(). Fixes ctfmerge on macOS hosts. Inspired by https://stackoverflow.com/a/27847103 tools/compat: regen for dispatch_semaphore_create ctfmerge: fix macOS semaphore implementation, part 2 dispatch_semaphore_signal() doesn't return an error, just an indicator of whether a thread was woken or not, so there's no need to fail on non-zero return. osnet: on macOS, use <mach/boolean.h> for boolean_t macOS/x86_64 defines boolean_t as 'unsigned int' not 'int', which causes a build issue with tools/ctfmerge on that host after my recent fixes for macOS semaphores. So use the <mach/boolean.h> instead of a local typedef ifdef __APPLE__. May fix a macOS/x86_64 build issue reported by cjep@. Builds fine on NetBSD/amd64 or macOS/arm. Note: this compat stuff is clunky, and based on the commit log, annoyingly error prone. A newer sync of osnet from upstream /may/ improve a lot of these compat typedef workarounds for solaris types... To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.5.10.1 \ src/external/cddl/osnet/dist/tools/ctf/cvt/barrier.c cvs rdiff -u -r1.3 -r1.3.12.1 \ src/external/cddl/osnet/dist/tools/ctf/cvt/barrier.h cvs rdiff -u -r1.17 -r1.17.8.1 \ src/external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c cvs rdiff -u -r1.9 -r1.9.12.1 \ src/external/cddl/osnet/dist/tools/ctf/cvt/tdata.c cvs rdiff -u -r1.6 -r1.6.6.1 src/external/cddl/osnet/sys/sys/opentypes.h cvs rdiff -u -r1.99 -r1.99.6.1 src/tools/compat/configure \ src/tools/compat/configure.ac cvs rdiff -u -r1.53 -r1.53.6.1 src/tools/compat/nbtool_config.h.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.