ARCHIVE_ENTRY_STAT(3)
β¨ archive_entry_stat(3) β¨
okay so bestie, this page comes from the Library Functions Manual and it's literally the whole girlboss toolkit for the accessor functions that manipulate archive entry descriptions. π no cap, there's like a million of them. let's go. π
π NAME π
archive_entry_stat, archive_entry_copy_stat, archive_entry_filetype, archive_entry_set_filetype, archive_entry_mode, archive_entry_set_mode, archive_entry_size, archive_entry_size_is_set, archive_entry_set_size, archive_entry_unset_size, archive_entry_dev, archive_entry_set_dev, archive_entry_dev_is_set, archive_entry_devmajor, archive_entry_set_devmajor, archive_entry_devminor, archive_entry_set_devminor, archive_entry_ino, archive_entry_set_ino, archive_entry_ino_is_set, archive_entry_ino64, archive_entry_set_ino64, archive_entry_nlink, archive_entry_rdev, archive_entry_set_rdev, archive_entry_rdevmajor, archive_entry_set_rdevmajor, archive_entry_rdevminor, archive_entry_set_rdevminor β accessor functions for manipulating archive entry descriptions β¨
π LIBRARY π
Streaming Archive Library (libarchive, -larchive) β she's streaming, obviously. π
π«Ά SYNOPSIS π«Ά
#include <archive_entry.h>
const struct stat *
archive_entry_stat(struct archive_entry *a);
void
archive_entry_copy_stat(struct archive_entry *a, const struct stat *sb);
mode_t
archive_entry_filetype(struct archive_entry *a);
void
archive_entry_set_filetype(struct archive_entry *a, unsigned int type);
mode_t
archive_entry_mode(struct archive_entry *a);
void
archive_entry_set_mode(struct archive_entry *a, mode_t mode);
int64_t
archive_entry_size(struct archive_entry *a);
int
archive_entry_size_is_set(struct archive_entry *a);
void
archive_entry_set_size(struct archive_entry *a, int64_t size);
void
archive_entry_unset_size(struct archive_entry *a);
dev_t
archive_entry_dev(struct archive_entry *a);
void
archive_entry_set_dev(struct archive_entry *a, dev_t dev);
int
archive_entry_dev_is_set(struct archive_entry *a);
dev_t
archive_entry_devmajor(struct archive_entry *a);
void
archive_entry_set_devmajor(struct archive_entry *a, dev_t major);
dev_t
archive_entry_devminor(struct archive_entry *a);
void
archive_entry_set_devminor(struct archive_entry *a, dev_t minor);
ino_t
archive_entry_ino(struct archive_entry *a);
void
archive_entry_set_ino(struct archive_entry *a, unsigned long ino);
int
archive_entry_ino_is_set(struct archive_entry *a);
int64_t
archive_entry_ino64(struct archive_entry *a);
void
archive_entry_set_ino64(struct archive_entry *a, int64_t ino);
unsigned int
archive_entry_nlink(struct archive_entry *a);
void
archive_entry_set_nlink(struct archive_entry *a, unsigned int count);
dev_t
archive_entry_rdev(struct archive_entry *a);
dev_t
archive_entry_rdevmajor(struct archive_entry *a);
dev_t
archive_entry_rdevminor(struct archive_entry *a);
void
archive_entry_set_rdev(struct archive_entry *a, dev_t dev);
void
archive_entry_set_rdevmajor(struct archive_entry *a, dev_t major);
void
archive_entry_set_rdevminor(struct archive_entry *a, dev_t minor);
π DESCRIPTION π
π¦ Copying to and from struct stat π¦
okay so archive_entry_stat() is the translator of the group π« β it converts all the various fields stored in the archive entry into the format that stat(2) uses. and the plot twist? the return value stays valid until either archive_entry_clear() or archive_entry_free() gets called. it is not affected by calls to the set accessor functions, so like, she doesn't care what you do to the setters, she's living her own life. π
right now it sets these values in struct stat: st_atime, st_ctime, st_dev, st_gid, st_ino, st_mode, st_mtime, st_nlink, st_rdev, st_size, st_uid. and on platforms that support it, st_birthtime plus high-precision information for time-related fields gets included too. the way she serves extra on some platforms? iconic. β¨
and then archive_entry_copy_stat() goes the other direction β it copies fields from the platform's struct stat. anything that struct stat doesn't provide just stays unchanged. no notes. π«Ά
π General accessor functions π
archive_entry_filetype() and archive_entry_set_filetype() get and set the filetype respectively. the file type is one of these constants:
AE_IFREGβ Regular fileAE_IFLNKβ Symbolic linkAE_IFSOCKβ SocketAE_IFCHRβ Character deviceAE_IFBLKβ Block deviceAE_IFDIRβ DirectoryAE_IFIFOβ Named pipe (fifo)
not all file types are supported by all platforms, bestie. and heads up β the constants used by stat(2) may have different numeric values from the corresponding constants listed above. π don't just assume they match.
archive_entry_mode() and archive_entry_set_mode() get/set a combination of file type and permissions, basically giving you the equivalent of st_mode. but here's the tea: the recommended move is to use archive_entry_filetype() and archive_entry_perm() for getting, and archive_entry_set_filetype() and archive_entry_set_perm() for setting. slay responsibly. π
archive_entry_size() returns the file size if it has been set, and 0 otherwise. archive_entry_size_is_set() is how you query that status β it's the vibe check for whether a size even exists. archive_entry_set_size() and archive_entry_unset_size() set and unset the size, respectively.
the number of references (hardlinks) can be obtained by calling archive_entry_nlink() and set with archive_entry_set_nlink(). π₯
πΈ Identifying unique files πΈ
archive_entry_dev() and archive_entry_ino64() are the duo that archive_entry_linkify(3) uses to find hardlinks. the pair of device and inode is supposed to identify hardlinked files β that's their whole main character job. π
the device major and minor number can be obtained independently using archive_entry_devmajor() and archive_entry_devminor(). and you can set the device either via archive_entry_set_dev() or by the combination of major and minor number using archive_entry_set_devmajor() and archive_entry_set_devminor().
the inode number can be obtained using archive_entry_ino(). β οΈ but listen β this is a legacy interface that uses the platform ino_t, which may be very small. to set the inode number, archive_entry_set_ino64() is the preferred interface. choose the glow-up, not the dusty one. π
π§ Accessor functions for block and character devices π§
block and character devices are characterised either using a device number or a pair of major and minor number. the combined device number can be obtained with archive_device_rdev() and set with archive_device_set_rdev(). the major and minor numbers are accessed by archive_device_rdevmajor(), archive_device_rdevminor(), archive_device_set_rdevmajor() and archive_device_set_rdevminor().
the process of splitting the combined device number into major and minor number β and the reverse process of combing them β differs between platforms. some archive formats use the combined form, while other formats use the split form. so like, it depends. π¦
π SEE ALSO π
stat(2), archive_entry_acl(3), archive_entry_perms(3), archive_entry_time(3), libarchive(3)
and that's the whole page, bestie!! π this one's from Debian and it's dated February 2, 2012 β so yes, she's an elder but she's still absolutely eating. π ARCHIVE_ENTRY_STAT(3) out. periodt. π
β¨
π¦ where this page comes from
- arch rolling: libarchive 3.8.9-1
- 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
- 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) 2010 Joerg Sonnenberger
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms