1ARCHIVE_ENTRY_STAT(3) BSD Library Functions Manual ARCHIVE_ENTRY_STAT(3)
2
4 archive_entry_stat, archive_entry_copy_stat, archive_entry_filetype,
5 archive_entry_set_filetype, archive_entry_mode, archive_entry_set_mode,
6 archive_entry_size, archive_entry_size_is_set, archive_entry_set_size,
7 archive_entry_unset_size, archive_entry_dev, archive_entry_set_dev,
8 archive_entry_dev_is_set, archive_entry_devmajor,
9 archive_entry_set_devmajor, archive_entry_devminor,
10 archive_entry_set_devminor, archive_entry_ino, archive_entry_set_ino,
11 archive_entry_ino_is_set, archive_entry_ino64, archive_entry_set_ino64,
12 archive_entry_nlink, archive_entry_rdev, archive_entry_set_rdev,
13 archive_entry_rdevmajor, archive_entry_set_rdevmajor,
14 archive_entry_rdevminor, archive_entry_set_rdevminor, — accessor func‐
15 tions for manipulating archive entry descriptions
16
18 Streaming Archive Library (libarchive, -larchive)
19
21 #include <archive_entry.h>
22
23 const struct stat *
24 archive_entry_stat(struct archive_entry *a);
25
26 void
27 archive_entry_copy_stat(struct archive_entry *a, const struct stat *sb);
28
29 mode_t
30 archive_entry_filetype(struct archive_entry *a);
31
32 void
33 archive_entry_set_filetype(struct archive_entry *a, unsigned int type);
34
35 mode_t
36 archive_entry_mode(struct archive_entry *a);
37
38 void
39 archive_entry_set_mode(struct archive_entry *a, mode_t mode);
40
41 int64_t
42 archive_entry_size(struct archive_entry *a);
43
44 int
45 archive_entry_size_is_set(struct archive_entry *a);
46
47 void
48 archive_entry_set_size(struct archive_entry *a, int64_t size);
49
50 void
51 archive_entry_unset_size(struct archive_entry *a);
52
53 dev_t
54 archive_entry_dev(struct archive_entry *a);
55
56 void
57 archive_entry_set_dev(struct archive_entry *a, dev_t dev);
58
59 int
60 archive_entry_dev_is_set(struct archive_entry *a);
61
62 dev_t
63 archive_entry_devmajor(struct archive_entry *a);
64
65 void
66 archive_entry_set_devmajor(struct archive_entry *a, dev_t major);
67
68 dev_t
69 archive_entry_devminor(struct archive_entry *a);
70
71 void
72 archive_entry_set_devminor(struct archive_entry *a, dev_t minor);
73
74 ino_t
75 archive_entry_ino(struct archive_entry *a);
76
77 void
78 archive_entry_set_ino(struct archive_entry *a, unsigned long ino);
79
80 int
81 archive_entry_ino_is_set(struct archive_entry *a);
82
83 int64_t
84 archive_entry_ino64(struct archive_entry *a);
85
86 void
87 archive_entry_set_ino64(struct archive_entry *a, int64_t ino);
88
89 unsigned int
90 archive_entry_nlink(struct archive_entry *a);
91
92 void
93 archive_entry_set_nlink(struct archive_entry *a, unsigned int count);
94
95 dev_t
96 archive_entry_rdev(struct archive_entry *a);
97
98 dev_t
99 archive_entry_rdevmajor(struct archive_entry *a);
100
101 dev_t
102 archive_entry_rdevminor(struct archive_entry *a);
103
104 void
105 archive_entry_set_rdev(struct archive_entry *a, dev_t dev);
106
107 void
108 archive_entry_set_rdevmajor(struct archive_entry *a, dev_t major);
109
110 void
111 archive_entry_set_rdevminor(struct archive_entry *a, dev_t minor);
112
114 Copying to and from struct stat
115 The function archive_entry_stat() converts the various fields stored in
116 the archive entry to the format used by stat(2). The return value
117 remains valid until either archive_entry_clear() or archive_entry_free()
118 is called. It is not affected by calls to the set accessor functions.
119 It currently sets the following values in struct stat: st_atime,
120 st_ctime, st_dev, st_gid, st_ino, st_mode, st_mtime, st_nlink, st_rdev,
121 st_size, st_uid. In addition, st_birthtime and high-precision informa‐
122 tion for time-related fields will be included on platforms that support
123 it.
124
125 The function archive_entry_copy_stat() copies fields from the platform's
126 struct stat. Fields not provided by struct stat are unchanged.
127
128 General accessor functions
129 The functions archive_entry_filetype() and archive_entry_set_filetype()
130 get respectively set the filetype. The file type is one of the following
131 constants:
132 AE_IFREG Regular file
133 AE_IFLNK Symbolic link
134 AE_IFSOCK Socket
135 AE_IFCHR Character device
136 AE_IFBLK Block device
137 AE_IFDIR Directory
138 AE_IFIFO Named pipe (fifo)
139 Not all file types are supported by all platforms. The constants used by
140 stat(2) may have different numeric values from the corresponding con‐
141 stants above.
142
143 The functions archive_entry_mode() and archive_entry_set_mode() get/set a
144 combination of file type and permissions and provide the equivalent of
145 st_mode. Use of archive_entry_filetype() and archive_entry_perm() for
146 getting and archive_entry_set_filetype() and archive_entry_set_perm() for
147 setting is recommended.
148
149 The function archive_entry_size() returns the file size, if it has been
150 set, and 0 otherwise. archive_entry_size() can be used to query that
151 status. archive_entry_set_size() and archive_entry_unset_size() set and
152 unset the size, respectively.
153
154 The number of references (hardlinks) can be obtained by calling
155 archive_entry_nlinks() and set with archive_entry_set_nlinks().
156
157 Identifying unique files
158 The functions archive_entry_dev() and archive_entry_ino64() are used by
159 archive_entry_linkify(3) to find hardlinks. The pair of device and inode
160 is suppossed to identify hardlinked files.
161
162 The device major and minor number can be obtained independently using
163 archive_entry_devmajor() and archive_entry_devminor(). The device can be
164 set either via archive_entry_set_dev() or by the combination of major and
165 minor number using archive_entry_set_devmajor() and
166 archive_entry_set_devminor().
167
168 The inode number can be obtained using archive_entry_ino(). This is a
169 legacy interface that uses the platform ino_t, which may be very small.
170 To set the inode number, archive_entry_set_ino64() is the preferred
171 interface.
172
173 Accessor functions for block and character devices
174 Block and character devices are characterised either using a device num‐
175 ber or a pair of major and minor number. The combined device number can
176 be obtained with archive_device_rdev() and set with
177 archive_device_set_rdev(). The major and minor numbers are accessed by
178 archive_device_rdevmajor(), archive_device_rdevminor()
179 archive_device_set_rdevmajor() and archive_device_set_rdevminor().
180
181 The process of splitting the combined device number into major and minor
182 number and the reverse process of combing them differs between platforms.
183 Some archive formats use the combined form, while other formats use the
184 split form.
185
187 archive(3), archive_entry_acl(3), archive_entry_perms(3),
188 archive_entry_time(3), stat(2)
189
190BSD February 2, 2012 BSD