carta
archive_read_extract2(3)

archive_read_extract23

Functions for reading streaming archives

Part of archive_read_extract(3).

Usage

int

int

void

Library

Streaming Archive Library (libarchive, -larchive)

Overview

archive_read_extract(,, Fn, archive_read_extract_set_skip_file)

A convenience function that wraps the corresponding archive_write_disk(3) interfaces. The first call to archive_read_extract() creates a restore object using archive_write_disk_new(3) and archive_write_disk_set_standard_lookup(3), then transparently invokes archive_write_disk_set_options(3), archive_write_header(3), archive_write_data(3), and archive_write_finish_entry(3) to create the entry on disk and copy data into it. The flags argument is passed unmodified to archive_write_disk_set_options(3).

archive_read_extract2()

This is another version of archive_read_extract() that allows you to provide your own restore object. In particular, this allows you to override the standard lookup functions using archive_write_disk_set_group_lookup(3), and archive_write_disk_set_user_lookup(3). Note that archive_read_extract2() does not accept a flags argument; you should use archive_write_disk_set_options() to set the restore options yourself.

archive_read_extract_set_progress_callback()

Sets a pointer to a user-defined callback that can be used for updating progress displays during extraction. The progress function will be invoked during the extraction of large regular files. The progress function will be invoked with the pointer provided to this call. Generally, the data pointed to should include a reference to the archive object and the archive_entry object so that various statistics can be retrieved for the progress display.

Return values

Most functions return zero on success, non-zero on error. The possible return codes include: ARCHIVE_OK (the operation succeeded), ARCHIVE_WARN (the operation succeeded but a non-critical error was encountered), ARCHIVE_EOF (end-of-archive was encountered), ARCHIVE_RETRY (the operation failed but can be retried), and ARCHIVE_FATAL (there was a fatal error; the archive should be closed immediately).

Errors

Detailed error codes and textual descriptions are available from the archive_errno() and archive_error_string() functions.

History

  • FreeBSD 16.0-CURRENT (2026-10-27) to FreeBSD 14.1-RELEASE: the text shown here
  • FreeBSD 14.0-RELEASE
  • FreeBSD 13.5-RELEASE to FreeBSD 13.4-RELEASE
  • FreeBSD 13.3-RELEASE to FreeBSD 12.2-RELEASE
  • FreeBSD 12.1-RELEASE to FreeBSD 12.0-RELEASE
  • FreeBSD 11.4-RELEASE
  • FreeBSD 11.3-RELEASE to FreeBSD 10.0-RELEASE

From base 16.0-CURRENT-20261027-61c70dc16a79 in FreeBSD 16.0-CURRENT (2026-10-27). Parsed by carta from the page's mdoc source.