MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / readall

Function readall

tools/comdb2ar/util.cpp:181–200  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

179
180
181ssize_t readall(int fd, void *buf, size_t nbytes)
182// Read all the bytes requested from the given fd. Returns the number of bytes
183// read, or -1 on error or 0 on eof.
184{
185 char *cbuf = static_cast<char *>(buf);
186 size_t total = 0;
187
188 while(nbytes > 0) {
189 ssize_t bytesread = read(fd, cbuf, nbytes);
190 if(bytesread <= 0) {
191 return bytesread;
192 }
193
194 cbuf += bytesread;
195 nbytes -= bytesread;
196 total += bytesread;
197 }
198
199 return total;
200}
201
202bool isDirectory(const std::string& file) {
203 struct stat st;

Callers 8

read_serialised_sha_fileFunction · 0.85
deserialise_databaseFunction · 0.85
deserialize_fileFunction · 0.85
restore_partialsFunction · 0.85
read_incr_manifestFunction · 0.85
update_treeFunction · 0.85
unpack_full_fileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected