/system/core/libcutils/ |
D | ashmem-dev.cpp | 165 android::base::unique_fd fd( in __has_memfd_support() local 167 if (fd == -1) { in __has_memfd_support() 172 if (fcntl(fd, F_ADD_SEALS, F_SEAL_FUTURE_WRITE) == -1) { in __has_memfd_support() 213 int fd = TEMP_FAILURE_RETRY(open(ashmem_device_path.c_str(), O_RDWR | O_CLOEXEC)); in __ashmem_open_locked() local 216 if (fd < 0) { in __ashmem_open_locked() 218 fd = TEMP_FAILURE_RETRY(open("/dev/ashmem", O_RDWR | O_CLOEXEC)); in __ashmem_open_locked() 219 if (fd < 0) { in __ashmem_open_locked() 224 return fd; in __ashmem_open_locked() 228 int ret = TEMP_FAILURE_RETRY(fstat(fd, &st)); in __ashmem_open_locked() 231 close(fd); in __ashmem_open_locked() [all …]
|
D | ashmem_test.cpp | 32 void TestCreateRegion(size_t size, unique_fd &fd, int prot) { in TestCreateRegion() argument 33 fd = unique_fd(ashmem_create_region(nullptr, size)); in TestCreateRegion() 34 ASSERT_TRUE(fd >= 0); in TestCreateRegion() 35 ASSERT_TRUE(ashmem_valid(fd)); in TestCreateRegion() 36 ASSERT_EQ(size, static_cast<size_t>(ashmem_get_size_region(fd))); in TestCreateRegion() 37 ASSERT_EQ(0, ashmem_set_prot_region(fd, prot)); in TestCreateRegion() 42 ASSERT_EQ(FD_CLOEXEC, (fcntl(fd, F_GETFD) & FD_CLOEXEC)); in TestCreateRegion() 45 void TestMmap(const unique_fd& fd, size_t size, int prot, void** region, off_t off = 0) { in TestMmap() argument 46 ASSERT_TRUE(fd >= 0); in TestMmap() 47 ASSERT_TRUE(ashmem_valid(fd)); in TestMmap() [all …]
|
D | ashmem-host.cpp | 37 static bool ashmem_validate_stat(int fd, struct stat* buf) { in ashmem_validate_stat() argument 38 int result = fstat(fd, buf); in ashmem_validate_stat() 55 int ashmem_valid(int fd) { in ashmem_valid() argument 57 return ashmem_validate_stat(fd, &buf); in ashmem_valid() 63 int fd = mkstemp(pattern); in ashmem_create_region() local 64 if (fd == -1) return -1; in ashmem_create_region() 68 if (TEMP_FAILURE_RETRY(ftruncate(fd, size)) == -1) { in ashmem_create_region() 69 close(fd); in ashmem_create_region() 73 return fd; in ashmem_create_region() 88 int ashmem_get_size_region(int fd) in ashmem_get_size_region() argument [all …]
|
D | android_get_control_file.cpp | 67 long fd = strtol(val, NULL, 10); in __android_get_control_from_env() local 71 if ((fd < 0) || (fd > INT_MAX)) return -1; in __android_get_control_from_env() 74 if (TEMP_FAILURE_RETRY(fcntl(fd, F_GETFD)) < 0) return -1; in __android_get_control_from_env() 76 return static_cast<int>(fd); in __android_get_control_from_env() 84 auto fd = __android_get_control_from_env(ANDROID_FILE_ENV_PREFIX, path); in android_get_control_file() local 85 if (fd < 0) { in android_get_control_file() 86 fd = __android_get_control_from_env(ANDROID_FILE_ENV_PREFIX, given_path.c_str()); in android_get_control_file() 87 if (fd < 0) return fd; in android_get_control_file() 91 auto proc = android::base::StringPrintf("/proc/self/fd/%d", fd); in android_get_control_file() 98 return fd; in android_get_control_file()
|
D | load_file.cpp | 28 int fd; in load_file() local 31 fd = open(fn, O_RDONLY); in load_file() 32 if(fd < 0) return 0; in load_file() 34 sz = lseek(fd, 0, SEEK_END); in load_file() 37 if(lseek(fd, 0, SEEK_SET) != 0) goto oops; in load_file() 42 if(read(fd, data, sz) != sz) goto oops; in load_file() 43 close(fd); in load_file() 50 close(fd); in load_file()
|
/system/memory/libion/ |
D | ion.c | 44 int ion_is_legacy(int fd) { in ion_is_legacy() argument 51 int err = ion_free(fd, (ion_user_handle_t)0); in ion_is_legacy() 59 int fd = open("/dev/ion", O_RDONLY | O_CLOEXEC); in ion_open() local 60 if (fd < 0) ALOGE("open /dev/ion failed: %s", strerror(errno)); in ion_open() 62 return fd; in ion_open() 65 int ion_close(int fd) { in ion_close() argument 66 int ret = close(fd); in ion_close() 71 static int ion_ioctl(int fd, int req, void* arg) { in ion_ioctl() argument 72 int ret = ioctl(fd, req, arg); in ion_ioctl() 80 int ion_is_using_modular_heaps(int fd) { in ion_is_using_modular_heaps() argument [all …]
|
D | ion_test.c | 41 int _ion_alloc_test(int *fd, ion_user_handle_t *handle) in _ion_alloc_test() argument 45 *fd = ion_open(); in _ion_alloc_test() 46 if (*fd < 0) in _ion_alloc_test() 47 return *fd; in _ion_alloc_test() 49 ret = ion_alloc(*fd, len, align, heap_mask, alloc_flags, handle); in _ion_alloc_test() 58 int fd, ret; in ion_alloc_test() local 61 if(_ion_alloc_test(&fd, &handle)) in ion_alloc_test() 64 ret = ion_free(fd, handle); in ion_alloc_test() 69 ion_close(fd); in ion_alloc_test() 75 int fd, map_fd, ret; in ion_map_test() local [all …]
|
/system/extras/boot_control_copy/ |
D | bootinfo.cpp | 48 int fd; in boot_info_open_partition() local 90 fd = open(path, flags); in boot_info_open_partition() 94 if (fd != -1 && out_size != NULL) { in boot_info_open_partition() 95 if (ioctl(fd, BLKGETSIZE64, out_size) != 0) { in boot_info_open_partition() 96 close(fd); in boot_info_open_partition() 101 return fd; in boot_info_open_partition() 121 int fd; in boot_info_load() local 125 fd = boot_info_open_partition("misc", NULL, O_RDONLY); in boot_info_load() 126 if (fd == -1) return false; in boot_info_load() 127 if (lseek(fd, BOOTINFO_OFFSET, SEEK_SET) != BOOTINFO_OFFSET) { in boot_info_load() [all …]
|
/system/memory/libion/include/ion/ |
D | ion.h | 32 int ion_close(int fd); 33 int ion_alloc(int fd, size_t len, size_t align, unsigned int heap_mask, 35 int ion_alloc_fd(int fd, size_t len, size_t align, unsigned int heap_mask, 37 int ion_sync_fd(int fd, int handle_fd); 38 int ion_free(int fd, ion_user_handle_t handle); 39 int ion_map(int fd, ion_user_handle_t handle, size_t length, int prot, 41 int ion_share(int fd, ion_user_handle_t handle, int *share_fd); 42 int ion_import(int fd, int share_fd, ion_user_handle_t *handle); 48 int ion_query_heap_cnt(int fd, int* cnt); 49 int ion_query_get_heaps(int fd, int cnt, void* buffers); [all …]
|
/system/bt/osi/src/ |
D | semaphore.cc | 40 int fd; member 45 ret->fd = eventfd(value, EFD_SEMAPHORE); in semaphore_new() 46 if (ret->fd == INVALID_FD) { in semaphore_new() 57 if (semaphore->fd != INVALID_FD) close(semaphore->fd); in semaphore_free() 63 CHECK(semaphore->fd != INVALID_FD); in semaphore_wait() 66 if (eventfd_read(semaphore->fd, &value) == -1) in semaphore_wait() 72 CHECK(semaphore->fd != INVALID_FD); in semaphore_try_wait() 74 int flags = fcntl(semaphore->fd, F_GETFL); in semaphore_try_wait() 80 if (fcntl(semaphore->fd, F_SETFL, flags | O_NONBLOCK) == -1) { in semaphore_try_wait() 88 if (eventfd_read(semaphore->fd, &value) == -1) rc = false; in semaphore_try_wait() [all …]
|
D | socket.cc | 41 int fd; member 55 ret->fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); in socket_new() 56 if (ret->fd == INVALID_FD) { in socket_new() 61 if (setsockopt(ret->fd, SOL_SOCKET, SO_REUSEADDR, &enable, sizeof(enable)) == in socket_new() 70 if (ret) close(ret->fd); in socket_new() 75 socket_t* socket_new_from_fd(int fd) { in socket_new_from_fd() argument 76 CHECK(fd != INVALID_FD); in socket_new_from_fd() 80 ret->fd = fd; in socket_new_from_fd() 88 close(socket->fd); in socket_free() 99 if (bind(socket->fd, (struct sockaddr*)&addr, sizeof(addr)) == -1) { in socket_listen() [all …]
|
/system/core/fs_mgr/liblp/ |
D | io_test.cpp | 52 unique_fd fd(syscall(__NR_memfd_create, "fake_disk", MFD_ALLOW_SEALING)); in CreateFakeDisk() local 53 if (fd < 0) { in CreateFakeDisk() 57 if (ftruncate(fd, size) < 0) { in CreateFakeDisk() 63 if (fcntl(fd, F_ADD_SEALS, F_SEAL_GROW | F_SEAL_SHRINK) < 0) { in CreateFakeDisk() 70 if (!android::base::WriteFully(fd, buffer.get(), size)) { in CreateFakeDisk() 73 return fd; in CreateFakeDisk() 90 explicit DefaultPartitionOpener(int fd) in DefaultPartitionOpener() argument 91 : TestPartitionOpener({{"super", fd}}, {{"super", kSuperInfo}}) {} in DefaultPartitionOpener() 108 unique_fd fd = CreateFakeDisk(); in CreateFlashedDisk() local 109 if (fd < 0) { in CreateFlashedDisk() [all …]
|
/system/memory/lmkd/libpsi/ |
D | psi.cpp | 40 int fd; in init_psi_monitor() local 44 fd = TEMP_FAILURE_RETRY(open(PSI_MON_FILE_MEMORY, O_WRONLY | O_CLOEXEC)); in init_psi_monitor() 45 if (fd < 0) { in init_psi_monitor() 69 res = TEMP_FAILURE_RETRY(write(fd, buf, strlen(buf) + 1)); in init_psi_monitor() 76 return fd; in init_psi_monitor() 79 close(fd); in init_psi_monitor() 83 int register_psi_monitor(int epollfd, int fd, void* data) { in register_psi_monitor() argument 89 res = epoll_ctl(epollfd, EPOLL_CTL_ADD, fd, &epev); in register_psi_monitor() 96 int unregister_psi_monitor(int epollfd, int fd) { in unregister_psi_monitor() argument 97 return epoll_ctl(epollfd, EPOLL_CTL_DEL, fd, NULL); in unregister_psi_monitor() [all …]
|
/system/memory/libdmabufheap/tests/ |
D | dmabuf_heap_test.c | 54 int fd = -1, ret = 0; in libdmabufheaptest() local 82 fd = DmabufHeapAllocSystem(bufferAllocator, true /* cpu_access */, len, 0, 0); in libdmabufheaptest() 83 if (fd < 0) { in libdmabufheaptest() 84 printf("DmabufHeapAllocSystem() failed: %d cpu_access: true\n", fd); in libdmabufheaptest() 87 close(fd); in libdmabufheaptest() 89 fd = DmabufHeapAllocSystem(bufferAllocator, false /* cpu_access */, len, 0, 0); in libdmabufheaptest() 90 if (fd < 0) { in libdmabufheaptest() 91 printf("DmabufHeapAllocSystem() failed: %d cpu_access: false\n", fd); in libdmabufheaptest() 94 close(fd); in libdmabufheaptest() 96 fd = DmabufHeapAlloc(bufferAllocator, kDmabufSystemHeapName, len, 0, 0); in libdmabufheaptest() [all …]
|
/system/core/trusty/libtrusty/tipc-test/ |
D | tipc_test.c | 199 int fd; in connect_foo() local 206 fd = tipc_connect(dev_name, "foo"); in connect_foo() 207 if (fd >= 0) { in connect_foo() 210 tipc_close(fd); in connect_foo() 225 int fd; in closer1_test() local 232 fd = tipc_connect(dev_name, closer1_name); in closer1_test() 233 if (fd < 0) { in closer1_test() 241 tipc_close(fd); in closer1_test() 254 int fd; in closer2_test() local 261 fd = tipc_connect(dev_name, closer2_name); in closer2_test() [all …]
|
/system/security/identity/ |
D | Util.cpp | 51 int fd = open(path.c_str(), O_RDONLY); in fileGetContents() local 52 if (fd == -1) { in fileGetContents() 58 if (fstat(fd, &statbuf) != 0) { in fileGetContents() 60 close(fd); in fileGetContents() 69 ssize_t numRead = TEMP_FAILURE_RETRY(read(fd, p, remaining)); in fileGetContents() 72 close(fd); in fileGetContents() 78 close(fd); in fileGetContents() 85 int fd; in fileSetContents() local 94 fd = mkstemp(tempName); in fileSetContents() 95 if (fd == -1) { in fileSetContents() [all …]
|
/system/bt/test/suite/rfcomm/ |
D | rfcomm_unittest.cc | 32 int fd = -1; in TEST_F() local 37 &HFP_UUID, 0, &fd, 0, getuid()); in TEST_F() 40 EXPECT_TRUE(fd != -1) << "Error creating RFCOMM socket: invalid fd"; in TEST_F() 44 len = read(fd, &channel, sizeof(channel)); in TEST_F() 47 len = read(fd, &signal, sizeof(signal)); in TEST_F() 57 len = write(fd, HANDSHAKE_COMMAND, sizeof(HANDSHAKE_COMMAND)); in TEST_F() 62 len = read(fd, response, sizeof(response)); in TEST_F() 65 close(fd); in TEST_F() 73 int fd = -1; in TEST_F() local 78 &HFP_UUID, 0, &fd, 0, getuid()); in TEST_F() [all …]
|
/system/netd/server/ |
D | OffloadUtilsTest.cpp | 110 int fd = getClatEgress4MapFd(); in TEST_F() local 111 ASSERT_GE(fd, 3); // 0,1,2 - stdin/out/err, thus fd >= 3 in TEST_F() 112 EXPECT_EQ(FD_CLOEXEC, fcntl(fd, F_GETFD)); in TEST_F() 113 close(fd); in TEST_F() 117 int fd = getClatEgress4ProgFd(RAWIP); in TEST_F() local 118 ASSERT_GE(fd, 3); in TEST_F() 119 EXPECT_EQ(FD_CLOEXEC, fcntl(fd, F_GETFD)); in TEST_F() 120 close(fd); in TEST_F() 124 int fd = getClatEgress4ProgFd(ETHER); in TEST_F() local 125 ASSERT_GE(fd, 3); in TEST_F() [all …]
|
/system/core/trusty/libtrusty/ |
D | trusty.c | 33 int fd; in tipc_connect() local 36 fd = TEMP_FAILURE_RETRY(open(dev_name, O_RDWR)); in tipc_connect() 37 if (fd < 0) { in tipc_connect() 43 rc = TEMP_FAILURE_RETRY(ioctl(fd, TIPC_IOC_CONNECT, srv_name)); in tipc_connect() 47 close(fd); in tipc_connect() 51 ALOGV("%s: connected to \"%s\" fd %d\n", __func__, srv_name, fd); in tipc_connect() 52 return fd; in tipc_connect() 55 ssize_t tipc_send(int fd, const struct iovec* iov, int iovcnt, struct trusty_shm* shms, in tipc_send() argument 63 int rc = TEMP_FAILURE_RETRY(ioctl(fd, TIPC_IOC_SEND_MSG, &req)); in tipc_send() 71 void tipc_close(int fd) { in tipc_close() argument [all …]
|
/system/extras/simpleperf/ |
D | IOEventLoop_test.cpp | 30 int fd[2]; in TEST() local 31 ASSERT_EQ(0, pipe(fd)); in TEST() 35 ASSERT_NE(nullptr, loop.AddReadEvent(fd[0], [&]() { in TEST() 38 int ret = read(fd[0], &c, 1); in TEST() 56 CHECK_EQ(write(fd[1], &c, 1), 1); in TEST() 64 close(fd[0]); in TEST() 65 close(fd[1]); in TEST() 69 int fd[2]; in TEST() local 70 ASSERT_EQ(0, pipe(fd)); in TEST() 73 ASSERT_NE(nullptr, loop.AddWriteEvent(fd[1], [&]() { in TEST() [all …]
|
/system/logging/logd/ |
D | libaudit.cpp | 36 static int get_ack(int fd) { in get_ack() argument 38 int rc = audit_get_reply(fd, &rep, GET_REPLY_BLOCKING, MSG_PEEK); in get_ack() 44 audit_get_reply(fd, &rep, GET_REPLY_BLOCKING, 0); in get_ack() 67 static int audit_send(int fd, int type, const void* data, size_t size) { in audit_send() argument 80 if (fd < 0) { in audit_send() 107 sendto(fd, &req, req.nlh.nlmsg_len, 0, (struct sockaddr*)&addr, sizeof(addr))); in audit_send() 117 rc = get_ack(fd); in audit_send() 125 int audit_setup(int fd, pid_t pid) { in audit_setup() argument 137 int rc = audit_send(fd, AUDIT_SET, &status, sizeof(status)); in audit_setup() 153 audit_get_reply(fd, &rep, GET_REPLY_NONBLOCKING, 0); in audit_setup() [all …]
|
/system/libbase/include/android-base/ |
D | unique_fd.h | 58 static void Tag(int fd, void* old_addr, void* new_addr) { in Tag() 64 android_fdsan_exchange_owner_tag(fd, old_tag, new_tag); in Tag() 67 static void Close(int fd, void* addr) { in Close() 71 android_fdsan_close_with_tag(fd, tag); in Close() 73 close(fd); in Close() 77 static void Close(int fd) { 82 ::close(fd); 92 explicit unique_fd_impl(int fd) { reset(fd); } in unique_fd_impl() argument 99 int fd = s.fd_; variable 101 reset(fd, &s); [all …]
|
/system/libbase/ |
D | abi_compatibility.cpp | 44 bool ReadFdToString(int fd, std::string* content) { in ReadFdToString() argument 45 return ReadFdToString(borrowed_fd(fd), content); in ReadFdToString() 48 bool WriteStringToFd(const std::string& content, int fd) { in WriteStringToFd() argument 49 return WriteStringToFd(content, borrowed_fd(fd)); in WriteStringToFd() 52 bool ReadFully(int fd, void* data, size_t byte_count) { in ReadFully() argument 53 return ReadFully(borrowed_fd(fd), data, byte_count); in ReadFully() 56 bool ReadFullyAtOffset(int fd, void* data, size_t byte_count, off64_t offset) { in ReadFullyAtOffset() argument 57 return ReadFullyAtOffset(borrowed_fd(fd), data, byte_count, offset); in ReadFullyAtOffset() 60 bool WriteFully(int fd, const void* data, size_t byte_count) { in WriteFully() argument 61 return WriteFully(borrowed_fd(fd), data, byte_count); in WriteFully() [all …]
|
/system/bt/gd/os/fuzz/ |
D | fake_timerfd.cc | 30 int fd; member in bluetooth::os::fuzz::FakeTimerFd 45 int fd = eventfd(0, 0); in fake_timerfd_create() local 46 if (fd == -1) { in fake_timerfd_create() 47 return fd; in fake_timerfd_create() 51 fake_timers[fd] = entry; in fake_timerfd_create() 52 entry->fd = fd; in fake_timerfd_create() 53 return fd; in fake_timerfd_create() 56 int fake_timerfd_settime(int fd, int flags, const struct itimerspec* new_value, struct itimerspec* … in fake_timerfd_settime() argument 57 if (fake_timers.find(fd) == fake_timers.end()) { in fake_timerfd_settime() 61 FakeTimerFd* entry = fake_timers[fd]; in fake_timerfd_settime() [all …]
|
/system/media/audio_utils/tests/ |
D | fdtostring_tests.cpp | 31 const int fd = fdToString.fd(); in TEST() local 32 ASSERT_TRUE(fd >= 0); in TEST() 34 write(fd, TEST_STRING.c_str(), TEST_STRING.size()); in TEST() 48 const int fd = fdToString.fd(); in TEST() local 49 ASSERT_TRUE(fd >= 0); in TEST() 51 write(fd, TEST_STRING1.c_str(), TEST_STRING1.size()); in TEST() 52 write(fd, DELIM.c_str(), DELIM.size()); // double newline in TEST() 53 write(fd, TEST_STRING2.c_str(), TEST_STRING2.size()); in TEST()
|