/aosp14/system/core/libcutils/ |
H A D | ashmem-dev.cpp | 167 if (fd == -1) { in __has_memfd_support() 216 if (fd < 0) { in __ashmem_open_locked() 231 close(fd); in __ashmem_open_locked() 236 close(fd); in __ashmem_open_locked() 242 return fd; in __ashmem_open_locked() 247 int fd; in __ashmem_open() local 253 return fd; in __ashmem_open() 380 if (fd < 0) { in ashmem_create_region() 381 return fd; in ashmem_create_region() 399 return fd; in ashmem_create_region() [all …]
|
H A D | ashmem_test.cpp | 34 ASSERT_TRUE(fd >= 0); in TestCreateRegion() 46 ASSERT_TRUE(fd >= 0); in TestMmap() 53 ASSERT_TRUE(fd >= 0); in TestProtDenied() 59 ASSERT_TRUE(fd >= 0); in TestProtIs() 75 unique_fd fd; in TEST() local 97 unique_fd fd; in TEST() local 133 unique_fd fd; in TEST() local 191 unique_fd fd; in TEST() local 197 TestProtIs(fd, PROT_READ); in TEST() 219 unique_fd fd; in TEST() local [all …]
|
H A 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()
|
H A 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 …]
|
/aosp14/frameworks/base/libs/androidfw/ |
H A D | ObbFile.cpp | 88 int fd; in readFrom() local 92 if (fd < 0) { in readFrom() 97 close(fd); in readFrom() 109 if (fd < 0) { in readFrom() 228 int fd; in writeTo() local 232 if (fd < 0) { in writeTo() 236 close(fd); in writeTo() 247 if (fd < 0) { in writeTo() 313 int fd; in removeFrom() local 317 if (fd < 0) { in removeFrom() [all …]
|
H A D | BackupHelpers.cpp | 302 close(fd); in write_update_file() 325 close(fd); in compute_crc32() 721 close(fd); in write_tarfile() 747 int fd; in WriteFile() local 798 close(fd); in WriteFile() 835 int fd; in write_text_file() local 859 int fd; in compare_file() local 907 int fd; in backup_helper_test_empty() local 966 int fd; in backup_helper_test_four() local 1168 int fd; in backup_helper_test_data_writer() local [all …]
|
/aosp14/frameworks/base/services/core/jni/ |
H A D | com_android_server_UsbDeviceManager.cpp | 63 if (fd < 0) { in android_server_UsbDeviceManager_getAccessoryStrings() 78 close(fd); in android_server_UsbDeviceManager_getAccessoryStrings() 85 if (fd < 0) { in android_server_UsbDeviceManager_openAccessory() 91 close(fd); in android_server_UsbDeviceManager_openAccessory() 102 if (fd < 0) { in android_server_UsbDeviceManager_isStartRequested() 107 close(fd); in android_server_UsbDeviceManager_isStartRequested() 114 if (fd < 0) { in android_server_UsbDeviceManager_getAudioMode() 119 close(fd); in android_server_UsbDeviceManager_getAudioMode() 126 int fd = -1; in android_server_UsbDeviceManager_openControl() local 132 if (fd < 0) { in android_server_UsbDeviceManager_openControl() [all …]
|
H A D | com_android_server_companion_virtual_InputController.cpp | 58 if (fd < 0) { in openUinput() 63 ioctl(fd, UI_SET_PHYS, phys); in openUinput() 65 ioctl(fd, UI_SET_EVBIT, EV_KEY); in openUinput() 66 ioctl(fd, UI_SET_EVBIT, EV_SYN); in openUinput() 79 ioctl(fd, UI_SET_EVBIT, EV_REL); in openUinput() 184 if (ioctl(fd, UI_DEV_CREATE) != 0) { in openUinput() 189 return fd; in openUinput() 205 return fd.ok() ? reinterpret_cast<jlong>(new VirtualDpad(std::move(fd))) : INVALID_PTR; in nativeOpenUinputDpad() 212 return fd.ok() ? reinterpret_cast<jlong>(new VirtualKeyboard(std::move(fd))) : INVALID_PTR; in nativeOpenUinputKeyboard() 219 return fd.ok() ? reinterpret_cast<jlong>(new VirtualMouse(std::move(fd))) : INVALID_PTR; in nativeOpenUinputMouse() [all …]
|
H A D | com_android_server_PersistentDataBlockService.cpp | 35 uint64_t get_block_device_size(int fd) in get_block_device_size() argument 40 ret = ioctl(fd, BLKGETSIZE64, &size); in get_block_device_size() 48 int wipe_block_device(int fd) in wipe_block_device() argument 60 ret = ioctl(fd, BLKSECDISCARD, &range); in wipe_block_device() 82 int fd = open(path.c_str(), O_RDONLY); in com_android_server_PersistentDataBlockService_getBlockDeviceSize() local 84 if (fd < 0) in com_android_server_PersistentDataBlockService_getBlockDeviceSize() 89 close(fd); in com_android_server_PersistentDataBlockService_getBlockDeviceSize() 96 int fd = open(path.c_str(), O_WRONLY); in com_android_server_PersistentDataBlockService_wipe() local 98 if (fd < 0) in com_android_server_PersistentDataBlockService_wipe() 101 const int ret = wipe_block_device(fd); in com_android_server_PersistentDataBlockService_wipe() [all …]
|
/aosp14/frameworks/base/core/java/android/net/ |
H A D | LocalSocketImpl.java | 190 this.fd = fd; in LocalSocketImpl() 205 if (fd != null) { in create() 247 fd = null; in close() 255 if (fd == null) { in connect() 271 if (fd == null) { in bind() 280 if (fd == null) { in listen() 298 if (fd == null) { in accept() 303 s.fd = Os.accept(fd, null /* address */); in accept() 318 if (fd == null) { in getInputStream() 339 if (fd == null) { in getOutputStream() [all …]
|
/aosp14/frameworks/base/core/jni/ |
H A D | android_util_MemoryIntArray.cpp | 42 if (fd < 0) { in android_util_MemoryIntArray_create() 53 return fd; in android_util_MemoryIntArray_create() 59 if (fd < 0) { in android_util_MemoryIntArray_open() 64 if (!ashmem_valid(fd)) { in android_util_MemoryIntArray_open() 117 if (fd < 0) { in android_util_MemoryIntArray_close() 122 if (!ashmem_valid(fd)) { in android_util_MemoryIntArray_close() 146 close(fd); in android_util_MemoryIntArray_close() 152 if (fd < 0) { in android_util_MemoryIntArray_get() 157 if (!ashmem_valid(fd)) { in android_util_MemoryIntArray_get() 174 if (fd < 0) { in android_util_MemoryIntArray_set() [all …]
|
H A D | fd_utils.cpp | 185 const int fd; member in FileDescriptorInfo 394 fd(fd), in FileDescriptorInfo() 406 fd(fd), in FileDescriptorInfo() 486 for (auto fd : *open_fds) { in Create() 487 open_fd_map[fd] = FileDescriptorInfo::CreateFromFd(fd, fail_fn); in Create() 506 if (fd == -1) { in GetOpenFdsIgnoring() 514 result->insert(fd); in GetOpenFdsIgnoring() 625 const int fd = (*it); in RestatInternal() local 626 open_fd_map_[fd] = FileDescriptorInfo::CreateFromFd(fd, fail_fn); in RestatInternal() 640 if (fd <= STDERR_FILENO || fd == dir_fd) { in ParseFd() [all …]
|
H A D | android_hardware_SerialPort.cpp | 137 fd = fcntl(fd, F_DUPFD_CLOEXEC, 0); in android_hardware_SerialPort_open() 138 if (fd < 0) { in android_hardware_SerialPort_open() 145 if (tcgetattr(fd, &tio)) in android_hardware_SerialPort_open() 156 tcsetattr(fd, TCSANOW, &tio); in android_hardware_SerialPort_open() 157 tcflush(fd, TCIFLUSH); in android_hardware_SerialPort_open() 164 close(fd); in android_hardware_SerialPort_close() 178 int ret = read(fd, buf, length); in android_hardware_SerialPort_read_array() 201 int ret = read(fd, buf, length); in android_hardware_SerialPort_read_direct() 218 jint ret = write(fd, buf, length); in android_hardware_SerialPort_write_array() 234 int ret = write(fd, buf, length); in android_hardware_SerialPort_write_direct() [all …]
|
H A D | android_net_LocalSocketImpl.cpp | 61 int fd; in socket_connect_local() local 77 fd, in socket_connect_local() 99 int fd; in socket_bind_local() local 169 for (auto &fd : received_fds) { in socket_read_all() local 171 static_cast<void>(fd.release()); in socket_read_all() 241 int fd; in socket_read() local 275 int fd; in socket_readba() local 308 fd, byteBuffer + off, len); in socket_readba() 320 int fd; in socket_write() local 342 int fd; in socket_writeba() local [all …]
|
/aosp14/system/core/fs_mgr/liblp/ |
H A D | io_test.cpp | 57 if (fd < 0) { in CreateFakeDisk() 77 return fd; in CreateFakeDisk() 113 if (fd < 0) { in CreateFlashedDisk() 126 return fd; in CreateFlashedDisk() 132 ASSERT_GE(fd, 0); in TEST_F() 155 ASSERT_GE(fd, 0); in TEST_F() 169 ASSERT_GE(fd, 0); in TEST_F() 215 ASSERT_GE(fd, 0); in TEST_F() 260 ASSERT_GE(fd, 0); in TEST_F() 642 TestPartitionOpener opener({{"super_a", fd}, {"super_b", fd}}, in TEST_F() [all …]
|
H A D | images.cpp | 40 if (fstat(fd.get(), &s) < 0) { in IsEmptySuperImage() 63 if (fd < 0) { in IsEmptySuperImage() 67 return IsEmptySuperImage(fd); in IsEmptySuperImage() 106 if (fd < 0) { in ReadFromImageFile() 110 return ReadFromImageFile(fd); in ReadFromImageFile() 128 if (fd < 0) { in WriteToImageFile() 188 if (fd < 0) { in Export() 213 if (fd < 0) { in ExportFiles() 330 if (fd < 0) { in AddPartitionImage() 461 return fd; in OpenImageFile() [all …]
|
/aosp14/frameworks/base/services/core/java/com/android/server/clipboard/ |
H A D | EmulatorClipboardMonitor.java | 69 mPipe = fd; in setPipeFD() 81 return fd; in openPipeImpl() 83 Os.close(fd); in openPipeImpl() 97 while (fd == null) { in openPipe() 99 fd = openPipeImpl(); in openPipe() 102 return fd; in openPipe() 125 final FileDescriptor fd, in sendMessage() argument 138 FileDescriptor fd = null; in EmulatorClipboardMonitor() 142 if (fd == null) { in EmulatorClipboardMonitor() 172 fd = null; in EmulatorClipboardMonitor() [all …]
|
/aosp14/system/core/trusty/libtrusty/tipc-test/ |
H A D | tipc_test.c | 213 int fd; in connect_foo() local 238 int fd; in closer1_test() local 266 int fd; in closer2_test() local 296 int fd[4]; in closer3_test() local 417 int fd; in burst_write_test() local 514 int fd; in select_test() local 557 int fd; in blocked_read_test() local 602 int fd; in ta2ta_ipc_test() local 662 int fd; in dev_uuid_test() local 689 int fd; in ta_access_test() local [all …]
|
/aosp14/frameworks/base/cmds/incidentd/src/ |
H A D | FdBuffer.cpp | 55 status_t FdBuffer::read(int fd, int64_t timeout) { in read() argument 56 struct pollfd pfds = {.fd = fd, .events = POLLIN}; in read() 59 fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK); in read() 113 status_t FdBuffer::readFully(int fd) { in readFully() argument 148 {.fd = fd, .events = POLLIN}, in readProcessedDataInStream() 149 {.fd = toFd.get(), .events = POLLOUT}, in readProcessedDataInStream() 150 {.fd = fromFd.get(), .events = POLLIN}, in readProcessedDataInStream() 156 fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK); in readProcessedDataInStream() 230 if (cirSize > 0 && pfds[1].fd != -1) { in readProcessedDataInStream() 249 if (cirSize == 0 && pfds[0].fd == -1 && pfds[1].fd != -1) { in readProcessedDataInStream() [all …]
|
/aosp14/frameworks/base/core/tests/coretests/src/android/os/ |
H A D | RedactingFileDescriptorTest.java | 86 assertEquals(buf.length, Os.pread(fd, buf, 0, 10, 90)); in testRanges() 89 assertEquals(buf.length, Os.pread(fd, buf, 0, 10, 95)); in testRanges() 92 assertEquals(buf.length, Os.pread(fd, buf, 0, 10, 100)); in testRanges() 95 assertEquals(buf.length, Os.pread(fd, buf, 0, 10, 195)); in testRanges() 107 try (FileInputStream in = new FileInputStream(fd)) { in testEntireFile() 122 assertEquals(buf.length, Os.pread(fd, buf, 0, 10, 95)); in testReadWrite() 126 Os.pwrite(fd, new byte[] { 32, 32 }, 0, 2, 102); in testReadWrite() 127 assertEquals(buf.length, Os.pread(fd, buf, 0, 10, 95)); in testReadWrite() 178 assertEquals(buf.length, Os.pread(fd, buf, 0, 10, 0)); in testFreeAtStart() 190 assertEquals(buf.length, Os.pread(fd, buf, 0, 10, 0)); in testFreeAtOffset() [all …]
|
/aosp14/frameworks/base/libs/androidfw/tests/ |
H A D | BackupData_test.cpp | 61 if (fd < 0) { in SetUp() 83 ::close(fd); in TEST_F() 84 fd = ::open(mFilename.string(), O_RDONLY); in TEST_F() 124 ::close(fd); in TEST_F() 125 fd = ::open(mFilename.string(), O_RDONLY); in TEST_F() 174 ::close(fd); in TEST_F() 175 fd = ::open(mFilename.string(), O_RDONLY); in TEST_F() 226 ::close(fd); in TEST_F() 267 ::close(fd); in TEST_F() 327 ::close(fd); in TEST_F() [all …]
|
/aosp14/system/core/trusty/libtrusty/ |
H A 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 …]
|
/aosp14/system/core/fs_mgr/libsnapshot/snapuserd/dm-snapshot-merge/ |
H A D | snapuserd_server.cpp | 63 close(watched_fds_[i].fd); in ~SnapuserdServer() 145 return Sendmsg(fd, retval); in Receivemsg() 217 return Sendmsg(fd, "fail"); in Receivemsg() 221 Sendmsg(fd, "fail"); in Receivemsg() 328 close(iter->fd); in Run() 357 p.fd = fd.get(); in AddWatchedFd() 364 if (fd < 0) { in AcceptClient() 369 AddWatchedFd(fd, POLLIN); in AcceptClient() 379 if (!Recv(fd, &str)) { in HandleClient() 382 if (!Receivemsg(fd, str)) { in HandleClient() [all …]
|
/aosp14/system/core/init/ |
H A D | service_utils.cpp | 52 if (fd == -1) { in EnterNamespace() 130 dup2(fd.get(), STDIN_FILENO); in SetupStdio() 133 if (fd == -1) fd.reset(open("/dev/null", O_WRONLY | O_CLOEXEC)); in SetupStdio() 135 dup2(fd.get(), STDOUT_FILENO); in SetupStdio() 136 dup2(fd.get(), STDERR_FILENO); in SetupStdio() 141 if (fd == -1) fd.reset(open("/dev/null", O_RDWR | O_CLOEXEC)); in OpenConsole() 143 dup2(fd.get(), 0); in OpenConsole() 144 dup2(fd.get(), 1); in OpenConsole() 145 dup2(fd.get(), 2); in OpenConsole() 157 int fd = fd_.get(); in Publish() local [all …]
|
/aosp14/system/core/fs_mgr/libsnapshot/snapuserd/user-space-merge/ |
H A D | snapuserd_server.cpp | 75 close(watched_fds_[i].fd); in ~UserSnapshotServer() 157 return Sendmsg(fd, retval); in Receivemsg() 247 return Sendmsg(fd, "fail"); in Receivemsg() 305 Sendmsg(fd, "fail"); in Receivemsg() 418 close(iter->fd); in Run() 450 p.fd = fd.get(); in AddWatchedFd() 457 if (fd < 0) { in AcceptClient() 462 AddWatchedFd(fd, POLLIN); in AcceptClient() 467 if (!Recv(fd, &str)) { in HandleClient() 474 if (!Receivemsg(fd, str)) { in HandleClient() [all …]
|