MCPcopy Create free account
hub / github.com/F-Stack/f-stack / compress_chunk

Function compress_chunk

freebsd/kern/imgact_elf.c:1502–1525  ·  view source on GitHub ↗

* Write out a core segment to the compression stream. */

Source from the content-addressed store, hash-verified

1500 * Write out a core segment to the compression stream.
1501 */
1502static int
1503compress_chunk(struct coredump_params *p, char *base, char *buf, u_int len)
1504{
1505 u_int chunk_len;
1506 int error;
1507
1508 while (len > 0) {
1509 chunk_len = MIN(len, CORE_BUF_SIZE);
1510
1511 /*
1512 * We can get EFAULT error here.
1513 * In that case zero out the current chunk of the segment.
1514 */
1515 error = copyin(base, buf, chunk_len);
1516 if (error != 0)
1517 bzero(buf, chunk_len);
1518 error = compressor_write(p->comp, buf, chunk_len);
1519 if (error != 0)
1520 break;
1521 base += chunk_len;
1522 len -= chunk_len;
1523 }
1524 return (error);
1525}
1526
1527static int
1528core_compressed_write(void *base, size_t len, off_t offset, void *arg)

Callers 1

core_outputFunction · 0.85

Calls 3

bzeroFunction · 0.85
compressor_writeFunction · 0.85
copyinFunction · 0.50

Tested by

no test coverage detected