logistics of getting file descriptor for ashmem */
| 79 | |
| 80 | /* logistics of getting file descriptor for ashmem */ |
| 81 | static int ashmem_open_legacy() { |
| 82 | int fd = TEMP_FAILURE_RETRY(open("/dev/ashmem", O_RDWR | O_CLOEXEC)); |
| 83 | struct stat st = {}; |
| 84 | int ret = TEMP_FAILURE_RETRY(fstat(fd, &st)); |
| 85 | if (ret < 0) { |
| 86 | int save_errno = errno; |
| 87 | close(fd); |
| 88 | errno = save_errno; |
| 89 | return ret; |
| 90 | } |
| 91 | if (!S_ISCHR(st.st_mode) || !st.st_rdev) { |
| 92 | close(fd); |
| 93 | errno = ENOTTY; |
| 94 | return -1; |
| 95 | } |
| 96 | return fd; |
| 97 | } |
| 98 | |
| 99 | /* |
| 100 | * ashmem_create_region - creates a new ashmem region and returns the file |
no outgoing calls
no test coverage detected