]> git.saurik.com Git - apple/libsystem.git/commitdiff
Libsystem-1197.1.1.tar.gz os-x-109 os-x-1091 os-x-1092 os-x-1093 os-x-1094 os-x-1095 v1197.1.1
authorApple <opensource@apple.com>
Fri, 11 Oct 2013 17:44:42 +0000 (17:44 +0000)
committerApple <opensource@apple.com>
Fri, 11 Oct 2013 17:44:42 +0000 (17:44 +0000)
Libsystem.xcconfig [new file with mode: 0644]
Libsystem.xcodeproj/project.pbxproj
alloc_once_private.h [new file with mode: 0644]
init.c
optionallibs
requiredlibs

diff --git a/Libsystem.xcconfig b/Libsystem.xcconfig
new file mode 100644 (file)
index 0000000..87b46fe
--- /dev/null
@@ -0,0 +1,19 @@
+#include "<DEVELOPER_DIR>/Makefiles/CoreOS/Xcode/BSD.xcconfig"
+BUILD_VARIANTS = normal debug
+INSTALL_PATH = /usr/lib
+DYLIB_CURRENT_VERSION = $(CURRENT_VERSION_STRING_$(RC_XBS))
+ORDER_FILE = $(SDKROOT)/$(APPLE_INTERNAL_DIR)/OrderFiles/libSystem.order
+ORDER_FILE[sdk=iphonesimulator*] =
+OTHER_LDFLAGS = -Wl,-search_paths_first -nodefaultlibs @$(BUILT_PRODUCTS_DIR)/linker_arguments.$(CURRENT_ARCH).$(CURRENT_VARIANT).txt
+LD_GENERATE_MAP_FILE = YES
+EXECUTABLE_PREFIX = lib
+PRIVATE_HEADERS_FOLDER_PATH = /usr/local/include/os
+LIBRARY_SEARCH_PATHS = $(SDKROOT)/usr/lib/system $(SDKROOT)/usr/local/lib/system
+GCC_NO_COMMON_BLOCKS = YES
+GCC_WARN_64_TO_32_BIT_CONVERSION = YES
+GCC_WARN_ABOUT_RETURN_TYPE = YES
+GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES
+GCC_TREAT_WARNINGS_AS_ERRORS = YES
+GCC_WARN_UNUSED_VARIABLE = YES
+CURRENT_VERSION_STRING_ = 159
+CURRENT_VERSION_STRING_YES = $(CURRENT_PROJECT_VERSION)
index caafa951f8d18fdad8b80c0361031a693295f72c..f9bd58f60d4bfbfbc6a60d519b955b252edafa69 100644 (file)
@@ -38,6 +38,7 @@
                BA2FABC5136DBF45004383E5 /* linker_arguments_changed.c in Sources */ = {isa = PBXBuildFile; fileRef = BA2FABC4136DBF45004383E5 /* linker_arguments_changed.c */; };
                BA5511C9136C9E4D0012B9B5 /* CompatibilityHacks.c in Sources */ = {isa = PBXBuildFile; fileRef = BA5511B4136C9D780012B9B5 /* CompatibilityHacks.c */; };
                BA5511CA136C9E510012B9B5 /* init.c in Sources */ = {isa = PBXBuildFile; fileRef = BA5511B7136C9D780012B9B5 /* init.c */; };
+               C9A43CAC15374DB200388D0C /* alloc_once_private.h in Headers */ = {isa = PBXBuildFile; fileRef = C9A43CAB15374DB200388D0C /* alloc_once_private.h */; settings = {ATTRIBUTES = (Private, ); }; };
 /* End PBXBuildFile section */
 
 /* Begin PBXContainerItemProxy section */
                BA5511B7136C9D780012B9B5 /* init.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = init.c; sourceTree = "<group>"; };
                BA5511B9136C9D780012B9B5 /* optionallibs */ = {isa = PBXFileReference; lastKnownFileType = text; path = optionallibs; sourceTree = "<group>"; };
                BA5511BA136C9D780012B9B5 /* requiredlibs */ = {isa = PBXFileReference; lastKnownFileType = text; path = requiredlibs; sourceTree = "<group>"; };
