1 .\" Copyright (c) 2003-2007 Tim Kientzle
2 .\" Copyright (c) 2010 Joerg Sonnenberger
3 .\" All rights reserved.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\" notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\" notice, this list of conditions and the following disclaimer in the
12 .\" documentation and/or other materials provided with the distribution.
14 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 .Dt ARCHIVE_ENTRY_PERMS 3
30 .Nm archive_entry_gid ,
31 .Nm archive_entry_set_gid ,
32 .Nm archive_entry_uid ,
33 .Nm archive_entry_set_uid ,
34 .Nm archive_entry_perm ,
35 .Nm archive_entry_set_perm ,
36 .Nm archive_entry_strmode ,
37 .Nm archive_entry_uname ,
38 .Nm archive_entry_uname_w ,
39 .Nm archive_entry_set_uname ,
40 .Nm archive_entry_copy_uname ,
41 .Nm archive_entry_copy_uname_w ,
42 .Nm archive_entry_update_uname_utf8 ,
43 .Nm archive_entry_gname ,
44 .Nm archive_entry_gname_w ,
45 .Nm archive_entry_set_gname ,
46 .Nm archive_entry_copy_gname ,
47 .Nm archive_entry_copy_gname_w ,
48 .Nm archive_entry_update_gname_utf8 ,
49 .Nm archive_entry_fflags ,
50 .Nm archive_entry_fflags_text ,
51 .Nm archive_entry_set_fflags ,
52 .Nm archive_entry_copy_fflags_text ,
53 .Nm archive_entry_copy_fflags_text_w
54 .Nd functions for manipulating ownership and permissions in archive entry descriptions
56 Streaming Archive Library (libarchive, -larchive)
60 .Fn archive_entry_gid "struct archive_entry *a"
62 .Fn archive_entry_set_gid "struct archive_entry *a" "gid_t gid"
64 .Fn archive_entry_uid "struct archive_entry *a"
66 .Fn archive_entry_set_uid "struct archive_entry *a" "uid_t uid"
68 .Fn archive_entry_perm "struct archive_entry *a"
70 .Fn archive_entry_set_perm "struct archive_entry *a" "mode_t mode"
72 .Fn archive_entry_strmode "struct archive_entry *a"
74 .Fn archive_entry_gname "struct archive_entry *a"
76 .Fn archive_entry_gname_w "struct archive_entry *a"
78 .Fn archive_entry_set_gname "struct archive_entry *a" "const char *a"
80 .Fn archive_entry_copy_gname "struct archive_entry *a" "const char *name"
82 .Fn archive_entry_copy_gname_w "struct archive_entry *a" "const wchar_t *name"
84 .Fn archive_entry_update_gname_utf8 "struct archive_entry *a" "const char *name"
86 .Fn archive_entry_uname "struct archive_entry *a"
88 .Fn archive_entry_uname_w "struct archive_entry *a"
90 .Fn archive_entry_set_uname "struct archive_entry *a" "const char *name"
92 .Fn archive_entry_copy_uname "struct archive_entry *a" "const char *name"
94 .Fn archive_entry_copy_uname_w "struct archive_entry *a" "const wchar_t *name"
96 .Fn archive_entry_update_uname_utf8 "struct archive_entry *a" "const char *name"
98 .Fo archive_entry_fflags
99 .Fa "struct archive_entry *a"
100 .Fa "unsigned long *set_bits"
101 .Fa "unsigned long *clear_bits"
104 .Fn archive_entry_fflags_text "struct archive_entry *a"
106 .Fo archive_entry_set_fflags
107 .Fa "struct archive_entry *a"
108 .Fa "unsigned long set_bits"
109 .Fa "unsigned long clear_bits"
112 .Fn archive_entry_copy_fflags_text "struct archive_entry *a" "const char *text"
114 .Fn archive_entry_copy_fflags_text_w "struct archive_entry *a" "const wchar_t *text"
116 .Ss User id, group id and mode
118 .Fn archive_entry_uid ,
119 .Fn archive_entry_gid ,
121 .Fn archive_entry_perm
122 can be used to extract the user id, group id and permission from the given entry.
123 The corresponding functions
124 .Fn archive_entry_set_uid ,
125 .Fn archive_entry_set_gid ,
127 .Fn archive_entry_set_perm
128 store the given user id, group id and permission in the entry.
129 The permission is also set as a side effect of calling
130 .Fn archive_entry_set_mode .
132 .Fn archive_entry_strmode
133 returns a string representation of the permission as used by the long mode of
135 .Ss User and group name
136 User and group names can be provided in one of three different ways:
137 .Bl -tag -width "wchar_t *"
139 Multibyte strings in the current locale.
141 Wide character strings in the current locale.
142 The accessor functions are named
145 Unicode strings encoded as UTF-8.
146 These are convenience functions to update both the multibyte and wide
147 character strings at the same time.
150 .Fn archive_entry_set_XXX
152 .Fn archive_entry_copy_XXX .
154 File flags are transparently converted between a bitmap
155 representation and a textual format.
156 For example, if you set the bitmap and ask for text, the library
157 will build a canonical text format.
158 However, if you set a text format and request a text format,
159 you will get back the same text, even if it is ill-formed.
160 If you need to canonicalize a textual flags string, you should first set the
161 text form, then request the bitmap form, then use that to set the bitmap form.
162 Setting the bitmap format will clear the internal text representation
163 and force it to be reconstructed when you next request the text form.
165 The bitmap format consists of two integers, one containing bits
166 that should be set, the other specifying bits that should be
168 Bits not mentioned in either bitmap will be ignored.
169 Usually, the bitmap of bits to be cleared will be set to zero.
170 In unusual circumstances, you can force a fully-specified set
171 of file flags by setting the bitmap of flags to clear to the complement
172 of the bitmap of flags to set.
175 which only includes names for set bits.)
176 Converting a bitmap to a textual string is a platform-specific
177 operation; bits that are not meaningful on the current platform
180 The canonical text format is a comma-separated list of flag names.
182 .Fn archive_entry_copy_fflags_text
184 .Fn archive_entry_copy_fflags_text_w
185 functions parse the provided text and set the internal bitmap values.
186 This is a platform-specific operation; names that are not meaningful
187 on the current platform will be ignored.
188 The function returns a pointer to the start of the first name that was not
189 recognized, or NULL if every name was recognized.
190 Note that every name \(em including names that follow an unrecognized
191 name \(em will be evaluated, and the bitmaps will be set to reflect
192 every name that is recognized.
193 (In particular, this differs from
195 which stops parsing at the first unrecognized name.)
197 .Xr archive_entry 3 ,
198 .Xr archive_entry_acl 3 ,
199 .Xr archive_read_disk 3 ,
200 .Xr archive_write_disk 3 ,
207 are often 16 or 32 bit wide.
208 In this case it is possible that the ids can not be correctly restored
209 from archives and get truncated.