michael@0: /* michael@0: * Copyright 2008 The Android Open Source Project michael@0: * michael@0: * Use of this source code is governed by a BSD-style license that can be michael@0: * found in the LICENSE file. michael@0: */ michael@0: michael@0: #ifndef _CUTILS_ASHMEM_H michael@0: #define _CUTILS_ASHMEM_H michael@0: michael@0: #include michael@0: michael@0: #ifdef __cplusplus michael@0: extern "C" { michael@0: #endif michael@0: michael@0: int ashmem_create_region(const char *name, size_t size); michael@0: int ashmem_set_prot_region(int fd, int prot); michael@0: michael@0: /** michael@0: * @return ASHMEM_NOT_PURGED if the memory was not purged. michael@0: * ASHMEM_WAS_PURGED if the memory was purged. michael@0: * -1 on error. michael@0: */ michael@0: int ashmem_pin_region(int fd, size_t offset, size_t len); michael@0: int ashmem_unpin_region(int fd, size_t offset, size_t len); michael@0: int ashmem_get_size_region(int fd); michael@0: int ashmem_purge_all_caches(int fd); michael@0: michael@0: #ifdef __cplusplus michael@0: } michael@0: #endif michael@0: michael@0: #ifndef __ASHMEMIOC /* in case someone included too */ michael@0: michael@0: #define ASHMEM_NAME_LEN 256 michael@0: michael@0: #define ASHMEM_NAME_DEF "dev/ashmem" michael@0: michael@0: /* Return values from ASHMEM_PIN: Was the mapping purged while unpinned? */ michael@0: #define ASHMEM_NOT_PURGED 0 michael@0: #define ASHMEM_WAS_PURGED 1 michael@0: michael@0: /* Return values from ASHMEM_UNPIN: Is the mapping now pinned or unpinned? */ michael@0: #define ASHMEM_IS_UNPINNED 0 michael@0: #define ASHMEM_IS_PINNED 1 michael@0: michael@0: #endif /* ! __ASHMEMIOC */ michael@0: michael@0: #endif /* _CUTILS_ASHMEM_H */