1ARCHIVE_ENTRY_PERMS(3) BSD Library Functions Manual ARCHIVE_ENTRY_PERMS(3)
2
4 archive_entry_gid, archive_entry_set_gid, archive_entry_uid,
5 archive_entry_set_uid, archive_entry_perm, archive_entry_set_perm,
6 archive_entry_strmode, archive_entry_uname, archive_entry_uname_w,
7 archive_entry_set_uname, archive_entry_copy_uname,
8 archive_entry_copy_uname_w, archive_entry_update_uname_utf8,
9 archive_entry_gname, archive_entry_gname_w, archive_entry_set_gname,
10 archive_entry_copy_gname, archive_entry_copy_gname_w,
11 archive_entry_update_gname_utf8, archive_entry_fflags,
12 archive_entry_fflags_text, archive_entry_set_fflags,
13 archive_entry_copy_fflags_text, archive_entry_copy_fflags_text_w — func‐
14 tions for manipulating ownership and permissions in archive entry
15 descriptions
16
18 Streaming Archive Library (libarchive, -larchive)
19
21 #include <archive_entry.h>
22
23 gid_t
24 archive_entry_gid(struct archive_entry *a);
25
26 void
27 archive_entry_set_gid(struct archive_entry *a, gid_t gid);
28
29 uid_t
30 archive_entry_uid(struct archive_entry *a);
31
32 void
33 archive_entry_set_uid(struct archive_entry *a, uid_t uid);
34
35 mode_t
36 archive_entry_perm(struct archive_entry *a);
37
38 void
39 archive_entry_set_perm(struct archive_entry *a, mode_t mode);
40
41 const char *
42 archive_entry_strmode(struct archive_entry *a);
43
44 const char *
45 archive_entry_gname(struct archive_entry *a);
46
47 const wchar_t *
48 archive_entry_gname_w(struct archive_entry *a);
49
50 void
51 archive_entry_set_gname(struct archive_entry *a, const char *a);
52
53 void
54 archive_entry_copy_gname(struct archive_entry *a, const char *name);
55
56 void
57 archive_entry_copy_gname_w(struct archive_entry *a, const wchar_t *name);
58
59 int
60 archive_entry_update_gname_utf8(struct archive_entry *a,
61 const char *name);
62
63 const char *
64 archive_entry_uname(struct archive_entry *a);
65
66 const wchar_t *
67 archive_entry_uname_w(struct archive_entry *a);
68
69 void
70 archive_entry_set_uname(struct archive_entry *a, const char *name);
71
72 void
73 archive_entry_copy_uname(struct archive_entry *a, const char *name);
74
75 void
76 archive_entry_copy_uname_w(struct archive_entry *a, const wchar_t *name);
77
78 int
79 archive_entry_update_uname_utf8(struct archive_entry *a,
80 const char *name);
81
82 void
83 archive_entry_fflags(struct archive_entry *a, unsigned long *set_bits,
84 unsigned long *clear_bits);
85
86 const char *
87 archive_entry_fflags_text(struct archive_entry *a);
88
89 void
90 archive_entry_set_fflags(struct archive_entry *a, unsigned long set_bits,
91 unsigned long clear_bits);
92
93 const char *
94 archive_entry_copy_fflags_text(struct archive_entry *a,
95 const char *text);
96
97 const wchar_t *
98 archive_entry_copy_fflags_text_w(struct archive_entry *a,
99 const wchar_t *text);
100
102 User id, group id and mode
103 The functions archive_entry_uid(), archive_entry_gid(), and
104 archive_entry_perm() can be used to extract the user id, group id and
105 permission from the given entry. The corresponding functions
106 archive_entry_set_uid(), archive_entry_set_gid(), and
107 archive_entry_set_perm() store the given user id, group id and permission
108 in the entry. The permission is also set as side effect of calling
109 archive_entry_set_mode().
110
111 archive_entry_strmode() returns a string representation of the permission
112 as used by the long mode of ls(1).
113
114 User and group name
115 User and group names can be provided in one of three different ways:
116
117 char * Multibyte strings in the current locale.
118
119 wchar_t * Wide character strings in the current locale. The accessor
120 functions are named XXX_w().
121
122 UTF-8 Unicode strings encoded as UTF-8. This are convience func‐
123 tions to update both the multibyte and wide character strings
124 at the same time.
125
126 archive_entry_set_XXX() is an alias for archive_entry_copy_XXX().
127
128 File Flags
129 File flags are transparently converted between a bitmap representation
130 and a textual format. For example, if you set the bitmap and ask for
131 text, the library will build a canonical text format. However, if you
132 set a text format and request a text format, you will get back the same
133 text, even if it is ill-formed. If you need to canonicalize a textual
134 flags string, you should first set the text form, then request the bitmap
135 form, then use that to set the bitmap form. Setting the bitmap format
136 will clear the internal text representation and force it to be recon‐
137 structed when you next request the text form.
138
139 The bitmap format consists of two integers, one containing bits that
140 should be set, the other specifying bits that should be cleared. Bits
141 not mentioned in either bitmap will be ignored. Usually, the bitmap of
142 bits to be cleared will be set to zero. In unusual circumstances, you
143 can force a fully-specified set of file flags by setting the bitmap of
144 flags to clear to the complement of the bitmap of flags to set. (This
145 differs from fflagstostr(3), which only includes names for set bits.)
146 Converting a bitmap to a textual string is a platform-specific operation;
147 bits that are not meaningful on the current platform will be ignored.
148
149 The canonical text format is a comma-separated list of flag names. The
150 archive_entry_copy_fflags_text() and archive_entry_copy_fflags_text_w()
151 functions parse the provided text and sets the internal bitmap values.
152 This is a platform-specific operation; names that are not meaningful on
153 the current platform will be ignored. The function returns a pointer to
154 the start of the first name that was not recognized, or NULL if every
155 name was recognized. Note that every name — including names that follow
156 an unrecognized name — will be evaluated, and the bitmaps will be set to
157 reflect every name that is recognized. (In particular, this differs from
158 strtofflags(3), which stops parsing at the first unrecognized name.)
159
161 archive_entry(3), archive_entry_acl(3), archive_read_disk(3),
162 archive_write_disk(3) libarchive(3),
163
165 The platform types uid_t and gid_t are often 16 or 32 bit wide. In this
166 case it is possible that the ids can not be correctly restored from ar‐
167 chives and get truncated.
168
169BSD February 2, 2012 BSD