-               BA5511BC136C9D960012B9B5 /* BSD.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = BSD.xcconfig; path = Makefiles/CoreOS/Xcode/BSD.xcconfig; sourceTree = DEVELOPER_DIR; };
                BA5511C4136C9E2E0012B9B5 /* libSystem.B.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libSystem.B.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
                C64EE1D7136F644700676C52 /* create_dylib_symlinks.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = create_dylib_symlinks.sh; sourceTree = "<group>"; };
                C64EE1D8136F644700676C52 /* create_system_framework.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = create_system_framework.sh; sourceTree = "<group>"; };
                C64EE1D9136F644700676C52 /* linker_arguments.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = linker_arguments.sh; sourceTree = "<group>"; };
+               C9A43CAB15374DB200388D0C /* alloc_once_private.h */ = {isa = PBXFileReference; fileEncoding = 4; path = alloc_once_private.h; sourceTree = "<group>"; };
+               C9B56C55153751A600C153A8 /* Libsystem.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Libsystem.xcconfig; sourceTree = "<group>"; };
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
                BA5511A7136C9D400012B9B5 = {
                        isa = PBXGroup;
                        children = (
-                               BA5511BC136C9D960012B9B5 /* BSD.xcconfig */,
+                               C9B56C55153751A600C153A8 /* Libsystem.xcconfig */,
                                BA5511B3136C9D780012B9B5 /* APPLE_LICENSE */,
                                BA5511B4136C9D780012B9B5 /* CompatibilityHacks.c */,
                                BA5511B6136C9D780012B9B5 /* Info.plist */,
+                               C9A43CAB15374DB200388D0C /* alloc_once_private.h */,
                                BA5511B7136C9D780012B9B5 /* init.c */,
                                BA5511B9136C9D780012B9B5 /* optionallibs */,
                                BA5511BA136C9D780012B9B5 /* requiredlibs */,
                        isa = PBXHeadersBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
