ManPageArchiveEntryStat3.wiki 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. ARCHIVE_ENTRY_STAT(3) manual page
  2. == NAME ==
  3. '''archive_entry_stat''',
  4. '''archive_entry_copy_stat''',
  5. '''archive_entry_filetype''',
  6. '''archive_entry_set_filetype''',
  7. '''archive_entry_mode''',
  8. '''archive_entry_set_mode''',
  9. '''archive_entry_size''',
  10. '''archive_entry_size_is_set''',
  11. '''archive_entry_set_size''',
  12. '''archive_entry_unset_size''',
  13. '''archive_entry_dev''',
  14. '''archive_entry_set_dev''',
  15. '''archive_entry_dev_is_set''',
  16. '''archive_entry_devmajor''',
  17. '''archive_entry_set_devmajor''',
  18. '''archive_entry_devminor''',
  19. '''archive_entry_set_devminor''',
  20. '''archive_entry_ino''',
  21. '''archive_entry_set_ino''',
  22. '''archive_entry_ino_is_set''',
  23. '''archive_entry_ino64''',
  24. '''archive_entry_set_ino64''',
  25. '''archive_entry_nlink''',
  26. '''archive_entry_rdev''',
  27. '''archive_entry_set_rdev''',
  28. '''archive_entry_rdevmajor''',
  29. '''archive_entry_set_rdevmajor''',
  30. '''archive_entry_rdevminor''',
  31. '''archive_entry_set_rdevminor'''
  32. - accessor functions for manipulating archive entry descriptions
  33. == LIBRARY ==
  34. Streaming Archive Library (libarchive, -larchive)
  35. == SYNOPSIS ==
  36. '''<nowiki>#include <archive_entry.h></nowiki>'''
  37. <br>
  38. ''const struct stat *''
  39. <br>
  40. '''archive_entry_stat'''(''struct archive_entry *a'');
  41. <br>
  42. ''void''
  43. <br>
  44. '''archive_entry_copy_stat'''(''struct archive_entry *a'', ''const struct stat *sb'');
  45. <br>
  46. ''mode_t''
  47. <br>
  48. '''archive_entry_filetype'''(''struct archive_entry *a'');
  49. <br>
  50. ''void''
  51. <br>
  52. '''archive_entry_set_filetype'''(''struct archive_entry *a'', ''unsigned int type'');
  53. <br>
  54. ''mode_t''
  55. <br>
  56. '''archive_entry_mode'''(''struct archive_entry *a'');
  57. <br>
  58. ''void''
  59. <br>
  60. '''archive_entry_set_mode'''(''struct archive_entry *a'', ''mode_t mode'');
  61. <br>
  62. ''int64_t''
  63. <br>
  64. '''archive_entry_size'''(''struct archive_entry *a'');
  65. <br>
  66. ''int''
  67. <br>
  68. '''archive_entry_size_is_set'''(''struct archive_entry *a'');
  69. <br>
  70. ''void''
  71. <br>
  72. '''archive_entry_set_size'''(''struct archive_entry *a'', ''int64_t size'');
  73. <br>
  74. ''void''
  75. <br>
  76. '''archive_entry_unset_size'''(''struct archive_entry *a'');
  77. <br>
  78. ''dev_t''
  79. <br>
  80. '''archive_entry_dev'''(''struct archive_entry *a'');
  81. <br>
  82. ''void''
  83. <br>
  84. '''archive_entry_set_dev'''(''struct archive_entry *a'', ''dev_t dev'');
  85. <br>
  86. ''int''
  87. <br>
  88. '''archive_entry_dev_is_set'''(''struct archive_entry *a'');
  89. <br>
  90. ''dev_t''
  91. <br>
  92. '''archive_entry_devmajor'''(''struct archive_entry *a'');
  93. <br>
  94. ''void''
  95. <br>
  96. '''archive_entry_set_devmajor'''(''struct archive_entry *a'', ''dev_t major'');
  97. <br>
  98. ''dev_t''
  99. <br>
  100. '''archive_entry_devminor'''(''struct archive_entry *a'');
  101. <br>
  102. ''void''
  103. <br>
  104. '''archive_entry_set_devminor'''(''struct archive_entry *a'', ''dev_t minor'');
  105. <br>
  106. ''ino_t''
  107. <br>
  108. '''archive_entry_ino'''(''struct archive_entry *a'');
  109. <br>
  110. ''void''
  111. <br>
  112. '''archive_entry_set_ino'''(''struct archive_entry *a'', ''unsigned long ino'');
  113. <br>
  114. ''int''
  115. <br>
  116. '''archive_entry_ino_is_set'''(''struct archive_entry *a'');
  117. <br>
  118. ''int64_t''
  119. <br>
  120. '''archive_entry_ino64'''(''struct archive_entry *a'');
  121. <br>
  122. ''void''
  123. <br>
  124. '''archive_entry_set_ino64'''(''struct archive_entry *a'', ''int64_t ino'');
  125. <br>
  126. ''unsigned int''
  127. <br>
  128. '''archive_entry_nlink'''(''struct archive_entry *a'');
  129. <br>
  130. ''void''
  131. <br>
  132. '''archive_entry_set_nlink'''(''struct archive_entry *a'', ''unsigned int count'');
  133. <br>
  134. ''dev_t''
  135. <br>
  136. '''archive_entry_rdev'''(''struct archive_entry *a'');
  137. <br>
  138. ''dev_t''
  139. <br>
  140. '''archive_entry_rdevmajor'''(''struct archive_entry *a'');
  141. <br>
  142. ''dev_t''
  143. <br>
  144. '''archive_entry_rdevminor'''(''struct archive_entry *a'');
  145. <br>
  146. ''void''
  147. <br>
  148. '''archive_entry_set_rdev'''(''struct archive_entry *a'', ''dev_t dev'');
  149. <br>
  150. ''void''
  151. <br>
  152. '''archive_entry_set_rdevmajor'''(''struct archive_entry *a'', ''dev_t major'');
  153. <br>
  154. ''void''
  155. <br>
  156. '''archive_entry_set_rdevminor'''(''struct archive_entry *a'', ''dev_t minor'');
  157. == DESCRIPTION ==
  158. === Copying to and from ''struct'' stat===
  159. The function
  160. '''archive_entry_stat'''()
  161. converts the various fields stored in the archive entry to the format
  162. used by
  163. [[stat(2)|http://www.freebsd.org/cgi/man.cgi?query=stat&sektion=2]].
  164. The return value remains valid until either
  165. '''archive_entry_clear'''()
  166. or
  167. '''archive_entry_free'''()
  168. is called.
  169. It is not affected by calls to the set accessor functions.
  170. It currently sets the following values in
  171. ''struct'' stat:
  172. ''st_atime'',
  173. ''st_ctime'',
  174. ''st_dev'',
  175. ''st_gid'',
  176. ''st_ino'',
  177. ''st_mode'',
  178. ''st_mtime'',
  179. ''st_nlink'',
  180. ''st_rdev'',
  181. ''st_size'',
  182. ''st_uid''.
  183. In addition,
  184. ''st_birthtime''
  185. and high-precision information for time-related fields
  186. will be included on platforms that support it.
  187. The function
  188. '''archive_entry_copy_stat'''()
  189. copies fields from the platform's
  190. ''struct'' stat.
  191. Fields not provided by
  192. ''struct'' stat
  193. are unchanged.
  194. === General accessor functions===
  195. The functions
  196. '''archive_entry_filetype'''()
  197. and
  198. '''archive_entry_set_filetype'''()
  199. get respectively set the filetype.
  200. The file type is one of the following constants:
  201. <dl>
  202. <dt>AE_IFREG</dt><dd>
  203. Regular file
  204. </dd><dt>AE_IFLNK</dt><dd>
  205. Symbolic link
  206. </dd><dt>AE_IFSOCK</dt><dd>
  207. Socket
  208. </dd><dt>AE_IFCHR</dt><dd>
  209. Character device
  210. </dd><dt>AE_IFBLK</dt><dd>
  211. Block device
  212. </dd><dt>AE_IFDIR</dt><dd>
  213. Directory
  214. </dd><dt>AE_IFIFO</dt><dd>
  215. Named pipe (fifo)
  216. </dd></dl>
  217. Not all file types are supported by all platforms.
  218. The constants used by
  219. [[stat(2)|http://www.freebsd.org/cgi/man.cgi?query=stat&sektion=2]]
  220. may have different numeric values from the
  221. corresponding constants above.
  222. The functions
  223. '''archive_entry_mode'''()
  224. and
  225. '''archive_entry_set_mode'''()
  226. get/set a combination of file type and permissions and provide the
  227. equivalent of
  228. ''st_mode''.
  229. Use of
  230. '''archive_entry_filetype'''()
  231. and
  232. '''archive_entry_perm'''()
  233. for getting and
  234. '''archive_entry_set_filetype'''()
  235. and
  236. '''archive_entry_set_perm'''()
  237. for setting is recommended.
  238. The function
  239. '''archive_entry_size'''()
  240. returns the file size, if it has been set, and 0 otherwise.
  241. '''archive_entry_size'''()
  242. can be used to query that status.
  243. '''archive_entry_set_size'''()
  244. and
  245. '''archive_entry_unset_size'''()
  246. set and unset the size, respectively.
  247. The number of references (hardlinks) can be obtained by calling
  248. '''archive_entry_nlink'''()
  249. and set with
  250. '''archive_entry_set_nlink'''().
  251. === Identifying unique files===
  252. The functions
  253. '''archive_entry_dev'''()
  254. and
  255. '''archive_entry_ino64'''()
  256. are used by
  257. [[ManPageArchiveEntryLinkify3]]
  258. to find hardlinks.
  259. The pair of device and inode is supposed to identify hardlinked files.
  260. The device major and minor number can be obtained independently using
  261. '''archive_entry_devmajor'''()
  262. and
  263. '''archive_entry_devminor'''().
  264. The device can be set either via
  265. '''archive_entry_set_dev'''()
  266. or by the combination of major and minor number using
  267. '''archive_entry_set_devmajor'''()
  268. and
  269. '''archive_entry_set_devminor'''().
  270. The inode number can be obtained using
  271. '''archive_entry_ino'''().
  272. This is a legacy interface that uses the platform
  273. ''ino_t'',
  274. which may be very small.
  275. To set the inode number,
  276. '''archive_entry_set_ino64'''()
  277. is the preferred interface.
  278. === Accessor functions for block and character devices===
  279. Block and character devices are characterised either using a device number
  280. or a pair of major and minor number.
  281. The combined device number can be obtained with
  282. '''archive_device_rdev'''()
  283. and set with
  284. '''archive_device_set_rdev'''().
  285. The major and minor numbers are accessed by
  286. '''archive_device_rdevmajor'''(),
  287. '''archive_device_rdevminor'''()
  288. '''archive_device_set_rdevmajor'''()
  289. and
  290. '''archive_device_set_rdevminor'''().
  291. The process of splitting the combined device number into major and
  292. minor number and the reverse process of combing them differs between
  293. platforms.
  294. Some archive formats use the combined form, while other formats use
  295. the split form.
  296. == SEE ALSO ==
  297. [[stat(2)|http://www.freebsd.org/cgi/man.cgi?query=stat&sektion=2]],
  298. [[ManPageArchiveEntryAcl3]],
  299. [[ManPageArchiveEntryPerms3]],
  300. [[ManPageArchiveEntryTime3]],
  301. [[ManPageLibarchive3]]