1<!-- Creator : groff version 1.22.4 --> 2<!-- CreationDate: Sun Aug 22 23:03:25 2021 --> 3<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 4"http://www.w3.org/TR/html4/loose.dtd"> 5<html> 6<head> 7<meta name="generator" content="groff -Thtml, see www.gnu.org"> 8<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> 9<meta name="Content-Style" content="text/css"> 10<style type="text/css"> 11 p { margin-top: 0; margin-bottom: 0; vertical-align: top } 12 pre { margin-top: 0; margin-bottom: 0; vertical-align: top } 13 table { margin-top: 0; margin-bottom: 0; vertical-align: top } 14 h1 { text-align: center } 15</style> 16<title></title> 17</head> 18<body> 19 20<hr> 21 22 23<p>ARCHIVE_ENTRY_STAT(3) BSD Library Functions Manual 24ARCHIVE_ENTRY_STAT(3)</p> 25 26<p style="margin-top: 1em"><b>NAME</b></p> 27 28<p style="margin-left:6%;"><b>archive_entry_stat</b>, 29<b>archive_entry_copy_stat</b>, 30<b>archive_entry_filetype</b>, 31<b>archive_entry_set_filetype</b>, 32<b>archive_entry_mode</b>, <b>archive_entry_set_mode</b>, 33<b>archive_entry_size</b>, <b>archive_entry_size_is_set</b>, 34<b>archive_entry_set_size</b>, 35<b>archive_entry_unset_size</b>, <b>archive_entry_dev</b>, 36<b>archive_entry_set_dev</b>, 37<b>archive_entry_dev_is_set</b>, 38<b>archive_entry_devmajor</b>, 39<b>archive_entry_set_devmajor</b>, 40<b>archive_entry_devminor</b>, 41<b>archive_entry_set_devminor</b>, <b>archive_entry_ino</b>, 42<b>archive_entry_set_ino</b>, 43<b>archive_entry_ino_is_set</b>, <b>archive_entry_ino64</b>, 44<b>archive_entry_set_ino64</b>, <b>archive_entry_nlink</b>, 45<b>archive_entry_rdev</b>, <b>archive_entry_set_rdev</b>, 46<b>archive_entry_rdevmajor</b>, 47<b>archive_entry_set_rdevmajor</b>, 48<b>archive_entry_rdevminor</b>, 49<b>archive_entry_set_rdevminor</b> — accessor 50functions for manipulating archive entry descriptions</p> 51 52<p style="margin-top: 1em"><b>LIBRARY</b></p> 53 54<p style="margin-left:6%;">Streaming Archive Library 55(libarchive, -larchive)</p> 56 57<p style="margin-top: 1em"><b>SYNOPSIS</b></p> 58 59<p style="margin-left:6%;"><b>#include 60<archive_entry.h></b></p> 61 62<p style="margin-left:6%; margin-top: 1em"><i>const struct 63stat *</i></p> 64 65 66<p style="margin-left:12%;"><b>archive_entry_stat</b>(<i>struct archive_entry *a</i>);</p> 67 68<p style="margin-left:6%; margin-top: 1em"><i>void</i></p> 69 70 71<p style="margin-left:12%;"><b>archive_entry_copy_stat</b>(<i>struct archive_entry *a</i>, 72<i>const struct stat *sb</i>);</p> 73 74 75<p style="margin-left:6%; margin-top: 1em"><i>mode_t</i></p> 76 77 78<p style="margin-left:12%;"><b>archive_entry_filetype</b>(<i>struct archive_entry *a</i>);</p> 79 80<p style="margin-left:6%; margin-top: 1em"><i>void</i></p> 81 82 83<p style="margin-left:12%;"><b>archive_entry_set_filetype</b>(<i>struct archive_entry *a</i>, 84<i>unsigned int type</i>);</p> 85 86 87<p style="margin-left:6%; margin-top: 1em"><i>mode_t</i></p> 88 89 90<p style="margin-left:12%;"><b>archive_entry_mode</b>(<i>struct archive_entry *a</i>);</p> 91 92<p style="margin-left:6%; margin-top: 1em"><i>void</i></p> 93 94 95<p style="margin-left:12%;"><b>archive_entry_set_mode</b>(<i>struct archive_entry *a</i>, 96<i>mode_t mode</i>);</p> 97 98 99<p style="margin-left:6%; margin-top: 1em"><i>int64_t</i></p> 100 101 102<p style="margin-left:12%;"><b>archive_entry_size</b>(<i>struct archive_entry *a</i>);</p> 103 104<p style="margin-left:6%; margin-top: 1em"><i>int</i></p> 105 106 107<p style="margin-left:12%;"><b>archive_entry_size_is_set</b>(<i>struct archive_entry *a</i>);</p> 108 109<p style="margin-left:6%; margin-top: 1em"><i>void</i></p> 110 111 112<p style="margin-left:12%;"><b>archive_entry_set_size</b>(<i>struct archive_entry *a</i>, 113<i>int64_t size</i>);</p> 114 115<p style="margin-left:6%; margin-top: 1em"><i>void</i></p> 116 117 118<p style="margin-left:12%;"><b>archive_entry_unset_size</b>(<i>struct archive_entry *a</i>);</p> 119 120 121<p style="margin-left:6%; margin-top: 1em"><i>dev_t</i></p> 122 123 124<p style="margin-left:12%;"><b>archive_entry_dev</b>(<i>struct archive_entry *a</i>);</p> 125 126<p style="margin-left:6%; margin-top: 1em"><i>void</i></p> 127 128 129<p style="margin-left:12%;"><b>archive_entry_set_dev</b>(<i>struct archive_entry *a</i>, 130<i>dev_t dev</i>);</p> 131 132<p style="margin-left:6%; margin-top: 1em"><i>int</i></p> 133 134 135<p style="margin-left:12%;"><b>archive_entry_dev_is_set</b>(<i>struct archive_entry *a</i>);</p> 136 137 138<p style="margin-left:6%; margin-top: 1em"><i>dev_t</i></p> 139 140 141<p style="margin-left:12%;"><b>archive_entry_devmajor</b>(<i>struct archive_entry *a</i>);</p> 142 143<p style="margin-left:6%; margin-top: 1em"><i>void</i></p> 144 145 146<p style="margin-left:12%;"><b>archive_entry_set_devmajor</b>(<i>struct archive_entry *a</i>, 147<i>dev_t major</i>);</p> 148 149 150<p style="margin-left:6%; margin-top: 1em"><i>dev_t</i></p> 151 152 153<p style="margin-left:12%;"><b>archive_entry_devminor</b>(<i>struct archive_entry *a</i>);</p> 154 155<p style="margin-left:6%; margin-top: 1em"><i>void</i></p> 156 157 158<p style="margin-left:12%;"><b>archive_entry_set_devminor</b>(<i>struct archive_entry *a</i>, 159<i>dev_t minor</i>);</p> 160 161 162<p style="margin-left:6%; margin-top: 1em"><i>ino_t</i></p> 163 164 165<p style="margin-left:12%;"><b>archive_entry_ino</b>(<i>struct archive_entry *a</i>);</p> 166 167<p style="margin-left:6%; margin-top: 1em"><i>void</i></p> 168 169 170<p style="margin-left:12%;"><b>archive_entry_set_ino</b>(<i>struct archive_entry *a</i>, 171<i>unsigned long ino</i>);</p> 172 173<p style="margin-left:6%; margin-top: 1em"><i>int</i></p> 174 175 176<p style="margin-left:12%;"><b>archive_entry_ino_is_set</b>(<i>struct archive_entry *a</i>);</p> 177 178 179<p style="margin-left:6%; margin-top: 1em"><i>int64_t</i></p> 180 181 182<p style="margin-left:12%;"><b>archive_entry_ino64</b>(<i>struct archive_entry *a</i>);</p> 183 184<p style="margin-left:6%; margin-top: 1em"><i>void</i></p> 185 186 187<p style="margin-left:12%;"><b>archive_entry_set_ino64</b>(<i>struct archive_entry *a</i>, 188<i>int64_t ino</i>);</p> 189 190<p style="margin-left:6%; margin-top: 1em"><i>unsigned 191int</i></p> 192 193 194<p style="margin-left:12%;"><b>archive_entry_nlink</b>(<i>struct archive_entry *a</i>);</p> 195 196<p style="margin-left:6%; margin-top: 1em"><i>void</i></p> 197 198 199<p style="margin-left:12%;"><b>archive_entry_set_nlink</b>(<i>struct archive_entry *a</i>, 200<i>unsigned int count</i>);</p> 201 202 203<p style="margin-left:6%; margin-top: 1em"><i>dev_t</i></p> 204 205 206<p style="margin-left:12%;"><b>archive_entry_rdev</b>(<i>struct archive_entry *a</i>);</p> 207 208 209<p style="margin-left:6%; margin-top: 1em"><i>dev_t</i></p> 210 211 212<p style="margin-left:12%;"><b>archive_entry_rdevmajor</b>(<i>struct archive_entry *a</i>);</p> 213 214 215<p style="margin-left:6%; margin-top: 1em"><i>dev_t</i></p> 216 217 218<p style="margin-left:12%;"><b>archive_entry_rdevminor</b>(<i>struct archive_entry *a</i>);</p> 219 220<p style="margin-left:6%; margin-top: 1em"><i>void</i></p> 221 222 223<p style="margin-left:12%;"><b>archive_entry_set_rdev</b>(<i>struct archive_entry *a</i>, 224<i>dev_t dev</i>);</p> 225 226<p style="margin-left:6%; margin-top: 1em"><i>void</i></p> 227 228 229<p style="margin-left:12%;"><b>archive_entry_set_rdevmajor</b>(<i>struct archive_entry *a</i>, 230<i>dev_t major</i>);</p> 231 232<p style="margin-left:6%; margin-top: 1em"><i>void</i></p> 233 234 235<p style="margin-left:12%;"><b>archive_entry_set_rdevminor</b>(<i>struct archive_entry *a</i>, 236<i>dev_t minor</i>);</p> 237 238<p style="margin-top: 1em"><b>DESCRIPTION</b></p> 239 240<p style="margin-left:6%;"><b>Copying to and from</b> 241<i>struct stat</i> <br> 242The function <b>archive_entry_stat</b>() converts the 243various fields stored in the archive entry to the format 244used by stat(2). The return value remains valid until either 245<b>archive_entry_clear</b>() or <b>archive_entry_free</b>() 246is called. It is not affected by calls to the set accessor 247functions. It currently sets the following values in 248<i>struct stat</i>: <i>st_atime</i>, <i>st_ctime</i>, 249<i>st_dev</i>, <i>st_gid</i>, <i>st_ino</i>, <i>st_mode</i>, 250<i>st_mtime</i>, <i>st_nlink</i>, <i>st_rdev</i>, 251<i>st_size</i>, <i>st_uid</i>. In addition, 252<i>st_birthtime</i> and high-precision information for 253time-related fields will be included on platforms that 254support it.</p> 255 256<p style="margin-left:6%; margin-top: 1em">The function 257<b>archive_entry_copy_stat</b>() copies fields from the 258platform’s <i>struct stat</i>. Fields not provided by 259<i>struct stat</i> are unchanged.</p> 260 261<p style="margin-left:6%; margin-top: 1em"><b>General 262accessor functions</b> <br> 263The functions <b>archive_entry_filetype</b>() and 264<b>archive_entry_set_filetype</b>() get respectively set the 265filetype. The file type is one of the following 266constants:</p> 267 268<p>AE_IFREG</p> 269 270<p style="margin-left:28%; margin-top: 1em">Regular 271file</p> 272 273<p>AE_IFLNK</p> 274 275<p style="margin-left:28%; margin-top: 1em">Symbolic 276link</p> 277 278<p>AE_IFSOCK</p> 279 280<p style="margin-left:28%; margin-top: 1em">Socket</p> 281 282<p>AE_IFCHR</p> 283 284<p style="margin-left:28%; margin-top: 1em">Character 285device</p> 286 287<p>AE_IFBLK</p> 288 289<p style="margin-left:28%; margin-top: 1em">Block 290device</p> 291 292<p>AE_IFDIR</p> 293 294<p style="margin-left:28%; margin-top: 1em">Directory</p> 295 296<p>AE_IFIFO</p> 297 298<p style="margin-left:28%; margin-top: 1em">Named pipe 299(fifo)</p> 300 301<p style="margin-left:6%;">Not all file types are supported 302by all platforms. The constants used by stat(2) may have 303different numeric values from the corresponding constants 304above.</p> 305 306<p style="margin-left:6%; margin-top: 1em">The functions 307<b>archive_entry_mode</b>() and 308<b>archive_entry_set_mode</b>() get/set a combination of 309file type and permissions and provide the equivalent of 310<i>st_mode</i>. Use of <b>archive_entry_filetype</b>() and 311<b>archive_entry_perm</b>() for getting and 312<b>archive_entry_set_filetype</b>() and 313<b>archive_entry_set_perm</b>() for setting is 314recommended.</p> 315 316<p style="margin-left:6%; margin-top: 1em">The function 317<b>archive_entry_size</b>() returns the file size, if it has 318been set, and 0 otherwise. <b>archive_entry_size</b>() can 319be used to query that status. 320<b>archive_entry_set_size</b>() and 321<b>archive_entry_unset_size</b>() set and unset the size, 322respectively.</p> 323 324<p style="margin-left:6%; margin-top: 1em">The number of 325references (hardlinks) can be obtained by calling 326<b>archive_entry_nlink</b>() and set with 327<b>archive_entry_set_nlink</b>().</p> 328 329<p style="margin-left:6%; margin-top: 1em"><b>Identifying 330unique files</b> <br> 331The functions <b>archive_entry_dev</b>() and 332<b>archive_entry_ino64</b>() are used by 333archive_entry_linkify(3) to find hardlinks. The pair of 334device and inode is supposed to identify hardlinked 335files.</p> 336 337<p style="margin-left:6%; margin-top: 1em">The device major 338and minor number can be obtained independently using 339<b>archive_entry_devmajor</b>() and 340<b>archive_entry_devminor</b>(). The device can be set 341either via <b>archive_entry_set_dev</b>() or by the 342combination of major and minor number using 343<b>archive_entry_set_devmajor</b>() and 344<b>archive_entry_set_devminor</b>().</p> 345 346<p style="margin-left:6%; margin-top: 1em">The inode number 347can be obtained using <b>archive_entry_ino</b>(). This is a 348legacy interface that uses the platform <i>ino_t</i>, which 349may be very small. To set the inode number, 350<b>archive_entry_set_ino64</b>() is the preferred 351interface.</p> 352 353<p style="margin-left:6%; margin-top: 1em"><b>Accessor 354functions for block and character devices</b> <br> 355Block and character devices are characterised either using a 356device number or a pair of major and minor number. The 357combined device number can be obtained with 358<b>archive_device_rdev</b>() and set with 359<b>archive_device_set_rdev</b>(). The major and minor 360numbers are accessed by <b>archive_device_rdevmajor</b>(), 361<b>archive_device_rdevminor</b>() 362<b>archive_device_set_rdevmajor</b>() and 363<b>archive_device_set_rdevminor</b>().</p> 364 365<p style="margin-left:6%; margin-top: 1em">The process of 366splitting the combined device number into major and minor 367number and the reverse process of combing them differs 368between platforms. Some archive formats use the combined 369form, while other formats use the split form.</p> 370 371<p style="margin-top: 1em"><b>SEE ALSO</b></p> 372 373<p style="margin-left:6%;">stat(2), archive_entry_acl(3), 374archive_entry_perms(3), archive_entry_time(3), 375libarchive(3)</p> 376 377<p style="margin-left:6%; margin-top: 1em">BSD 378February 2, 2012 BSD</p> 379<hr> 380</body> 381</html> 382