MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / poll_until

Function poll_until

src/daemon/ipc.c:766–784  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

764}
765
766static int poll_until(int fd, short events, uint64_t deadline_ms) {
767 for (;;) {
768 struct pollfd descriptor = {.fd = fd, .events = events, .revents = 0};
769 int timeout_ms = deadline_ms == UINT64_MAX ? -1 : deadline_remaining_ms(deadline_ms);
770 int result = poll(&descriptor, 1, timeout_ms);
771 if (result > 0) {
772 if ((descriptor.revents & events) != 0) {
773 return 1;
774 }
775 return -1;
776 }
777 if (result == 0) {
778 return 0;
779 }
780 if (errno != EINTR) {
781 return -1;
782 }
783 }
784}
785
786static bool socket_peer_is_current_user(int fd) {
787#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)

Callers 5

connection_read_fullFunction · 0.85
connection_write_fullFunction · 0.85
cbm_daemon_ipc_acceptFunction · 0.85
cbm_daemon_ipc_connectFunction · 0.85

Calls 1

deadline_remaining_msFunction · 0.85

Tested by

no test coverage detected