Home
last modified time | relevance | path

Searched refs:fd (Results 1 – 25 of 151) sorted by relevance

1234567

/packages/providers/MediaProvider/src/com/android/providers/media/util/
DIsoInterface.java116 private static int readInt(@NonNull FileDescriptor fd) in readInt() argument
119 if (Os.read(fd, buf, 0, 4) == 4) { in readInt()
126 private static @NonNull UUID readUuid(@NonNull FileDescriptor fd) in readUuid() argument
128 final long high = (((long) readInt(fd)) << 32L) | ((long) readInt(fd)) & 0xffffffffL; in readUuid()
129 final long low = (((long) readInt(fd)) << 32L) | ((long) readInt(fd)) & 0xffffffffL; in readUuid()
133 private static @Nullable Box parseNextBox(@NonNull FileDescriptor fd, long end, in parseNextBox() argument
135 final long pos = Os.lseek(fd, 0, OsConstants.SEEK_CUR); in parseNextBox()
140 final long len = Integer.toUnsignedLong(readInt(fd)); in parseNextBox()
148 final int type = readInt(fd); in parseNextBox()
150 readInt(fd); in parseNextBox()
[all …]
/packages/modules/NetworkStack/common/netlinkclient/src/android/net/netlink/
DNetlinkSocket.java61 final FileDescriptor fd = forProto(nlProto); in sendOneShotKernelMessage() local
64 connectToKernel(fd); in sendOneShotKernelMessage()
65 sendMessage(fd, msg, 0, msg.length, IO_TIMEOUT); in sendOneShotKernelMessage()
66 final ByteBuffer bytes = recvMessage(fd, DEFAULT_RECV_BUFSIZE, IO_TIMEOUT); in sendOneShotKernelMessage()
99 SocketUtils.closeSocket(fd); in sendOneShotKernelMessage()
107 final FileDescriptor fd = Os.socket(AF_NETLINK, SOCK_DGRAM, nlProto); in forProto() local
108 Os.setsockoptInt(fd, SOL_SOCKET, SO_RCVBUF, SOCKET_RECV_BUFSIZE); in forProto()
109 return fd; in forProto()
112 public static void connectToKernel(FileDescriptor fd) throws ErrnoException, SocketException { in connectToKernel() argument
113 Os.connect(fd, makeNetlinkSocketAddress(0, 0)); in connectToKernel()
[all …]
DInetDiagMessage.java117 FileDescriptor fd) in lookupUidByFamily() argument
120 NetlinkSocket.sendMessage(fd, msg, 0, msg.length, TIMEOUT_MS); in lookupUidByFamily()
121 ByteBuffer response = NetlinkSocket.recvMessage(fd, DEFAULT_RECV_BUFSIZE, TIMEOUT_MS); in lookupUidByFamily()
137 InetSocketAddress remote, FileDescriptor fd) in lookupUid() argument
148 uid = lookupUidByFamily(protocol, remote, local, family, NLM_F_REQUEST, fd); in lookupUid()
150 uid = lookupUidByFamily(protocol, local, remote, family, NLM_F_REQUEST, fd); in lookupUid()
169 (short) (NLM_F_REQUEST | NLM_F_DUMP), fd); in lookupUid()
175 (short) (NLM_F_REQUEST | NLM_F_DUMP), fd); in lookupUid()
193 FileDescriptor fd = null; in getConnectionOwnerUid() local
195 fd = NetlinkSocket.forProto(NETLINK_INET_DIAG); in getConnectionOwnerUid()
[all …]
/packages/apps/Test/connectivity/sl4n/rapidjson/test/perftest/
Dplatformtest.cpp116 int fd = _open(filename_, _O_BINARY | _O_RDONLY); in TEST_F() local
117 ASSERT_NE(-1, fd); in TEST_F()
118 ASSERT_EQ(length_, _read(fd, temp_, length_)); in TEST_F()
120 _close(fd); in TEST_F()
126 int fd = open(filename_, O_RDONLY); in TEST_F() local
127 ASSERT_NE(-1, fd); in TEST_F()
128 ASSERT_EQ(length_, read(fd, temp_, length_)); in TEST_F()
130 close(fd); in TEST_F()
155 int fd = open(filename_, O_RDONLY); in TEST_F() local
156 ASSERT_NE(-1, fd); in TEST_F()
[all …]
/packages/modules/NetworkStack/common/moduleutils/src/android/net/ip/
DNetlinkMonitor.java82 FileDescriptor fd = null; in createFd() local
85 fd = Os.socket(AF_NETLINK, SOCK_DGRAM | SOCK_NONBLOCK, mFamily); in createFd()
86 Os.bind(fd, makeNetlinkSocketAddress(0, mBindGroups)); in createFd()
87 NetlinkSocket.connectToKernel(fd); in createFd()
90 final SocketAddress nlAddr = Os.getsockname(fd); in createFd()
95 closeSocketQuietly(fd); in createFd()
99 return fd; in createFd()
131 private void closeSocketQuietly(FileDescriptor fd) { in closeSocketQuietly() argument
133 SocketUtils.closeSocket(fd); in closeSocketQuietly()
/packages/modules/DnsResolver/
DDnsTlsSocket.cpp59 int waitForReading(int fd, int timeoutMs = -1) { in waitForReading() argument
60 pollfd fds = {.fd = fd, .events = POLLIN}; in waitForReading()
64 int waitForWriting(int fd, int timeoutMs = -1) { in waitForWriting() argument
65 pollfd fds = {.fd = fd, .events = POLLOUT}; in waitForWriting()
190 bssl::UniquePtr<SSL> DnsTlsSocket::sslConnect(int fd) { in sslConnect() argument
202 bssl::UniquePtr<BIO> bio(BIO_new_socket(fd, BIO_NOCLOSE)); in sslConnect()
245 if (int err = waitForReading(fd, mServer.connectTimeout.count()); err <= 0) { in sslConnect()
254 if (int err = waitForWriting(fd, mServer.connectTimeout.count()); err <= 0) { in sslConnect()
315 struct pollfd fds[2] = { { .fd = -1 }, { .fd = -1 } }; in loop()
319 fds[SSLFD].fd = mSslFd.get(); in loop()
[all …]
/packages/apps/TV/jni/
DDvbManager.cpp71 pollFd.fd = mFeFd; in isFeLocked()
312 int fd = (int) env->CallIntMethod(thiz, mOpenDvbFrontEndMethodID); in openDvbFeFromSystemApi() local
313 fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK); in openDvbFeFromSystemApi()
314 return fd; in openDvbFeFromSystemApi()
318 int fd = (int) env->CallIntMethod(thiz, mOpenDvbDemuxMethodID); in openDvbDemuxFromSystemApi() local
319 fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK); in openDvbDemuxFromSystemApi()
320 return fd; in openDvbDemuxFromSystemApi()
324 int fd = (int) env->CallIntMethod(thiz, mOpenDvbDvrMethodID); in openDvbDvrFromSystemApi() local
325 fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK); in openDvbDvrFromSystemApi()
326 return fd; in openDvbDvrFromSystemApi()
[all …]
/packages/modules/NetworkStack/src/com/android/networkstack/netlink/
DTcpSocketTracker.java195 FileDescriptor fd = null; in pollSocketsInfo()
198 fd = mDependencies.connectToKernel(); in pollSocketsInfo()
202 mDependencies.sendPollingRequest(fd, mSockDiagMsg.get(family)); in pollSocketsInfo()
214 final ByteBuffer bytes = mDependencies.recvMessage(fd); in pollSocketsInfo()
271 NetworkStackUtils.closeSocketQuietly(fd); in pollSocketsInfo()
540 final FileDescriptor fd = in connectToKernel() local
543 fd, SocketUtils.makeNetlinkSocketAddress(0 /* portId */, 0 /* groupMask */)); in connectToKernel()
545 return fd; in connectToKernel()
555 public void sendPollingRequest(@NonNull final FileDescriptor fd, @NonNull final byte[] msg) in sendPollingRequest() argument
557 Os.setsockoptTimeval(fd, SOL_SOCKET, SO_SNDTIMEO, in sendPollingRequest()
[all …]
/packages/modules/NetworkStack/jni/
Dnetwork_stack_utils_jni.cpp87 int fd = jniGetFDFromFileDescriptor(env, javaFd); in network_stack_utils_addArpEntry() local
88 if (fd < 0) { in network_stack_utils_addArpEntry()
93 if (ioctl(fd, SIOCSARP, &req)) { in network_stack_utils_addArpEntry()
125 int fd = jniGetFDFromFileDescriptor(env, javaFd); in network_stack_utils_attachDhcpFilter() local
126 if (setsockopt(fd, SOL_SOCKET, SO_ATTACH_FILTER, &filter, sizeof(filter)) != 0) { in network_stack_utils_attachDhcpFilter()
158 int fd = jniGetFDFromFileDescriptor(env, javaFd); in network_stack_utils_attachRaFilter() local
159 if (setsockopt(fd, SOL_SOCKET, SO_ATTACH_FILTER, &filter, sizeof(filter)) != 0) { in network_stack_utils_attachRaFilter()
233 int fd = jniGetFDFromFileDescriptor(env, javaFd); in network_stack_utils_attachControlPacketFilter() local
234 if (setsockopt(fd, SOL_SOCKET, SO_ATTACH_FILTER, &filter, sizeof(filter)) != 0) { in network_stack_utils_attachControlPacketFilter()
/packages/modules/NetworkStack/tests/unit/src/android/net/netlink/
DNetlinkSocketTest.java51 final FileDescriptor fd = NetlinkSocket.forProto(NETLINK_ROUTE); in testBasicWorkingGetNeighborsQuery() local
52 assertNotNull(fd); in testBasicWorkingGetNeighborsQuery()
54 NetlinkSocket.connectToKernel(fd); in testBasicWorkingGetNeighborsQuery()
56 final NetlinkSocketAddress localAddr = (NetlinkSocketAddress) Os.getsockname(fd); in testBasicWorkingGetNeighborsQuery()
66 assertEquals(req.length, NetlinkSocket.sendMessage(fd, req, 0, req.length, TIMEOUT)); in testBasicWorkingGetNeighborsQuery()
72 ByteBuffer response = NetlinkSocket.recvMessage(fd, DEFAULT_RECV_BUFSIZE, TIMEOUT); in testBasicWorkingGetNeighborsQuery()
104 IoUtils.closeQuietly(fd); in testBasicWorkingGetNeighborsQuery()
/packages/services/Car/tools/keventreader/server/
Deventgatherer.cpp49 for (auto& fd : mFds) { in read() local
50 if (fd.revents != 0) { in read()
51 if (fd.revents == POLLIN) { in read()
52 if (auto dev = mDevices[fd.fd].get()) { in read()
59 fd.revents = 0; in read()
/packages/apps/Dialer/java/com/android/voicemail/impl/
DVvmLog.java39 public static void dump(FileDescriptor fd, PrintWriter printwriter, String[] args) { in dump() argument
42 localLog.dump(fd, indentingPrintWriter, args); in dump()
143 public synchronized void dump(FileDescriptor fd, PrintWriter pw, String[] args) { in dump() argument
150 public synchronized void reverseDump(FileDescriptor fd, PrintWriter pw, String[] args) { in reverseDump() argument
165 public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { in dump() argument
166 log.dump(fd, pw, args); in dump()
169 public void reverseDump(FileDescriptor fd, PrintWriter pw, String[] args) { in reverseDump() argument
170 log.reverseDump(fd, pw, args); in reverseDump()
/packages/modules/NetworkStack/tests/unit/src/android/net/ip/
DIpReachabilityMonitorTest.kt105 private val fd = mock(FileDescriptor::class.java) constant
122 private val fd: FileDescriptor constant
130 override fun createFd() = fd in createFd()
137 listener.onFileDescriptorEvents(fd, OnFileDescriptorEventListener.EVENT_INPUT) in createFd()
141 override fun readPacket(fd: FileDescriptor, packetBuffer: ByteArray): Int { in readPacket()
156 eq(fd), anyInt(), captor.capture()) in onStart()
164 doReturn(true).`when`(fd).valid() in setUp()
171 neighborMonitor = TestIpNeighborMonitor(handler, log, cb, fd) in setUp()
198 doReturn(false).`when`(fd).valid() in tearDown()
/packages/apps/Gallery2/src/com/android/gallery3d/data/
DDecodeUtils.java60 public static Bitmap decode(JobContext jc, FileDescriptor fd, Options options) { in decode() argument
65 BitmapFactory.decodeFileDescriptor(fd, null, options)); in decode()
68 public static void decodeBounds(JobContext jc, FileDescriptor fd, in decodeBounds() argument
73 BitmapFactory.decodeFileDescriptor(fd, null, options); in decodeBounds()
104 FileDescriptor fd = fis.getFD(); in decodeThumbnail() local
105 return decodeThumbnail(jc, fd, options, targetSize, type); in decodeThumbnail()
115 JobContext jc, FileDescriptor fd, Options options, int targetSize, int type) { in decodeThumbnail() argument
120 BitmapFactory.decodeFileDescriptor(fd, null, options); in decodeThumbnail()
148 Bitmap result = BitmapFactory.decodeFileDescriptor(fd, null, options); in decodeThumbnail()
227 JobContext jc, FileDescriptor fd, boolean shareable) { in createBitmapRegionDecoder() argument
[all …]
/packages/modules/DnsResolver/tests/
Dpbtxt2pb_converter_host.cpp30 int fd = open(pbtxtFile.c_str(), O_RDONLY); in ConvertPbtxtToPb() local
31 if (fd < 0) { in ConvertPbtxtToPb()
36 google::protobuf::io::FileInputStream fileInput(fd); in ConvertPbtxtToPb()
47 fd = open(pbFile.c_str(), O_CREAT | O_WRONLY | O_TRUNC, 0660); in ConvertPbtxtToPb()
48 if (fd < 0) { in ConvertPbtxtToPb()
53 google::protobuf::io::FileOutputStream fileOutputStream(fd); in ConvertPbtxtToPb()
Dtun_forwarder.cpp145 unique_fd fd(open("/dev/tun", O_RDWR | O_NONBLOCK | O_CLOEXEC)); in createTun() local
146 if (!fd.ok() == -1) { in createTun()
155 if (ioctl(fd.get(), TUNSETIFF, &ifr) == -1) { in createTun()
167 return fd; in createTun()
187 handlePacket(wait_fd[1].fd); in loop()
192 void TunForwarder::handlePacket(int fd) const { in handlePacket()
195 ssize_t readlen = read(fd, buf, std::size(buf)); in handlePacket()
217 write(fd, buf, readlen); in handlePacket()
/packages/modules/NetworkStack/src/android/net/util/
DNetworkStackUtils.java254 public static void closeSocketQuietly(FileDescriptor fd) { in closeSocketQuietly() argument
256 SocketUtils.closeSocket(fd); in closeSocketQuietly()
408 public static native void attachDhcpFilter(FileDescriptor fd) throws SocketException; in attachDhcpFilter() argument
415 public static native void attachRaFilter(FileDescriptor fd, int packetType) in attachRaFilter() argument
426 public static native void attachControlPacketFilter(FileDescriptor fd, int packetType) in attachControlPacketFilter() argument
433 String ifname, FileDescriptor fd) throws IOException { in addArpEntry() argument
434 addArpEntry(ethAddr.toByteArray(), ipv4Addr.getAddress(), ifname, fd); in addArpEntry() local
438 FileDescriptor fd) throws IOException; in addArpEntry() argument
/packages/services/BuiltInPrintService/jni/plugins/
Dplugin_pdf.c73 int fd; in _print_page() local
91 fd = open(pathname, O_RDONLY); in _print_page()
92 if (fd != ERROR) { in _print_page()
93 rbytes = read(fd, buff, BUFF_SIZE); in _print_page()
99 rbytes = read(fd, buff, BUFF_SIZE); in _print_page()
107 close(fd); in _print_page()
/packages/services/Car/car-bugreportd/
Dmain.cpp91 int fd = accept(s, &addr, &alen); in openSocket() local
92 if (fd < 0) { in openSocket()
96 return fd; in openSocket()
136 android::base::unique_fd fd(TEMP_FAILURE_RETRY(open(filepath.c_str(), O_RDONLY))); in zipFilesToFd() local
137 if (fd == -1) { in zipFilesToFd()
143 ssize_t bytes_read = TEMP_FAILURE_RETRY(read(fd, buffer, sizeof(buffer))); in zipFilesToFd()
199 android::base::unique_fd fd(TEMP_FAILURE_RETRY(open(zip_path.c_str(), O_RDONLY))); in copyFile() local
200 if (fd == -1) { in copyFile()
206 int bytes_copied = copyTo(fd, output_socket, buffer, sizeof(buffer)); in copyFile()
/packages/services/Car/tests/BugReportApp/src/com/google/android/car/bugreport/
DBugReportInfoActivity.java210 public void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) { in dump() argument
211 super.dump(prefix, fd, writer, args); in dump()
288 AssetFileDescriptor fd = mResolver.openAssetFileDescriptor(newFileUri, "w"); in mergeFilesAndCopyToUsb()
289 OutputStream outputStream = fd.createOutputStream(); in mergeFilesAndCopyToUsb()
307 try (AssetFileDescriptor fd = mResolver.openAssetFileDescriptor(newFileUri, "w")) { in mergeFilesAndCopyToUsb() argument
309 fd.getFileDescriptor().sync(); in mergeFilesAndCopyToUsb()
323 AssetFileDescriptor fd = mResolver.openAssetFileDescriptor(newFileUri, "w")) { in copyFileToUsb()
324 OutputStream output = fd.createOutputStream(); in copyFileToUsb()
327 fd.getFileDescriptor().sync(); in copyFileToUsb()
/packages/modules/IPsec/tests/iketests/src/java/com/android/internal/net/ipsec/ike/
DIkeSocketTestBase.java109 protected boolean isFdOpen(FileDescriptor fd) { in isFdOpen() argument
111 Os.getsockname(fd); in isFdOpen()
118 protected void verifyCloseFd(FileDescriptor fd) { in verifyCloseFd() argument
121 fd, in verifyCloseFd()
163 FileDescriptor fd, byte[] data, InetAddress destAddress, int port) throws Exception { in sendToIkeSocket() argument
164 Os.sendto(fd, data, 0, data.length, 0, destAddress, port); in sendToIkeSocket()
/packages/apps/Bluetooth/src/com/android/bluetooth/opp/
DBluetoothOppSendFileInfo.java177 AssetFileDescriptor fd = contentResolver.openAssetFileDescriptor(uri, "r"); in generateFileInfo() local
178 long statLength = fd.getLength(); in generateFileInfo()
189 is = fd.createInputStream(); in generateFileInfo()
197 fd = contentResolver.openAssetFileDescriptor(uri, "r"); in generateFileInfo()
198 is = fd.createInputStream(); in generateFileInfo()
202 fd.close(); in generateFileInfo()
/packages/inputmethods/LatinIME/native/jni/src/dictionary/utils/
Dfile_utils.cpp32 const int fd = open(filePath, O_RDONLY); in getFileSize() local
33 if (fd == -1) { in getFileSize()
37 if (fstat(fd, &statBuf) != 0) { in getFileSize()
38 close(fd); in getFileSize()
41 close(fd); in getFileSize()
/packages/modules/DnsResolver/tests/dns_responder/
Ddns_responder.cpp684 const int fd = evs[i].data.fd; in requestHandler() local
686 if (fd == event_fd_.get() && (events & (EPOLLIN | EPOLLERR))) { in requestHandler()
689 } else if (fd == udp_socket_.get() && (events & (EPOLLIN | EPOLLERR))) { in requestHandler()
691 } else if (fd == tcp_socket_.get() && (events & (EPOLLIN | EPOLLERR))) { in requestHandler()
694 LOG(WARNING) << "unexpected epoll events " << events << " on fd " << fd; in requestHandler()
1050 bool DNSResponder::addFd(int fd, uint32_t events) { in addFd() argument
1053 ev.data.fd = fd; in addFd()
1054 if (epoll_ctl(epoll_fd_.get(), EPOLL_CTL_ADD, fd, &ev) < 0) { in addFd()
1055 PLOG(ERROR) << "epoll_ctl() for socket " << fd << " failed"; in addFd()
1198 android::base::unique_fd fd( in createListeningSocket() local
[all …]
/packages/apps/Camera2/src/com/android/camera/
DThumbnail.java25 public static Bitmap createVideoThumbnailBitmap(FileDescriptor fd, int targetWidth) { in createVideoThumbnailBitmap() argument
26 return createVideoThumbnailBitmap(null, fd, targetWidth); in createVideoThumbnailBitmap()
33 private static Bitmap createVideoThumbnailBitmap(String filePath, FileDescriptor fd, in createVideoThumbnailBitmap() argument
41 retriever.setDataSource(fd); in createVideoThumbnailBitmap()

1234567