Hurd select fixes.
[glibc.git] / posix / tar.h
blobe5e9901bdfae2f05d2705e5f3e67809e1a8b74db
1 /* Extended tar format from POSIX.1.
2 Copyright (C) 1992 Free Software Foundation, Inc.
3 Written by David J. MacKenzie.
5 This file is part of the GNU C Library.
7 The GNU C Library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public License as
9 published by the Free Software Foundation; either version 2 of the
10 License, or (at your option) any later version.
12 The GNU C Library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details.
17 You should have received a copy of the GNU Library General Public
18 License along with the GNU C Library; see the file COPYING.LIB. If
19 not, write to the, 1992 Free Software Foundation, Inc., 675 Mass Ave,
20 Cambridge, MA 02139, USA. */
22 #ifndef _TAR_H
24 #define _TAR_H 1
26 /* A tar archive consists of 512-byte blocks.
27 Each file in the archive has a header block followed by 0+ data blocks.
28 Two blocks of NUL bytes indicate the end of the archive. */
30 /* The fields of header blocks:
31 All strings are stored as ISO 646 (approximately ASCII) strings.
33 Fields are numeric unless otherwise noted below; numbers are ISO 646
34 representations of octal numbers, with leading zeros as needed.
36 linkname is only valid when typeflag==LNKTYPE. It doesn't use prefix;
37 files that are links to pathnames >100 chars long can not be stored
38 in a tar archive.
40 If typeflag=={LNKTYPE,SYMTYPE,DIRTYPE} then size must be 0.
42 devmajor and devminor are only valid for typeflag=={BLKTYPE,CHRTYPE}.
44 chksum contains the sum of all 512 bytes in the header block,
45 treating each byte as an 8-bit unsigned value and treating the
46 8 bytes of chksum as blank characters.
48 uname and gname are used in preference to uid and gid, if those
49 names exist locally.
51 Field Name Byte Offset Length in Bytes Field Type
52 name 0 100 NUL-terminated if NUL fits
53 mode 100 8
54 uid 108 8
55 gid 116 8
56 size 124 12
57 mtime 136 12
58 chksum 148 8
59 typeflag 156 1 see below
60 linkname 157 100 NUL-terminated if NUL fits
61 magic 257 6 must be TMAGIC (NUL term.)
62 version 263 2 must be TVERSION
63 uname 265 32 NUL-terminated
64 gname 297 32 NUL-terminated
65 devmajor 329 8
66 devminor 337 8
67 prefix 345 155 NUL-terminated if NUL fits
69 If the first character of prefix is '\0', the file name is name;
70 otherwise, it is prefix/name. Files whose pathnames don't fit in that
71 length can not be stored in a tar archive. */
73 /* The bits in mode: */
74 #define TSUID 04000
75 #define TSGID 02000
76 #define TSVTX 01000
77 #define TUREAD 00400
78 #define TUWRITE 00200
79 #define TUEXEC 00100
80 #define TGREAD 00040
81 #define TGWRITE 00020
82 #define TGEXEC 00010
83 #define TOREAD 00004
84 #define TOWRITE 00002
85 #define TOEXEC 00001
87 /* The values for typeflag:
88 Values 'A'-'Z' are reserved for custom implementations.
89 All other values are reserved for future POSIX.1 revisions. */
91 #define REGTYPE '0' /* Regular file (preferred code). */
92 #define AREGTYPE '\0' /* Regular file (alternate code). */
93 #define LNKTYPE '1' /* Hard link. */
94 #define SYMTYPE '2' /* Symbolic link (hard if not supported). */
95 #define CHRTYPE '3' /* Character special. */
96 #define BLKTYPE '4' /* Block special. */
97 #define DIRTYPE '5' /* Directory. */
98 #define FIFOTYPE '6' /* Named pipe. */
99 #define CONTTYPE '7' /* Contiguous file */
100 /* (regular file if not supported). */
102 /* Contents of magic field and its length. */
103 #define TMAGIC "ustar"
104 #define TMAGLEN 6
106 /* Contents of the version field and its length. */
107 #define TVERSION "00"
108 #define TVERSLEN 2
110 #endif /* tar.h */