summaryrefslogtreecommitdiff
path: root/archivers/libarchive/files/doc/wiki/ManPageArchiveEntryStat3.wiki
blob: e96169f1c32ff77b528bf6938fc04bcfdc1ccce5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
ARCHIVE_ENTRY_STAT(3) manual page 
== 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) 
== SYNOPSIS == 
'''<nowiki>#include <archive_entry.h></nowiki>''' 
<br> 
''const struct stat *'' 
<br> 
'''archive_entry_stat'''(''struct archive_entry *a''); 
<br> 
''void'' 
<br> 
'''archive_entry_copy_stat'''(''struct archive_entry *a'', ''const struct stat *sb''); 
<br> 
''mode_t'' 
<br> 
'''archive_entry_filetype'''(''struct archive_entry *a''); 
<br> 
''void'' 
<br> 
'''archive_entry_set_filetype'''(''struct archive_entry *a'', ''unsigned int type''); 
<br> 
''mode_t'' 
<br> 
'''archive_entry_mode'''(''struct archive_entry *a''); 
<br> 
''void'' 
<br> 
'''archive_entry_set_mode'''(''struct archive_entry *a'', ''mode_t mode''); 
<br> 
''int64_t'' 
<br> 
'''archive_entry_size'''(''struct archive_entry *a''); 
<br> 
''int'' 
<br> 
'''archive_entry_size_is_set'''(''struct archive_entry *a''); 
<br> 
''void'' 
<br> 
'''archive_entry_set_size'''(''struct archive_entry *a'', ''int64_t size''); 
<br> 
''void'' 
<br> 
'''archive_entry_unset_size'''(''struct archive_entry *a''); 
<br> 
''dev_t'' 
<br> 
'''archive_entry_dev'''(''struct archive_entry *a''); 
<br> 
''void'' 
<br> 
'''archive_entry_set_dev'''(''struct archive_entry *a'', ''dev_t dev''); 
<br> 
''int'' 
<br> 
'''archive_entry_dev_is_set'''(''struct archive_entry *a''); 
<br> 
''dev_t'' 
<br> 
'''archive_entry_devmajor'''(''struct archive_entry *a''); 
<br> 
''void'' 
<br> 
'''archive_entry_set_devmajor'''(''struct archive_entry *a'', ''dev_t major''); 
<br> 
''dev_t'' 
<br> 
'''archive_entry_devminor'''(''struct archive_entry *a''); 
<br> 
''void'' 
<br> 
'''archive_entry_set_devminor'''(''struct archive_entry *a'', ''dev_t minor''); 
<br> 
''ino_t'' 
<br> 
'''archive_entry_ino'''(''struct archive_entry *a''); 
<br> 
''void'' 
<br> 
'''archive_entry_set_ino'''(''struct archive_entry *a'', ''unsigned long ino''); 
<br> 
''int'' 
<br> 
'''archive_entry_ino_is_set'''(''struct archive_entry *a''); 
<br> 
''int64_t'' 
<br> 
'''archive_entry_ino64'''(''struct archive_entry *a''); 
<br> 
''void'' 
<br> 
'''archive_entry_set_ino64'''(''struct archive_entry *a'', ''int64_t ino''); 
<br> 
''unsigned int'' 
<br> 
'''archive_entry_nlink'''(''struct archive_entry *a''); 
<br> 
''void'' 
<br> 
'''archive_entry_set_nlink'''(''struct archive_entry *a'', ''unsigned int count''); 
<br> 
''dev_t'' 
<br> 
'''archive_entry_rdev'''(''struct archive_entry *a''); 
<br> 
''dev_t'' 
<br> 
'''archive_entry_rdevmajor'''(''struct archive_entry *a''); 
<br> 
''dev_t'' 
<br> 
'''archive_entry_rdevminor'''(''struct archive_entry *a''); 
<br> 
''void'' 
<br> 
'''archive_entry_set_rdev'''(''struct archive_entry *a'', ''dev_t dev''); 
<br> 
''void'' 
<br> 
'''archive_entry_set_rdevmajor'''(''struct archive_entry *a'', ''dev_t major''); 
<br> 
''void'' 
<br> 
'''archive_entry_set_rdevminor'''(''struct archive_entry *a'', ''dev_t minor''); 
== DESCRIPTION == 
=== Copying to and from ''struct'' stat=== 
The function 
'''archive_entry_stat'''() 
converts the various fields stored in the archive entry to the format 
used by 
[[stat(2)|http://www.freebsd.org/cgi/man.cgi?query=stat&sektion=2]]. 
The return value remains valid until either 
'''archive_entry_clear'''() 
or 
'''archive_entry_free'''() 
is called. 
It is not affected by calls to the set accessor functions. 
It currently sets the following 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''. 
In addition, 
''st_birthtime'' 
and high-precision information for time-related fields 
will be included on platforms that support it. 

The function 
'''archive_entry_copy_stat'''() 
copies fields from the platform's 
''struct'' stat. 
Fields not provided by 
''struct'' stat 
are unchanged. 
=== General accessor functions=== 
The functions 
'''archive_entry_filetype'''() 
and 
'''archive_entry_set_filetype'''() 
get respectively set the filetype. 
The file type is one of the following constants: 
<dl> 
<dt>AE_IFREG</dt><dd> 
Regular file 
</dd><dt>AE_IFLNK</dt><dd> 
Symbolic link 
</dd><dt>AE_IFSOCK</dt><dd> 
Socket 
</dd><dt>AE_IFCHR</dt><dd> 
Character device 
</dd><dt>AE_IFBLK</dt><dd> 
Block device 
</dd><dt>AE_IFDIR</dt><dd> 
Directory 
</dd><dt>AE_IFIFO</dt><dd> 
Named pipe (fifo) 
</dd></dl> 
Not all file types are supported by all platforms. 
The constants used by 
[[stat(2)|http://www.freebsd.org/cgi/man.cgi?query=stat&sektion=2]] 
may have different numeric values from the 
corresponding constants above. 

The functions 
'''archive_entry_mode'''() 
and 
'''archive_entry_set_mode'''() 
get/set a combination of file type and permissions and provide the 
equivalent of 
''st_mode''. 
Use of 
'''archive_entry_filetype'''() 
and 
'''archive_entry_perm'''() 
for getting and 
'''archive_entry_set_filetype'''() 
and 
'''archive_entry_set_perm'''() 
for setting is recommended. 

The function 
'''archive_entry_size'''() 
returns the file size, if it has been set, and 0 otherwise. 
'''archive_entry_size'''() 
can be used to query that status. 
'''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_nlinks'''() 
and set with 
'''archive_entry_set_nlinks'''(). 
=== Identifying unique files=== 
The functions 
'''archive_entry_dev'''() 
and 
'''archive_entry_ino64'''() 
are used by 
[[ManPageArchiveEntryLinkify3]] 
to find hardlinks. 
The pair of device and inode is supposed to identify hardlinked files. 

The device major and minor number can be obtained independently using 
'''archive_entry_devmajor'''() 
and 
'''archive_entry_devminor'''(). 
The device can be set 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'''(). 
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. 
=== 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. 
== SEE ALSO == 
[[ManPageArchiveEntryAcl3]], 
[[ManPageArchiveEntryPerms3]], 
[[ManPageArchiveEntryTime3]], 
[[ManPageLibarchive3]], 
[[stat(2)|http://www.freebsd.org/cgi/man.cgi?query=stat&sektion=2]]