]> git.saurik.com Git - apple/libc.git/blob - include/sys/cdefs.h
Libc-594.9.5.tar.gz
[apple/libc.git] / include / sys / cdefs.h
1 /*
2 * Copyright (c) 2006 - 2008 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 /***********************************************************************
25 * Not to be installed in /usr/include
26 ***********************************************************************/
27
28 #ifndef _LIBC_SYS_CDEFS_H_
29 #define _LIBC_SYS_CDEFS_H_
30
31 /*
32 * Now include the real sys/cdefs.h. The checks in libc-features.h will assure
33 * that those macros are consistent with the current build environment.
34 */
35 #include_next <sys/cdefs.h>
36 #ifndef _LIBC_NO_FEATURE_VERIFICATION
37 #if defined(__arm__)
38 # include <arm/libc-features.h>
39 #elif defined(__i386__)
40 # include <i386/libc-features.h>
41 #elif defined(__ppc__)
42 # include <ppc/libc-features.h>
43 #elif defined(__ppc64__)
44 # include <ppc64/libc-features.h>
45 #elif defined(__x86_64__)
46 # include <x86_64/libc-features.h>
47 #else
48 # error "Unknown architecture."
49 #endif
50 #endif /* _LIBC_NO_FEATURE_VERIFICATION */
51
52 /*
53 * symbol suffixes used for symbol versioning
54 */
55 #if defined(VARIANT_LEGACY)
56 # define LIBC_SUF_UNIX03 /* nothing */
57 # define LIBC_SUF_64_BIT_INO_T /* nothing */
58 # define LIBC_SUF_NON_CANCELABLE /* nothing */
59 # define LIBC_SUF_1050 /* nothing */
60 #else /* !VARIANT_LEGACY */
61 # if __DARWIN_ONLY_UNIX_CONFORMANCE
62 # define LIBC_SUF_UNIX03 /* nothing */
63 # else /* !__DARWIN_ONLY_UNIX_CONFORMANCE */
64 # define LIBC_SUF_UNIX03 "$UNIX2003"
65 # endif /* __DARWIN_ONLY_UNIX_CONFORMANCE */
66
67 # if defined(VARIANT_INODE32)
68 # define LIBC_SUF_64_BIT_INO_T /* nothing */
69 # else /* !VARIANT_INODE32 */
70 # if __DARWIN_ONLY_64_BIT_INO_T
71 # define LIBC_SUF_64_BIT_INO_T /* nothing */
72 # else /* !__DARWIN_ONLY_64_BIT_INO_T */
73 # define LIBC_SUF_64_BIT_INO_T "$INODE64"
74 # endif /* __DARWIN_ONLY_64_BIT_INO_T */
75 # endif /* VARIANT_INODE32 */
76
77 # if defined(VARIANT_CANCELABLE)
78 # define LIBC_SUF_NON_CANCELABLE /* nothing */
79 # else /* !LIBC_NON_CANCELABLE */
80 # define LIBC_SUF_NON_CANCELABLE "$NOCANCEL"
81 # endif /* LIBC_NON_CANCELABLE */
82
83 # if defined(VARIANT_PRE1050)
84 # define LIBC_SUF_1050 /* nothing */
85 # else /* !VARIANT_PRE1050 */
86 # if __DARWIN_ONLY_VERS_1050
87 # define LIBC_SUF_1050 /* nothing */
88 # else /* !__DARWIN_ONLY_VERS_1050 */
89 # define LIBC_SUF_1050 "$1050"
90 # endif /* __DARWIN_ONLY_VERS_1050 */
91 # endif /* VARIANT_PRE1050 */
92
93 #endif /* LIBC_UNIX03 */
94
95 #define LIBC_SUF_EXTSN "$DARWIN_EXTSN"
96
97 /*
98 * symbol versioning macros
99 */
100 #define LIBC_ALIAS(sym) __asm("_" __STRING(sym) LIBC_SUF_UNIX03)
101 #define LIBC_ALIAS_C(sym) __asm("_" __STRING(sym) LIBC_SUF_NON_CANCELABLE LIBC_SUF_UNIX03)
102 #define LIBC_ALIAS_I(sym) __asm("_" __STRING(sym) LIBC_SUF_64_BIT_INO_T LIBC_SUF_UNIX03)
103 #define LIBC_INODE64(sym) __asm("_" __STRING(sym) LIBC_SUF_64_BIT_INO_T)
104
105 #define LIBC_1050(sym) __asm("_" __STRING(sym) LIBC_SUF_1050)
106 #define LIBC_1050ALIAS(sym) __asm("_" __STRING(sym) LIBC_SUF_1050 LIBC_SUF_UNIX03)
107 #define LIBC_1050ALIAS_C(sym) __asm("_" __STRING(sym) LIBC_SUF_1050 LIBC_SUF_NON_CANCELABLE LIBC_SUF_UNIX03)
108 #define LIBC_1050ALIAS_I(sym) __asm("_" __STRING(sym) LIBC_SUF_1050 LIBC_SUF_64_BIT_INO_T LIBC_SUF_UNIX03)
109 #define LIBC_1050INODE64(sym) __asm("_" __STRING(sym) LIBC_SUF_1050 LIBC_SUF_64_BIT_INO_T)
110
111 #define LIBC_EXTSN(sym) __asm("_" __STRING(sym) LIBC_SUF_EXTSN)
112 #define LIBC_EXTSN_C(sym) __asm("_" __STRING(sym) LIBC_SUF_EXTSN LIBC_SUF_NON_CANCELABLE)
113
114 extern int __pthread_tsd_first;
115 extern int pthread_key_init_np(int, void (*)(void *));
116
117 #define __LIBC_PTHREAD_KEY(x) (__pthread_tsd_first + (x))
118
119 /*
120 * Libc pthread key assignments
121 */
122 #define __LIBC_PTHREAD_KEY_XLOCALE __LIBC_PTHREAD_KEY(0)
123 #define __LIBC_PTHREAD_KEY_TTYNAME __LIBC_PTHREAD_KEY(1)
124 #define __LIBC_PTHREAD_KEY_LOCALTIME __LIBC_PTHREAD_KEY(2)
125 #define __LIBC_PTHREAD_KEY_GMTIME __LIBC_PTHREAD_KEY(3)
126 #define __LIBC_PTHREAD_KEY_GDTOA_BIGINT __LIBC_PTHREAD_KEY(4)
127 #define __LIBC_PTHREAD_KEY_PARSEFLOAT __LIBC_PTHREAD_KEY(5)
128
129 #endif /* _LIBC_SYS_CDEFS_H_ */