ManPageArchiveEntryPerms3.wiki 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. ARCHIVE_ENTRY_PERMS(3) manual page
  2. == NAME ==
  3. '''archive_entry_gid''',
  4. '''archive_entry_set_gid''',
  5. '''archive_entry_uid''',
  6. '''archive_entry_set_uid''',
  7. '''archive_entry_perm''',
  8. '''archive_entry_set_perm''',
  9. '''archive_entry_strmode''',
  10. '''archive_entry_uname''',
  11. '''archive_entry_uname_w''',
  12. '''archive_entry_set_uname''',
  13. '''archive_entry_copy_uname''',
  14. '''archive_entry_copy_uname_w''',
  15. '''archive_entry_update_uname_utf8''',
  16. '''archive_entry_gname''',
  17. '''archive_entry_gname_w''',
  18. '''archive_entry_set_gname''',
  19. '''archive_entry_copy_gname''',
  20. '''archive_entry_copy_gname_w''',
  21. '''archive_entry_update_gname_utf8''',
  22. '''archive_entry_fflags''',
  23. '''archive_entry_fflags_text''',
  24. '''archive_entry_set_fflags''',
  25. '''archive_entry_copy_fflags_text''',
  26. '''archive_entry_copy_fflags_text_w'''
  27. - functions for manipulating ownership and permissions in archive entry descriptions
  28. == LIBRARY ==
  29. Streaming Archive Library (libarchive, -larchive)
  30. == SYNOPSIS ==
  31. '''<nowiki>#include <archive_entry.h></nowiki>'''
  32. <br>
  33. ''gid_t''
  34. <br>
  35. '''archive_entry_gid'''(''struct archive_entry *a'');
  36. <br>
  37. ''void''
  38. <br>
  39. '''archive_entry_set_gid'''(''struct archive_entry *a'', ''gid_t gid'');
  40. <br>
  41. ''uid_t''
  42. <br>
  43. '''archive_entry_uid'''(''struct archive_entry *a'');
  44. <br>
  45. ''void''
  46. <br>
  47. '''archive_entry_set_uid'''(''struct archive_entry *a'', ''uid_t uid'');
  48. <br>
  49. ''mode_t''
  50. <br>
  51. '''archive_entry_perm'''(''struct archive_entry *a'');
  52. <br>
  53. ''void''
  54. <br>
  55. '''archive_entry_set_perm'''(''struct archive_entry *a'', ''mode_t mode'');
  56. <br>
  57. ''const char *''
  58. <br>
  59. '''archive_entry_strmode'''(''struct archive_entry *a'');
  60. <br>
  61. ''const char *''
  62. <br>
  63. '''archive_entry_gname'''(''struct archive_entry *a'');
  64. <br>
  65. ''const wchar_t *''
  66. <br>
  67. '''archive_entry_gname_w'''(''struct archive_entry *a'');
  68. <br>
  69. ''void''
  70. <br>
  71. '''archive_entry_set_gname'''(''struct archive_entry *a'', ''const char *a'');
  72. <br>
  73. ''void''
  74. <br>
  75. '''archive_entry_copy_gname'''(''struct archive_entry *a'', ''const char *name'');
  76. <br>
  77. ''void''
  78. <br>
  79. '''archive_entry_copy_gname_w'''(''struct archive_entry *a'', ''const wchar_t *name'');
  80. <br>
  81. ''int''
  82. <br>
  83. '''archive_entry_update_gname_utf8'''(''struct archive_entry *a'', ''const char *name'');
  84. <br>
  85. ''const char *''
  86. <br>
  87. '''archive_entry_uname'''(''struct archive_entry *a'');
  88. <br>
  89. ''const wchar_t *''
  90. <br>
  91. '''archive_entry_uname_w'''(''struct archive_entry *a'');
  92. <br>
  93. ''void''
  94. <br>
  95. '''archive_entry_set_uname'''(''struct archive_entry *a'', ''const char *name'');
  96. <br>
  97. ''void''
  98. <br>
  99. '''archive_entry_copy_uname'''(''struct archive_entry *a'', ''const char *name'');
  100. <br>
  101. ''void''
  102. <br>
  103. '''archive_entry_copy_uname_w'''(''struct archive_entry *a'', ''const wchar_t *name'');
  104. <br>
  105. ''int''
  106. <br>
  107. '''archive_entry_update_uname_utf8'''(''struct archive_entry *a'', ''const char *name'');
  108. <br>
  109. ''void''
  110. <br>
  111. '''archive_entry_fflags'''(''struct archive_entry *a'', ''unsigned long *set_bits'', ''unsigned long *clear_bits'');
  112. <br>
  113. ''const char *''
  114. <br>
  115. '''archive_entry_fflags_text'''(''struct archive_entry *a'');
  116. <br>
  117. ''void''
  118. <br>
  119. '''archive_entry_set_fflags'''(''struct archive_entry *a'', ''unsigned long set_bits'', ''unsigned long clear_bits'');
  120. <br>
  121. ''const char *''
  122. <br>
  123. '''archive_entry_copy_fflags_text'''(''struct archive_entry *a'', ''const char *text'');
  124. <br>
  125. ''const wchar_t *''
  126. <br>
  127. '''archive_entry_copy_fflags_text_w'''(''struct archive_entry *a'', ''const wchar_t *text'');
  128. == DESCRIPTION ==
  129. === User id, group id and mode===
  130. The functions
  131. '''archive_entry_uid'''(),
  132. '''archive_entry_gid'''(),
  133. and
  134. '''archive_entry_perm'''()
  135. can be used to extract the user id, group id and permission from the given entry.
  136. The corresponding functions
  137. '''archive_entry_set_uid'''(),
  138. '''archive_entry_set_gid'''(),
  139. and
  140. '''archive_entry_set_perm'''()
  141. store the given user id, group id and permission in the entry.
  142. The permission is also set as a side effect of calling
  143. '''archive_entry_set_mode'''().
  144. '''archive_entry_strmode'''()
  145. returns a string representation of the permission as used by the long mode of
  146. [[ls(1)|http://www.freebsd.org/cgi/man.cgi?query=ls&sektion=1]].
  147. === User and group name===
  148. User and group names can be provided in one of three different ways:
  149. <dl>
  150. <dt>char *</dt><dd>
  151. Multibyte strings in the current locale.
  152. </dd><dt>wchar_t *</dt><dd>
  153. Wide character strings in the current locale.
  154. The accessor functions are named
  155. '''XXX_w'''().
  156. </dd><dt>UTF-8</dt><dd>
  157. Unicode strings encoded as UTF-8.
  158. These are convenience functions to update both the multibyte and wide
  159. character strings at the same time.
  160. </dd></dl>
  161. '''archive_entry_set_XXX'''()
  162. is an alias for
  163. '''archive_entry_copy_XXX'''().
  164. === File Flags===
  165. File flags are transparently converted between a bitmap
  166. representation and a textual format.
  167. For example, if you set the bitmap and ask for text, the library
  168. will build a canonical text format.
  169. However, if you set a text format and request a text format,
  170. you will get back the same text, even if it is ill-formed.
  171. If you need to canonicalize a textual flags string, you should first set the
  172. text form, then request the bitmap form, then use that to set the bitmap form.
  173. Setting the bitmap format will clear the internal text representation
  174. and force it to be reconstructed when you next request the text form.
  175. The bitmap format consists of two integers, one containing bits
  176. that should be set, the other specifying bits that should be
  177. cleared.
  178. Bits not mentioned in either bitmap will be ignored.
  179. Usually, the bitmap of bits to be cleared will be set to zero.
  180. In unusual circumstances, you can force a fully-specified set
  181. of file flags by setting the bitmap of flags to clear to the complement
  182. of the bitmap of flags to set.
  183. (This differs from
  184. [[fflagstostr(3)|http://www.freebsd.org/cgi/man.cgi?query=fflagstostr&sektion=3]],
  185. which only includes names for set bits.)
  186. Converting a bitmap to a textual string is a platform-specific
  187. operation; bits that are not meaningful on the current platform
  188. will be ignored.
  189. The canonical text format is a comma-separated list of flag names.
  190. The
  191. '''archive_entry_copy_fflags_text'''()
  192. and
  193. '''archive_entry_copy_fflags_text_w'''()
  194. functions parse the provided text and set the internal bitmap values.
  195. This is a platform-specific operation; names that are not meaningful
  196. on the current platform will be ignored.
  197. The function returns a pointer to the start of the first name that was not
  198. recognized, or NULL if every name was recognized.
  199. Note that every name \(em including names that follow an unrecognized
  200. name \(em will be evaluated, and the bitmaps will be set to reflect
  201. every name that is recognized.
  202. (In particular, this differs from
  203. [[strtofflags(3)|http://www.freebsd.org/cgi/man.cgi?query=strtofflags&sektion=3]],
  204. which stops parsing at the first unrecognized name.)
  205. == SEE ALSO ==
  206. [[ManPageArchiveEntry3]],
  207. [[ManPageArchiveEntryAcl3]],
  208. [[ManPageArchiveReadDisk3]],
  209. [[ManPageArchiveWriteDisk3]],
  210. [[ManPageLibarchive3]]
  211. == BUGS ==
  212. The platform types
  213. ''uid_t''
  214. and
  215. ''gid_t''
  216. are often 16 or 32 bit wide.
  217. In this case it is possible that the ids can not be correctly restored
  218. from archives and get truncated.