authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2020-12-20 11:52:25+01:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2021-01-02 15:30:14+01:00
log763d8073774ae0b77014187a75b2167522c44079
treeb590c771c0a5bf19dbc04d0fe29152ada879e15c
parent91a35e1a922e865ca0e9beb43a2be2c5552fc494

Duplicate OSAtomic.h between aarch64 and x86_64

The reason this is required is for two reasons: 1) the libc targeting `aarch64` macOS is slightly newer than that targeting `x86_64`, and 2) `OSAtomic.h` uses relative imports rather than system-wide imports for accompanying headers which clearly is an oversight on Apple's part. Until such time when `libkern` headers between `x86_64` and `aarch64` are identical, this will require a manual intervention to duplicate the relevant headers between the respective architectures.

7 files changed, 518 insertions(+), 260 deletions(-)

lib/libc/include/aarch64-macos-gnu/libkern/OSAtomic.h created+47
...@@ -0,0 +1,47 @@
1/*
2 * Copyright (c) 2004-2016 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24#ifndef _OSATOMIC_H_
25#define _OSATOMIC_H_
26
27/*! @header
28 * These are deprecated legacy interfaces for atomic and synchronization
29 * operations.
30 *
31 * Define OSATOMIC_USE_INLINED=1 to get inline implementations of the
32 * OSAtomic interfaces in terms of the <stdatomic.h> primitives.
33 *
34 * Define OSSPINLOCK_USE_INLINED=1 to get inline implementations of the
35 * OSSpinLock interfaces in terms of the <os/lock.h> primitives.
36 *
37 * These are intended as a transition convenience, direct use of those
38 * primitives should be preferred.
39 */
40
41#include <sys/cdefs.h>
42
43#include "OSAtomicDeprecated.h"
44#include "OSSpinLockDeprecated.h"
45#include "OSAtomicQueue.h"
46
47#endif /* _OSATOMIC_H_ */
\ No newline at end of file
lib/libc/include/aarch64-macos-gnu/libkern/OSSpinLockDeprecated.h created+212
...@@ -0,0 +1,212 @@
1/*
2 * Copyright (c) 2004-2016 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24#ifndef _OSSPINLOCK_DEPRECATED_H_
25#define _OSSPINLOCK_DEPRECATED_H_
26
27/*! @header
28 * These are deprecated legacy interfaces for userspace spinlocks.
29 *
30 * These interfaces should no longer be used, particularily in situations where
31 * threads of differing priorities may contend on the same spinlock.
32 *
33 * The interfaces in <os/lock.h> should be used instead in cases where a very
34 * low-level lock primitive is required. In general however, using higher level
35 * synchronization primitives such as those provided by the pthread or dispatch
36 * subsystems should be preferred.
37 *
38 * Define OSSPINLOCK_USE_INLINED=1 to get inline implementations of these
39 * interfaces in terms of the <os/lock.h> primitives. This is intended as a
40 * transition convenience, direct use of those primitives is preferred.
41 */
42
43#ifndef OSSPINLOCK_DEPRECATED
44#define OSSPINLOCK_DEPRECATED 1
45#define OSSPINLOCK_DEPRECATED_MSG(_r) "Use " #_r "() from <os/lock.h> instead"
46#define OSSPINLOCK_DEPRECATED_REPLACE_WITH(_r) \
47 __OS_AVAILABILITY_MSG(macosx, deprecated=10.12, OSSPINLOCK_DEPRECATED_MSG(_r)) \
48 __OS_AVAILABILITY_MSG(ios, deprecated=10.0, OSSPINLOCK_DEPRECATED_MSG(_r)) \
49 __OS_AVAILABILITY_MSG(tvos, deprecated=10.0, OSSPINLOCK_DEPRECATED_MSG(_r)) \
50 __OS_AVAILABILITY_MSG(watchos, deprecated=3.0, OSSPINLOCK_DEPRECATED_MSG(_r))
51#else
52#undef OSSPINLOCK_DEPRECATED
53#define OSSPINLOCK_DEPRECATED 0
54#define OSSPINLOCK_DEPRECATED_REPLACE_WITH(_r)
55#endif
56
57#if !(defined(OSSPINLOCK_USE_INLINED) && OSSPINLOCK_USE_INLINED)
58
59#include <sys/cdefs.h>
60#include <stddef.h>
61#include <stdint.h>
62#include <stdbool.h>
63#include <Availability.h>
64
65__BEGIN_DECLS
66
67/*! @abstract The default value for an <code>OSSpinLock</code>.
68 @discussion
69 The convention is that unlocked is zero, locked is nonzero.
70 */
71#define OS_SPINLOCK_INIT 0
72
73
74/*! @abstract Data type for a spinlock.
75 @discussion
76 You should always initialize a spinlock to {@link OS_SPINLOCK_INIT} before
77 using it.
78 */
79typedef int32_t OSSpinLock OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock);
80
81
82/*! @abstract Locks a spinlock if it would not block
83 @result
84 Returns <code>false</code> if the lock was already held by another thread,
85 <code>true</code> if it took the lock successfully.
86 */
87OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock_trylock)
88__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0)
89bool OSSpinLockTry( volatile OSSpinLock *__lock );
90
91
92/*! @abstract Locks a spinlock
93 @discussion
94 Although the lock operation spins, it employs various strategies to back
95 off if the lock is held.
96 */
97OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock_lock)
98__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0)
99void OSSpinLockLock( volatile OSSpinLock *__lock );
100
101
102/*! @abstract Unlocks a spinlock */
103OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock_unlock)
104__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0)
105void OSSpinLockUnlock( volatile OSSpinLock *__lock );
106
107__END_DECLS
108
109#else /* OSSPINLOCK_USE_INLINED */
110
111/*
112 * Inline implementations of the legacy OSSpinLock interfaces in terms of the
113 * of the <os/lock.h> primitives. Direct use of those primitives is preferred.
114 *
115 * NOTE: the locked value of os_unfair_lock is implementation defined and
116 * subject to change, code that relies on the specific locked value used by the
117 * legacy OSSpinLock interface WILL break when using these inline
118 * implementations in terms of os_unfair_lock.
119 */
120
121#if !OSSPINLOCK_USE_INLINED_TRANSPARENT
122
123#include <os/lock.h>
124
125__BEGIN_DECLS
126
127#if __has_attribute(always_inline)
128#define OSSPINLOCK_INLINE static __inline
129#else
130#define OSSPINLOCK_INLINE static __inline __attribute__((__always_inline__))
131#endif
132
133#define OS_SPINLOCK_INIT 0
134typedef int32_t OSSpinLock;
135
136#if __has_extension(c_static_assert)
137_Static_assert(sizeof(OSSpinLock) == sizeof(os_unfair_lock),
138 "Incompatible os_unfair_lock type");
139#endif
140
141OSSPINLOCK_INLINE
142void
143OSSpinLockLock(volatile OSSpinLock *__lock)
144{
145 os_unfair_lock_t lock = (os_unfair_lock_t)__lock;
146 return os_unfair_lock_lock(lock);
147}
148
149OSSPINLOCK_INLINE
150bool
151OSSpinLockTry(volatile OSSpinLock *__lock)
152{
153 os_unfair_lock_t lock = (os_unfair_lock_t)__lock;
154 return os_unfair_lock_trylock(lock);
155}
156
157OSSPINLOCK_INLINE
158void
159OSSpinLockUnlock(volatile OSSpinLock *__lock)
160{
161 os_unfair_lock_t lock = (os_unfair_lock_t)__lock;
162 return os_unfair_lock_unlock(lock);
163}
164
165#undef OSSPINLOCK_INLINE
166
167__END_DECLS
168
169#else /* OSSPINLOCK_USE_INLINED_TRANSPARENT */
170
171#include <sys/cdefs.h>
172#include <stddef.h>
173#include <stdint.h>
174#include <stdbool.h>
175#include <Availability.h>
176
177#define OS_NOSPIN_LOCK_AVAILABILITY \
178 __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) \
179 __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0)
180
181__BEGIN_DECLS
182
183#define OS_SPINLOCK_INIT 0
184typedef int32_t OSSpinLock OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock);
185typedef volatile OSSpinLock *_os_nospin_lock_t
186 OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock_t);
187
188OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock_lock)
189OS_NOSPIN_LOCK_AVAILABILITY
190void _os_nospin_lock_lock(_os_nospin_lock_t lock);
191#undef OSSpinLockLock
192#define OSSpinLockLock(lock) _os_nospin_lock_lock(lock)
193
194OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock_trylock)
195OS_NOSPIN_LOCK_AVAILABILITY
196bool _os_nospin_lock_trylock(_os_nospin_lock_t lock);
197#undef OSSpinLockTry
198#define OSSpinLockTry(lock) _os_nospin_lock_trylock(lock)
199
200OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock_unlock)
201OS_NOSPIN_LOCK_AVAILABILITY
202void _os_nospin_lock_unlock(_os_nospin_lock_t lock);
203#undef OSSpinLockUnlock
204#define OSSpinLockUnlock(lock) _os_nospin_lock_unlock(lock)
205
206__END_DECLS
207
208#endif /* OSSPINLOCK_USE_INLINED_TRANSPARENT */
209
210#endif /* OSSPINLOCK_USE_INLINED */
211
212#endif /* _OSSPINLOCK_DEPRECATED_H_ */
\ No newline at end of file
lib/libc/include/any-macos-any/libkern/OSAtomic.h deleted-47
...@@ -1,47 +0,0 @@
1/*
2 * Copyright (c) 2004-2016 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24#ifndef _OSATOMIC_H_
25#define _OSATOMIC_H_
26
27/*! @header
28 * These are deprecated legacy interfaces for atomic and synchronization
29 * operations.
30 *
31 * Define OSATOMIC_USE_INLINED=1 to get inline implementations of the
32 * OSAtomic interfaces in terms of the <stdatomic.h> primitives.
33 *
34 * Define OSSPINLOCK_USE_INLINED=1 to get inline implementations of the
35 * OSSpinLock interfaces in terms of the <os/lock.h> primitives.
36 *
37 * These are intended as a transition convenience, direct use of those
38 * primitives should be preferred.
39 */
40
41#include <sys/cdefs.h>
42
43#include "OSAtomicDeprecated.h"
44#include "OSSpinLockDeprecated.h"
45#include "OSAtomicQueue.h"
46
47#endif /* _OSATOMIC_H_ */
\ No newline at end of file
lib/libc/include/any-macos-any/libkern/OSSpinLockDeprecated.h deleted-212
...@@ -1,212 +0,0 @@
1/*
2 * Copyright (c) 2004-2016 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24#ifndef _OSSPINLOCK_DEPRECATED_H_
25#define _OSSPINLOCK_DEPRECATED_H_
26
27/*! @header
28 * These are deprecated legacy interfaces for userspace spinlocks.
29 *
30 * These interfaces should no longer be used, particularily in situations where
31 * threads of differing priorities may contend on the same spinlock.
32 *
33 * The interfaces in <os/lock.h> should be used instead in cases where a very
34 * low-level lock primitive is required. In general however, using higher level
35 * synchronization primitives such as those provided by the pthread or dispatch
36 * subsystems should be preferred.
37 *
38 * Define OSSPINLOCK_USE_INLINED=1 to get inline implementations of these
39 * interfaces in terms of the <os/lock.h> primitives. This is intended as a
40 * transition convenience, direct use of those primitives is preferred.
41 */
42
43#ifndef OSSPINLOCK_DEPRECATED
44#define OSSPINLOCK_DEPRECATED 1
45#define OSSPINLOCK_DEPRECATED_MSG(_r) "Use " #_r "() from <os/lock.h> instead"
46#define OSSPINLOCK_DEPRECATED_REPLACE_WITH(_r) \
47 __OS_AVAILABILITY_MSG(macosx, deprecated=10.12, OSSPINLOCK_DEPRECATED_MSG(_r)) \
48 __OS_AVAILABILITY_MSG(ios, deprecated=10.0, OSSPINLOCK_DEPRECATED_MSG(_r)) \
49 __OS_AVAILABILITY_MSG(tvos, deprecated=10.0, OSSPINLOCK_DEPRECATED_MSG(_r)) \
50 __OS_AVAILABILITY_MSG(watchos, deprecated=3.0, OSSPINLOCK_DEPRECATED_MSG(_r))
51#else
52#undef OSSPINLOCK_DEPRECATED
53#define OSSPINLOCK_DEPRECATED 0
54#define OSSPINLOCK_DEPRECATED_REPLACE_WITH(_r)
55#endif
56
57#if !(defined(OSSPINLOCK_USE_INLINED) && OSSPINLOCK_USE_INLINED)
58
59#include <sys/cdefs.h>
60#include <stddef.h>
61#include <stdint.h>
62#include <stdbool.h>
63#include <Availability.h>
64
65__BEGIN_DECLS
66
67/*! @abstract The default value for an <code>OSSpinLock</code>.
68 @discussion
69 The convention is that unlocked is zero, locked is nonzero.
70 */
71#define OS_SPINLOCK_INIT 0
72
73
74/*! @abstract Data type for a spinlock.
75 @discussion
76 You should always initialize a spinlock to {@link OS_SPINLOCK_INIT} before
77 using it.
78 */
79typedef int32_t OSSpinLock OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock);
80
81
82/*! @abstract Locks a spinlock if it would not block
83 @result
84 Returns <code>false</code> if the lock was already held by another thread,
85 <code>true</code> if it took the lock successfully.
86 */
87OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock_trylock)
88__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0)
89bool OSSpinLockTry( volatile OSSpinLock *__lock );
90
91
92/*! @abstract Locks a spinlock
93 @discussion
94 Although the lock operation spins, it employs various strategies to back
95 off if the lock is held.
96 */
97OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock_lock)
98__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0)
99void OSSpinLockLock( volatile OSSpinLock *__lock );
100
101
102/*! @abstract Unlocks a spinlock */
103OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock_unlock)
104__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0)
105void OSSpinLockUnlock( volatile OSSpinLock *__lock );
106
107__END_DECLS
108
109#else /* OSSPINLOCK_USE_INLINED */
110
111/*
112 * Inline implementations of the legacy OSSpinLock interfaces in terms of the
113 * of the <os/lock.h> primitives. Direct use of those primitives is preferred.
114 *
115 * NOTE: the locked value of os_unfair_lock is implementation defined and
116 * subject to change, code that relies on the specific locked value used by the
117 * legacy OSSpinLock interface WILL break when using these inline
118 * implementations in terms of os_unfair_lock.
119 */
120
121#if !OSSPINLOCK_USE_INLINED_TRANSPARENT
122
123#include <os/lock.h>
124
125__BEGIN_DECLS
126
127#if __has_attribute(always_inline)
128#define OSSPINLOCK_INLINE static __inline
129#else
130#define OSSPINLOCK_INLINE static __inline __attribute__((__always_inline__))
131#endif
132
133#define OS_SPINLOCK_INIT 0
134typedef int32_t OSSpinLock;
135
136#if __has_extension(c_static_assert)
137_Static_assert(sizeof(OSSpinLock) == sizeof(os_unfair_lock),
138 "Incompatible os_unfair_lock type");
139#endif
140
141OSSPINLOCK_INLINE
142void
143OSSpinLockLock(volatile OSSpinLock *__lock)
144{
145 os_unfair_lock_t lock = (os_unfair_lock_t)__lock;
146 return os_unfair_lock_lock(lock);
147}
148
149OSSPINLOCK_INLINE
150bool
151OSSpinLockTry(volatile OSSpinLock *__lock)
152{
153 os_unfair_lock_t lock = (os_unfair_lock_t)__lock;
154 return os_unfair_lock_trylock(lock);
155}
156
157OSSPINLOCK_INLINE
158void
159OSSpinLockUnlock(volatile OSSpinLock *__lock)
160{
161 os_unfair_lock_t lock = (os_unfair_lock_t)__lock;
162 return os_unfair_lock_unlock(lock);
163}
164
165#undef OSSPINLOCK_INLINE
166
167__END_DECLS
168
169#else /* OSSPINLOCK_USE_INLINED_TRANSPARENT */
170
171#include <sys/cdefs.h>
172#include <stddef.h>
173#include <stdint.h>
174#include <stdbool.h>
175#include <Availability.h>
176
177#define OS_NOSPIN_LOCK_AVAILABILITY \
178 __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) \
179 __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0)
180
181__BEGIN_DECLS
182
183#define OS_SPINLOCK_INIT 0
184typedef int32_t OSSpinLock OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock);
185typedef volatile OSSpinLock *_os_nospin_lock_t
186 OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock_t);
187
188OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock_lock)
189OS_NOSPIN_LOCK_AVAILABILITY
190void _os_nospin_lock_lock(_os_nospin_lock_t lock);
191#undef OSSpinLockLock
192#define OSSpinLockLock(lock) _os_nospin_lock_lock(lock)
193
194OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock_trylock)
195OS_NOSPIN_LOCK_AVAILABILITY
196bool _os_nospin_lock_trylock(_os_nospin_lock_t lock);
197#undef OSSpinLockTry
198#define OSSpinLockTry(lock) _os_nospin_lock_trylock(lock)
199
200OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock_unlock)
201OS_NOSPIN_LOCK_AVAILABILITY
202void _os_nospin_lock_unlock(_os_nospin_lock_t lock);
203#undef OSSpinLockUnlock
204#define OSSpinLockUnlock(lock) _os_nospin_lock_unlock(lock)
205
206__END_DECLS
207
208#endif /* OSSPINLOCK_USE_INLINED_TRANSPARENT */
209
210#endif /* OSSPINLOCK_USE_INLINED */
211
212#endif /* _OSSPINLOCK_DEPRECATED_H_ */
\ No newline at end of file
lib/libc/include/x86_64-macos-gnu/libkern/OSAtomic.h created+47
...@@ -0,0 +1,47 @@
1/*
2 * Copyright (c) 2004-2016 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24#ifndef _OSATOMIC_H_
25#define _OSATOMIC_H_
26
27/*! @header
28 * These are deprecated legacy interfaces for atomic and synchronization
29 * operations.
30 *
31 * Define OSATOMIC_USE_INLINED=1 to get inline implementations of the
32 * OSAtomic interfaces in terms of the <stdatomic.h> primitives.
33 *
34 * Define OSSPINLOCK_USE_INLINED=1 to get inline implementations of the
35 * OSSpinLock interfaces in terms of the <os/lock.h> primitives.
36 *
37 * These are intended as a transition convenience, direct use of those
38 * primitives should be preferred.
39 */
40
41#include <sys/cdefs.h>
42
43#include "OSAtomicDeprecated.h"
44#include "OSSpinLockDeprecated.h"
45#include "OSAtomicQueue.h"
46
47#endif /* _OSATOMIC_H_ */
\ No newline at end of file
lib/libc/include/x86_64-macos-gnu/libkern/OSSpinLockDeprecated.h created+212
...@@ -0,0 +1,212 @@
1/*
2 * Copyright (c) 2004-2016 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24#ifndef _OSSPINLOCK_DEPRECATED_H_
25#define _OSSPINLOCK_DEPRECATED_H_
26
27/*! @header
28 * These are deprecated legacy interfaces for userspace spinlocks.
29 *
30 * These interfaces should no longer be used, particularily in situations where
31 * threads of differing priorities may contend on the same spinlock.
32 *
33 * The interfaces in <os/lock.h> should be used instead in cases where a very
34 * low-level lock primitive is required. In general however, using higher level
35 * synchronization primitives such as those provided by the pthread or dispatch
36 * subsystems should be preferred.
37 *
38 * Define OSSPINLOCK_USE_INLINED=1 to get inline implementations of these
39 * interfaces in terms of the <os/lock.h> primitives. This is intended as a
40 * transition convenience, direct use of those primitives is preferred.
41 */
42
43#ifndef OSSPINLOCK_DEPRECATED
44#define OSSPINLOCK_DEPRECATED 1
45#define OSSPINLOCK_DEPRECATED_MSG(_r) "Use " #_r "() from <os/lock.h> instead"
46#define OSSPINLOCK_DEPRECATED_REPLACE_WITH(_r) \
47 __OS_AVAILABILITY_MSG(macosx, deprecated=10.12, OSSPINLOCK_DEPRECATED_MSG(_r)) \
48 __OS_AVAILABILITY_MSG(ios, deprecated=10.0, OSSPINLOCK_DEPRECATED_MSG(_r)) \
49 __OS_AVAILABILITY_MSG(tvos, deprecated=10.0, OSSPINLOCK_DEPRECATED_MSG(_r)) \
50 __OS_AVAILABILITY_MSG(watchos, deprecated=3.0, OSSPINLOCK_DEPRECATED_MSG(_r))
51#else
52#undef OSSPINLOCK_DEPRECATED
53#define OSSPINLOCK_DEPRECATED 0
54#define OSSPINLOCK_DEPRECATED_REPLACE_WITH(_r)
55#endif
56
57#if !(defined(OSSPINLOCK_USE_INLINED) && OSSPINLOCK_USE_INLINED)
58
59#include <sys/cdefs.h>
60#include <stddef.h>
61#include <stdint.h>
62#include <stdbool.h>
63#include <Availability.h>
64
65__BEGIN_DECLS
66
67/*! @abstract The default value for an <code>OSSpinLock</code>.
68 @discussion
69 The convention is that unlocked is zero, locked is nonzero.
70 */
71#define OS_SPINLOCK_INIT 0
72
73
74/*! @abstract Data type for a spinlock.
75 @discussion
76 You should always initialize a spinlock to {@link OS_SPINLOCK_INIT} before
77 using it.
78 */
79typedef int32_t OSSpinLock OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock);
80
81
82/*! @abstract Locks a spinlock if it would not block
83 @result
84 Returns <code>false</code> if the lock was already held by another thread,
85 <code>true</code> if it took the lock successfully.
86 */
87OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock_trylock)
88__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0)
89bool OSSpinLockTry( volatile OSSpinLock *__lock );
90
91
92/*! @abstract Locks a spinlock
93 @discussion
94 Although the lock operation spins, it employs various strategies to back
95 off if the lock is held.
96 */
97OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock_lock)
98__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0)
99void OSSpinLockLock( volatile OSSpinLock *__lock );
100
101
102/*! @abstract Unlocks a spinlock */
103OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock_unlock)
104__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0)
105void OSSpinLockUnlock( volatile OSSpinLock *__lock );
106
107__END_DECLS
108
109#else /* OSSPINLOCK_USE_INLINED */
110
111/*
112 * Inline implementations of the legacy OSSpinLock interfaces in terms of the
113 * of the <os/lock.h> primitives. Direct use of those primitives is preferred.
114 *
115 * NOTE: the locked value of os_unfair_lock is implementation defined and
116 * subject to change, code that relies on the specific locked value used by the
117 * legacy OSSpinLock interface WILL break when using these inline
118 * implementations in terms of os_unfair_lock.
119 */
120
121#if !OSSPINLOCK_USE_INLINED_TRANSPARENT
122
123#include <os/lock.h>
124
125__BEGIN_DECLS
126
127#if __has_attribute(always_inline)
128#define OSSPINLOCK_INLINE static __inline
129#else
130#define OSSPINLOCK_INLINE static __inline __attribute__((__always_inline__))
131#endif
132
133#define OS_SPINLOCK_INIT 0
134typedef int32_t OSSpinLock;
135
136#if __has_extension(c_static_assert)
137_Static_assert(sizeof(OSSpinLock) == sizeof(os_unfair_lock),
138 "Incompatible os_unfair_lock type");
139#endif
140
141OSSPINLOCK_INLINE
142void
143OSSpinLockLock(volatile OSSpinLock *__lock)
144{
145 os_unfair_lock_t lock = (os_unfair_lock_t)__lock;
146 return os_unfair_lock_lock(lock);
147}
148
149OSSPINLOCK_INLINE
150bool
151OSSpinLockTry(volatile OSSpinLock *__lock)
152{
153 os_unfair_lock_t lock = (os_unfair_lock_t)__lock;
154 return os_unfair_lock_trylock(lock);
155}
156
157OSSPINLOCK_INLINE
158void
159OSSpinLockUnlock(volatile OSSpinLock *__lock)
160{
161 os_unfair_lock_t lock = (os_unfair_lock_t)__lock;
162 return os_unfair_lock_unlock(lock);
163}
164
165#undef OSSPINLOCK_INLINE
166
167__END_DECLS
168
169#else /* OSSPINLOCK_USE_INLINED_TRANSPARENT */
170
171#include <sys/cdefs.h>
172#include <stddef.h>
173#include <stdint.h>
174#include <stdbool.h>
175#include <Availability.h>
176
177#define OS_NOSPIN_LOCK_AVAILABILITY \
178 __OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0) \
179 __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0)
180
181__BEGIN_DECLS
182
183#define OS_SPINLOCK_INIT 0
184typedef int32_t OSSpinLock OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock);
185typedef volatile OSSpinLock *_os_nospin_lock_t
186 OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock_t);
187
188OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock_lock)
189OS_NOSPIN_LOCK_AVAILABILITY
190void _os_nospin_lock_lock(_os_nospin_lock_t lock);
191#undef OSSpinLockLock
192#define OSSpinLockLock(lock) _os_nospin_lock_lock(lock)
193
194OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock_trylock)
195OS_NOSPIN_LOCK_AVAILABILITY
196bool _os_nospin_lock_trylock(_os_nospin_lock_t lock);
197#undef OSSpinLockTry
198#define OSSpinLockTry(lock) _os_nospin_lock_trylock(lock)
199
200OSSPINLOCK_DEPRECATED_REPLACE_WITH(os_unfair_lock_unlock)
201OS_NOSPIN_LOCK_AVAILABILITY
202void _os_nospin_lock_unlock(_os_nospin_lock_t lock);
203#undef OSSpinLockUnlock
204#define OSSpinLockUnlock(lock) _os_nospin_lock_unlock(lock)
205
206__END_DECLS
207
208#endif /* OSSPINLOCK_USE_INLINED_TRANSPARENT */
209
210#endif /* OSSPINLOCK_USE_INLINED */
211
212#endif /* _OSSPINLOCK_DEPRECATED_H_ */
\ No newline at end of file
src/Compilation.zig-1
...@@ -2888,7 +2888,6 @@ fn buildOutputFromZig(...@@ -2888,7 +2888,6 @@ fn buildOutputFromZig(
2888 .directory = null, // Put it in the cache directory.2888 .directory = null, // Put it in the cache directory.
2889 .basename = bin_basename,2889 .basename = bin_basename,
2890 };2890 };
2891
2892 const sub_compilation = try Compilation.create(comp.gpa, .{2891 const sub_compilation = try Compilation.create(comp.gpa, .{
2893 .global_cache_directory = comp.global_cache_directory,2892 .global_cache_directory = comp.global_cache_directory,
2894 .local_cache_directory = comp.global_cache_directory,2893 .local_cache_directory = comp.global_cache_directory,