| 206 | } |
| 207 | |
| 208 | string ASharedMemory_getName(int fd) { |
| 209 | // Android Q doesn't have ASharedMemory_getName() |
| 210 | // I've make a request to Google, https://issuetracker.google.com/issues/130741665 |
| 211 | // There's nothing we can do before it's supported officially by Google |
| 212 | #ifndef MMKV_OHOS |
| 213 | if (g_android_api >= __ANDROID_API_O__) { |
| 214 | return ""; |
| 215 | } |
| 216 | #endif |
| 217 | |
| 218 | char name[ASHMEM_NAME_LEN] = {0}; |
| 219 | if (ioctl(fd, ASHMEM_GET_NAME, name) != 0) { |
| 220 | MMKVError("fail to get ashmem name:%d, %s", fd, strerror(errno)); |
| 221 | return ""; |
| 222 | } |
| 223 | return {name}; |
| 224 | } |
| 225 | |
| 226 | } // namespace mmkv |
| 227 | |