Lines Matching refs:fd
37 bool SendProtocolString(borrowed_fd fd, std::string_view s) { in SendProtocolString() argument
47 return WriteFdExactly(fd, str); in SendProtocolString()
50 bool ReadProtocolString(borrowed_fd fd, std::string* s, std::string* error) { in ReadProtocolString() argument
52 if (!ReadFdExactly(fd, buf, 4)) { in ReadProtocolString()
60 if (!ReadFdExactly(fd, &(*s)[0], len)) { in ReadProtocolString()
68 bool SendOkay(borrowed_fd fd) { in SendOkay() argument
69 return WriteFdExactly(fd, "OKAY", 4); in SendOkay()
72 bool SendFail(borrowed_fd fd, std::string_view reason) { in SendFail() argument
73 return WriteFdExactly(fd, "FAIL", 4) && SendProtocolString(fd, reason); in SendFail()
76 bool ReadFdExactly(borrowed_fd fd, void* buf, size_t len) { in ReadFdExactly() argument
81 D("readx: fd=%d wanted=%zu", fd.get(), len); in ReadFdExactly()
83 int r = adb_read(fd, p, len); in ReadFdExactly()
88 D("readx: fd=%d error %d: %s", fd.get(), errno, strerror(errno)); in ReadFdExactly()
91 D("readx: fd=%d disconnected", fd.get()); in ReadFdExactly()
97 VLOG(RWX) << "readx: fd=" << fd.get() << " wanted=" << len0 << " got=" << (len0 - len) << " " in ReadFdExactly()
103 bool WriteFdExactly(borrowed_fd fd, const void* buf, size_t len) { in WriteFdExactly() argument
107 VLOG(RWX) << "writex: fd=" << fd.get() << " len=" << len << " " in WriteFdExactly()
111 r = adb_write(fd, p, len); in WriteFdExactly()
113 D("writex: fd=%d error %d: %s", fd.get(), errno, strerror(errno)); in WriteFdExactly()
118 D("writex: fd=%d disconnected", fd.get()); in WriteFdExactly()
132 bool WriteFdExactly(borrowed_fd fd, const char* str) { in WriteFdExactly() argument
133 return WriteFdExactly(fd, str, strlen(str)); in WriteFdExactly()
136 bool WriteFdExactly(borrowed_fd fd, const std::string& str) { in WriteFdExactly() argument
137 return WriteFdExactly(fd, str.c_str(), str.size()); in WriteFdExactly()
140 bool WriteFdFmt(borrowed_fd fd, const char* fmt, ...) { in WriteFdFmt() argument
148 return WriteFdExactly(fd, str); in WriteFdFmt()
151 bool ReadOrderlyShutdown(borrowed_fd fd) { in ReadOrderlyShutdown() argument
158 int result = adb_read(fd, buf, sizeof(buf)); in ReadOrderlyShutdown()
181 VLOG(RWX) << "ReadOrderlyShutdown(" << fd.get() << ") unexpectedly read " in ReadOrderlyShutdown()
185 adb_shutdown(fd); in ReadOrderlyShutdown()