MCPcopy Index your code
hub / github.com/git/git / xread

Function xread

wrapper.c:228–243  ·  view source on GitHub ↗

* xread() is the same a read(), but it automatically restarts read() * operations with a recoverable error (EAGAIN and EINTR). xread() * DOES NOT GUARANTEE that "len" bytes is read even if the data is available. */

Source from the content-addressed store, hash-verified

226 * DOES NOT GUARANTEE that "len" bytes is read even if the data is available.
227 */
228ssize_t xread(int fd, void *buf, size_t len)
229{
230 ssize_t nr;
231 if (len > MAX_IO_SIZE)
232 len = MAX_IO_SIZE;
233 while (1) {
234 nr = read(fd, buf, len);
235 if (nr < 0) {
236 if (errno == EINTR)
237 continue;
238 if (handle_nonblock(fd, POLLIN, errno))
239 continue;
240 }
241 return nr;
242 }
243}
244
245/*
246 * xwrite() is the same a write(), but it automatically restarts write()

Callers 15

relay_pack_dataFunction · 0.85
create_pack_fileFunction · 0.85
read_in_fullFunction · 0.85
csprng_bytesFunction · 0.85
new_http_object_requestFunction · 0.85
rpc_serviceFunction · 0.85
copy_fdFunction · 0.85
pack_objectsFunction · 0.85
strbuf_read_onceFunction · 0.85
strbuf_getwholeline_fdFunction · 0.85
fixup_pack_header_footerFunction · 0.85

Calls 1

handle_nonblockFunction · 0.85

Tested by 3

cmd__hexdumpFunction · 0.68
cmd__xml_encodeFunction · 0.68
cmd_hash_implFunction · 0.68