1/* -*- mode: C++; c-basic-offset: 4; tab-width: 4 -*-
2 *
3 * Copyright (c) 2004-2009 Apple Inc. All rights reserved.
4 *
5 * @APPLE_LICENSE_HEADER_START@
6 *
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
12 * file.
13 *
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.
21 *
22 * @APPLE_LICENSE_HEADER_END@
23 */
24
25
26#ifndef __DYLDLIBSYSTEMHELPERS__
27#define __DYLDLIBSYSTEMHELPERS__
28
29#include <stdint.h>
30
31#if __cplusplus
32namespace dyld {
33#endif
34	//
35	// This file contains the synchronization utilities used by dyld to be thread safe.
36	// This struct is implemented in in libSystem (where pthreads is available)
37	// and passed to dyld to use.
38	//
39	struct LibSystemHelpers
40	{
41		uintptr_t	version;
42		void		(*acquireGlobalDyldLock)();
43		void		(*releaseGlobalDyldLock)();
44		char*		(*getThreadBufferFor_dlerror)(uint32_t sizeRequired);
45		// addded in version 2
46		void*		(*malloc)(size_t);
47		void		(*free)(void*);
48		int			(*cxa_atexit)(void (*)(void*), void*, void*);
49		// addded in version 3
50		void		(*dyld_shared_cache_missing)();
51		void		(*dyld_shared_cache_out_of_date)();
52		// addded in version 4
53		void		(*acquireDyldInitializerLock)();
54		void		(*releaseDyldInitializerLock)();
55		// added in version 5
56		int			(*pthread_key_create)(pthread_key_t*, void (*destructor)(void*));
57		int			(*pthread_setspecific)(pthread_key_t, const void*);
58		// added in version 6
59		size_t		(*malloc_size)(const void *ptr);
60		// added in version 7
61		void*		(*pthread_getspecific)(pthread_key_t);
62		// added in version 8
63		void		(*cxa_finalize)(const void*);
64		// added in version 9
65		void*		startGlueToCallExit;
66		// added in version 10
67		bool		(*hasPerThreadBufferFor_dlerror)();
68		// added in version 11
69		bool		(*isLaunchdOwned)();
70		// added in version 12
71		kern_return_t (*vm_alloc)(vm_map_t task, vm_address_t* addr, vm_size_t size, int flags);
72		void*		(*mmap)(void* addr, size_t len, int prot, int flags, int fd, off_t offset);
73	};
74#if __cplusplus
75}
76#endif
77
78
79
80
81#endif // __DYLDLIBSYSTEMHELPERS__
82
83