OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 The Android Open Source Project | 2 * Copyright (C) 2008 The Android Open Source Project |
3 * | 3 * |
4 * Licensed under the Apache License, Version 2.0 (the "License"); | 4 * Licensed under the Apache License, Version 2.0 (the "License"); |
5 * you may not use this file except in compliance with 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 | 6 * You may obtain a copy of the License at |
7 * | 7 * |
8 * http://www.apache.org/licenses/LICENSE-2.0 | 8 * http://www.apache.org/licenses/LICENSE-2.0 |
9 * | 9 * |
10 * Unless required by applicable law or agreed to in writing, software | 10 * Unless required by applicable law or agreed to in writing, software |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 int ashmem_unpin_region(int fd, size_t offset, size_t len) | 81 int ashmem_unpin_region(int fd, size_t offset, size_t len) |
82 { | 82 { |
83 struct ashmem_pin pin = { offset, len }; | 83 struct ashmem_pin pin = { offset, len }; |
84 return ioctl(fd, ASHMEM_UNPIN, &pin); | 84 return ioctl(fd, ASHMEM_UNPIN, &pin); |
85 } | 85 } |
86 | 86 |
87 int ashmem_get_size_region(int fd) | 87 int ashmem_get_size_region(int fd) |
88 { | 88 { |
89 return ioctl(fd, ASHMEM_GET_SIZE, NULL); | 89 return ioctl(fd, ASHMEM_GET_SIZE, NULL); |
90 } | 90 } |
| 91 |
| 92 int ashmem_purge_all(void) |
| 93 { |
| 94 const int fd = open(ASHMEM_DEVICE, O_RDWR); |
| 95 if (fd < 0) |
| 96 return fd; |
| 97 const int ret = ioctl(fd, ASHMEM_PURGE_ALL_CACHES, 0); |
| 98 close(fd); |
| 99 return ret; |
| 100 } |
OLD | NEW |