Lines Matching refs:fd
69 int32_t UDSServer::GetClientPid(int32_t fd) const in GetClientPid()
71 auto it = sessionsMap_.find(fd); in GetClientPid()
73 MMI_HILOGE("Not found fd:%{public}d", fd); in GetClientPid()
79 bool UDSServer::SendMsg(int32_t fd, NetPacket& pkt) in SendMsg() argument
81 if (fd < 0) { in SendMsg()
85 auto ses = GetSession(fd); in SendMsg()
88 fd, SESSION_NOT_FOUND); in SendMsg()
186 void UDSServer::Dump(int32_t fd, const std::vector<std::string> &args) in Dump() argument
189 mprintf(fd, "Uds_server information:\t"); in Dump()
190 mprintf(fd, "uds_server: count=%zu", sessionsMap_.size()); in Dump()
194 mprintf(fd, in Dump()
213 int32_t UDSServer::AddEpoll(EpollEventType type, int32_t fd) in AddEpoll() argument
224 void UDSServer::ReleaseSession(int32_t fd, epoll_event& ev) in ReleaseSession() argument
227 auto secPtr = GetSession(fd); in ReleaseSession()
230 DelSession(fd); in ReleaseSession()
232 MMI_HILOGE("Get session secPtr is nullptr, fd:%{public}d", fd); in ReleaseSession()
233 … DfxHisysevent::OnClientDisconnect(secPtr, fd, OHOS::HiviewDFX::HiSysEvent::EventType::FAULT); in ReleaseSession()
236 RemoveEpollEvent(fd); in ReleaseSession()
239 if (auto it = circleBufMap_.find(fd); it != circleBufMap_.end()) { in ReleaseSession()
244 if (close(fd) == RET_OK) { in ReleaseSession()
245 … DfxHisysevent::OnClientDisconnect(secPtr, fd, OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR); in ReleaseSession()
247 … DfxHisysevent::OnClientDisconnect(secPtr, fd, OHOS::HiviewDFX::HiSysEvent::EventType::FAULT); in ReleaseSession()
251 void UDSServer::OnPacket(int32_t fd, NetPacket& pkt) in OnPacket() argument
253 auto sess = GetSession(fd); in OnPacket()
258 void UDSServer::OnEpollRecv(int32_t fd, epoll_event& ev) in OnEpollRecv() argument
260 if (fd < 0) { in OnEpollRecv()
261 MMI_HILOGE("Invalid input param fd:%{public}d", fd); in OnEpollRecv()
264 auto& buf = circleBufMap_[fd]; in OnEpollRecv()
267 auto size = recv(fd, szBuf, MAX_PACKET_BUF_SIZE, MSG_DONTWAIT | MSG_NOSIGNAL); in OnEpollRecv()
272 OnReadPackets(buf, [this, fd] (NetPacket& pkt) { return this->OnPacket(fd, pkt); }); in OnEpollRecv()
283 ReleaseSession(fd, ev); in OnEpollRecv()
295 auto fd = ev.data.fd; in OnEpollEvent() local
296 if (fd < 0) { in OnEpollEvent()
301 MMI_HILOGI("EPOLLERR or EPOLLHUP fd:%{public}d, ev.events:0x%{public}x", fd, ev.events); in OnEpollEvent()
302 ReleaseSession(fd, ev); in OnEpollEvent()
304 OnEpollRecv(fd, ev); in OnEpollEvent()
308 void UDSServer::AddEpollEvent(int32_t fd, std::shared_ptr<mmi_epoll_event> epollEvent) in AddEpollEvent() argument
310 MMI_HILOGI("Add %{public}d in epollEvent map", fd); in AddEpollEvent()
311 epollEventMap_[fd] = epollEvent; in AddEpollEvent()
314 void UDSServer::RemoveEpollEvent(int32_t fd) in RemoveEpollEvent() argument
316 MMI_HILOGI("Remove %{public}d in epollEvent map", fd); in RemoveEpollEvent()
317 epollEventMap_.erase(fd); in RemoveEpollEvent()
331 SessionPtr UDSServer::GetSession(int32_t fd) const in GetSession()
333 auto it = sessionsMap_.find(fd); in GetSession()
335 MMI_HILOGE("Session not found. fd:%{public}d", fd); in GetSession()
344 int32_t fd = GetClientFd(pid); in GetSessionByPid() local
345 if (fd <= 0) { in GetSessionByPid()
352 return GetSession(fd); in GetSessionByPid()
359 auto fd = ses->GetFd(); in AddSession() local
360 if (fd < 0) { in AddSession()
369 idxPidMap_[pid] = fd; in AddSession()
370 sessionsMap_[fd] = ses; in AddSession()
380 void UDSServer::DelSession(int32_t fd) in DelSession() argument
383 MMI_HILOGI("fd:%{public}d", fd); in DelSession()
384 if (fd < 0) { in DelSession()
388 auto pid = GetClientPid(fd); in DelSession()
393 auto it = sessionsMap_.find(fd); in DelSession()