Text preview for : UNIX_Programmers_Manual_2ed_Jun72.pdf part of AT&T UNIX Programmers Manual 2ed Jun72 AT&T unix 2nd_Edition UNIX_Programmers_Manual_2ed_Jun72.pdf



Back to : UNIX_Programmers_Manual_2 | Home

UNIX PROGRAMMER'S MANUAL
Second Edition



K. Thompson
D. M. Ritchie



Jun e 1 2 , 1 972




Copyright @ 1972
Bell Telephone Laboratories, Inc.
No part of this document may pe reproduced,
_ or distributed outside the Laboratories, without
t.he written permission of Bell Telephone Laboratories.
PREFACE
to the Second Edition

In the months since this manual first appeared, many changes have
occurred both in the system itself and in the way it is used.
Perhaps most obviously, there have been additions, deletions, and
modifications to the system and its software. It is these
changes, of course, that caused the appearance of this revised
manual.
Second, the number of pe::>ple spending an appreciabl e amount of
time writing UNIX software has increased. Credit is due to
L. L. Cherry, M. D. McIlroy, L. E. McMahon, R. Morris, and
J. F. Ossanna for their contributions.
Finally, the number of UNIX installations has grown to 10, with
more expected. None of these has exactly the same complement of
hardware or software. Therefore, at any particular installation,
it is quite possible that this manual will give inappropriate
information. One area to watch concerns commands which deal with
special files (I/O devices). Another is places which talk about
such things as absolute core locations which are likely to vary
with the memory configuration and existence of protection
hardware. Also, not all installations have the latest versions
of all the software. In particular, the assembler and loader
have just undergone major reorganizations in anticipation of a
UNIX for the PDP-11/45.




- ii -
INTRODUCT ION

This manual gives descriptions of the publicly available features
of UNIX. It provides neither a general overview (see "The UNIX
Time-sharing system" for that) nor details of the implementation
of the system (which remain to be disclosed).
Within the area it surveys, this manual attempts to be as com-
pI ete and timely as possibl e. A conscious decision was made to
describe each program in exactly the state it was in at the time
its manual section was prepared. In particular, the desire to
describe something as it should be, not as it is, was resisted.
Inevitably, this mea"ns that many sections will soon be out of
date. (The rate of change of the system is so great that a
dismayingly large number of early sections had to be modified
while the rest were being written. The unbounded effort required
to stay up-to-date is best indicated by the fact that several of
the programs described were written specifically to aid in
preparation of this manual!)
This manual is divided into seven sections:

I. ():)mmands
II. System calls
III. SUbroutines
N. Special files
V. File formats
VI. User-maintained programs
VII. Miscellaneous
Cbmmands are programs intended to be invoked directly by the
user, in contradistinction to subroutines, which are intended to
be called by the user's programs. Commands generally reside in
directory /bin (for binary programs). This directory is searched
automatically by the command line interpreter. Some prog.rams
classified as commands are located elsewhere; this fact is indi-
cated in the appropriate sections.
System calls are entries into the UNIX supervisor. In assembly
language, they are code:l with the use of the opcode " sys " , a
synonym for the trap instruction.
A small assortment of subroutines is available; they are
described in sect ion III. The binary form of most of them is
kept in the system library /usr/lib/liba.a.
The special files section IV discusses the characteristics of
each system "file" which actually refers to an I/O device.
The file formats section V documents the structure of" particular
kinds of" files; for example, the form of the output of the loader
and assembler is given. Excluded are files used by only one com-
mand, for example the assembler's intermediate files.

- iii -
User-maintained progr~s (section VI) are not considered part of
the UNIX system, and the principal reason for listing them is to
indicate their existence without necessarily giving a complete
description. The author should be consulted for information.
The miscellaneous section (VII) gathers odds and ends.


Each section consists of a number of independent entries of a
page or so each. The name of the entry is in the upper right
corner of its pages, its preparation date in the upper left.
Entries within each section are alphabetized. It was thought
better to avoid running page numbers, since it is hoped that the
manual will be updated frequently. Therefore each entry is nun-
bered st art ing at page 1.

All entries ha~e a common format.
The ~ section repeats the entry name and gives a very
short description of its purpose.

The synopsis summarizes the use of the program being
described. A few conventions are used, particularly in the
COmmands section:

Underlined words are considered literals, and are typed
just as th ey app ear.
Square brackets ([J) around an argument indicate that the
. .
argument is optional. When an argument is given as
name , it always refers to a file name.
Ell ipses ....... ar e used to show that the pr evious
argument-prototype may be repeated.

.. - .
A final convention is used by the commands themselves.
An argument beginning with a minus sign is often tak-
en to mean some sort of flag argument even if it appears
in a position where a file name could appear. Therefore,
it is unwise to have f il es whose names bEgin wi th - .
....
The description section discusses in detail the subject at
hand.
The files section gives the names of files which are built
into the program.
A ~ ~ section gives pOinters to related information.

A diaqnostics section discusses the diagnostics that may be
produced. This section tends to be as terse as the diagnos-
tics themselves.

The ~ section gives known bugs and sometimes deficien-
cies. OCcasionally also the suggested fix is described.


- iv -
The owner section gives the name of the person or persons to
be consulted in case of difficulty. The rule has been that
the last one to modify something owns it, so the owner is
not necessarily the author. The owner's nicknames stand
for:
ken K. Thompson
dmr D. M. Ritchie
jfo J. F. Qssanna
rhm R. Morr is
doug M. D. McIlroy
lem L. E. McMahon
llc L. L. Cherry
csr c. s. Robert s
These nicknames also happen to be UNIX user ID's, so mes-
sages may be transmitted by the !!!S!l command or, if the
addressee is logged in,' by write.
At the be:.;Jinning of this document is a table of contents, organ-
ized by section and alphabetically within each section. There is
also a permuted index derived from the table of contents. Within
each index 'entry, the title of the writeup to which it refers is
followed by the appropriate section number in parentheses. This
fact is important because there. is considerable name duplication
among the sections, arising principally from commands which exist
only to exercise a particular system call.

This manual was prepared using the UNIX text editor ed and the
formatting program ~.




- v -
TABLE OF CONTENTS
I. COMMANDS