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

Function poll_until

src/daemon/ipc.c:938–956  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

936}
937
938static int poll_until(int fd, short events, uint64_t deadline_ms) {
939 for (;;) {
940 struct pollfd descriptor = {.fd = fd, .events = events, .revents = 0};
941 int timeout_ms = deadline_ms == UINT64_MAX ? -1 : deadline_remaining_ms(deadline_ms);
942 int result = poll(&descriptor, 1, timeout_ms);
943 if (result > 0) {
944 if ((descriptor.revents & events) != 0) {
945 return 1;
946 }
947 return -1;
948 }
949 if (result == 0) {
950 return 0;
951 }
952 if (errno != EINTR) {
953 return -1;
954 }
955 }
956}
957
958static bool socket_peer_is_current_user(int fd) {
959#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 2

deadline_remaining_msFunction · 0.85
pollFunction · 0.50

Tested by

no test coverage detected