summaryrefslogtreecommitdiff
path: root/archivers/libarchive/files/doc/man/archive_entry_stat.3
blob: 5b58c0e67efa3bd49289ca35c569603cd508f7fc (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
309
310
311
312
313
314
315
316
317
318
319
320
.TH ARCHIVE_ENTRY_STAT 3 "February 2, 2012" ""
.SH NAME
.ad l
\fB\%archive_entry_stat\fP,
\fB\%archive_entry_copy_stat\fP,
\fB\%archive_entry_filetype\fP,
\fB\%archive_entry_set_filetype\fP,
\fB\%archive_entry_mode\fP,
\fB\%archive_entry_set_mode\fP,
\fB\%archive_entry_size\fP,
\fB\%archive_entry_size_is_set\fP,
\fB\%archive_entry_set_size\fP,
\fB\%archive_entry_unset_size\fP,
\fB\%archive_entry_dev\fP,
\fB\%archive_entry_set_dev\fP,
\fB\%archive_entry_dev_is_set\fP,
\fB\%archive_entry_devmajor\fP,
\fB\%archive_entry_set_devmajor\fP,
\fB\%archive_entry_devminor\fP,
\fB\%archive_entry_set_devminor\fP,
\fB\%archive_entry_ino\fP,
\fB\%archive_entry_set_ino\fP,
\fB\%archive_entry_ino_is_set\fP,
\fB\%archive_entry_ino64\fP,
\fB\%archive_entry_set_ino64\fP,
\fB\%archive_entry_nlink\fP,
\fB\%archive_entry_rdev\fP,
\fB\%archive_entry_set_rdev\fP,
\fB\%archive_entry_rdevmajor\fP,
\fB\%archive_entry_set_rdevmajor\fP,
\fB\%archive_entry_rdevminor\fP,
\fB\%archive_entry_set_rdevminor\fP,
\- accessor functions for manipulating archive entry descriptions
.SH LIBRARY
.ad l
Streaming Archive Library (libarchive, -larchive)
.SH SYNOPSIS
.ad l
\fB#include <archive_entry.h>\fP
.br
\fIconst struct stat *\fP
.br
\fB\%archive_entry_stat\fP(\fI\%struct\ archive_entry\ *a\fP);
.br
\fIvoid\fP
.br
\fB\%archive_entry_copy_stat\fP(\fI\%struct\ archive_entry\ *a\fP, \fI\%const\ struct\ stat\ *sb\fP);
.br
\fImode_t\fP
.br
\fB\%archive_entry_filetype\fP(\fI\%struct\ archive_entry\ *a\fP);
.br
\fIvoid\fP
.br
\fB\%archive_entry_set_filetype\fP(\fI\%struct\ archive_entry\ *a\fP, \fI\%unsigned\ int\ type\fP);
.br
\fImode_t\fP
.br
\fB\%archive_entry_mode\fP(\fI\%struct\ archive_entry\ *a\fP);
.br
\fIvoid\fP
.br
\fB\%archive_entry_set_mode\fP(\fI\%struct\ archive_entry\ *a\fP, \fI\%mode_t\ mode\fP);
.br
\fIint64_t\fP
.br
\fB\%archive_entry_size\fP(\fI\%struct\ archive_entry\ *a\fP);
.br
\fIint\fP
.br
\fB\%archive_entry_size_is_set\fP(\fI\%struct\ archive_entry\ *a\fP);
.br
\fIvoid\fP
.br
\fB\%archive_entry_set_size\fP(\fI\%struct\ archive_entry\ *a\fP, \fI\%int64_t\ size\fP);
.br
\fIvoid\fP
.br
\fB\%archive_entry_unset_size\fP(\fI\%struct\ archive_entry\ *a\fP);
.br
\fIdev_t\fP
.br
\fB\%archive_entry_dev\fP(\fI\%struct\ archive_entry\ *a\fP);
.br
\fIvoid\fP
.br
\fB\%archive_entry_set_dev\fP(\fI\%struct\ archive_entry\ *a\fP, \fI\%dev_t\ dev\fP);
.br
\fIint\fP
.br
\fB\%archive_entry_dev_is_set\fP(\fI\%struct\ archive_entry\ *a\fP);
.br
\fIdev_t\fP
.br
\fB\%archive_entry_devmajor\fP(\fI\%struct\ archive_entry\ *a\fP);
.br
\fIvoid\fP
.br
\fB\%archive_entry_set_devmajor\fP(\fI\%struct\ archive_entry\ *a\fP, \fI\%dev_t\ major\fP);
.br
\fIdev_t\fP
.br
\fB\%archive_entry_devminor\fP(\fI\%struct\ archive_entry\ *a\fP);
.br
\fIvoid\fP
.br
\fB\%archive_entry_set_devminor\fP(\fI\%struct\ archive_entry\ *a\fP, \fI\%dev_t\ minor\fP);
.br
\fIino_t\fP
.br
\fB\%archive_entry_ino\fP(\fI\%struct\ archive_entry\ *a\fP);
.br
\fIvoid\fP
.br
\fB\%archive_entry_set_ino\fP(\fI\%struct\ archive_entry\ *a\fP, \fI\%unsigned\ long\ ino\fP);
.br
\fIint\fP
.br
\fB\%archive_entry_ino_is_set\fP(\fI\%struct\ archive_entry\ *a\fP);
.br
\fIint64_t\fP
.br
\fB\%archive_entry_ino64\fP(\fI\%struct\ archive_entry\ *a\fP);
.br
\fIvoid\fP
.br
\fB\%archive_entry_set_ino64\fP(\fI\%struct\ archive_entry\ *a\fP, \fI\%int64_t\ ino\fP);
.br
\fIunsigned int\fP
.br
\fB\%archive_entry_nlink\fP(\fI\%struct\ archive_entry\ *a\fP);
.br
\fIvoid\fP
.br
\fB\%archive_entry_set_nlink\fP(\fI\%struct\ archive_entry\ *a\fP, \fI\%unsigned\ int\ count\fP);
.br
\fIdev_t\fP
.br
\fB\%archive_entry_rdev\fP(\fI\%struct\ archive_entry\ *a\fP);
.br
\fIdev_t\fP
.br
\fB\%archive_entry_rdevmajor\fP(\fI\%struct\ archive_entry\ *a\fP);
.br
\fIdev_t\fP
.br
\fB\%archive_entry_rdevminor\fP(\fI\%struct\ archive_entry\ *a\fP);
.br
\fIvoid\fP
.br
\fB\%archive_entry_set_rdev\fP(\fI\%struct\ archive_entry\ *a\fP, \fI\%dev_t\ dev\fP);
.br
\fIvoid\fP
.br
\fB\%archive_entry_set_rdevmajor\fP(\fI\%struct\ archive_entry\ *a\fP, \fI\%dev_t\ major\fP);
.br
\fIvoid\fP
.br
\fB\%archive_entry_set_rdevminor\fP(\fI\%struct\ archive_entry\ *a\fP, \fI\%dev_t\ minor\fP);
.SH DESCRIPTION
.ad l
.SS Copying to and from Vt struct stat
The function
\fB\%archive_entry_stat\fP()
converts the various fields stored in the archive entry to the format
used by
\fBstat\fP(2).
The return value remains valid until either
\fB\%archive_entry_clear\fP()
or
\fB\%archive_entry_free\fP()
is called.
It is not affected by calls to the set accessor functions.
It currently sets the following values in
Vt struct stat:
Vt st_atime,
Vt st_ctime,
Vt st_dev,
Vt st_gid,
Vt st_ino,
Vt st_mode,
Vt st_mtime,
Vt st_nlink,
Vt st_rdev,
Vt st_size,
Vt st_uid.
In addition,
Vt st_birthtime
and high-precision information for time-related fields
will be included on platforms that support it.
.PP
The function
\fB\%archive_entry_copy_stat\fP()
copies fields from the platform's
Vt struct stat.
Fields not provided by
Vt struct stat
are unchanged.
.SS General accessor functions
The functions
\fB\%archive_entry_filetype\fP()
and
\fB\%archive_entry_set_filetype\fP()
get respectively set the filetype.
The file type is one of the following constants:
.RS 5
.TP
AE_IFREG
Regular file
.TP
AE_IFLNK
Symbolic link
.TP
AE_IFSOCK
Socket
.TP
AE_IFCHR
Character device
.TP
AE_IFBLK
Block device
.TP
AE_IFDIR
Directory
.TP
AE_IFIFO
Named pipe (fifo)
.RE
Not all file types are supported by all platforms.
The constants used by
\fBstat\fP(2)
may have different numeric values from the
corresponding constants above.
.PP
The functions
\fB\%archive_entry_mode\fP()
and
\fB\%archive_entry_set_mode\fP()
get/set a combination of file type and permissions and provide the
equivalent of
\fIst_mode\fP.
Use of
\fB\%archive_entry_filetype\fP()
and
\fB\%archive_entry_perm\fP()
for getting and
\fB\%archive_entry_set_filetype\fP()
and
\fB\%archive_entry_set_perm\fP()
for setting is recommended.
.PP
The function
\fB\%archive_entry_size\fP()
returns the file size, if it has been set, and 0 otherwise.
\fB\%archive_entry_size\fP()
can be used to query that status.
\fB\%archive_entry_set_size\fP()
and
\fB\%archive_entry_unset_size\fP()
set and unset the size, respectively.
.PP
The number of references (hardlinks) can be obtained by calling
\fB\%archive_entry_nlinks\fP()
and set with
\fB\%archive_entry_set_nlinks\fP().
.SS Identifying unique files
The functions
\fB\%archive_entry_dev\fP()
and
\fB\%archive_entry_ino64\fP()
are used by
\fBarchive_entry_linkify\fP(3)
to find hardlinks.
The pair of device and inode is supposed to identify hardlinked files.
.PP
The device major and minor number can be obtained independently using
\fB\%archive_entry_devmajor\fP()
and
\fB\%archive_entry_devminor\fP().
The device can be set either via
\fB\%archive_entry_set_dev\fP()
or by the combination of major and minor number using
\fB\%archive_entry_set_devmajor\fP()
and
\fB\%archive_entry_set_devminor\fP().
.PP
The inode number can be obtained using
\fB\%archive_entry_ino\fP().
This is a legacy interface that uses the platform
Vt ino_t,
which may be very small.
To set the inode number,
\fB\%archive_entry_set_ino64\fP()
is the preferred interface.
.SS 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
\fB\%archive_device_rdev\fP()
and set with
\fB\%archive_device_set_rdev\fP().
The major and minor numbers are accessed by
\fB\%archive_device_rdevmajor\fP(),
\fB\%archive_device_rdevminor\fP()
\fB\%archive_device_set_rdevmajor\fP()
and
\fB\%archive_device_set_rdevminor\fP().
.PP
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.
.SH SEE ALSO
.ad l
\fBarchive_entry_acl\fP(3),
\fBarchive_entry_perms\fP(3),
\fBarchive_entry_time\fP(3),
\fBlibarchive\fP(3),
\fBstat\fP(2)