tail head cat sleep
QR code linking to this page



archive_write_get_bytes_per_block, archive_write_set_bytes_per_block, archive_write_get_bytes_in_last_block, archive_write_set_bytes_in_last_block – functions for creating archives



Streaming Archive Library (libarchive, -larchive)


#include <archive.h>

archive_write_get_bytes_per_block(struct archive *);

archive_write_set_bytes_per_block(struct archive *, int bytes_per_block);

archive_write_get_bytes_in_last_block(struct archive *);

archive_write_set_bytes_in_last_block(struct archive *, int);


  Sets the block size used for writing the archive data. Every call to the write callback function, except possibly the last one, will use this value for the length. The default is to use a block size of 10240 bytes. Note that a block size of zero will suppress internal blocking and cause writes to be sent directly to the write callback as they occur.
  Retrieve the block size to be used for writing. A value of -1 here indicates that the library should use default values. A value of zero indicates that internal blocking is suppressed.
  Sets the block size used for writing the last block. If this value is zero, the last block will be padded to the same size as the other blocks. Otherwise, the final block will be padded to a multiple of this size. In particular, setting it to 1 will cause the final block to not be padded. For compressed output, any padding generated by this option is applied only after the compression. The uncompressed data is always unpadded. The default is to pad the last block to the full block size (note that archive_write_open_filename() will set this based on the file type). Unlike the other "set" functions, this function can be called after the archive is opened.
  Retrieve the currently-set value for last block size. A value of -1 here indicates that the library should use default values.


archive_write_set_bytes_per_block() and archive_write_set_bytes_in_last_block() return ARCHIVE_OK on success, or ARCHIVE_FATAL.

archive_write_get_bytes_per_block() and archive_write_get_bytes_in_last_block() return currently configured block size ( -1 indicates the default block size ), or ARCHIVE_FATAL.


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


tar(1), archive_write_set_options(3), libarchive(3), cpio(5), mtree(5), tar(5)

ARCHIVE_WRITE_BLOCKSIZE (3) February 2, 2012

tail head cat sleep
QR code linking to this page

Please direct any comments about this manual page service to Ben Bullock. Privacy policy.

Like a classics radio station whose play list spans decades, Unix simultaneously exhibits its mixed and dated heritage. There's Clash-era graphics interfaces; Beatles-era two-letter command names; and systems programs (for example, ps) whose terse and obscure output was designed for slow teletypes; Bing Crosby-era command editing (# and @ are still the default line editing commands), and Scott Joplin-era core dumps.
— The Unix Haters' handbook