blob: ec21926c96383a69fb24c02b922b2a83c0666a79 [file] [log] [blame]
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08001/*
Ian Rogers2c344d32012-08-28 15:53:10 -07002 * Copyright (C) 2012 The Android Open Source Project
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08003 *
Ian Rogers2c344d32012-08-28 15:53:10 -07004 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08007 *
Ian Rogers2c344d32012-08-28 15:53:10 -07008 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080015 */
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080016
Ian Rogers2c344d32012-08-28 15:53:10 -070017#ifndef LIBC_INCLUDE_MALLOC_H_
18#define LIBC_INCLUDE_MALLOC_H_
19
20/*
21 * Declaration of malloc routines. Bionic uses dlmalloc (see
22 * upstream-dlmalloc) but doesn't directly include it here to keep the
23 * defined malloc.h interface small.
24 */
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080025#include <sys/cdefs.h>
26#include <stddef.h>
27
28__BEGIN_DECLS
29
30extern __mallocfunc void* malloc(size_t);
31extern __mallocfunc void* calloc(size_t, size_t);
Nick Kralevichb27631b2012-06-13 15:43:14 -070032extern void* realloc(void *, size_t);
Ian Rogers2c344d32012-08-28 15:53:10 -070033extern void free(void *);
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080034
Ian Rogers2c344d32012-08-28 15:53:10 -070035extern void* memalign(size_t alignment, size_t bytesize);
36extern size_t malloc_usable_size(void*);
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080037
Ian Rogers2c344d32012-08-28 15:53:10 -070038extern void* valloc(size_t bytesize);
39extern void* pvalloc(size_t bytesize);
40
41#ifndef STRUCT_MALLINFO_DECLARED
42#define STRUCT_MALLINFO_DECLARED 1
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080043struct mallinfo {
Ian Rogers2c344d32012-08-28 15:53:10 -070044 size_t arena;
45 size_t ordblks;
46 size_t smblks;
47 size_t hblks;
48 size_t hblkhd;
49 size_t usmblks;
50 size_t fsmblks;
51 size_t uordblks;
52 size_t fordblks;
53 size_t keepcost;
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080054};
Ian Rogers2c344d32012-08-28 15:53:10 -070055#endif /* STRUCT_MALLINFO_DECLARED */
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080056
Ian Rogers2c344d32012-08-28 15:53:10 -070057extern struct mallinfo mallinfo(void);
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080058
59__END_DECLS
60
Ian Rogers2c344d32012-08-28 15:53:10 -070061#endif /* LIBC_INCLUDE_MALLOC_H_ */