MCPcopy Create free account
hub / github.com/catboost/catboost / ProcessBuffer

Function ProcessBuffer

util/system/daemon_ut.cpp:12–33  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10#ifdef _unix_
11 template <typename Func>
12 static bool ProcessBuffer(Func&& func, void* bufin, size_t size) {
13 char* buf = (char*)bufin;
14 do {
15 const ssize_t bytesDone = func(buf, size);
16 if (bytesDone == 0) {
17 return false;
18 }
19
20 if (bytesDone < 0) {
21 if (errno == EAGAIN || errno == EINTR) {
22 continue;
23 } else {
24 return false;
25 }
26 }
27
28 buf += bytesDone;
29 size -= bytesDone;
30 } while (size != 0);
31
32 return true;
33 }
34
35 const int size = 1024 * 4;
36 const int pagesSize = sizeof(int) * size;

Callers 1

Y_UNIT_TESTFunction · 0.85

Calls 1

funcFunction · 0.85

Tested by

no test coverage detected