From: Iain Sandoe Date: Wed, 3 Dec 2025 07:44:53 +0000 (+0000) Subject: Ada, Darwin: Implement OSLock for Darwin [PR115305]. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bdf293a112d293cee8bca0ae2e3944eba36e8005;p=thirdparty%2Fgcc.git Ada, Darwin: Implement OSLock for Darwin [PR115305]. The generic Posix code does not match the layout of the pthread entities in the Darwin _pthread_types.h. So, let's make a Darwin-specific version and use it. PR ada/115305 gcc/ada/ChangeLog: * Makefile.rtl: Use s-oslock__darwin instead of the Posix version. * libgnat/s-oslock__darwin.ads: New file. Signed-off-by: Iain Sandoe --- diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl index 0fa2c51ceb6..2c3891dc464 100644 --- a/gcc/ada/Makefile.rtl +++ b/gcc/ada/Makefile.rtl @@ -3036,7 +3036,7 @@ ifeq ($(strip $(filter-out darwin%,$(target_os))),) s-inmaop.adb. -- +-- -- +-- GNARL was developed by the GNARL team at Florida State University. -- +-- Extensive contributions were provided by Ada Core Technologies, Inc. -- +-- -- +------------------------------------------------------------------------------ + +-- This is a Darwin version of this package + +with Interfaces.C; +with System.OS_Constants; + +package System.OS_Locks is + pragma Preelaborate; + + type pthread_mutex_t is limited private; + + subtype RTS_Lock is pthread_mutex_t; + -- Should be used inside the runtime system. The difference between Lock + -- and the RTS_Lock is that the latter serves only as a semaphore so that + -- we do not check for ceiling violations. + +private + + subtype char_array is Interfaces.C.char_array; + + type pthread_mutex_t is record + Sig : Interfaces.C.long; + Data : char_array (1 .. OS_Constants.PTHREAD_MUTEX_SIZE); + end record; + pragma Convention (C, pthread_mutex_t); + +end System.OS_Locks;