+                               C9A43CAC15374DB200388D0C /* alloc_once_private.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
 /* Begin XCBuildConfiguration section */
                BA5511AF136C9D400012B9B5 /* Release */ = {
                        isa = XCBuildConfiguration;
+                       baseConfigurationReference = C9B56C55153751A600C153A8 /* Libsystem.xcconfig */;
                        buildSettings = {
                        };
                        name = Release;
                };
                BA5511C6136C9E2E0012B9B5 /* Release */ = {
                        isa = XCBuildConfiguration;
-                       baseConfigurationReference = BA5511BC136C9D960012B9B5 /* BSD.xcconfig */;
+                       baseConfigurationReference = C9B56C55153751A600C153A8 /* Libsystem.xcconfig */;
                        buildSettings = {
-                               BUILD_VARIANTS = (
-                                       normal,
-                                       debug,
-                               );
-                               CURRENT_VERSION_STRING_ = 159;
-                               CURRENT_VERSION_STRING_YES = "$(CURRENT_PROJECT_VERSION)";
-                               DYLIB_CURRENT_VERSION = "$(CURRENT_VERSION_STRING_$(RC_XBS))";
-                               EXECUTABLE_PREFIX = lib;
-                               GCC_NO_COMMON_BLOCKS = YES;
-                               GCC_TREAT_WARNINGS_AS_ERRORS = YES;
-                               GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
-                               GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
-                               GCC_WARN_ABOUT_RETURN_TYPE = YES;
-                               GCC_WARN_UNUSED_VARIABLE = YES;
-                               INSTALL_PATH = /usr/lib;
-                               LD_GENERATE_MAP_FILE = YES;
-                               LIBRARY_SEARCH_PATHS = (
-                                       "$(SDKROOT)/usr/lib/system",
-                                       "$(SDKROOT)/usr/local/lib/system",
-                               );
-                               ORDER_FILE = "$(SDKROOT)/$(APPLE_INTERNAL_DIR)/OrderFiles/libSystem.order";
-                               "ORDER_FILE[sdk=iphonesimulator*]" = "";
-                               OTHER_LDFLAGS = (
-                                       "-Wl,-search_paths_first",
-                                       "-nodefaultlibs",
-                                       "@$(BUILT_PRODUCTS_DIR)/linker_arguments.$(CURRENT_ARCH).$(CURRENT_VARIANT).txt",
-                               );
                                PRODUCT_NAME = "$(TARGET_NAME).B";
                        };
                        name = Release;
                };
                BA5511D1136CA8480012B9B5 /* Release */ = {
                        isa = XCBuildConfiguration;
-                       baseConfigurationReference = BA5511BC136C9D960012B9B5 /* BSD.xcconfig */;
+                       baseConfigurationReference = C9B56C55153751A600C153A8 /* Libsystem.xcconfig */;
                        buildSettings = {
                                BUILD_VARIANTS = (
                                        normal,
                };
                BA5511D8136D22ED0012B9B5 /* Release */ = {
                        isa = XCBuildConfiguration;
-                       baseConfigurationReference = BA5511BC136C9D960012B9B5 /* BSD.xcconfig */;
+                       baseConfigurationReference = C9B56C55153751A600C153A8 /* Libsystem.xcconfig */;
                        buildSettings = {
                                BUILD_VARIANTS = (
                                        normal,
diff --git a/alloc_once_private.h b/alloc_once_private.h
new file mode 100644 (file)
index 0000000..6f65f84
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2012-2013 Apple Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+
+#ifndef __OS_ALLOC__
+#define __OS_ALLOC__
+
+#ifndef __OS_ALLOC_INDIRECT__
+#define __OS_ALLOC_INDIRECT__
+#endif // __OS_ALLOC_INDIRECT__
+
+#include <os/alloc_once_impl.h>
+
+/* Keys for use with os_once_alloc. */
+
+/* Keys for Libsystem. */
+#define OS_ALLOC_ONCE_KEY_LIBSYSTEM_NOTIFY     0
+#define OS_ALLOC_ONCE_KEY_LIBXPC       1
+#define OS_ALLOC_ONCE_KEY_LIBSYSTEM_C  2
+#define OS_ALLOC_ONCE_KEY_LIBSYSTEM_INFO       3
+#define OS_ALLOC_ONCE_KEY_LIBSYSTEM_NETWORK    4
+#define OS_ALLOC_ONCE_KEY_LIBCACHE     5
+#define OS_ALLOC_ONCE_KEY_LIBCOMMONCRYPTO      6
+#define OS_ALLOC_ONCE_KEY_LIBDISPATCH  7
+#define OS_ALLOC_ONCE_KEY_LIBDYLD      8
+#define OS_ALLOC_ONCE_KEY_LIBKEYMGR    9
+#define OS_ALLOC_ONCE_KEY_LIBLAUNCH    10
+#define OS_ALLOC_ONCE_KEY_LIBMACHO     11
+#define OS_ALLOC_ONCE_KEY_OS_TRACE     12
+#define OS_ALLOC_ONCE_KEY_LIBSYSTEM_BLOCKS     13
+#define OS_ALLOC_ONCE_KEY_LIBSYSTEM_MALLOC     14
+#define OS_ALLOC_ONCE_KEY_LIBSYSTEM_PLATFORM   15
+#define OS_ALLOC_ONCE_KEY_LIBSYSTEM_PTHREAD    16
+#define OS_ALLOC_ONCE_KEY_LIBSYSTEM_STATS      17
+
+/* Keys OS_ALLOC_ONCE_KEY_MAX - 10 upwards are reserved for the system. */
+#define OS_ALLOC_ONCE_KEY_RESERVED_0   (OS_ALLOC_ONCE_KEY_MAX - 10)
+#define OS_ALLOC_ONCE_KEY_RESERVED_1   (OS_ALLOC_ONCE_KEY_MAX - 9)
+#define OS_ALLOC_ONCE_KEY_RESERVED_2   (OS_ALLOC_ONCE_KEY_MAX - 8)
+#define OS_ALLOC_ONCE_KEY_RESERVED_3   (OS_ALLOC_ONCE_KEY_MAX - 7)
+#define OS_ALLOC_ONCE_KEY_RESERVED_4   (OS_ALLOC_ONCE_KEY_MAX - 6)
+#define OS_ALLOC_ONCE_KEY_RESERVED_5   (OS_ALLOC_ONCE_KEY_MAX - 5)
+#define OS_ALLOC_ONCE_KEY_RESERVED_6   (OS_ALLOC_ONCE_KEY_MAX - 4)
+#define OS_ALLOC_ONCE_KEY_RESERVED_7   (OS_ALLOC_ONCE_KEY_MAX - 3)
+#define OS_ALLOC_ONCE_KEY_RESERVED_8   (OS_ALLOC_ONCE_KEY_MAX - 2)
+#define OS_ALLOC_ONCE_KEY_RESERVED_9   (OS_ALLOC_ONCE_KEY_MAX - 1)
+
+/* OS_ALLOC_ONCE_KEY_MAX cannot be used. */
+
+#endif // __OS_ALLOC__
diff --git a/init.c b/init.c
index 073973318b6f11333411f47f4cf5cc61e0c8f59f..9df51a18f3856a94d2b6f3bbc607c526fee4f736 100644 (file)
--- a/init.c
+++ b/init.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2008, 2011 Apple Inc. All rights reserved.
+ * Copyright (c) 2007, 2008, 2011, 2012 Apple Inc. All rights reserved.
  *
  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
  * 
 
 #include <TargetConditionals.h>        // for TARGET_OS_EMBEDDED
 
+#include <pthread.h>
+#include <pthread/private.h>
 #include <_libkernel_init.h>
+#include <stdlib.h>
 #include <dlfcn.h>
 #include <errno.h>
+#include <TargetConditionals.h>
 
 struct ProgramVars; /* forward reference */
 
 // system library initialisers
 extern void bootstrap_init(void);              // from liblaunch.dylib
-extern void mach_init(void);                   // from libsystem_mach.dylib
-extern void pthread_init(void);                        // from libc.a
-extern void __libc_init(const struct ProgramVars *vars, void (*atfork_prepare)(void), void (*atfork_parent)(void), void (*atfork_child)(void), const char *apple[]);   // from libc.a
-extern void __keymgr_initializer(void);                // from libkeymgr.a
-extern void _dyld_initializer(void);           // from libdyld.a
-extern void libdispatch_init(void);            // from libdispatch.a
-extern void _libxpc_initializer(void);         // from libxpc
+extern void mach_init(void);                   // from libsystem_kernel.dylib
+extern void __libplatform_init(void *future_use, const char *envp[], const char *apple[], const struct ProgramVars *vars);
+extern void __pthread_init(const struct _libpthread_functions *libpthread_funcs, const char *envp[], const char *apple[], const struct ProgramVars *vars);     // from libsystem_pthread.dylib
+extern void __libc_init(const struct ProgramVars *vars, void (*atfork_prepare)(void), void (*atfork_parent)(void), void (*atfork_child)(void), const char *apple[]);   // from libsystem_c.dylib
+extern void __malloc_init(const char *apple[]); // from libsystem_malloc.dylib
+extern void __keymgr_initializer(void);                // from libkeymgr.dylib
+extern void _dyld_initializer(void);           // from libdyld.dylib
+extern void libdispatch_init(void);            // from libdispatch.dylib
+extern void _libxpc_initializer(void);         // from libxpc.dylib
 
 // signal malloc stack logging that initialisation has finished
 extern void __stack_logging_early_finished(void); // form libsystem_c.dylib
 
 // system library atfork handlers
-extern void _cthread_fork_prepare(void);
-extern void _cthread_fork_parent(void);
-extern void _cthread_fork_child(void);
-extern void _cthread_fork_child_postinit(void);
+extern void _pthread_fork_prepare(void);
+extern void _pthread_fork_parent(void);
+extern void _pthread_fork_child(void);
+extern void _pthread_fork_child_postinit(void);
+
+extern void dispatch_atfork_prepare(void);
+extern void dispatch_atfork_parent(void);
+extern void dispatch_atfork_child(void);
+
+extern void _malloc_fork_prepare(void);
+extern void _malloc_fork_parent(void);
+extern void _malloc_fork_child(void);
 
 extern void _mach_fork_child(void);
-extern void _cproc_fork_child(void);
 extern void _libc_fork_child(void);
 extern void _notify_fork_child(void);
 extern void _dyld_fork_child(void);
 extern void xpc_atfork_prepare(void);
 extern void xpc_atfork_parent(void);
 extern void xpc_atfork_child(void);
+extern void _libSC_info_fork_prepare(void);
+extern void _libSC_info_fork_parent(void);
+extern void _libSC_info_fork_child(void);
+extern void _asl_fork_child(void);
 
 // advance decls for below;
 void libSystem_atfork_prepare(void);
 void libSystem_atfork_parent(void);
 void libSystem_atfork_child(void);
 
-// from mig_support.c in libc
-mach_port_t _mig_get_reply_port(void);
-void _mig_set_reply_port(mach_port_t);
-
-void cthread_set_errno_self(int);
+void _pthread_exit_if_canceled(int);
 
 /*
  * libsyscall_initializer() initializes all of libSystem.dylib <rdar://problem/4892197>
  */
-static __attribute__((constructor)) 
+static __attribute__((constructor))
 void libSystem_initializer(int argc, const char* argv[], const char* envp[], const char* apple[], const struct ProgramVars* vars)
 {
-       _libkernel_functions_t libkernel_funcs = {
-               .get_reply_port = _mig_get_reply_port,
-               .set_reply_port = _mig_set_reply_port,
-               .get_errno = __error,
-               .set_errno = cthread_set_errno_self,
+       static const struct _libkernel_functions libkernel_funcs = {
+               .version = 1,
                .dlsym = dlsym,
+               .malloc = malloc,
+               .free = free,
+               .realloc = realloc,
+               ._pthread_exit_if_canceled = _pthread_exit_if_canceled,
+       };
+
+       static const struct _libpthread_functions libpthread_funcs = {
+               .version = 1,
+               .exit = exit,
        };
 
-       _libkernel_init(libkernel_funcs);
+       __libkernel_init(&libkernel_funcs, envp, apple, vars);
 
        bootstrap_init();
-       mach_init();
-       pthread_init();
+       __libplatform_init(NULL, envp, apple, vars);
+
+       __pthread_init(&libpthread_funcs, envp, apple, vars);
        __libc_init(vars, libSystem_atfork_prepare, libSystem_atfork_parent, libSystem_atfork_child, apple);
-       __keymgr_initializer();
+
+       // TODO: Move __malloc_init before __libc_init after breaking malloc's upward link to Libc
+       __malloc_init(apple);
+
        _dyld_initializer();
        libdispatch_init();
        _libxpc_initializer();
@@ -114,29 +137,38 @@ void libSystem_initializer(int argc, const char* argv[], const char* envp[], con
  */
 void libSystem_atfork_prepare(void)
 {
+       _libSC_info_fork_prepare();
        xpc_atfork_prepare();
-       _cthread_fork_prepare();
+       dispatch_atfork_prepare();
+       _pthread_fork_prepare();
+       _malloc_fork_prepare();
 }
 
 void libSystem_atfork_parent(void)
 {
-       _cthread_fork_parent();
+       _malloc_fork_parent();
+       _pthread_fork_parent();
+       dispatch_atfork_parent();
        xpc_atfork_parent();
+       _libSC_info_fork_parent();
 }
 
 void libSystem_atfork_child(void)
 {
        _dyld_fork_child();
-       _cthread_fork_child();
+       _pthread_fork_child();
+       _malloc_fork_child();
+       dispatch_atfork_child();
        
        bootstrap_init();
        _mach_fork_child();
-       _cproc_fork_child();
        _libc_fork_child();
+       _asl_fork_child();
        _notify_fork_child();
        xpc_atfork_child();
+       _libSC_info_fork_child();
 
-       _cthread_fork_child_postinit();
+       _pthread_fork_child_postinit();
 }
 
 /*  
index 8ef1535f5098f851066c73b05366f7390ebc4f15..2d0cde254c0ceff882076fb7957ab79134250deb 100644 (file)
@@ -1,20 +1,4 @@
-cache
-closure
-compiler_rt
-dispatch
-dnsinfo
-dyld
 keymgr
 quarantine
-sandbox
-system_auto
-system_blocks
-system_c++
-system_c++abi
-system_dyld
-system_network
-system_objc
-system_sandbox
+system_stats
 unc
-unwind
-xpc
index 38e3cce9c67938288f3c3bffb2096bf3a9a002f8..763e333290b0a270924f515f6be2787a89b89730 100644 (file)
@@ -1,11 +1,26 @@
+cache
 commonCrypto
+compiler_rt
 copyfile
+corecrypto
+dispatch
+dyld
 launch
 macho
 removefile
+system_asl
+system_blocks
 system_c
+system_configuration
 system_dnssd
 system_info
 system_kernel
 system_m
+system_malloc
+system_network
 system_notify
+system_platform
+system_pthread
+system_sandbox
+unwind
+xpc