from small one page howto to huge articles all in one place

search text in:

Which screen resolution do you use?

poll results

Last additions:
using iotop to find disk usage hogs

using iotop to find disk usage hogs






average rating: 1.7 (82 votes) (1=very good 6=terrible)

May 25th. 2007:




why adblockers are bad

Workaround and fixes for the current Core Dump Handling vulnerability affected kernels

Workaround and fixes for the current Core Dump Handling vulnerability affected kernels






average rating: 1.3 (27 votes) (1=very good 6=terrible)

April, 26th. 2006:

You are here: manpages


Section: C Library Functions (3)
Index Return to Main Contents

BSD mandoc


archive_entry_linkresolver archive_entry_linkresolver_new archive_entry_linkresolver_set_strategy archive_entry_linkresolver_free archive_entry_linkify - hardlink resolver functions  


Streaming Archive Library (libarchive, -larchive)  


In archive_entry.h Ft struct archive_entry_linkresolver * Fn archive_entry_linkresolver_new void Ft void Fo archive_entry_linkresolver_set_strategy Fa struct archive_entry_linkresolver *resolver Fa int format Fc Ft void Fo archive_entry_linkresolver_free Fa struct archive_entry_linkresolver *resolver Fc Ft void Fo archive_entry_linkify Fa struct archive_entry_linkresolver *resolver Fa struct archive_entry **entry Fa struct archive_entry **sparse Fc  


Programs that want to create archives have to deal with hardlinks. Hardlinks are handled in different ways by the archive formats. The basic strategies are:

  1. Ignore hardlinks and store the body for each reference (old cpio, zip).
  2. Store the body the first time an inode is seen (ustar, pax).
  3. Store the body the last time an inode is seen (new cpio).

The functions help by providing a unified interface and handling the complexity behind the scene.

The functions assume that Vt archive_entry instances have valid nlinks, inode and device values. The inode and device value is used to match entries. The nlinks value is used to determined if all references have been found and if the internal references can be recycled.

The Fn archive_entry_linkresolver_new function allocates a new link resolver. The instance can be freed using Fn archive_entry_linkresolver_free . All deferred entries are flushed and the internal storage is freed.

The Fn archive_entry_linkresolver_set_strategy function selects the optimal hardlink strategy for the given format. The format code can be obtained from archive_format3. The function can be called more than once, but it is recommended to flush all deferred entries first.

The Fn archive_entry_linkify function is the core of . The Fn entry argument points to the Vt archive_entry that should be written. Depending on the strategy one of the following actions is taken:

  1. For the simple archive formats *entry is left unmodified and *sparse is set to NULL
  2. For tar like archive formats, *sparse is set to NULL If *entry is NULL no action is taken. If the hardlink count of *entry is larger than 1 and the file type is a regular file or symbolic link, the internal list is searched for a matching inode. If such an inode is found, the link count is decremented and the file size of *entry is set to 0 to notify that no body should be written. If no such inode is found, a copy of the entry is added to the internal cache with a link count reduced by one.
  3. For new cpio like archive formats a value for *entry of NULL is used to flush deferred entries. In that case *entry is set to an arbitrary deferred entry and the entry itself is removed from the internal list. If the internal list is empty, *entry is set to NULL In either case, *sparse is set to NULL and the function returns. If the hardlink count of *entry is one or the file type is a directory or device, *sparse is set to NULL and no further action is taken. Otherwise, the internal list is searched for a matching inode. If such an inode is not found, the entry is added to the internal list, both *entry and *sparse are set to NULL and the function returns. If such an inode is found, the link count is decremented. If it remains larger than one, the existing entry on the internal list is swapped with *entry after retaining the link count. The existing entry is returned in *entry If the link count reached one, the new entry is also removed from the internal list and returned in *sparse Otherwise *sparse is set to NULL

The general usage is therefore:

  1. For each new archive entry, call Fn archive_entry_linkify .
  2. Keep in mind that the entries returned may have a size of 0 now.
  3. If *entry is not NULL archive it.
  4. If *sparse is not NULL archive it.
  5. After all entries have been written to disk, call Fn archive_entry_linkify with *entry set to NULL and archive the returned entry as long as it is not NULL



Fn archive_entry_linkresolver_new returns NULL on malloc(3) failures.  






Please read "Why adblockers are bad".

Other free services
Shorten long
URLs to short
links like
Reverse DNS lookup
Find out which hostname(s)
resolve to a
given IP or other hostnames for the server
rdf newsfeed | rss newsfeed | Atom newsfeed
- Powered by LeopardCMS - Running on Gentoo -
Copyright 2004-2013 Sascha Nitsch Unternehmensberatung UG(haftungsbeschränkt)
Valid XHTML1.1 : Valid CSS : buttonmaker
- Level Triple-A Conformance to Web Content Accessibility Guidelines 1.0 -
- Copyright and legal notices -
Time to create this page: 7.2 ms