\documentstyle[a4,12pt]{article}
\begin{document}
\author{APM Manual pages}
\title{Files Giving Information About the System}
\maketitle
\parskip .1 in
\setcounter{secnumdepth}{10}
\parindent 0in

\section{Preamble}
The filestore provides useful systems information via a number of special
"files". These are indistinguishable from real files to the user but are
generated "on-the-fly" by the filestore. Most are "read-only" .

The system manager administration program maintains two databases giving
information about owners of directories and APMs. These live in MANAGR:ADMIN.DAT
and MANAGR:NS.DAT respectively. The second of these is strictly experimental.

\section{\$:UNOS}

\small\tt \begin{verbatim}bytes   Field                                    Comments

3    User number (UNO)                           decimal
4    "Context". Usually = filestore port.        decimal. See note [1]
2    <sp><sp>
2    User Station                                hex
3    User port if meaningful                     decimal. See note [2]
7    User name if meaningful                     right-justified. See [2]
1    Privileged indication ('!')
7    Directory name                              right-justified
2    <sp><sp>
14   Date and time user logged on                DD/MM/YY HH:MM
2    <sp><sp>
14   Date and time UNO was last used             "
2    <sp><sp>
14   Date and time XNO last used by this UNO     "      
1    <linefeed>

78   Total                                       Fixed format

\end{verbatim}\rm  \normalsize Note [1]:

For locally connected terminals Context = Qsart port + 256. Certain
internally created processes have context -2 (e.g. file copies)

Note [2]:

User station and port are blank for UNO = 0 [ANON], non-ether contexts
or -ve contexts. i.e. where station and port are meaningless.


\section{\$:PORTS}

\small\tt \begin{verbatim}Bytes   Field                                        Comments

3    Filestore port ("Context")                      Decimal
4    User Station                                    Hex
3    User port
2    <sp><sp>
14   Date and time port was attached                 DD/MM/YY HH:MM
2    <sp><sp>
14   Date and time port last used                    "
1    <linefeed>

43   Total                                           Fixed format
\end{verbatim}\rm  \normalsize 

\section{\$:XNOS}

\small\tt \begin{verbatim}bytes   Field                                    Comments

3    XNO
3    UNO associated with this XNO
3    Filestore port ("Context")
1    <sp>
21   File name or "Special File"
5    Next file block to be read or written       * starts at 1
5    Next block of extent                        * starts at 0
6    Next disc block to be read                  *
3    Current extent                              *
1    "/"                                         *
3    Extents in file                             *
1    <sp>
5    Blocks in file
2    <sp><sp>
14   Time XNO was last active
1    <sp>
1-3  "R" (read operations) &/or "W" (write operations)
     "L" (last block has gone)                   See note [3]
1    <linefeed>

78-80 Total
\end{verbatim}\rm  \normalsize 
[3] Any or all of these may be present. Files opened MOD have R \& W set.

\section{\$:DIRECTORIES}

\small\tt \begin{verbatim}bytes   Field                                     Comments

4    Cache Slot
3    <sp><sp><sp>
8    Directory owner                              left-justified
1    "("
1    partition
1    "."
3    user directory number
1    ")"
5    Reference count                              See note [4]
5    <sp><sp><sp><sp><sp>
5    Time Stamp
     "** Written **"
1    <linefeed>

     Total

\end{verbatim}\rm  \normalsize Note [4]:

Reference count = No of entities referencing this directory:
1/Logged on user + 1/Default + 1/XNO referencing this file + a few
for internal use.

\section{\$:BITMAP.$<$n$>$}

There is one of these for each filestore partition $<$n$>$.
(0 $<$= $<$n$>$ $<$= max partition)


8000 Bitmap of available pages on the filestore disc. 0 = free; 1 = allocated

\section{\$:TRACE}

\small\tt \begin{verbatim}Bytes   Field                                Comments

4    Index of first trace record

4    "Context"                               *
4    In (=0) | Out (=1)                      *
56   Text                                    * String (55)

4    Index of last trace record
\end{verbatim}\rm  \normalsize 
The file has TBUFFS entries (see system:config.inc) each of format
(the fields marked '*') with a leading first entry pointer and trailing last
entry pointer.

\section{\$:BOOTAREA}

This is the filestore bootstrap area i.e. the file from which the filestore
bootstraps itself. The file is included here for completeness as it is of no
value to machines other than the filestores. It is read and write protected
againts all non-privileged users.

This file must be opened MOD to enable it to be accessed via DA-type operations.

\section{$<$u$>$:DIRECTORY}

There is one of these for each user $<$u$>$.
The file consists of a complete list of the accessible files of the directory,
one per line in date order (Last file first). Lines are of varying length and
terminate with a linefeed.

\section{MANAGR:ADMIN.DAT}

This is an indexed sequential file of 128-byte records comprising
a header record followed by one record for each top-level directory.
Directory records are sorted in increasing alphabetical order.

\small\tt \begin{verbatim}Header Record

  4  Number of directory records in file (not counting header)
