]>
git.saurik.com Git - apple/libc.git/blob - gen.subproj/zone.c
0f4610f91ed26d1b1f322d6f0ec7df31abfae17c
2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
27 /********* NX functions ************/
29 malloc_zone_t
*NXDefaultMallocZone() {
30 return malloc_default_zone();
33 malloc_zone_t
*NXCreateZone(size_t startsize
, size_t granularity
, int canfree
) {
34 return malloc_create_zone(startsize
, 0);
37 void NXNameZone(malloc_zone_t
*z
, const char *name
) {
38 malloc_set_zone_name(z
, name
);
41 void *NXZoneMalloc(malloc_zone_t
*zone
, size_t size
) {
42 return malloc_zone_malloc(zone
, size
);
45 void *NXZoneRealloc(malloc_zone_t
*zone
, void *ptr
, size_t size
) {
46 return malloc_zone_realloc(zone
, ptr
, size
);
49 void *NXZoneCalloc(malloc_zone_t
*zone
, size_t num_items
, size_t size
) {
50 return malloc_zone_calloc(zone
, num_items
, size
);
53 void NXZoneFree(malloc_zone_t
*zone
, void *ptr
) {
54 malloc_zone_free(zone
, ptr
);
57 void NXDestroyZone(malloc_zone_t
*zone
) {
58 if (zone
== malloc_default_zone()) return; // we avoid destroying child zones
59 malloc_destroy_zone(zone
);
62 NXZone
*NXZoneFromPtr(void *ptr
) {
63 NXZone
*zone
= malloc_zone_from_ptr(ptr
);
65 fprintf(stderr
, "*** malloc[%d]: NXZoneFromPtr() did not find any zone for %p; returning default\n", getpid(), ptr
);
71 void NXAddRegion(void *start
, size_t size
, malloc_zone_t
*zone
) {
72 fprintf(stderr
, "*** malloc[%d]: OBSOLETE: NXAddRegion()\n", getpid());
75 void NXRemoveRegion(void *start
) {
76 fprintf(stderr
, "*** malloc[%d]: OBSOLETE: NXRemoveRegion()\n", getpid());
79 void NXZonePtrInfo(void *ptr
) {
80 malloc_zone_print_ptr_info(ptr
);
83 int NXMallocCheck(void) {
84 malloc_zone_check(NULL
);
88 void _NXMallocDumpZones(void) {
89 malloc_zone_print(NULL
, 0);
92 /***************** UNIMPLEMENTED ENTRY POINTS ********************/
94 void NXMergeZone(malloc_zone_t
*z
) {
95 static char warned
= 0;
97 fprintf(stderr
, "*** malloc[%d]: NXMergeZone() now obsolete, does nothing\n", getpid());
102 boolean_t
NXProtectZone(malloc_zone_t
*zone
, int protection
) {
103 fprintf(stderr
, "*** malloc[%d]: NXProtectZone() is obsolete\n", getpid());
107 malloc_zone_t
*NXCreateChildZone(malloc_zone_t
*parentzone
, size_t startsize
, size_t granularity
, int canfree
) {
108 // We can not remove this one as it is still used by IndexingKit
109 static char warned
= 0;
111 fprintf(stderr
, "*** malloc[%d]: NXCreateChildZone() now obsolete, has been defined to create new zone\n", getpid());
114 return NXCreateZone(startsize
, granularity
, canfree
);
117 void _NXMallocDumpFrees(void) {
118 fprintf(stderr
, "*** malloc[%d]: OBSOLETE: _NXMallocDumpFrees()\n", getpid());