1 /* -*- mode: C++; c-basic-offset: 4; tab-width: 4 -*- 
   3  * Copyright (c) 2004-2009 Apple Inc. All rights reserved. 
   5  * @APPLE_LICENSE_HEADER_START@ 
   7  * This file contains Original Code and/or Modifications of Original Code 
   8  * as defined in and that are subject to the Apple Public Source License 
   9  * Version 2.0 (the 'License'). You may not use this file except in 
  10  * compliance with the License. Please obtain a copy of the License at 
  11  * http://www.opensource.apple.com/apsl/ and read it before using this 
  14  * The Original Code and all software distributed under the License are 
  15  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 
  16  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 
  17  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 
  18  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 
  19  * Please see the License for the specific language governing rights and 
  20  * limitations under the License. 
  22  * @APPLE_LICENSE_HEADER_END@ 
  26 #ifndef __DYLDLIBSYSTEMHELPERS__ 
  27 #define __DYLDLIBSYSTEMHELPERS__ 
  31 struct __cxa_range_t 
{ const void* addr
; size_t length
; }; 
  37         // This file contains the synchronization utilities used by dyld to be thread safe. 
  38         // This struct is implemented in in libSystem (where pthreads is available) 
  39         // and passed to dyld to use. 
  41         struct LibSystemHelpers
 
  44                 void            (*acquireGlobalDyldLock
)(); 
  45                 void            (*releaseGlobalDyldLock
)(); 
  46                 char*           (*getThreadBufferFor_dlerror
)(size_t sizeRequired
); 
  47                 // addded in version 2 
  48                 void*           (*malloc
)(size_t); 
  50                 int                     (*cxa_atexit
)(void (*)(void*), void*, void*); 
  51                 // addded in version 3 
  52                 void            (*dyld_shared_cache_missing
)(); 
  53                 void            (*dyld_shared_cache_out_of_date
)(); 
  54                 // addded in version 4 
  55                 void            (*acquireDyldInitializerLock
)(); 
  56                 void            (*releaseDyldInitializerLock
)(); 
  58                 int                     (*pthread_key_create
)(pthread_key_t
*, void (*destructor
)(void*)); 
  59                 int                     (*pthread_setspecific
)(pthread_key_t
, const void*); 
  61                 size_t          (*malloc_size
)(const void *ptr
); 
  63                 void*           (*pthread_getspecific
)(pthread_key_t
); 
  65                 void            (*cxa_finalize
)(const void*); 
  67                 void*           startGlueToCallExit
; 
  68                 // added in version 10 
  69                 bool            (*hasPerThreadBufferFor_dlerror
)(); 
  70                 // added in version 11 
  71                 bool            (*isLaunchdOwned
)(); 
  72                 // added in version 12 
  73                 kern_return_t (*vm_alloc
)(vm_map_t task
, vm_address_t
* addr
, vm_size_t size
, int flags
); 
  74                 void*           (*mmap
)(void* addr
, size_t len
, int prot
, int flags
, int fd
, off_t offset
); 
  75                 // added in version 13 
  76                 void            (*cxa_finalize_ranges
)(const struct __cxa_range_t ranges
[], int count
); 
  85 #endif // __DYLDLIBSYSTEMHELPERS__