Open System Services System Calls Reference Manual (G06.29+, H06.08+, J06.03+)
Files tar(4)
Symbolic constants used in the header block are defined in the header file /usr/include/tar.h.
The definitions are as follows:
#define TMAGIC "ustar" /* ustar and a null */
#define TMAGLEN 6
#define TVERSION "00" /* 00 and no null */
#define TVERSLEN 2
/* Values used in typeflag field */
#define REGTYPE ’0’ /* regular file */
#define AREGTYPE ’ ’ /* regular file */
#define LNKTYPE ’1’ /* line */
#define SYMTYPE ’2’ /* reserved */
#define CHRTYPE ’3’ /* character special */
#define BLKTYPE ’4’ /* block special */
#define DIRTYPE ’5’ /* directory */
#define FIFOTYPE ’6’ /* FIFO special */
#define CONTTYPE ’7’ /* reserved */
/* Bits used in the mode field - values in octal */
#define TSUID 04000 /* set UID on execution */
#define TSGID 02000 /* set GID on execution */
#define TSVTX 01000 /* reserved */
#define TUREAD 00400 /* read by owner */
#define TUWRITE 00200 /* write by owner */
#define TUEXEC 00100 /* execute/search by owner */
#define TGREAD 00040 /* read by group */
#define TGWRITE 00020 /* write by group */
#define TGEXEC 00010 /* execute/search by group */
#define TOREAD 00004 /* read by other */
#define TOWRITE 00002 /* write by other */
#define TOEXEC 00001 /* execute/search by other */
The fields in the header block must be contiguous; that is, no padding is used. Each character in
the archive file is stored contiguously.
The fields magic, uname, and gname are null-terminated character strings.
The fields name, linkname, and prefix are null-terminated character strings except when all the
characters in the field are nonnull characters, including the last character.
The version field is two bytes containing the characters "00" (ASCII zero-zero).
The typeflag field contains a single character.
All other fields are leading zero-filled octal numbers in ASCII. Each numeric field is terminated
by one or more space or null characters.
The name and prefix fields produce the pathname of the file. The hierarchical relationship of the
file is retained by specifying the pathname as a path prefix, a slash character, and the filename as
the suffix. If prefix contains nonnull characters, then the value of prefix, a slash character, and
the value of name are concatenated without modification or addition of new characters to pro-
duce a new pathname. In this manner, pathnames of at most 256 characters can be supported. If
a pathname does not fit in the space provided, the tar command notifies the user of the error and
no attempt is made to store any part of the file, header, or data in the archive.
The linkname field does not use prefix to produce a pathname. As such, linkname is limited to
99 characters. If the name does not fit in the space provided, the tar command notifies the user
527186-023 Hewlett-Packard Company 11−49