MCPcopy Index your code
hub / github.com/RsyncProject/rsync / write_buf

Function write_buf

io.c:2255–2284  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2253}
2254
2255void write_buf(int f, const char *buf, size_t len)
2256{
2257 size_t pos, siz;
2258
2259 if (f != iobuf.out_fd) {
2260 safe_write(f, buf, len);
2261 goto batch_copy;
2262 }
2263
2264 if (iobuf.out.len + len > iobuf.out.size)
2265 perform_io(len, PIO_NEED_OUTROOM);
2266
2267 pos = iobuf.out.pos + iobuf.out.len; /* Must be set after any flushing. */
2268 if (pos >= iobuf.out.size)
2269 pos -= iobuf.out.size;
2270
2271 /* Handle a split copy if we wrap around the end of the circular buffer. */
2272 if (pos >= iobuf.out.pos && (siz = iobuf.out.size - pos) < len) {
2273 memcpy(iobuf.out.buf + pos, buf, siz);
2274 memcpy(iobuf.out.buf, buf + siz, len - siz);
2275 } else
2276 memcpy(iobuf.out.buf + pos, buf, len);
2277
2278 iobuf.out.len += len;
2279 total_data_written += len;
2280
2281 batch_copy:
2282 if (f == write_batch_monitor_out)
2283 safe_write(batch_fd, buf, len);
2284}
2285
2286/* Write a string to the connection */
2287void write_sbuf(int f, const char *buf)

Callers 15

send_one_nameFunction · 0.85
write_filter_rulesFunction · 0.85
send_rulesFunction · 0.85
send_ida_entriesFunction · 0.85
simple_send_tokenFunction · 0.85
send_deflated_tokenFunction · 0.85
send_zstd_tokenFunction · 0.85
send_compressed_tokenFunction · 0.85
forward_filesfrom_dataFunction · 0.85
read_bufFunction · 0.85
write_shortintFunction · 0.85
write_intFunction · 0.85

Calls 2

safe_writeFunction · 0.85
perform_ioFunction · 0.85

Tested by

no test coverage detected