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

Function memfd_create_region_post_q

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

Source from the content-addressed store, hash-verified

39#define ASHMEM_NAME_LEN 256
40
41static int memfd_create_region_post_q(const char *name, size_t size) {
42 // This code needs to build on old API levels, so we can't use the libc
43 // wrapper.
44 int fd = (int) syscall(__NR_memfd_create, name, MFD_CLOEXEC | MFD_ALLOW_SEALING);
45 if (fd == -1) {
46 return -errno;
47 }
48 if (ftruncate(fd, size) == -1) {
49 int orig = errno;
50 close(fd);
51 errno = orig;
52 return -orig;
53 }
54 return fd;
55}
56
57static bool testMemfdSupport() {
58 int fd = (int) syscall(__NR_memfd_create, "test_support_memfd", MFD_CLOEXEC | MFD_ALLOW_SEALING);

Callers 1

ashmem_create_regionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected