ashmem.h revision 4f6e8d7a00cbeda1e70cc15be9c4af1018bdad53
1/* cutils/ashmem.h
2 **
3 ** Copyright 2008 The Android Open Source Project
4 **
5 ** This file is dual licensed.  It may be redistributed and/or modified
6 ** under the terms of the Apache 2.0 License OR version 2 of the GNU
7 ** General Public License.
8 */
9
10#ifndef _CUTILS_ASHMEM_H
11#define _CUTILS_ASHMEM_H
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
17int ashmem_create_region(const char *name, size_t size);
18int ashmem_set_prot_region(int fd, int prot);
19int ashmem_pin_region(int fd, size_t offset, size_t len);
20int ashmem_unpin_region(int fd, size_t offset, size_t len);
21
22#ifdef __cplusplus
23}
24#endif
25
26#ifndef __ASHMEMIOC	/* in case someone included <linux/ashmem.h> too */
27
28#define ASHMEM_NAME_LEN		256
29
30#define ASHMEM_NAME_DEF		"dev/ashmem"
31
32/* Return values from ASHMEM_PIN: Was the mapping purged while unpinned? */
33#define ASHMEM_NOT_PURGED	0
34#define ASHMEM_WAS_PURGED	1
35
36/* Return values from ASHMEM_UNPIN: Is the mapping now pinned or unpinned? */
37#define ASHMEM_IS_UNPINNED	0
38#define ASHMEM_IS_PINNED	1
39
40#endif	/* ! __ASHMEMIOC */
41
42#endif	/* _CUTILS_ASHMEM_H */
43