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

Function transfer

tests/test_coverage_parent_failure.c:80–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78}
79
80static bool transfer(int fd, void *bytes, size_t size, bool writing) {
81 unsigned char *cursor = bytes;
82 while (size) {
83 struct pollfd item = {.fd = fd, .events = writing ? POLLOUT : POLLIN};
84 int ready;
85 do {
86 ready = poll(&item, 1, 60000);
87 } while (ready < 0 && errno == EINTR);
88 if (ready <= 0)
89 return false;
90 ssize_t n;
91 do {
92 n = writing ? write(fd, cursor, size) : read(fd, cursor, size);
93 } while (n < 0 && errno == EINTR);
94 if (n <= 0)
95 return false;
96 cursor += (size_t)n;
97 size -= (size_t)n;
98 }
99 return true;
100}
101
102static bool close_fd(int *fd) {
103 if (*fd < 0)

Callers 2

child_runFunction · 0.70
observe_and_releaseFunction · 0.70

Calls 3

readFunction · 0.70
pollFunction · 0.50
writeFunction · 0.50

Tested by

no test coverage detected