this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

More progress on libc upgrade+fat build, now at the point of linking libSystem

+721 -106
+2
cmake/use_ld64.cmake
··· 23 23 -Wl,-dylib_file,/usr/lib/system/libmacho.dylib:${CMAKE_BINARY_DIR}/src/libmacho/libmacho.dylib \ 24 24 -Wl,-dylib_file,/usr/lib/system/libsystem_sandbox.dylib:${CMAKE_BINARY_DIR}/src/sandbox/libsystem_sandbox.dylib \ 25 25 -Wl,-dylib_file,/usr/lib/system/libsystem_duct.dylib:${CMAKE_BINARY_DIR}/src/duct/src/libsystem_duct.dylib \ 26 + -Wl,-dylib_file,/usr/lib/system/libsystem_pthread.dylib:${CMAKE_BINARY_DIR}/src/external/libpthread/src/libsystem_pthread.dylib \ 27 + -Wl,-dylib_file,/usr/lib/system/libsystem_platform.dylib:${CMAKE_BINARY_DIR}/src/external/libplatform/libsystem_platform.dylib \ 26 28 -Wl,-dylib_file,/usr/lib/libcommonCrypto.dylib:${CMAKE_BINARY_DIR}/src/CommonCrypto/libcommonCrypto.dylib \ 27 29 -Wl,-dylib_file,/usr/lib/system/libsystem_malloc.dylib:${CMAKE_BINARY_DIR}/src/libmalloc/libsystem_malloc.dylib ") 28 30
+1 -1
compiler-include/stdatomic.h
··· 27 27 /* If we're hosted, fall back to the system's stdatomic.h. FreeBSD, for 28 28 * example, already has a Clang-compatible stdatomic.h header. 29 29 */ 30 - #if __STDC_HOSTED__ && __has_include_next(<stdatomic.h>) 30 + #if __STDC_HOSTED__ && __has_include_next(<stdatomic.h>) && 0 31 31 # include_next <stdatomic.h> 32 32 #else 33 33
+66
platform-include/i386/atomic.h
··· 1 + /* 2 + * Copyright (c) 2015 Apple Inc. All rights reserved. 3 + * 4 + * @APPLE_OSREFERENCE_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. The rights granted to you under the License 10 + * may not be used to create, or enable the creation or redistribution of, 11 + * unlawful or unlicensed copies of an Apple operating system, or to 12 + * circumvent, violate, or enable the circumvention or violation of, any 13 + * terms of an Apple operating system software license agreement. 14 + * 15 + * Please obtain a copy of the License at 16 + * http://www.opensource.apple.com/apsl/ and read it before using this file. 17 + * 18 + * The Original Code and all software distributed under the License are 19 + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20 + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21 + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22 + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23 + * Please see the License for the specific language governing rights and 24 + * limitations under the License. 25 + * 26 + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27 + */ 28 + 29 + #ifndef _I386_ATOMIC_H_ 30 + #define _I386_ATOMIC_H_ 31 + 32 + #include <i386/smp.h> 33 + 34 + #if __SMP__ 35 + 36 + #define memory_order_consume_smp memory_order_consume 37 + #define memory_order_acquire_smp memory_order_acquire 38 + #define memory_order_release_smp memory_order_release 39 + #define memory_order_acq_rel_smp memory_order_acq_rel 40 + #define memory_order_seq_cst_smp memory_order_seq_cst 41 + 42 + #else 43 + 44 + #define memory_order_consume_smp memory_order_relaxed 45 + #define memory_order_acquire_smp memory_order_relaxed 46 + #define memory_order_release_smp memory_order_relaxed 47 + #define memory_order_acq_rel_smp memory_order_relaxed 48 + #define memory_order_seq_cst_smp memory_order_relaxed 49 + 50 + #endif 51 + 52 + #ifdef ATOMIC_PRIVATE 53 + 54 + static boolean_t 55 + atomic_compare_exchange(uintptr_t *target, uintptr_t oldval, uintptr_t newval, 56 + enum memory_order ord, boolean_t wait) 57 + { 58 + (void)wait; 59 + return __c11_atomic_compare_exchange_strong((_Atomic uintptr_t *)target, &oldval, newval, ord, memory_order_relaxed); 60 + } 61 + 62 + #endif // ATOMIC_PRIVATE 63 + 64 + 65 + #endif // _I386_ATOMIC_H_ 66 +
+35
platform-include/i386/smp.h
··· 1 + /* 2 + * Copyright (c) 2014 Apple Inc. All rights reserved. 3 + * 4 + * @APPLE_OSREFERENCE_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. The rights granted to you under the License 10 + * may not be used to create, or enable the creation or redistribution of, 11 + * unlawful or unlicensed copies of an Apple operating system, or to 12 + * circumvent, violate, or enable the circumvention or violation of, any 13 + * terms of an Apple operating system software license agreement. 14 + * 15 + * Please obtain a copy of the License at 16 + * http://www.opensource.apple.com/apsl/ and read it before using this file. 17 + * 18 + * The Original Code and all software distributed under the License are 19 + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20 + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21 + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22 + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23 + * Please see the License for the specific language governing rights and 24 + * limitations under the License. 25 + * 26 + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27 + */ 28 + 29 + #ifndef _I386_SMP_H_ 30 + #define _I386_SMP_H_ 31 + 32 + /* x86_64 kernels are always built SMP, even if only 1 CPU is active */ 33 + #define __SMP__ 1 34 + 35 + #endif /* _I386_SMP_H_ */
+51
platform-include/machine/atomic.h
··· 1 + /* 2 + * Copyright (c) 2015 Apple Inc. All rights reserved. 3 + * 4 + * @APPLE_OSREFERENCE_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. The rights granted to you under the License 10 + * may not be used to create, or enable the creation or redistribution of, 11 + * unlawful or unlicensed copies of an Apple operating system, or to 12 + * circumvent, violate, or enable the circumvention or violation of, any 13 + * terms of an Apple operating system software license agreement. 14 + * 15 + * Please obtain a copy of the License at 16 + * http://www.opensource.apple.com/apsl/ and read it before using this file. 17 + * 18 + * The Original Code and all software distributed under the License are 19 + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20 + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21 + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22 + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23 + * Please see the License for the specific language governing rights and 24 + * limitations under the License. 25 + * 26 + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27 + */ 28 + 29 + #ifndef _MACHINE_ATOMIC_H 30 + #define _MACHINE_ATOMIC_H 31 + #include <stdatomic.h> 32 + 33 + #if 0 34 + /* This should be in stdatomic.h once supported by compiler */ 35 + enum memory_order { 36 + memory_order_relaxed, 37 + memory_order_consume, 38 + memory_order_acquire, 39 + memory_order_release, 40 + memory_order_acq_rel, 41 + memory_order_seq_cst 42 + }; 43 + #endif 44 + 45 + #if defined (__x86_64__) || defined (__i386__) 46 + #include "i386/atomic.h" 47 + #else 48 + #error architecture not supported 49 + #endif 50 + 51 + #endif /* _MACHINE_ATOMIC_H */
+419
platform-include/sys/spawn_internal.h
··· 1 + /* 2 + * Copyright (c) 2006 Apple Computer, Inc. All rights reserved. 3 + * 4 + * @APPLE_OSREFERENCE_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. The rights granted to you under the License 10 + * may not be used to create, or enable the creation or redistribution of, 11 + * unlawful or unlicensed copies of an Apple operating system, or to 12 + * circumvent, violate, or enable the circumvention or violation of, any 13 + * terms of an Apple operating system software license agreement. 14 + * 15 + * Please obtain a copy of the License at 16 + * http://www.opensource.apple.com/apsl/ and read it before using this file. 17 + * 18 + * The Original Code and all software distributed under the License are 19 + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20 + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21 + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22 + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23 + * Please see the License for the specific language governing rights and 24 + * limitations under the License. 25 + * 26 + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27 + */ 28 + 29 + 30 + /* 31 + * [SPN] Support for _POSIX_SPAWN 32 + * 33 + * This file contains internal data structures which are externally represented 34 + * as opaque void pointers to prevent introspection. This permits us to 35 + * change the underlying implementation of the code to maintain it or to 36 + * support new features, as needed, without the consumer needing to recompile 37 + * their code because of structure size changes or data reorganization. 38 + */ 39 + 40 + #ifndef _SYS_SPAWN_INTERNAL_H_ 41 + #define _SYS_SPAWN_INTERNAL_H_ 42 + 43 + #include <sys/_types.h> /* __offsetof(), __darwin_size_t */ 44 + #include <sys/param.h> 45 + #include <sys/syslimits.h> /* PATH_MAX */ 46 + #include <sys/spawn.h> 47 + #include <mach/machine.h> 48 + #include <mach/port.h> 49 + #include <mach/exception_types.h> 50 + #include <mach/coalition.h> /* COALITION_NUM_TYPES */ 51 + 52 + /* 53 + * Allowable posix_spawn() port action types 54 + */ 55 + typedef enum { 56 + PSPA_SPECIAL = 0, 57 + PSPA_EXCEPTION = 1, 58 + PSPA_AU_SESSION = 2, 59 + PSPA_IMP_WATCHPORTS = 3, 60 + } pspa_t; 61 + 62 + /* 63 + * Internal representation of one port to be set on posix_spawn(). 64 + * Currently this is limited to setting special and exception ports, 65 + * but could be extended to other inheritable port types. 66 + */ 67 + typedef struct _ps_port_action { 68 + pspa_t port_type; 69 + exception_mask_t mask; 70 + mach_port_name_t new_port; 71 + exception_behavior_t behavior; 72 + thread_state_flavor_t flavor; 73 + int which; 74 + } _ps_port_action_t; 75 + 76 + /* 77 + * A collection of port actions to take on the newly spawned process. 78 + */ 79 + typedef struct _posix_spawn_port_actions { 80 + int pspa_alloc; 81 + int pspa_count; 82 + _ps_port_action_t pspa_actions[]; 83 + } *_posix_spawn_port_actions_t; 84 + 85 + /* 86 + * Returns size in bytes of a _posix_spawn_port_actions holding x elements. 87 + */ 88 + #define PS_PORT_ACTIONS_SIZE(x) \ 89 + __offsetof(struct _posix_spawn_port_actions, pspa_actions[(x)]) 90 + 91 + #define NBINPREFS 4 92 + 93 + /* 94 + * Mapping of opaque data pointer to a MAC policy (specified by name). 95 + */ 96 + typedef struct _ps_mac_policy_extension { 97 + char policyname[128]; 98 + union { 99 + uint64_t data; 100 + void *datap; /* pointer in kernel memory */ 101 + }; 102 + uint64_t datalen; 103 + } _ps_mac_policy_extension_t; 104 + 105 + /* 106 + * A collection of extra data passed to MAC policies for the newly spawned process. 107 + */ 108 + typedef struct _posix_spawn_mac_policy_extensions { 109 + int psmx_alloc; 110 + int psmx_count; 111 + _ps_mac_policy_extension_t psmx_extensions[]; 112 + } *_posix_spawn_mac_policy_extensions_t; 113 + 114 + /* 115 + * Returns size in bytes of a _posix_spawn_mac_policy_extensions holding x elements. 116 + */ 117 + #define PS_MAC_EXTENSIONS_SIZE(x) \ 118 + __offsetof(struct _posix_spawn_mac_policy_extensions, psmx_extensions[(x)]) 119 + 120 + #define PS_MAC_EXTENSIONS_INIT_COUNT 2 121 + 122 + /* 123 + * Coalition posix spawn attributes 124 + */ 125 + struct _posix_spawn_coalition_info { 126 + struct { 127 + uint64_t psci_id; 128 + uint32_t psci_role; 129 + uint32_t psci_reserved1; 130 + uint64_t psci_reserved2; 131 + } psci_info[COALITION_NUM_TYPES]; 132 + }; 133 + 134 + /* 135 + * Persona attributes 136 + */ 137 + struct _posix_spawn_persona_info { 138 + uid_t pspi_id; /* persona ID (unix UID) */ 139 + uint32_t pspi_flags; /* spawn persona flags */ 140 + uid_t pspi_uid; /* alternate posix/unix UID */ 141 + gid_t pspi_gid; /* alternate posix/unix GID */ 142 + uint32_t pspi_ngroups; /* alternate advisory groups */ 143 + gid_t pspi_groups[NGROUPS]; 144 + uid_t pspi_gmuid; /* group membership UID */ 145 + }; 146 + 147 + #define POSIX_SPAWN_PERSONA_FLAGS_NONE 0x0 148 + #define POSIX_SPAWN_PERSONA_FLAGS_OVERRIDE 0x1 149 + #define POSIX_SPAWN_PERSONA_FLAGS_VERIFY 0x2 150 + 151 + #define POSIX_SPAWN_PERSONA_ALL_FLAGS \ 152 + (POSIX_SPAWN_PERSONA_FLAGS_OVERRIDE \ 153 + | POSIX_SPAWN_PERSONA_FLAGS_VERIFY \ 154 + ) 155 + 156 + #define POSIX_SPAWN_PERSONA_UID 0x00010000 157 + #define POSIX_SPAWN_PERSONA_GID 0x00020000 158 + #define POSIX_SPAWN_PERSONA_GROUPS 0x00040000 159 + 160 + 161 + /* 162 + * A posix_spawnattr structure contains all of the attribute elements that 163 + * can be set, as well as any metadata whose validity is signalled by the 164 + * presence of a bit in the flags field. All fields are initialized to the 165 + * appropriate default values by posix_spawnattr_init(). 166 + */ 167 + 168 + typedef struct _posix_spawnattr { 169 + short psa_flags; /* spawn attribute flags */ 170 + short flags_padding; /* get the flags to be int aligned */ 171 + sigset_t psa_sigdefault; /* signal set to default */ 172 + sigset_t psa_sigmask; /* signal set to mask */ 173 + pid_t psa_pgroup; /* pgroup to spawn into */ 174 + cpu_type_t psa_binprefs[NBINPREFS]; /* cpu affinity prefs*/ 175 + int psa_pcontrol; /* process control bits on resource starvation */ 176 + int psa_apptype; /* app type and process spec behav */ 177 + uint64_t psa_cpumonitor_percent; /* CPU usage monitor percentage */ 178 + uint64_t psa_cpumonitor_interval; /* CPU usage monitor interval, in seconds */ 179 + uint64_t psa_reserved; 180 + 181 + short psa_jetsam_flags; /* jetsam flags */ 182 + short short_padding; /* Padding for alignment issues */ 183 + int psa_priority; /* jetsam relative importance */ 184 + int psa_memlimit_active; /* jetsam memory limit (in MB) when process is active */ 185 + int psa_memlimit_inactive; /* jetsam memory limit (in MB) when process is inactive */ 186 + 187 + uint64_t psa_qos_clamp; /* QoS Clamp to set on the new process */ 188 + uint64_t psa_darwin_role; /* PRIO_DARWIN_ROLE to set on the new process */ 189 + 190 + /* 191 + * NOTE: Extensions array pointers must stay at the end so that 192 + * everything above this point stays the same size on different bitnesses 193 + * see <rdar://problem/12858307> 194 + */ 195 + _posix_spawn_port_actions_t psa_ports; /* special/exception ports */ 196 + _posix_spawn_mac_policy_extensions_t psa_mac_extensions; /* MAC policy-specific extensions. */ 197 + struct _posix_spawn_coalition_info *psa_coalition_info; /* coalition info */ 198 + struct _posix_spawn_persona_info *psa_persona_info; /* spawn new process into given persona */ 199 + } *_posix_spawnattr_t; 200 + 201 + /* 202 + * Jetsam flags eg: psa_jetsam_flags 203 + */ 204 + #define POSIX_SPAWN_JETSAM_SET 0x8000 205 + 206 + #define POSIX_SPAWN_JETSAM_USE_EFFECTIVE_PRIORITY 0x01 207 + #define POSIX_SPAWN_JETSAM_HIWATER_BACKGROUND 0x02 /* to be deprecated */ 208 + #define POSIX_SPAWN_JETSAM_MEMLIMIT_FATAL 0x04 /* to be deprecated */ 209 + 210 + /* 211 + * Additional flags available for use with 212 + * the posix_spawnattr_setjetsam_ext() call 213 + */ 214 + #define POSIX_SPAWN_JETSAM_MEMLIMIT_ACTIVE_FATAL 0x04 /* if set, limit is fatal when the process is active */ 215 + #define POSIX_SPAWN_JETSAM_MEMLIMIT_INACTIVE_FATAL 0x08 /* if set, limit is fatal when the process is inactive */ 216 + 217 + /* 218 + * Deprecated posix_spawn psa_flags values 219 + * 220 + * POSIX_SPAWN_OSX_TALAPP_START 0x0400 221 + * POSIX_SPAWN_IOS_RESV1_APP_START 0x0400 222 + * POSIX_SPAWN_IOS_APPLE_DAEMON_START 0x0800 223 + * POSIX_SPAWN_IOS_APP_START 0x1000 224 + * POSIX_SPAWN_OSX_WIDGET_START 0x0800 225 + * POSIX_SPAWN_OSX_DBCLIENT_START 0x0800 226 + * POSIX_SPAWN_OSX_RESVAPP_START 0x1000 227 + */ 228 + 229 + /* 230 + * Deprecated posix_spawn psa_apptype values 231 + * 232 + * POSIX_SPAWN_PROCESS_TYPE_APPLEDAEMON 0x00000001 233 + * POSIX_SPAWN_PROCESS_TYPE_UIAPP 0x00000002 234 + * POSIX_SPAWN_PROCESS_TYPE_ADAPTIVE 0x00000004 235 + * POSIX_SPAWN_PROCESS_TYPE_TAL 0x00000001 236 + * POSIX_SPAWN_PROCESS_TYPE_WIDGET 0x00000002 237 + * POSIX_SPAWN_PROCESS_TYPE_DELAYIDLESLEEP 0x10000000 238 + * 239 + * POSIX_SPAWN_PROCESS_FLAG_IMPORTANCE_DONOR 0x00000010 240 + * POSIX_SPAWN_PROCESS_FLAG_ADAPTIVE 0x00000020 241 + * POSIX_SPAWN_PROCESS_FLAG_START_BACKGROUND 0x00000040 242 + * POSIX_SPAWN_PROCESS_FLAG_START_LIGHT_THROTTLE 0x00000080 243 + */ 244 + 245 + /* 246 + * posix_spawn psa_apptype process type settings. 247 + * when POSIX_SPAWN_PROC_TYPE is set, old psa_apptype bits are ignored 248 + */ 249 + 250 + #define POSIX_SPAWN_PROCESS_TYPE_NORMAL 0x00000000 251 + #define POSIX_SPAWN_PROCESS_TYPE_DEFAULT POSIX_SPAWN_PROCESS_TYPE_NORMAL 252 + 253 + #define POSIX_SPAWN_PROC_TYPE_MASK 0x00000F00 254 + 255 + #define POSIX_SPAWN_PROC_TYPE_APP_DEFAULT 0x00000100 256 + #define POSIX_SPAWN_PROC_TYPE_APP_TAL 0x00000200 257 + 258 + #define POSIX_SPAWN_PROC_TYPE_DAEMON_STANDARD 0x00000300 259 + #define POSIX_SPAWN_PROC_TYPE_DAEMON_INTERACTIVE 0x00000400 260 + #define POSIX_SPAWN_PROC_TYPE_DAEMON_BACKGROUND 0x00000500 261 + #define POSIX_SPAWN_PROC_TYPE_DAEMON_ADAPTIVE 0x00000600 262 + 263 + #define POSIX_SPAWN_PROC_CLAMP_NONE 0x00000000 264 + #define POSIX_SPAWN_PROC_CLAMP_UTILITY 0x00000001 265 + #define POSIX_SPAWN_PROC_CLAMP_BACKGROUND 0x00000002 266 + #define POSIX_SPAWN_PROC_CLAMP_MAINTENANCE 0x00000003 267 + #define POSIX_SPAWN_PROC_CLAMP_LAST 0x00000004 268 + 269 + /* Setting to indicate no change to darwin role */ 270 + #define POSIX_SPAWN_DARWIN_ROLE_NONE 0x00000000 271 + /* Other possible values are specified by PRIO_DARWIN_ROLE in sys/resource.h */ 272 + 273 + /* 274 + * Allowable posix_spawn() file actions 275 + */ 276 + typedef enum { 277 + PSFA_OPEN = 0, 278 + PSFA_CLOSE = 1, 279 + PSFA_DUP2 = 2, 280 + PSFA_INHERIT = 3 281 + } psfa_t; 282 + 283 + 284 + /* 285 + * A posix_spawn() file action record for a single action 286 + * 287 + * Notes: We carry around the full open arguments for both the open 288 + * and the close to permit the use of a single array of action 289 + * elements to be associated with a file actions object. 290 + * 291 + * A possible future optimization would be to break this into 292 + * a variable sized vector list to save space (i.e. a separate 293 + * string area, allocation of least amount of path buffer per 294 + * open action, etc.). 295 + * 296 + * XXX: Currently overloading psfao_oflag for PSFA_DUP2 297 + */ 298 + typedef struct _psfa_action { 299 + psfa_t psfaa_type; /* file action type */ 300 + int psfaa_filedes; /* fd to operate on */ 301 + struct _psfaa_open { 302 + int psfao_oflag; /* open flags to use */ 303 + mode_t psfao_mode; /* mode for open */ 304 + char psfao_path[PATH_MAX]; /* path to open */ 305 + } psfaa_openargs; 306 + } _psfa_action_t; 307 + 308 + 309 + /* 310 + * Internal representation of posix_spawn() file actions structure 311 + * 312 + * Notes: This is implemented as a structure followed by an array of 313 + * file action records. The psfa_act_alloc value is the number 314 + * of elements allocated in this array, and the psfa_act_count is 315 + * the number of elements currently in use (to permit some form 316 + * of preallocation, e.g. a power of 2 growth for reallocation, 317 + * etc.). 318 + * 319 + * A possible future optimization would keep a size value and 320 + * a structure base reference pointer to permit copyin to the 321 + * kernel directly as a single blob, without damaging relative 322 + * internal pointer math. It's probably better that this be a 323 + * long long rather than a true pointer, to make it invariant 324 + * for 32 vs. 64 bt programming SPIs. 325 + */ 326 + typedef struct _posix_spawn_file_actions { 327 + int psfa_act_alloc; /* available actions space */ 328 + int psfa_act_count; /* count of defined actions */ 329 + _psfa_action_t psfa_act_acts[]; /* actions array (uses c99) */ 330 + } *_posix_spawn_file_actions_t; 331 + 332 + /* 333 + * Calculate the size of a structure, given the number of elements that it is 334 + * capable of containing. 335 + */ 336 + #define PSF_ACTIONS_SIZE(x) \ 337 + __offsetof(struct _posix_spawn_file_actions, psfa_act_acts[(x)]) 338 + 339 + /* 340 + * Initial count of actions in a struct _posix_spawn_file_actions after it is 341 + * first allocated; this should be non-zero, since we expect that one would not 342 + * have been allocated unless there was an intent to use it. 343 + */ 344 + #define PSF_ACTIONS_INIT_COUNT 2 345 + 346 + /* 347 + * Structure defining the true third argument to the posix_spawn() system call 348 + * entry point; we wrap it and pass a descriptor so that we can know the 349 + * copyin size ahead of time, and deal with copying in variant lists of things 350 + * as single monolithic units, instead of many individual elements. This is a 351 + * performance optimization. 352 + */ 353 + struct _posix_spawn_args_desc { 354 + __darwin_size_t attr_size; /* size of attributes block */ 355 + _posix_spawnattr_t attrp; /* pointer to block */ 356 + __darwin_size_t file_actions_size; /* size of file actions block */ 357 + _posix_spawn_file_actions_t 358 + file_actions; /* pointer to block */ 359 + __darwin_size_t port_actions_size; /* size of port actions block */ 360 + _posix_spawn_port_actions_t 361 + port_actions; /* pointer to port block */ 362 + __darwin_size_t mac_extensions_size; 363 + _posix_spawn_mac_policy_extensions_t 364 + mac_extensions; /* pointer to policy-specific 365 + * attributes */ 366 + __darwin_size_t coal_info_size; 367 + struct _posix_spawn_coalition_info *coal_info; /* pointer to coalition info */ 368 + 369 + __darwin_size_t persona_info_size; 370 + struct _posix_spawn_persona_info *persona_info; 371 + }; 372 + 373 + #ifdef KERNEL 374 + #include <sys/appleapiopts.h> 375 + #ifdef __APPLE_API_PRIVATE 376 + 377 + #if __DARWIN_ALIGN_NATURAL 378 + #pragma options align=natural 379 + #endif 380 + 381 + struct user32__posix_spawn_args_desc { 382 + uint32_t attr_size; /* size of attributes block */ 383 + uint32_t attrp; /* pointer to block */ 384 + uint32_t file_actions_size; /* size of file actions block */ 385 + uint32_t file_actions; /* pointer to block */ 386 + uint32_t port_actions_size; /* size of port actions block */ 387 + uint32_t port_actions; /* pointer to block */ 388 + uint32_t mac_extensions_size; 389 + uint32_t mac_extensions; 390 + uint32_t coal_info_size; 391 + uint32_t coal_info; 392 + uint32_t persona_info_size; 393 + uint32_t persona_info; 394 + }; 395 + 396 + struct user__posix_spawn_args_desc { 397 + user_size_t attr_size; /* size of attributes block */ 398 + user_addr_t attrp; /* pointer to block */ 399 + user_size_t file_actions_size; /* size of file actions block */ 400 + user_addr_t file_actions; /* pointer to block */ 401 + user_size_t port_actions_size; /* size of port actions block */ 402 + user_addr_t port_actions; /* pointer to block */ 403 + user_size_t mac_extensions_size; /* size of MAC-specific attrs. */ 404 + user_addr_t mac_extensions; /* pointer to block */ 405 + user_size_t coal_info_size; 406 + user_addr_t coal_info; 407 + user_size_t persona_info_size; 408 + user_addr_t persona_info; 409 + }; 410 + 411 + 412 + #if __DARWIN_ALIGN_NATURAL 413 + #pragma options align=reset 414 + #endif 415 + 416 + #endif /* __APPLE_API_PRIVATE */ 417 + #endif /* KERNEL */ 418 + 419 + #endif /* _SYS_SPAWN_INTERNAL_H_ */
+1
src/CMakeLists.txt
··· 55 55 include_directories("${CMAKE_CURRENT_SOURCE_DIR}/external/libplatform/include") 56 56 57 57 add_subdirectory(external/libplatform) 58 + add_subdirectory(external/libpthread) 58 59 add_subdirectory(kernel) 59 60 add_subdirectory(libc) 60 61
+6 -1
src/CommonCrypto/CMakeLists.txt
··· 22 22 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/Source) 23 23 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/Source/ccUtilities) 24 24 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/Source/CommonCryptoSPI) 25 - include_directories(${DARLING_TOP_DIRECTORY}/src/external/libdispatch) 25 + include_directories(${CMAKE_SOURCE_DIR}/src/external/libdispatch) 26 + include_directories(${CMAKE_SOURCE_DIR}/src/libc/darwin) 27 + include_directories(${CMAKE_SOURCE_DIR}/src/libc/locale) 28 + include_directories(${CMAKE_SOURCE_DIR}/src/libc/locale/FreeBSD) 29 + include_directories(${CMAKE_SOURCE_DIR}/src/libc/stdtime/FreeBSD) 30 + include_directories(${CMAKE_SOURCE_DIR}/src/kernel/libsyscall/wrappers) 26 31 27 32 set(cc_SRCS 28 33 Source/Digest/md2_dgst.c
+6 -3
src/copyfile/CMakeLists.txt
··· 5 5 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -nostdinc -fblocks") 6 6 set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -nostdlib") 7 7 8 - include_directories(${DARLING_TOP_DIRECTORY}/platform-include) 9 - include_directories(${DARLING_TOP_DIRECTORY}/src/libinfo/membership.subproj/) 10 - include_directories(${DARLING_TOP_DIRECTORY}/src/external/libdispatch) 8 + include_directories(${CMAKE_SOURCE_DIR}/platform-include) 9 + include_directories(${CMAKE_SOURCE_DIR}/src/libinfo/membership.subproj/) 10 + include_directories(${CMAKE_SOURCE_DIR}/src/external/libdispatch) 11 + include_directories(${CMAKE_SOURCE_DIR}/src/libc/darwin) 12 + include_directories(${CMAKE_SOURCE_DIR}/src/kernel/libsyscall/wrappers) 11 13 include_directories(${CMAKE_CURRENT_SOURCE_DIR}) 12 14 13 15 add_definitions(-DTARGET_OS_MAC=1) ··· 29 31 add_darling_library(system_copyfile SHARED ${copyfile_sources}) 30 32 set_target_properties(system_copyfile PROPERTIES OUTPUT_NAME "copyfile") 31 33 target_link_libraries(system_copyfile PRIVATE system_kernel system_c system_blocks system_info system_dyld system_malloc) 34 + make_fat(system_copyfile) 32 35 33 36 install(TARGETS system_copyfile DESTINATION libexec/darling/usr/lib/system)
-71
src/duct/include/commpage.h
··· 1 - #ifndef COMMPAGE_H 2 - #define COMMPAGE_H 3 - 4 - #ifndef __ASSEMBLER__ 5 - #include <stdint.h> 6 - 7 - extern uint8_t __commpage[]; 8 - #endif 9 - 10 - //#ifndef __ASSEMBLER__ 11 - //#define _COMM_PAGE_BASE_ADDRESS (__commpage) 12 - //#else 13 - //#define _COMM_PAGE_BASE_ADDRESS ___commpage@GOTPCREL(%rip) 14 - //#endif 15 - #define _COMM_PAGE_AREA_LENGTH ( 1 * 4096 ) /* reserved length of entire comm area */ 16 - 17 - #ifdef __x86_64__ 18 - #define _COMM_PAGE_BASE_ADDRESS ( 0x7fffffe00000 ) /* base address of allocated memory */ 19 - #else 20 - #define _COMM_PAGE_BASE_ADDRESS ( 0xaaaa0000 ) /* base address of allocated memory */ 21 - #endif 22 - 23 - #define _COMM_PAGE_START_ADDRESS ( _COMM_PAGE_BASE_ADDRESS ) /* address traditional commpage code starts on */ 24 - #define _COMM_PAGE_AREA_USED ( 1 * 4096 ) /* this is the amt actually allocated */ 25 - #define _COMM_PAGE_SIGS_OFFSET 0x8000 /* offset to routine signatures */ 26 - 27 - 28 - #define _COMM_PAGE_SIGNATURE (_COMM_PAGE_START_ADDRESS+0x000) /* first few bytes are a signature */ 29 - #define _COMM_PAGE_VERSION (_COMM_PAGE_START_ADDRESS+0x01E) /* 16-bit version# */ 30 - #define _COMM_PAGE_THIS_VERSION 12 /* version of the commarea format */ 31 - 32 - #define _COMM_PAGE_CPU_CAPABILITIES (_COMM_PAGE_START_ADDRESS+0x020) /* uint32_t _cpu_capabilities */ 33 - #define _COMM_PAGE_NCPUS (_COMM_PAGE_START_ADDRESS+0x022) /* uint8_t number of configured CPUs (hw.logicalcpu at boot time) */ 34 - #define _COMM_PAGE_UNUSED0 (_COMM_PAGE_START_ADDRESS+0x024) /* 2 unused bytes, reserved for future expansion of cpu_capabilities */ 35 - #define _COMM_PAGE_CACHE_LINESIZE (_COMM_PAGE_START_ADDRESS+0x026) /* uint16_t cache line size */ 36 - 37 - #define _COMM_PAGE_SCHED_GEN (_COMM_PAGE_START_ADDRESS+0x028) /* uint32_t scheduler generation number (count of pre-emptions) */ 38 - #define _COMM_PAGE_MEMORY_PRESSURE (_COMM_PAGE_START_ADDRESS+0x02c) /* uint32_t copy of vm_memory_pressure */ 39 - #define _COMM_PAGE_SPIN_COUNT (_COMM_PAGE_START_ADDRESS+0x030) /* uint32_t max spin count for mutex's */ 40 - 41 - #define _COMM_PAGE_ACTIVE_CPUS (_COMM_PAGE_START_ADDRESS+0x034) /* uint8_t number of active CPUs (hw.activecpu) */ 42 - #define _COMM_PAGE_PHYSICAL_CPUS (_COMM_PAGE_START_ADDRESS+0x035) /* uint8_t number of physical CPUs (hw.physicalcpu_max) */ 43 - #define _COMM_PAGE_LOGICAL_CPUS (_COMM_PAGE_START_ADDRESS+0x036) /* uint8_t number of logical CPUs (hw.logicalcpu_max) */ 44 - #define _COMM_PAGE_UNUSED1 (_COMM_PAGE_START_ADDRESS+0x037) /* 1 unused bytes */ 45 - #define _COMM_PAGE_MEMORY_SIZE (_COMM_PAGE_START_ADDRESS+0x038) /* uint64_t max memory size */ 46 - 47 - #define _COMM_PAGE_CPUFAMILY (_COMM_PAGE_START_ADDRESS+0x040) /* uint32_t hw.cpufamily, x86*/ 48 - #define _COMM_PAGE_UNUSED2 (_COMM_PAGE_START_ADDRESS+0x044) /* [0x44,0x50) unused */ 49 - 50 - #define _COMM_PAGE_TIME_DATA_START (_COMM_PAGE_START_ADDRESS+0x050) /* base of offsets below (_NT_SCALE etc) */ 51 - #define _COMM_PAGE_NT_TSC_BASE (_COMM_PAGE_START_ADDRESS+0x050) /* used by nanotime() */ 52 - #define _COMM_PAGE_NT_SCALE (_COMM_PAGE_START_ADDRESS+0x058) /* used by nanotime() */ 53 - #define _COMM_PAGE_NT_SHIFT (_COMM_PAGE_START_ADDRESS+0x05c) /* used by nanotime() */ 54 - #define _COMM_PAGE_NT_NS_BASE (_COMM_PAGE_START_ADDRESS+0x060) /* used by nanotime() */ 55 - #define _COMM_PAGE_NT_GENERATION (_COMM_PAGE_START_ADDRESS+0x068) /* used by nanotime() */ 56 - #define _COMM_PAGE_GTOD_GENERATION (_COMM_PAGE_START_ADDRESS+0x06c) /* used by gettimeofday() */ 57 - #define _COMM_PAGE_GTOD_NS_BASE (_COMM_PAGE_START_ADDRESS+0x070) /* used by gettimeofday() */ 58 - #define _COMM_PAGE_GTOD_SEC_BASE (_COMM_PAGE_START_ADDRESS+0x078) /* used by gettimeofday() */ 59 - 60 - #define _COMM_PAGE_APPROX_TIME_SUPPORTED (_COMM_PAGE_START_ADDRESS+0x080) 61 - #define _COMM_PAGE_APPROX_TIME (_COMM_PAGE_START_ADDRESS+0x088) 62 - 63 - #define _COMM_TEXT_PFZ_ENQUEUE_OFFSET (_COMM_PAGE_START_ADDRESS+0xc00) 64 - #define _COMM_TEXT_PFZ_DEQUEUE_OFFSET (_COMM_PAGE_START_ADDRESS+0xc80) 65 - #define _COMM_TEXT_PFZ_MUTEX_LOCK_OFFSET (_COMM_PAGE_START_ADDRESS+0xd00) 66 - 67 - #define _COMM_PAGE_END (_COMM_PAGE_START_ADDRESS+0xfff) /* end of common page */ 68 - 69 - #define _COMM_PAGE_TEXT_START (_COMM_PAGE_START_ADDRESS+0x1000) 70 - 71 - #endif
+1 -1
src/duct/src/CMakeLists.txt
··· 4 4 5 5 add_definitions(-DTARGET_OS_MAC=1) 6 6 add_definitions(-DHAVE_STDINT_H=1) 7 - add_definitions(-D__APPLE__ -D__DYNAMIC__) 7 + add_definitions(-D__APPLE__ -D__DYNAMIC__ -DPRIVATE) 8 8 add_definitions(-D__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__=1080) 9 9 10 10 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -nostdinc -D__DARWIN_UNIX03 -fPIC -w")
+5 -4
src/duct/src/commpage.c
··· 1 - #include <commpage.h> 1 + #include <i386/cpu_capabilities.h> 2 2 #include <sys/mman.h> 3 + #include <stdint.h> 3 4 4 5 //uint8_t __commpage[_COMM_PAGE_AREA_LENGTH]; 5 6 6 7 void _darling_initialize_commpage(void) 7 8 { 8 - mmap(_COMM_PAGE_BASE_ADDRESS, _COMM_PAGE_AREA_LENGTH, PROT_READ|PROT_WRITE, 9 + mmap(_COMM_PAGE_START_ADDRESS, _COMM_PAGE_AREA_LENGTH, PROT_READ|PROT_WRITE, 9 10 MAP_ANON | MAP_PRIVATE, -1, 0); 10 11 11 12 *((uint8_t*)_COMM_PAGE_NCPUS) = 1; ··· 13 14 *((uint64_t*) _COMM_PAGE_MEMORY_SIZE) = 1024LL*1024LL*1024LL; 14 15 } 15 16 16 - int _get_cpu_capabilities(void) 17 + /*int _get_cpu_capabilities(void) 17 18 { 18 19 const uint16_t* p = (uint16_t*) _COMM_PAGE_CPU_CAPABILITIES; 19 20 return *p; 20 - } 21 + }*/ 21 22
+2
src/dyld-apple/CMakeLists.txt
··· 75 75 set_property(TARGET system_loader APPEND_STRING PROPERTY LINK_FLAGS " -Wl,-dylinker -Wl,-dead_strip -nostdlib -Wl,-e,__dyld_start") 76 76 target_link_libraries(system_loader libc_static system_blocks_static unwind_static system_kernel_static system_m_static cxxabi_static keymgr_static compiler_rt_static system_duct_static) 77 77 78 + make_fat(system_dyld) 79 + 78 80 install(TARGETS system_dyld DESTINATION libexec/darling/usr/lib/system) 79 81 install(TARGETS system_loader DESTINATION libexec/darling/usr/lib)
+3
src/kernel/libsyscall/CMakeLists.txt
··· 14 14 include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../../libc/include") 15 15 include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../../duct/include") 16 16 include_directories("${CMAKE_CURRENT_SOURCE_DIR}/wrappers/libproc") 17 + include_directories("${CMAKE_CURRENT_SOURCE_DIR}/wrappers/spawn") 17 18 include_directories("${CMAKE_CURRENT_BINARY_DIR}") 18 19 add_definitions(-DPRIVATE=1 -D__DARWIN_C_LEVEL=20150101) 19 20 add_definitions('-D__XNU_PRIVATE_EXTERN=') ··· 132 133 wrappers/unix03/mmap.c 133 134 wrappers/unix03/munmap.c 134 135 wrappers/unix03/setrlimit.c 136 + 137 + wrappers/spawn/posix_spawn.c 135 138 136 139 ${syscall_legacy_sources} 137 140
+5
src/kernel/libsyscall/bsdsyscalls/___getpid.S
··· 102 102 #else 103 103 #error Unsupported architecture 104 104 #endif 105 + 106 + #if defined(__x86_64__) || defined(__i386__) 107 + .globl _getpid 108 + _getpid = ___getpid 109 + #endif
+38 -7
src/kernel/libsyscall/os/tsd.h
··· 1 - // Modified by Lubos Dolezel for Darling; gs->fs 2 1 /* 3 2 * Copyright (c) 2012 Apple Inc. All rights reserved. 4 3 * ··· 50 49 return 0; 51 50 } 52 51 52 + #if defined(__i386__) || defined(__x86_64__) 53 + 54 + #if defined(__has_attribute) 55 + #if __has_attribute(address_space) 56 + #define OS_GS_RELATIVE __attribute__((address_space(256))) 57 + #endif 58 + #endif 59 + 60 + #ifdef OS_GS_RELATIVE 61 + #define _os_tsd_get_base() ((void * OS_GS_RELATIVE *)0) 62 + #else 53 63 __attribute__((always_inline)) 54 64 static __inline__ void* 55 65 _os_tsd_get_direct(unsigned long slot) ··· 57 67 void *ret; 58 68 #if defined(__i386__) 59 69 __asm__("mov %%fs:%1, %0" : "=r" (ret) : "m" (*(void **)(slot * sizeof(void *)))); 60 - #elif defined(__x86_64__) 70 + #else 61 71 __asm__("mov %%gs:%1, %0" : "=r" (ret) : "m" (*(void **)(slot * sizeof(void *)))); 62 72 #endif 63 - 64 - 65 73 return ret; 66 74 } 67 75 68 76 __attribute__((always_inline)) 69 77 static __inline__ int 70 - _os_tsd_set_direct(unsigned long slot, void* val) 78 + _os_tsd_set_direct(unsigned long slot, void *val) 71 79 { 72 80 #if defined(__i386__) && defined(__PIC__) 73 81 __asm__("movl %1, %%fs:%0" : "=m" (*(void **)(slot * sizeof(void *))) : "rn" (val)); 74 82 #elif defined(__i386__) && !defined(__PIC__) 75 - __asm__("movl %1, %%fs:%0" : "=m" (*(void **)(slot * sizeof(void *))) : "ri" (val)); 76 - #elif defined(__x86_64__) 83 + __asm__("movl %1, %%gs:%0" : "=m" (*(void **)(slot * sizeof(void *))) : "ri" (val)); 84 + #else 77 85 __asm__("movq %1, %%gs:%0" : "=m" (*(void **)(slot * sizeof(void *))) : "rn" (val)); 78 86 #endif 87 + return 0; 88 + } 89 + #endif 79 90 91 + #else 92 + #error _os_tsd_get_base not implemented on this architecture 93 + #endif 94 + 95 + #ifdef _os_tsd_get_base 96 + __attribute__((always_inline)) 97 + static __inline__ void* 98 + _os_tsd_get_direct(unsigned long slot) 99 + { 100 + return _os_tsd_get_base()[slot]; 101 + } 102 + 103 + __attribute__((always_inline)) 104 + static __inline__ int 105 + _os_tsd_set_direct(unsigned long slot, void *val) 106 + { 107 + _os_tsd_get_base()[slot] = val; 80 108 return 0; 81 109 } 110 + #endif 111 + 112 + extern void _thread_set_tsd_base(void *tsd_base); 82 113 83 114 #endif
+3 -1
src/keymgr/CMakeLists.txt
··· 7 7 8 8 include_directories(${CMAKE_SOURCE_DIR}/libc/fbsdcompat) 9 9 include_directories(${CMAKE_SOURCE_DIR}/kernel/libsyscall/wrappers) 10 + include_directories(${CMAKE_SOURCE_DIR}/src/libc/darwin) 10 11 11 12 add_definitions(-DTARGET_OS_MAC=1) 12 13 add_definitions(-DHAVE_STDINT_H=1) ··· 18 19 19 20 set(DYLIB_INSTALL_NAME "/usr/lib/system/libkeymgr.dylib") 20 21 add_darling_library(keymgr SHARED ${keymgr_sources}) 21 - target_link_libraries(keymgr PRIVATE system_c system_dyld system_malloc) 22 + target_link_libraries(keymgr PRIVATE system_c system_dyld system_malloc system_pthread) 23 + make_fat(keymgr) 22 24 23 25 set(CMAKE_AR "${CMAKE_BINARY_DIR}/src/external/cctools-port/cctools/ar/x86_64-apple-darwin11-ar") 24 26 set(CMAKE_RANLIB "${CMAKE_BINARY_DIR}/src/external/cctools-port/cctools/misc/ranlib")
+1
src/launchd/liblaunch/CMakeLists.txt
··· 33 33 set(DYLIB_INSTALL_NAME "/usr/lib/system/liblaunch.dylib") 34 34 add_darling_library(launch SHARED ${launch_sources}) 35 35 target_link_libraries(launch PRIVATE system_c system_kernel) 36 + make_fat(launch) 36 37 37 38 install(TARGETS launch DESTINATION libexec/darling/usr/lib/system) 38 39
+3 -3
src/libc/CMakeLists.txt
··· 143 143 $<TARGET_OBJECTS:libc-uuid> 144 144 $<TARGET_OBJECTS:libc-util> 145 145 $<TARGET_OBJECTS:libc-string> 146 + $<TARGET_OBJECTS:libc-string-x86_64> 146 147 $<TARGET_OBJECTS:libc-stdtime> 147 148 $<TARGET_OBJECTS:libc-sys> 148 149 $<TARGET_OBJECTS:libc-sys_noinode64> ··· 173 174 $<TARGET_OBJECTS:libc-locale_legacy> 174 175 $<TARGET_OBJECTS:libc-net_legacy> 175 176 ) 176 - target_link_libraries(system_c system_kernel system_m macho system_malloc) 177 + target_link_libraries(system_c system_kernel system_m macho system_malloc platform) 177 178 make_fat(system_c) 179 + set_property(TARGET system_c APPEND_STRING PROPERTY LINK_FLAGS " -Wl,-alias_list,${CMAKE_CURRENT_SOURCE_DIR}/xcodescripts/alias.list") 178 180 179 181 install(TARGETS system_c DESTINATION libexec/darling/usr/lib/system) 180 182 ··· 185 187 $<TARGET_OBJECTS:libc-stdlib_dyld> 186 188 $<TARGET_OBJECTS:libc-string_dyld> 187 189 $<TARGET_OBJECTS:libc-sys_dyld> 188 - $<TARGET_OBJECTS:libc-x86_64> 189 - $<TARGET_OBJECTS:libc-i386> 190 190 $<TARGET_OBJECTS:libc-locale> 191 191 $<TARGET_OBJECTS:libc-stdio> 192 192 $<TARGET_OBJECTS:libc-stdtime>
+1 -1
src/libc/derived/i386/libc-features.h
··· 20 20 # error Feature mismatch: __DARWIN_ONLY_64_BIT_INO_T == 1 21 21 #endif /* __DARWIN_ONLY_64_BIT_INO_T */ 22 22 #define __APPLE_PR3417676_HACK__ 1 23 - #define PLOCKSTAT 1 23 + /* #define PLOCKSTAT 0 */ 24 24 #define NOTIFY_TZ 1 25 25 /* #undef LIBC_NO_LIBCRASHREPORTERCLIENT */ 26 26 /* #undef FEATURE_SMALL_STDIOBUF */
+1 -1
src/libc/derived/x86_64/libc-features.h
··· 20 20 # error Feature mismatch: __DARWIN_ONLY_64_BIT_INO_T == 1 21 21 #endif /* __DARWIN_ONLY_64_BIT_INO_T */ 22 22 #define __APPLE_PR3417676_HACK__ 1 23 - #define PLOCKSTAT 1 23 + /* #define PLOCKSTAT 0 */ 24 24 #define NOTIFY_TZ 1 25 25 /* #undef LIBC_NO_LIBCRASHREPORTERCLIENT */ 26 26 /* #undef FEATURE_SMALL_STDIOBUF */
+10 -3
src/libc/string/CMakeLists.txt
··· 13 13 stpncpy.c 14 14 strcat.c 15 15 #strcpy.c 16 - #strlcat.c 17 - #strlcpy.c 18 16 strncat.c 19 17 #strncpy.c 18 + ) 19 + 20 + # x86_64 only, i386 has its own assembly impl 21 + set(string_x86_64_sources 22 + strlcat.c 23 + strlcpy.c 20 24 ) 21 25 22 26 set(string_sources ${string_sources} ··· 80 84 SET_SOURCE_FILES_PROPERTIES(FreeBSD/strerror.c PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} -DLIBC_ALIAS_STRERROR") 81 85 82 86 add_library(libc-string OBJECT ${string_sources}) 87 + add_library(libc-string-x86_64 OBJECT ${string_x86_64_sources}) 88 + set_target_properties(libc-string-x86_64 PROPERTIES COMPILE_FLAGS "-arch x86_64") 83 89 84 90 # Legacy variant 85 91 set(string-legacy_sources ··· 89 95 90 96 # DYLD variant 91 97 add_library(libc-string_dyld OBJECT strcat.c strcpy.c FreeBSD/strdup.c strlcat.c strlcpy.c FreeBSD/strnlen.c FreeBSD/strrchr.c FreeBSD/strstr.c FreeBSD/strtok.c 92 - FreeBSD/wcscpy.c FreeBSD/wcslen.c FreeBSD/wcsncmp.c FreeBSD/wcsncpy.c FreeBSD/strerror.c) 98 + FreeBSD/wcscpy.c FreeBSD/wcslen.c FreeBSD/wcsncmp.c FreeBSD/wcsncpy.c FreeBSD/strerror.c 99 + strlcat.c strlcpy.c strncat.c strncpy.c) 93 100 SET_TARGET_PROPERTIES(libc-string_dyld PROPERTIES COMPILE_FLAGS "-UBUILDING_VARIANT -DVARIANT_DYLD -DVARIANT_CANCELABLE -DVARIANT_DARWINEXTSN") 94 101
+16 -1
src/libinfo/CMakeLists.txt
··· 18 18 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -nostdinc -D__DARWIN_UNIX03 -fPIC -w -ggdb") 19 19 set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -nostdlib") 20 20 21 + include_directories(${CMAKE_SOURCE_DIR}/src/libc/darwin) 22 + include_directories(${CMAKE_SOURCE_DIR}/src/kernel/libsyscall/wrappers) 23 + include_directories(${CMAKE_SOURCE_DIR}/src/libmalloc/include) 24 + include_directories(${CMAKE_SOURCE_DIR}/src/external/syslog/libsystem_asl.tproj/include) 25 + 21 26 add_subdirectory(gen.subproj) 22 27 add_subdirectory(util.subproj) 23 28 add_subdirectory(dns.subproj) ··· 27 32 add_subdirectory(membership.subproj) 28 33 add_subdirectory(darling-resolver) 29 34 35 + make_fat(info-dns 36 + info-gen 37 + info-nis 38 + info-rpc 39 + info-lookup 40 + info-membership 41 + darling-resolver 42 + ) 43 + 30 44 set(DYLIB_INSTALL_NAME "/usr/lib/system/libsystem_info.dylib") 31 45 add_darling_library(system_info SHARED $<TARGET_OBJECTS:info-util> 32 46 $<TARGET_OBJECTS:info-dns> ··· 37 51 $<TARGET_OBJECTS:info-membership> 38 52 $<TARGET_OBJECTS:darling-resolver> 39 53 ) 40 - target_link_libraries(system_info PRIVATE system_c resolv-darwin system_dyld system_blocks libdispatch_shared system_notify) 54 + target_link_libraries(system_info PRIVATE system_c resolv-darwin system_dyld system_blocks libdispatch_shared system_notify platform) 55 + make_fat(system_info) 41 56 42 57 install(TARGETS system_info DESTINATION libexec/darling/usr/lib/system) 43 58 install(FILES master.passwd DESTINATION libexec/darling/etc)
+4 -1
src/libnotify/CMakeLists.txt
··· 9 9 include_directories(${DARLING_TOP_DIRECTORY}/src/libc/gen) 10 10 include_directories(${CMAKE_CURRENT_SOURCE_DIR}) 11 11 include_directories(${CMAKE_CURRENT_BINARY_DIR}) 12 + include_directories(${CMAKE_SOURCE_DIR}/src/libc/darwin) 13 + include_directories(${CMAKE_SOURCE_DIR}/src/kernel/libsyscall/wrappers) 12 14 13 15 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fblocks -nostdinc -include ${DARLING_TOP_DIRECTORY}/kernel-include/sys/fileport.h") 14 16 set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -nostdlib") ··· 24 26 25 27 set(DYLIB_INSTALL_NAME "/usr/lib/system/libsystem_notify.dylib") 26 28 add_darling_library(system_notify SHARED ${notify_sources}) 27 - target_link_libraries(system_notify system_c system_kernel system_blocks libdispatch_shared launch system_dyld system_malloc) 29 + target_link_libraries(system_notify system_c system_kernel system_blocks libdispatch_shared launch system_dyld system_malloc system_pthread) 30 + make_fat(system_notify) 28 31 29 32 install(TARGETS system_notify DESTINATION libexec/darling/usr/lib/system) 30 33
+7 -1
src/libremovefile/CMakeLists.txt
··· 5 5 include_directories(${DARLING_TOP_DIRECTORY}/platform-include) 6 6 include_directories(${DARLING_TOP_DIRECTORY}/src/libc/gen) 7 7 include_directories(${CMAKE_CURRENT_SOURCE_DIR}) 8 + include_directories(${CMAKE_SOURCE_DIR}/src/libc/darwin) 9 + include_directories(${CMAKE_SOURCE_DIR}/src/libc/stdtime/FreeBSD) 10 + include_directories(${CMAKE_SOURCE_DIR}/src/libc/locale/FreeBSD) 11 + include_directories(${CMAKE_SOURCE_DIR}/src/libc/locale) 12 + include_directories(${CMAKE_SOURCE_DIR}/src/kernel/libsyscall/wrappers) 8 13 9 14 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fblocks -nostdinc") 10 15 set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -nostdlib") ··· 19 24 20 25 set(DYLIB_INSTALL_NAME "/usr/lib/system/libremovefile.dylib") 21 26 add_darling_library(removefile SHARED ${removefile_sources}) 22 - target_link_libraries(removefile system_c system_kernel system_dyld system_malloc) 27 + target_link_libraries(removefile system_c system_kernel system_dyld system_malloc compiler_rt) 28 + make_fat(removefile) 23 29 24 30 install(TARGETS removefile DESTINATION libexec/darling/usr/lib/system) 25 31
+8 -2
src/libresolv/CMakeLists.txt
··· 4 4 5 5 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../external/libdispatch/) 6 6 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../external/libdispatch/private) 7 - include_directories(${DARLING_TOP_DIRECTORY}/platform-include) 8 - include_directories(${DARLING_TOP_DIRECTORY}/src/libinfo/lookup.subproj/) 7 + include_directories(${CMAKE_SOURCE_DIR}/platform-include) 8 + include_directories(${CMAKE_SOURCE_DIR}/src/libinfo/lookup.subproj/) 9 + include_directories(${CMAKE_SOURCE_DIR}/src/libc/locale) 10 + include_directories(${CMAKE_SOURCE_DIR}/src/libc/darwin) 11 + include_directories(${CMAKE_SOURCE_DIR}/src/libc/locale/FreeBSD) 12 + include_directories(${CMAKE_SOURCE_DIR}/src/libc/stdtime/FreeBSD) 13 + include_directories(${CMAKE_SOURCE_DIR}/src/kernel/libsyscall/wrappers) 9 14 include_directories(${CMAKE_CURRENT_SOURCE_DIR}) 10 15 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/dnsinfo) 11 16 ··· 57 62 set(DYLIB_INSTALL_NAME "/usr/lib/libresolv.9.dylib") 58 63 add_darling_library(resolv-darwin SHARED ${resolv_sources}) 59 64 set_target_properties(resolv-darwin PROPERTIES OUTPUT_NAME "resolv.9") 65 + make_fat(resolv-darwin) 60 66 #target_link_libraries(resolv-darwin PRIVATE system) 61 67 62 68 install(TARGETS resolv-darwin DESTINATION libexec/darling/usr/lib)
+7 -1
src/libsystem/CMakeLists.txt
··· 11 11 set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -nostdlib -Wl,-bind_at_load") 12 12 13 13 include_directories(${DARLING_TOP_DIRECTORY}/src/libc/fbsdcompat) 14 + include_directories(${DARLING_TOP_DIRECTORY}/src/libc/darwin) 14 15 include_directories(${DARLING_TOP_DIRECTORY}/src/kernel/libsyscall/wrappers) 15 16 16 17 add_definitions(-DTARGET_OS_MAC=1) ··· 38 39 add_darling_library(system SHARED ${libsystem_sources}) 39 40 target_link_libraries(system PRIVATE system_malloc system_c system_kernel keymgr sandbox 40 41 system_m system_info system_notify system_quarantine libdispatch_shared launch compiler_rt 41 - removefile system_copyfile unwind system_coreservices system_dyld macho CommonCrypto) # objc 42 + removefile system_copyfile unwind system_coreservices system_dyld macho CommonCrypto 43 + system_pthread platform) # objc 42 44 set_target_properties(system PROPERTIES OUTPUT_NAME "System.B") 43 45 set_property(TARGET system APPEND_STRING PROPERTY LINK_FLAGS 44 46 " -sub_library libsystem_malloc \ ··· 51 53 -sub_library libquarantine \ 52 54 -sub_library libsystem_blocks \ 53 55 -sub_library libsystem_duct \ 56 + -sub_library libsystem_pthread \ 57 + -sub_library libsystem_platform \ 54 58 -sub_library libdispatch \ 55 59 -sub_library liblaunch \ 56 60 -sub_library libremovefile \ ··· 63 67 -sub_library libsystem_sandbox \ 64 68 -sub_library libsystem_coreservices \ 65 69 -Wl,-dylib_compatibility_version,1238.0.0") 70 + 71 + make_fat(system) 66 72 67 73 install(TARGETS system DESTINATION libexec/darling/usr/lib) 68 74 InstallSymlink("libSystem.B.dylib" "${CMAKE_INSTALL_PREFIX}/libexec/darling/usr/lib/libSystem.dylib")
+5 -1
src/libsystem_coreservices/CMakeLists.txt
··· 17 17 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -nostdinc -D__DARWIN_UNIX03 -fPIC -w") 18 18 set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -nostdlib") 19 19 20 + include_directories(${CMAKE_SOURCE_DIR}/src/kernel/libsyscall/wrappers) 21 + include_directories(${CMAKE_SOURCE_DIR}/src/libc/darwin) 22 + 20 23 set(DYLIB_INSTALL_NAME "/usr/lib/system/libsystem_coreservices.dylib") 21 24 add_darling_library(system_coreservices SHARED dirhelper.c NSSystemDirectories.c) 22 - target_link_libraries(system_coreservices PRIVATE system_c system_dyld) 25 + target_link_libraries(system_coreservices PRIVATE system_c system_dyld platform system_pthread) 26 + make_fat(system_coreservices) 23 27 24 28 install(TARGETS system_coreservices DESTINATION libexec/darling/usr/lib/system)
+7 -1
src/libunwind/CMakeLists.txt
··· 19 19 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../libc/locale/FreeBSD) 20 20 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../libc/stdtime/FreeBSD) 21 21 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../libc/pthreads) 22 - include_directories(${DARLING_TOP_DIRECTORY}/platform-include) 22 + include_directories(${CMAKE_SOURCE_DIR}/platform-include) 23 + include_directories(${CMAKE_SOURCE_DIR}/src/libc/darwin) 24 + include_directories(${CMAKE_SOURCE_DIR}/src/external/libpthread/private) 25 + include_directories(${CMAKE_SOURCE_DIR}/src/kernel/libsyscall/wrappers) 26 + include_directories(${CMAKE_SOURCE_DIR}/src/kernel/libsyscall) 23 27 24 28 set(libunwind_sources 25 29 src/libuwind.cxx ··· 34 38 add_darling_library(unwind SHARED ${libunwind_sources}) 35 39 target_link_libraries(unwind PRIVATE system_c keymgr) 36 40 set_target_properties(unwind PROPERTIES LINKER_LANGUAGE C) 41 + make_fat(unwind) 37 42 38 43 add_library(unwind_static STATIC ${libunwind_sources}) 39 44 set_target_properties(unwind_static PROPERTIES COMPILE_FLAGS "-DNDEBUG=1") 45 + make_fat(unwind_static) 40 46 41 47 install(TARGETS unwind DESTINATION libexec/darling/usr/lib/system)
-1
src/libunwind/System
··· 1 - ../libc/pthreads/
+1
src/libunwind/System/pthread_machdep.h
··· 1 + ../../external/libpthread/private/private.h
+2
src/quarantine/CMakeLists.txt
··· 4 4 5 5 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -nostdinc -D__DARWIN_UNIX03 -fPIC -w -ggdb") 6 6 set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -nostdlib") 7 + include_directories(${CMAKE_SOURCE_DIR}/src/libc/darwin) 7 8 8 9 set(DYLIB_INSTALL_NAME "/usr/lib/system/libquarantine.dylib") 9 10 add_darling_library(system_quarantine SHARED ··· 11 12 ) 12 13 set_target_properties(system_quarantine PROPERTIES OUTPUT_NAME "quarantine") 13 14 target_link_libraries(system_quarantine PRIVATE system_c system_dyld system_malloc) 15 + make_fat(system_quarantine) 14 16 15 17 install(TARGETS system_quarantine DESTINATION libexec/darling/usr/lib/system) 16 18
+4
src/sandbox/CMakeLists.txt
··· 11 11 add_definitions(-D__APPLE__ -D__DYNAMIC__) 12 12 add_definitions(-D__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__=1080) 13 13 14 + include_directories(${CMAKE_SOURCE_DIR}/src/kernel/libsyscall/wrappers) 15 + include_directories(${CMAKE_SOURCE_DIR}/src/libc/darwin) 16 + 14 17 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -nostdinc -D__DARWIN_UNIX03 -fPIC -w") 15 18 set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -nostdlib") 16 19 ··· 22 25 add_darling_library(sandbox SHARED sandbox.c) 23 26 target_link_libraries(sandbox PRIVATE system_c system_kernel system_dyld system_malloc) 24 27 set_target_properties(sandbox PROPERTIES OUTPUT_NAME "system_sandbox") 28 + make_fat(sandbox) 25 29 26 30 install(TARGETS sandbox DESTINATION libexec/darling/usr/lib/system)