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

Function poll_until

src/daemon/ipc.c:759–777  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

757}
758
759static int poll_until(int fd, short events, uint64_t deadline_ms) {
760 for (;;) {
761 struct pollfd descriptor = {.fd = fd, .events = events, .revents = 0};
762 int timeout_ms = deadline_ms == UINT64_MAX ? -1 : deadline_remaining_ms(deadline_ms);
763 int result = poll(&descriptor, 1, timeout_ms);
764 if (result > 0) {
765 if ((descriptor.revents & events) != 0) {
766 return 1;
767 }
768 return -1;
769 }
770 if (result == 0) {
771 return 0;
772 }
773 if (errno != EINTR) {
774 return -1;
775 }
776 }
777}
778
779static bool socket_peer_is_current_user(int fd) {
780#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