]>
git.saurik.com Git - apple/libc.git/blob - gen/zone.c
2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
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
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.
21 * @APPLE_LICENSE_HEADER_END@
28 /********* NX functions ************/
30 malloc_zone_t
*NXDefaultMallocZone() {
31 return malloc_default_zone();
34 malloc_zone_t
*NXCreateZone(size_t startsize
, size_t granularity
, int canfree
) {
35 return malloc_create_zone(startsize
, 0);
38 void NXNameZone(malloc_zone_t
*z
, const char *name
) {
39 malloc_set_zone_name(z
, name
);
42 void *NXZoneMalloc(malloc_zone_t
*zone
, size_t size
) {
43 return malloc_zone_malloc(zone
, size
);
46 void *NXZoneRealloc(malloc_zone_t
*zone
, void *ptr
, size_t size
) {
47 return malloc_zone_realloc(zone
, ptr
, size
);
50 void *NXZoneCalloc(malloc_zone_t
*zone
, size_t num_items
, size_t size
) {
51 return malloc_zone_calloc(zone
, num_items
, size
);
54 void NXZoneFree(malloc_zone_t
*zone
, void *ptr
) {
55 malloc_zone_free(zone
, ptr
);
58 void NXDestroyZone(malloc_zone_t
*zone
) {
59 if (zone
== malloc_default_zone()) return; // we avoid destroying child zones
60 malloc_destroy_zone(zone
);
63 NXZone
*NXZoneFromPtr(void *ptr
) {
64 NXZone
*zone
= malloc_zone_from_ptr(ptr
);
66 malloc_printf("*** NXZoneFromPtr() did not find any zone for %p; returning default\n", ptr
);
72 void NXAddRegion(void *start
, size_t size
, malloc_zone_t
*zone
) {
73 malloc_printf("*** OBSOLETE: NXAddRegion()\n");
76 void NXRemoveRegion(void *start
) {
77 malloc_printf("*** OBSOLETE: NXRemoveRegion()\n");
80 void NXZonePtrInfo(void *ptr
) {
81 malloc_zone_print_ptr_info(ptr
);
84 int NXMallocCheck(void) {
85 malloc_zone_check(NULL
);
89 void _NXMallocDumpZones(void) {
90 malloc_zone_print(NULL
, 0);
93 /***************** UNIMPLEMENTED ENTRY POINTS ********************/
95 void NXMergeZone(malloc_zone_t
*z
) {
96 static char warned
= 0;
98 malloc_printf("*** NXMergeZone() now obsolete, does nothing\n");
103 boolean_t
NXProtectZone(malloc_zone_t
*zone
, int protection
) {
104 malloc_printf("*** NXProtectZone() is obsolete\n");
108 malloc_zone_t
*NXCreateChildZone(malloc_zone_t
*parentzone
, size_t startsize
, size_t granularity
, int canfree
) {
109 // We can not remove this one as it is still used by IndexingKit
110 static char warned
= 0;
112 malloc_printf("*** NXCreateChildZone() now obsolete, has been defined to create new zone\n");
115 return NXCreateZone(startsize
, granularity
, canfree
);
118 void _NXMallocDumpFrees(void) {
119 malloc_printf("*** OBSOLETE: _NXMallocDumpFrees()\n");