104  Index into file. This is an integerarray A('A'-'Z') 
     Entries are record numbers, counting from the header (= 0)
     and indicate the point from which a search should start.
 10  Spare


Directory Records

  8  Directory ID                            String (7)

 36  {Prenames                               String (35)
 16  {Surname                                String (15)
or..
 52  {Description                            String (51)

 16  Supervisor                              String (15)
  2  Group                                   Shortinteger
  2  Bitmap of F'stores this no. is on.      Shortinteger
 10  Creation Date                           String (9)
 10  Date after which directory may be deleted String (9)
 28  Mail Address of owner or supervisor     String (27)
\end{verbatim}\rm  \normalsize 

The Description option is used for systems directories. All "Description"
strings start with '!'.

The Dates are string(8)s with one extra byte for alignment.

Groups:

\small\tt \begin{verbatim}0: Unknown                           1: Essential systems directories
2: Additional Systems directories    3: Staff
4: Postgrads                         5: CS4
6: CS3                               7: CS2
8: CS1                               9: IS1
10: Visitors                         11: Public directories
12: Other Departments                13: ERCC

Bit 15: "Trusted" bit                Bit 14: "Ex-" bit
Bit 13: Laser printer bit            Bit 12: Female Bit


FS accredit bits
Bit 0: alpha                         Bit 1: bravo
Bit 2: charlie                       Bit 3: portable
Bit 4: vax                           Bit 5: old
\end{verbatim}\rm  \normalsize 
The Include file MANAGR:ADDEFS.INC contains specs for the above record formats.
MANAGR:ADMIN.INC contains the routines FIND DIR and SHOW DIR which access the
database. \hspace{ 0.2 in} NOTE: The format of the database is a quick fudge and is far from
ideal. Anyone writing utilites which use it are advised to contact JHB first:
The format may change with little notice and access should be channeled through
MANAGR:ADMIN.INC where possible, which may entail adding new routines.

\section{MANAGR:NS.DAT}

*** Note *** This facility is still under development and may change without
notice. If you are writing software to use it you are advised to notify JHB.

This file is a pair of tables, indexed by station number giving a short and
long destription of the APM at the specified station number. The short table
is intended for quick name $<$-$>$ address translation and the long one is a
database for housekeeping and general reference.

The table comprises 128 8-byte fields followed by 128 64-byte fields.

All "strings" are stored as bytearrays padded to right with characters $<$= ' '
with no length byte. (To save space)

The 8-byte fields are simply the station short names in station number order.
APMs are designated by names starting with an '@' character.

The 64-byte fields are records of type NS LFM (specified in MANAGR:NSDEFS.INC)
in station number order..


\small\tt \begin{verbatim}bytes   Field                                               Comments
  1     "In" or "On" designation                            see note [5]
  1     "Room" designation                                  see note [5]
 31     Long text name of station                           Bytearray padded
  1     Case Number                                         see note [6]
  8     Spare
  4     Supplementary address information (eg Room number)  Bytearray padded
 18     Backplane Map.                                      see note [7]

 64     Total


[5]     These fields taken with the long text name give a "user-friendly"
description of the location.  "In"/"On" takes values..
'I'     In
'O'     On
'A'     At
' '     No special description

"Room" takes values..
'R'     to indicate the description refers to someone's room 
'T'     to indicate it is the something-or-other
' '     No special description

Examples..
'I''R'  John Butler   ->    In John Butler's Room
'O''T'  Test Rig      ->    On the Test Rig

\end{verbatim}\rm  \normalsize 
[6] \hspace{ 0.3 in} Note to systems staff - This field may cause alignment problems if moved
[7] \hspace{ 0.3 in} The backplane map should indicate what is in each of the 16 backplane
slots plus an indication of what mouse and display is being used.
Position is irrelevant. \hspace{ 0.3 in} Each entry can take the value..

'A' \hspace{ 0.3 in} 0.5 Mb Memory Board
'B' \hspace{ 0.3 in} 1.0 Mb Memory Board
'C' \hspace{ 0.3 in} Processor Board (8 MHz)
'D' \hspace{ 0.3 in} Processor Board (10 MHz)
'E' \hspace{ 0.3 in} Ethernet Board
'G' \hspace{ 0.3 in} Level 1 Graphics
'H' \hspace{ 0.3 in} Level 1.5 Graphics
'J' \hspace{ 0.3 in} Level 2 Graphics
'L' \hspace{ 0.3 in} 2.0 Mb Memory Board
'M' \hspace{ 0.3 in} Mouse
'X' \hspace{ 0.3 in} MIT Graphics Monitor
'Y' \hspace{ 0.3 in} DJR/MIT Monitor


MANAGR:NS.INC contains a set of routines for accessing the file. It is suggested
that all NS.DAT access be channeled through these routines (adding new ones if
necessary) so the file format can be changed without too much difficulty.
(Which will be necessary if ISO-style Ethernet addresses are to be handled or
if the A.T. Ethernet address space overlaps that of KB.


\vspace{.75in} view:sfiles printed on 16/02/89 at 11.33

\newpage
\tableofcontents
\end{document}
