MCPcopy Create free account
hub / github.com/cinit/TMoe / ashmem_open_legacy

Function ashmem_open_legacy

app/src/main/cpp/utils/shared_memory.cpp:81–97  ·  view source on GitHub ↗

logistics of getting file descriptor for ashmem */

Source from the content-addressed store, hash-verified

79
80/* logistics of getting file descriptor for ashmem */
81static 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

Callers 1

ashmem_create_regionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected