* Write out a core segment to the compression stream. */
| 1500 | * Write out a core segment to the compression stream. |
| 1501 | */ |
| 1502 | static int |
| 1503 | compress_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 | |
| 1527 | static int |
| 1528 | core_compressed_write(void *base, size_t len, off_t offset, void *arg) |
no test coverage detected