commits
Disable the lib-runtime-events/test_create_cursor_failures.ml test when the current user is a superuser
* Enable native backend for DragonFly BSD
Without this, it's not possible to build ocamlopt on DragonFly BSD.
Tested-on: DragonFly 6.5
* Add Changelog entry
* Mention DragonFly has Tier 2 support of native-code compiler
I like mentioning DragonFly in close proximity to the other BSDs,
ideally next to FreeBSD, as it shares most similarities with FreeBSD.
In this case, FreeBSD is in Tier 1, so mention it after OpenBSD. Sorry
for shifting OmniOS to the right.
As of the naming: We call it "DragonFly" and only sometimes "DragonFly
BSD" when talking to non-DragonFly people.
Use more POSIX thread-safe functions in libunix
Fix the testsuite on _all_ CRLF checkouts
Clarify barriers and spin macros with delayed expansion
Cache test results of custom Autoconf tests from `aclocal.m4`
`unixsupport.h`: fix C++ missing `std::` namespace on `atomic_int`
The `std::` namespace was missing from
bdbe619f1655a02c3ce18dcb745a4cf96c672dc2.
- https://pubs.opengroup.org/onlinepubs/9799919799/functions/mktime.html
- https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/mktime-mktime32-mktime64?view=msvc-170
- C11 standard § 7.26.2.3 The mktime function
- https://pubs.opengroup.org/onlinepubs/9799919799/functions/gmtime_r.html
- https://pubs.opengroup.org/onlinepubs/9799919799/functions/localtime_r.html
- https://pubs.opengroup.org/onlinepubs/9799919799/functions/getgrnam_r.html
- https://pubs.opengroup.org/onlinepubs/9799919799/functions/getgrgid_r.html
- https://pubs.opengroup.org/onlinepubs/9799919799/functions/getpwnam_r.html
- https://pubs.opengroup.org/onlinepubs/9799919799/functions/getpwuid_r.html
Configure fixes for Windows
Open the file in binary mode on all platforms and simply ignore \r
characters when counting the total number of characters.
mnemonics.mll opens the channel in text mode, which on Windows
automatically transforms the line-endings. Tweak the test so that the
behaviour is uniform on both Unix and Windows.
Note that M4sh reserves the '^as_' prefix for shell variables.
Note that M4sh reserves the '^as_' prefix for shell variables.
Co-authored-by: David Allsopp <david.allsopp@metastack.com>
If the source files are checked out with Windows line-endings on Unix,
the CR characters will leak into the source display. Trim them in the
same way as whitespace is trimmed.
Use an opaque abstract type for Dynarray.Dummy.with_dummy
See also _[PATCH] AC_SEARCH_LIBS now searches for .lib files_ at
https://lists.gnu.org/archive/html/autoconf-patches/2025-01/msg00004.html
Co-authored-by: David Allsopp <david.allsopp@metastack.com>
Using delayed macro expansion to generate the identifiers, it's
possible to simplify the code content of the macros.
Use __COUNTER__, which expands to sequential integral values starting
from 0, to avoid conflicts. __COUNTER__ is documented by GCC, clang,
MSVC, and xlc.
Reduce the scope of for loop iterators.
Compute C dependency information as a side-effect of compilation
Remove unnecessary guards on `unistd.h`
For the MSVC port, the triplet-prefixed versions of gcc will definitely
define _WIN32. Harden the use of, say, Cygwin gcc for dependencies by
ensuring _WIN32 is always defined.
C dependencies are intended to be computed as a side-effect of compiling
a C file, not necessarily as a separate step. Compiling a C file with
GCC or clang is now responsible for directly creating the .d dependency
file, if dependencies are being computed. The workaround for MSVC now
becomes two calls to the C compiler, firstly to cl, to compile the file,
then to GCC to create the dependency information. This does the same
work as before, but with the calls in a different order.
Computing dependencies this way allows us to avoid re-checking the C
dependencies on every single invocation of make. If .d files are found,
then they are loaded. On first invocationm, neither the .o or the .d
file will exist, so make knows that the object needs rebuilding without
needing to compute the dependencies of it first.
Marking .depend as .PHONY reduces the amount of work does before
including them.
Use WinAPI concurrency primitives on Windows ports (remove winpthreads)
Use a similar trick as on GitHub Actions - build with `-j` but if the
build fails, repeat without -j and then exit with error.
in caml_set_current_thread_name.
In particular, remove utilities which installed mingw-w64 runtime DLLs
that wouldn't otherwise be in PATH.
See also PR 10220 and issue 8857.
SetLastError is called when accessing the TLS value This_thread.
(cherry picked from commit 93843575809433ea50e0406d56c0681287411f1b)
Don't include pthread.h on Windows to avoid using pthreads emulation
libraries (such as winpthreads) by mistake.
Functions from platform.c that used pthreads are moved to unix.c,
their Windows counterparts are implemented in win32.c. Introduce a new
sync_win32.h header, counterpart of sync_unix.h. Use the
caml_plat_thread and caml_plat_thread_attr to abstract over the
system's thread id/handle type and thread attributes.
Use pairs of SRWLOCK and CONDITION_VARIABLES to replace pthreads
mutexes and condition variables.
POSIX states:
> The pthread_mutex_lock() function shall fail if:
> [EDEADLK]
> The mutex type is PTHREAD_MUTEX_ERRORCHECK and the current thread
> already owns the mutex.
The Windows documentation states:
> Exclusive mode SRW locks cannot be acquired recursively. If a thread
> tries to acquire a lock that it already holds, that attempt will
> [...] deadlock (for AcquireSRWLockExclusive).
Deadlocks caused by recursive attemps to lock cannot be detected on
Windows.
mingw-w64 GCC synthesises some calls to pthreads functions to implement
TLS. Ensure that the runtime still links pthreads statically on
mingw-w64 by including a single call to a pthreads function in the
runtime itself which causes the required module of libwinpthreads to be
linked for GCC, and thus avoids executables suddenly requiring the
libwinpthreads runtime DLL.
Done to ease the diff when switching to WinAPI primitives.
Done to ease the diff when switching to WinAPI primitives.
Done to ease the diff when switching to WinAPI primitives.
Substitute then remove the copyright header.
sed -i \
-e '/#include "st_pthreads.h"/{r otherlibs/systhreads/st_pthreads.h' \
-e 'd}' \
otherlibs/systhreads/st_win32.h
Done to ease the diff when switching to WinAPI primitives.
Introduce new caml_plat_thread and caml_plat_thread_attr to abstract
over the system's thread id/handle type and thread attributes.
Disable the lib-runtime-events/test_create_cursor_failures.ml test when the current user is a superuser
* Enable native backend for DragonFly BSD
Without this, it's not possible to build ocamlopt on DragonFly BSD.
Tested-on: DragonFly 6.5
* Add Changelog entry
* Mention DragonFly has Tier 2 support of native-code compiler
I like mentioning DragonFly in close proximity to the other BSDs,
ideally next to FreeBSD, as it shares most similarities with FreeBSD.
In this case, FreeBSD is in Tier 1, so mention it after OpenBSD. Sorry
for shifting OmniOS to the right.
As of the naming: We call it "DragonFly" and only sometimes "DragonFly
BSD" when talking to non-DragonFly people.
- https://pubs.opengroup.org/onlinepubs/9799919799/functions/getgrnam_r.html
- https://pubs.opengroup.org/onlinepubs/9799919799/functions/getgrgid_r.html
- https://pubs.opengroup.org/onlinepubs/9799919799/functions/getpwnam_r.html
- https://pubs.opengroup.org/onlinepubs/9799919799/functions/getpwuid_r.html
Using delayed macro expansion to generate the identifiers, it's
possible to simplify the code content of the macros.
Use __COUNTER__, which expands to sequential integral values starting
from 0, to avoid conflicts. __COUNTER__ is documented by GCC, clang,
MSVC, and xlc.
Reduce the scope of for loop iterators.
C dependencies are intended to be computed as a side-effect of compiling
a C file, not necessarily as a separate step. Compiling a C file with
GCC or clang is now responsible for directly creating the .d dependency
file, if dependencies are being computed. The workaround for MSVC now
becomes two calls to the C compiler, firstly to cl, to compile the file,
then to GCC to create the dependency information. This does the same
work as before, but with the calls in a different order.
Computing dependencies this way allows us to avoid re-checking the C
dependencies on every single invocation of make. If .d files are found,
then they are loaded. On first invocationm, neither the .o or the .d
file will exist, so make knows that the object needs rebuilding without
needing to compute the dependencies of it first.
Don't include pthread.h on Windows to avoid using pthreads emulation
libraries (such as winpthreads) by mistake.
Functions from platform.c that used pthreads are moved to unix.c,
their Windows counterparts are implemented in win32.c. Introduce a new
sync_win32.h header, counterpart of sync_unix.h. Use the
caml_plat_thread and caml_plat_thread_attr to abstract over the
system's thread id/handle type and thread attributes.
Use pairs of SRWLOCK and CONDITION_VARIABLES to replace pthreads
mutexes and condition variables.
POSIX states:
> The pthread_mutex_lock() function shall fail if:
> [EDEADLK]
> The mutex type is PTHREAD_MUTEX_ERRORCHECK and the current thread
> already owns the mutex.
The Windows documentation states:
> Exclusive mode SRW locks cannot be acquired recursively. If a thread
> tries to acquire a lock that it already holds, that attempt will
> [...] deadlock (for AcquireSRWLockExclusive).
Deadlocks caused by recursive attemps to lock cannot be detected on
Windows.
mingw-w64 GCC synthesises some calls to pthreads functions to implement
TLS. Ensure that the runtime still links pthreads statically on
mingw-w64 by including a single call to a pthreads function in the
runtime itself which causes the required module of libwinpthreads to be
linked for GCC, and thus avoids executables suddenly requiring the
libwinpthreads runtime DLL.