1 .\" Copyright (c) 2010 Joerg Sonnenberger
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
13 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 .Dt ARCHIVE_ENTRY_STAT 3
29 .Nm archive_entry_stat ,
30 .Nm archive_entry_copy_stat ,
31 .Nm archive_entry_filetype ,
32 .Nm archive_entry_set_filetype ,
33 .Nm archive_entry_mode ,
34 .Nm archive_entry_set_mode ,
35 .Nm archive_entry_size ,
36 .Nm archive_entry_size_is_set ,
37 .Nm archive_entry_set_size ,
38 .Nm archive_entry_unset_size ,
39 .Nm archive_entry_dev ,
40 .Nm archive_entry_set_dev ,
41 .Nm archive_entry_dev_is_set ,
42 .Nm archive_entry_devmajor ,
43 .Nm archive_entry_set_devmajor ,
44 .Nm archive_entry_devminor ,
45 .Nm archive_entry_set_devminor ,
46 .Nm archive_entry_ino ,
47 .Nm archive_entry_set_ino ,
48 .Nm archive_entry_ino_is_set ,
49 .Nm archive_entry_ino64 ,
50 .Nm archive_entry_set_ino64 ,
51 .Nm archive_entry_nlink ,
52 .Nm archive_entry_rdev ,
53 .Nm archive_entry_set_rdev ,
54 .Nm archive_entry_rdevmajor ,
55 .Nm archive_entry_set_rdevmajor ,
56 .Nm archive_entry_rdevminor ,
57 .Nm archive_entry_set_rdevminor ,
58 .Nd accessor functions for manipulating archive entry descriptions
60 Streaming Archive Library (libarchive, -larchive)
63 .Ft const struct stat *
64 .Fn archive_entry_stat "struct archive_entry *a"
66 .Fn archive_entry_copy_stat "struct archive_entry *a" "const struct stat *sb"
68 .Fn archive_entry_filetype "struct archive_entry *a"
70 .Fn archive_entry_set_filetype "struct archive_entry *a" "unsigned int type"
72 .Fn archive_entry_mode "struct archive_entry *a"
74 .Fn archive_entry_set_mode "struct archive_entry *a" "mode_t mode"
76 .Fn archive_entry_size "struct archive_entry *a"
78 .Fn archive_entry_size_is_set "struct archive_entry *a"
80 .Fn archive_entry_set_size "struct archive_entry *a" "int64_t size"
82 .Fn archive_entry_unset_size "struct archive_entry *a"
84 .Fn archive_entry_dev "struct archive_entry *a"
86 .Fn archive_entry_set_dev "struct archive_entry *a" "dev_t dev"
88 .Fn archive_entry_dev_is_set "struct archive_entry *a"
90 .Fn archive_entry_devmajor "struct archive_entry *a"
92 .Fn archive_entry_set_devmajor "struct archive_entry *a" "dev_t major"
94 .Fn archive_entry_devminor "struct archive_entry *a"
96 .Fn archive_entry_set_devminor "struct archive_entry *a" "dev_t minor"
98 .Fn archive_entry_ino "struct archive_entry *a"
100 .Fn archive_entry_set_ino "struct archive_entry *a" "unsigned long ino"
102 .Fn archive_entry_ino_is_set "struct archive_entry *a"
104 .Fn archive_entry_ino64 "struct archive_entry *a"
106 .Fn archive_entry_set_ino64 "struct archive_entry *a" "int64_t ino"
108 .Fn archive_entry_nlink "struct archive_entry *a"
110 .Fn archive_entry_set_nlink "struct archive_entry *a" "unsigned int count"
112 .Fn archive_entry_rdev "struct archive_entry *a"
114 .Fn archive_entry_rdevmajor "struct archive_entry *a"
116 .Fn archive_entry_rdevminor "struct archive_entry *a"
118 .Fn archive_entry_set_rdev "struct archive_entry *a" "dev_t dev"
120 .Fn archive_entry_set_rdevmajor "struct archive_entry *a" "dev_t major"
122 .Fn archive_entry_set_rdevminor "struct archive_entry *a" "dev_t minor"
124 .Ss Copying to and from Vt struct stat
126 .Fn archive_entry_stat
127 converts the various fields stored in the archive entry to the format
130 The return value remains valid until either
131 .Fn archive_entry_clear
133 .Fn archive_entry_free
135 It is not affected by calls to the set accessor functions.
136 It currently sets the following values in
151 and high-precision information for time-related fields
152 will be included on platforms that support it.
155 .Fn archive_entry_copy_stat
156 copies fields from the platform's
158 Fields not provided by
161 .Ss General accessor functions
163 .Fn archive_entry_filetype
165 .Fn archive_entry_set_filetype
166 get respectively set the filetype.
167 The file type is one of the following constants:
168 .Bl -tag -width "AE_IFSOCK" -compact -offset indent
184 Not all file types are supported by all platforms.
185 The constants used by
187 may have different numeric values from the
188 corresponding constants above.
191 .Fn archive_entry_mode
193 .Fn archive_entry_set_mode
194 get/set a combination of file type and permissions and provide the
198 .Fn archive_entry_filetype
200 .Fn archive_entry_perm
202 .Fn archive_entry_set_filetype
204 .Fn archive_entry_set_perm
205 for setting is recommended.
208 .Fn archive_entry_size
209 returns the file size, if it has been set, and 0 otherwise.
210 .Fn archive_entry_size
211 can be used to query that status.
212 .Fn archive_entry_set_size
214 .Fn archive_entry_unset_size
215 set and unset the size, respectively.
217 The number of references (hardlinks) can be obtained by calling
218 .Fn archive_entry_nlinks
220 .Fn archive_entry_set_nlinks .
221 .Ss Identifying unique files
223 .Fn archive_entry_dev
225 .Fn archive_entry_ino64
227 .Xr archive_entry_linkify 3
229 The pair of device and inode is supposed to identify hardlinked files.
231 The device major and minor number can be obtained independently using
232 .Fn archive_entry_devmajor
234 .Fn archive_entry_devminor .
235 The device can be set either via
236 .Fn archive_entry_set_dev
237 or by the combination of major and minor number using
238 .Fn archive_entry_set_devmajor
240 .Fn archive_entry_set_devminor .
242 The inode number can be obtained using
243 .Fn archive_entry_ino .
244 This is a legacy interface that uses the platform
246 which may be very small.
247 To set the inode number,
248 .Fn archive_entry_set_ino64
249 is the preferred interface.
250 .Ss Accessor functions for block and character devices
251 Block and character devices are characterised either using a device number
252 or a pair of major and minor number.
253 The combined device number can be obtained with
254 .Fn archive_device_rdev
256 .Fn archive_device_set_rdev .
257 The major and minor numbers are accessed by
258 .Fn archive_device_rdevmajor ,
259 .Fn archive_device_rdevminor
260 .Fn archive_device_set_rdevmajor
262 .Fn archive_device_set_rdevminor .
264 The process of splitting the combined device number into major and
265 minor number and the reverse process of combing them differs between
267 Some archive formats use the combined form, while other formats use
270 .Xr archive_entry_acl 3 ,
271 .Xr archive_entry_perms 3 ,
272 .Xr archive_entry_time 3 ,