ARCHIVE_WRITE_DATA(3)
β¨ ARCHIVE_WRITE_DATA(3) β¨
okay bestie, so this is a page from the Library Functions Manual β the ARCHIVE_WRITE_DATA one, aka the manual name for the whole vibe you're reading rn. it lives in the Streaming Archive Library (that's libarchive, linked with -larchive), and it's literally the girlies who make archives happen π
πΈ NAME πΈ
archive_write_data, archive_write_data_block β functions for creating archives π
π¦ LIBRARY π¦
Streaming Archive Library (libarchive, -larchive)
β¨ SYNOPSIS β¨
#include <archive.h>
la_ssize_t
archive_write_data(struct archive *, const void *, size_t);
la_ssize_t
archive_write_data_block(struct archive *, const void *, size_t size,
int64_t offset);
π DESCRIPTION π
okay so here's the tea, one function at a time:
archive_write_data()β writes the data that goes with the header you just wrote. that's it, that's the job π«Άarchive_write_data_block()β also writes the data corresponding to the header just written, but with a lil twist: it's likearchive_write_data()except that it performs a seek on the file being written to the specified offset before writing the data. so basically seek first, then spill the data. this is lowkey iconic when you're restoring sparse files from archive formats that support sparse files. it returns the number of bytes written, or-1on error. it's giving precision π―
β οΈ not me being the bearer of bad news but: this is currently not supported forarchive_writehandles, only forarchive_write_diskhandles. periodt.
π₯ RETURN VALUES π₯
this function returns the number of bytes actually written, or a negative error code on error. that's the whole mood.
π ERRORS π
need the deets? detailed error codes AND textual descriptions are available from the archive_errno() and archive_error_string() functions. go ask them, they know everything π
π BUGS π
okay so in libarchive 3.x, this function sometimes returns zero on success instead of returning the number of bytes written π. specifically, this occurs when writing to an archive_write_disk handle. so bestie, here's the rule:
- treat any value less than zero as an error
- consider any non-negative value as success
no cap, that's the whole survival guide.
π SEE ALSO π
tar(1), archive_write_finish_entry(3), archive_write_set_options(3), libarchive(3), cpio(5), mtree(5), tar(5)
and that's the page, bestie!! this one's from the Debian girlies, dated February 28, 2017 β so it's vintage, it's classic, it's serving ARCHIVE_WRITE_DATA(3) realness β¨π go forth and write some archives, you absolute legend π
π¦ where this page comes from
- arch rolling: libarchive 3.8.9-1
- centos-stream 10: libarchive-devel 3.7.7-11.el10 Β· BSD-2-Clause AND FSFULLR AND GPL-2.0-or-later WITH Libtool-exception AND BSD-3-Clause AND FSFUL
- debian trixie: libarchive-dev 3.7.4-4+deb13u1 Β· BSD-2-Clause
- fedora 43: libarchive-devel 3.8.1-3.fc43 Β· BSD-2-Clause AND FSFULLR AND GPL-2.0-or-later WITH Libtool-exception AND BSD-3-Clause AND FSFUL
- fedora 43: libarchive-devel 3.8.1-3.fc43 Β· BSD-2-Clause AND FSFULLR AND GPL-2.0-or-later WITH Libtool-exception AND BSD-3-Clause AND FSFUL
- fedora 43: libarchive-devel 3.8.4-1.fc43 Β· BSD-2-Clause AND FSFULLR AND GPL-2.0-or-later WITH Libtool-exception AND BSD-3-Clause AND FSFUL
- fedora 43: libarchive-devel 3.8.4-1.fc43 Β· BSD-2-Clause AND FSFULLR AND GPL-2.0-or-later WITH Libtool-exception AND BSD-3-Clause AND FSFUL
- fedora 44: libarchive-devel 3.8.4-2.fc44 Β· BSD-2-Clause AND FSFULLR AND GPL-2.0-or-later WITH Libtool-exception AND BSD-3-Clause AND FSFUL
- fedora 44: libarchive-devel 3.8.4-2.fc44 Β· BSD-2-Clause AND FSFULLR AND GPL-2.0-or-later WITH Libtool-exception AND BSD-3-Clause AND FSFUL
- fedora 44: libarchive-devel 3.8.7-1.fc44 Β· BSD-2-Clause AND FSFULLR AND GPL-2.0-or-later WITH Libtool-exception AND BSD-3-Clause AND FSFUL
- fedora 44: libarchive-devel 3.8.7-1.fc44 Β· BSD-2-Clause AND FSFULLR AND GPL-2.0-or-later WITH Libtool-exception AND BSD-3-Clause AND FSFUL
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- nixos 26.05: libarchive 3.8.9
- nixpkgs unstable: libarchive 3.8.9
- opensuse-leap 16.0: libarchive-devel 3.8.1-160000.4.1 Β· BSD-2-Clause
- opensuse-leap 16.0: libarchive-devel 3.8.1-160000.4.1 Β· BSD-2-Clause
- opensuse-leap 16.0: libarchive-devel 3.8.1-160000.4.1 Β· BSD-2-Clause
- opensuse-leap 16.0: libarchive-devel 3.8.1-160000.4.1 Β· BSD-2-Clause
- ubuntu questing: libarchive-dev 3.7.7-0ubuntu3
- ubuntu questing: libarchive-dev 3.7.7-0ubuntu3.2
- ubuntu resolute: libarchive-dev 3.8.5-1ubuntu2 Β· BSD-2-Clause
- ubuntu resolute: libarchive-dev 3.8.5-1ubuntu2.3 Β· BSD-2-Clause
- ubuntu stonking: libarchive-dev 3.8.9-1 Β· BSD-2-Clause
- Copyright (c) 2003-2011 Tim Kientzle
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms